tinkerforge 2.1.23 → 2.1.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +109 -30
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +191 -86
- data/lib/tinkerforge/brick_imu_v2.rb +219 -118
- data/lib/tinkerforge/brick_master.rb +495 -195
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
- data/lib/tinkerforge/brick_stepper.rb +212 -100
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +75 -47
- data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
- data/lib/tinkerforge/bricklet_compass.rb +81 -40
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +250 -164
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
- data/lib/tinkerforge/device_display_names.rb +167 -0
- data/lib/tinkerforge/ip_connection.rb +156 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +8 -3
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Generates configurable DC voltage and current, 0V to 10V and 4mA to 20mA
|
14
16
|
class BrickletIndustrialAnalogOut < Device
|
@@ -35,7 +37,7 @@ module Tinkerforge
|
|
35
37
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
36
38
|
# the IP Connection <tt>ipcon</tt>.
|
37
39
|
def initialize(uid, ipcon)
|
38
|
-
super uid, ipcon
|
40
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
39
41
|
|
40
42
|
@api_version = [2, 0, 0]
|
41
43
|
|
@@ -51,51 +53,66 @@ module Tinkerforge
|
|
51
53
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
52
54
|
|
53
55
|
|
56
|
+
@ipcon.add_device self
|
54
57
|
end
|
55
58
|
|
56
59
|
# Enables the output of voltage and current.
|
57
60
|
#
|
58
61
|
# The default is disabled.
|
59
62
|
def enable
|
60
|
-
|
63
|
+
check_validity
|
64
|
+
|
65
|
+
send_request FUNCTION_ENABLE, [], '', 8, ''
|
61
66
|
end
|
62
67
|
|
63
68
|
# Disables the output of voltage and current.
|
64
69
|
#
|
65
70
|
# The default is disabled.
|
66
71
|
def disable
|
67
|
-
|
72
|
+
check_validity
|
73
|
+
|
74
|
+
send_request FUNCTION_DISABLE, [], '', 8, ''
|
68
75
|
end
|
69
76
|
|
70
77
|
# Returns *true* if output of voltage and current is enabled, *false* otherwise.
|
71
78
|
def is_enabled
|
72
|
-
|
79
|
+
check_validity
|
80
|
+
|
81
|
+
send_request FUNCTION_IS_ENABLED, [], '', 9, '?'
|
73
82
|
end
|
74
83
|
|
75
|
-
# Sets the output voltage
|
84
|
+
# Sets the output voltage.
|
76
85
|
#
|
77
86
|
# The output voltage and output current are linked. Changing the output voltage
|
78
87
|
# also changes the output current.
|
79
88
|
def set_voltage(voltage)
|
80
|
-
|
89
|
+
check_validity
|
90
|
+
|
91
|
+
send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 8, ''
|
81
92
|
end
|
82
93
|
|
83
94
|
# Returns the voltage as set by BrickletIndustrialAnalogOut#set_voltage.
|
84
95
|
def get_voltage
|
85
|
-
|
96
|
+
check_validity
|
97
|
+
|
98
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
|
86
99
|
end
|
87
100
|
|
88
|
-
# Sets the output current
|
101
|
+
# Sets the output current.
|
89
102
|
#
|
90
103
|
# The output current and output voltage are linked. Changing the output current
|
91
104
|
# also changes the output voltage.
|
92
105
|
def set_current(current)
|
93
|
-
|
106
|
+
check_validity
|
107
|
+
|
108
|
+
send_request FUNCTION_SET_CURRENT, [current], 'S', 8, ''
|
94
109
|
end
|
95
110
|
|
96
111
|
# Returns the current as set by BrickletIndustrialAnalogOut#set_current.
|
97
112
|
def get_current
|
98
|
-
|
113
|
+
check_validity
|
114
|
+
|
115
|
+
send_request FUNCTION_GET_CURRENT, [], '', 10, 'S'
|
99
116
|
end
|
100
117
|
|
101
118
|
# Configures the voltage and current range.
|
@@ -103,35 +120,41 @@ module Tinkerforge
|
|
103
120
|
# Possible voltage ranges are:
|
104
121
|
#
|
105
122
|
# * 0V to 5V
|
106
|
-
# * 0V to 10V
|
123
|
+
# * 0V to 10V
|
107
124
|
#
|
108
125
|
# Possible current ranges are:
|
109
126
|
#
|
110
|
-
# * 4mA to 20mA
|
127
|
+
# * 4mA to 20mA
|
111
128
|
# * 0mA to 20mA
|
112
129
|
# * 0mA to 24mA
|
113
130
|
#
|
114
131
|
# The resolution will always be 12 bit. This means, that the
|
115
132
|
# precision is higher with a smaller range.
|
116
133
|
def set_configuration(voltage_range, current_range)
|
117
|
-
|
134
|
+
check_validity
|
135
|
+
|
136
|
+
send_request FUNCTION_SET_CONFIGURATION, [voltage_range, current_range], 'C C', 8, ''
|
118
137
|
end
|
119
138
|
|
120
139
|
# Returns the configuration as set by BrickletIndustrialAnalogOut#set_configuration.
|
121
140
|
def get_configuration
|
122
|
-
|
141
|
+
check_validity
|
142
|
+
|
143
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
|
123
144
|
end
|
124
145
|
|
125
146
|
# Returns the UID, the UID where the Bricklet is connected to,
|
126
147
|
# the position, the hardware and firmware version as well as the
|
127
148
|
# device identifier.
|
128
149
|
#
|
129
|
-
# The position can be 'a', 'b', 'c' or '
|
150
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
151
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
152
|
+
# position 'z'.
|
130
153
|
#
|
131
154
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
132
155
|
# |device_identifier_constant|
|
133
156
|
def get_identity
|
134
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
157
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
135
158
|
end
|
136
159
|
|
137
160
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Generates configurable DC voltage and current, 0V to 10V and 4mA to 20mA
|
14
16
|
class BrickletIndustrialAnalogOutV2 < Device
|
@@ -70,7 +72,7 @@ module Tinkerforge
|
|
70
72
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
71
73
|
# the IP Connection <tt>ipcon</tt>.
|
72
74
|
def initialize(uid, ipcon)
|
73
|
-
super uid, ipcon
|
75
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
74
76
|
|
75
77
|
@api_version = [2, 0, 0]
|
76
78
|
|
@@ -100,44 +102,55 @@ module Tinkerforge
|
|
100
102
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
101
103
|
|
102
104
|
|
105
|
+
@ipcon.add_device self
|
103
106
|
end
|
104
107
|
|
105
108
|
# Enables/disables the output of voltage and current.
|
106
|
-
#
|
107
|
-
# The default is disabled.
|
108
109
|
def set_enabled(enabled)
|
109
|
-
|
110
|
+
check_validity
|
111
|
+
|
112
|
+
send_request FUNCTION_SET_ENABLED, [enabled], '?', 8, ''
|
110
113
|
end
|
111
114
|
|
112
115
|
# Returns *true* if output of voltage and current is enabled, *false* otherwise.
|
113
116
|
def get_enabled
|
114
|
-
|
117
|
+
check_validity
|
118
|
+
|
119
|
+
send_request FUNCTION_GET_ENABLED, [], '', 9, '?'
|
115
120
|
end
|
116
121
|
|
117
|
-
# Sets the output voltage
|
122
|
+
# Sets the output voltage.
|
118
123
|
#
|
119
124
|
# The output voltage and output current are linked. Changing the output voltage
|
120
125
|
# also changes the output current.
|
121
126
|
def set_voltage(voltage)
|
122
|
-
|
127
|
+
check_validity
|
128
|
+
|
129
|
+
send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 8, ''
|
123
130
|
end
|
124
131
|
|
125
132
|
# Returns the voltage as set by BrickletIndustrialAnalogOutV2#set_voltage.
|
126
133
|
def get_voltage
|
127
|
-
|
134
|
+
check_validity
|
135
|
+
|
136
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
|
128
137
|
end
|
129
138
|
|
130
|
-
# Sets the output current
|
139
|
+
# Sets the output current.
|
131
140
|
#
|
132
141
|
# The output current and output voltage are linked. Changing the output current
|
133
142
|
# also changes the output voltage.
|
134
143
|
def set_current(current)
|
135
|
-
|
144
|
+
check_validity
|
145
|
+
|
146
|
+
send_request FUNCTION_SET_CURRENT, [current], 'S', 8, ''
|
136
147
|
end
|
137
148
|
|
138
149
|
# Returns the current as set by BrickletIndustrialAnalogOutV2#set_current.
|
139
150
|
def get_current
|
140
|
-
|
151
|
+
check_validity
|
152
|
+
|
153
|
+
send_request FUNCTION_GET_CURRENT, [], '', 10, 'S'
|
141
154
|
end
|
142
155
|
|
143
156
|
# Configures the voltage and current range.
|
@@ -145,23 +158,27 @@ module Tinkerforge
|
|
145
158
|
# Possible voltage ranges are:
|
146
159
|
#
|
147
160
|
# * 0V to 5V
|
148
|
-
# * 0V to 10V
|
161
|
+
# * 0V to 10V
|
149
162
|
#
|
150
163
|
# Possible current ranges are:
|
151
164
|
#
|
152
|
-
# * 4mA to 20mA
|
165
|
+
# * 4mA to 20mA
|
153
166
|
# * 0mA to 20mA
|
154
167
|
# * 0mA to 24mA
|
155
168
|
#
|
156
169
|
# The resolution will always be 12 bit. This means, that the
|
157
170
|
# precision is higher with a smaller range.
|
158
171
|
def set_configuration(voltage_range, current_range)
|
159
|
-
|
172
|
+
check_validity
|
173
|
+
|
174
|
+
send_request FUNCTION_SET_CONFIGURATION, [voltage_range, current_range], 'C C', 8, ''
|
160
175
|
end
|
161
176
|
|
162
177
|
# Returns the configuration as set by BrickletIndustrialAnalogOutV2#set_configuration.
|
163
178
|
def get_configuration
|
164
|
-
|
179
|
+
check_validity
|
180
|
+
|
181
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
|
165
182
|
end
|
166
183
|
|
167
184
|
# You can turn the Out LED off, on or show a
|
@@ -170,15 +187,17 @@ module Tinkerforge
|
|
170
187
|
# of the LED can change with the output value (voltage or current).
|
171
188
|
#
|
172
189
|
# You can configure the channel status behavior with BrickletIndustrialAnalogOutV2#set_out_led_status_config.
|
173
|
-
#
|
174
|
-
# By default the LED is configured as "Out Status"
|
175
190
|
def set_out_led_config(config)
|
176
|
-
|
191
|
+
check_validity
|
192
|
+
|
193
|
+
send_request FUNCTION_SET_OUT_LED_CONFIG, [config], 'C', 8, ''
|
177
194
|
end
|
178
195
|
|
179
196
|
# Returns the Out LED configuration as set by BrickletIndustrialAnalogOutV2#set_out_led_config
|
180
197
|
def get_out_led_config
|
181
|
-
|
198
|
+
check_validity
|
199
|
+
|
200
|
+
send_request FUNCTION_GET_OUT_LED_CONFIG, [], '', 9, 'C'
|
182
201
|
end
|
183
202
|
|
184
203
|
# Sets the Out LED status config. This config is used if the Out LED is
|
@@ -202,16 +221,17 @@ module Tinkerforge
|
|
202
221
|
# 8V and above and the brightness is linearly scaled between the values 2V and 8V.
|
203
222
|
# If the min value is greater than the max value, the LED brightness is scaled the
|
204
223
|
# other way around.
|
205
|
-
#
|
206
|
-
# By default the channel LED status config is set to intensity with min=0V and
|
207
|
-
# max=10V.
|
208
224
|
def set_out_led_status_config(min, max, config)
|
209
|
-
|
225
|
+
check_validity
|
226
|
+
|
227
|
+
send_request FUNCTION_SET_OUT_LED_STATUS_CONFIG, [min, max, config], 'S S C', 8, ''
|
210
228
|
end
|
211
229
|
|
212
230
|
# Returns the Out LED status configuration as set by BrickletIndustrialAnalogOutV2#set_out_led_status_config.
|
213
231
|
def get_out_led_status_config
|
214
|
-
|
232
|
+
check_validity
|
233
|
+
|
234
|
+
send_request FUNCTION_GET_OUT_LED_STATUS_CONFIG, [], '', 13, 'S S C'
|
215
235
|
end
|
216
236
|
|
217
237
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -226,7 +246,9 @@ module Tinkerforge
|
|
226
246
|
# The errors counts are for errors that occur on the Bricklet side. All
|
227
247
|
# Bricks have a similar function that returns the errors on the Brick side.
|
228
248
|
def get_spitfp_error_count
|
229
|
-
|
249
|
+
check_validity
|
250
|
+
|
251
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
230
252
|
end
|
231
253
|
|
232
254
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -239,12 +261,16 @@ module Tinkerforge
|
|
239
261
|
# This function is used by Brick Viewer during flashing. It should not be
|
240
262
|
# necessary to call it in a normal user program.
|
241
263
|
def set_bootloader_mode(mode)
|
242
|
-
|
264
|
+
check_validity
|
265
|
+
|
266
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
243
267
|
end
|
244
268
|
|
245
269
|
# Returns the current bootloader mode, see BrickletIndustrialAnalogOutV2#set_bootloader_mode.
|
246
270
|
def get_bootloader_mode
|
247
|
-
|
271
|
+
check_validity
|
272
|
+
|
273
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
248
274
|
end
|
249
275
|
|
250
276
|
# Sets the firmware pointer for BrickletIndustrialAnalogOutV2#write_firmware. The pointer has
|
@@ -254,7 +280,9 @@ module Tinkerforge
|
|
254
280
|
# This function is used by Brick Viewer during flashing. It should not be
|
255
281
|
# necessary to call it in a normal user program.
|
256
282
|
def set_write_firmware_pointer(pointer)
|
257
|
-
|
283
|
+
check_validity
|
284
|
+
|
285
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
258
286
|
end
|
259
287
|
|
260
288
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -266,7 +294,9 @@ module Tinkerforge
|
|
266
294
|
# This function is used by Brick Viewer during flashing. It should not be
|
267
295
|
# necessary to call it in a normal user program.
|
268
296
|
def write_firmware(data)
|
269
|
-
|
297
|
+
check_validity
|
298
|
+
|
299
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
270
300
|
end
|
271
301
|
|
272
302
|
# Sets the status LED configuration. By default the LED shows
|
@@ -277,22 +307,28 @@ module Tinkerforge
|
|
277
307
|
#
|
278
308
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
279
309
|
def set_status_led_config(config)
|
280
|
-
|
310
|
+
check_validity
|
311
|
+
|
312
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
281
313
|
end
|
282
314
|
|
283
315
|
# Returns the configuration as set by BrickletIndustrialAnalogOutV2#set_status_led_config
|
284
316
|
def get_status_led_config
|
285
|
-
|
317
|
+
check_validity
|
318
|
+
|
319
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
286
320
|
end
|
287
321
|
|
288
|
-
# Returns the temperature
|
322
|
+
# Returns the temperature as measured inside the microcontroller. The
|
289
323
|
# value returned is not the ambient temperature!
|
290
324
|
#
|
291
325
|
# The temperature is only proportional to the real temperature and it has bad
|
292
326
|
# accuracy. Practically it is only useful as an indicator for
|
293
327
|
# temperature changes.
|
294
328
|
def get_chip_temperature
|
295
|
-
|
329
|
+
check_validity
|
330
|
+
|
331
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
296
332
|
end
|
297
333
|
|
298
334
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -302,7 +338,9 @@ module Tinkerforge
|
|
302
338
|
# calling functions on the existing ones will result in
|
303
339
|
# undefined behavior!
|
304
340
|
def reset
|
305
|
-
|
341
|
+
check_validity
|
342
|
+
|
343
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
306
344
|
end
|
307
345
|
|
308
346
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -311,25 +349,31 @@ module Tinkerforge
|
|
311
349
|
#
|
312
350
|
# We recommend that you use Brick Viewer to change the UID.
|
313
351
|
def write_uid(uid)
|
314
|
-
|
352
|
+
check_validity
|
353
|
+
|
354
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
315
355
|
end
|
316
356
|
|
317
357
|
# Returns the current UID as an integer. Encode as
|
318
358
|
# Base58 to get the usual string version.
|
319
359
|
def read_uid
|
320
|
-
|
360
|
+
check_validity
|
361
|
+
|
362
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
321
363
|
end
|
322
364
|
|
323
365
|
# Returns the UID, the UID where the Bricklet is connected to,
|
324
366
|
# the position, the hardware and firmware version as well as the
|
325
367
|
# device identifier.
|
326
368
|
#
|
327
|
-
# The position can be 'a', 'b', 'c' or '
|
369
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
370
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
371
|
+
# position 'z'.
|
328
372
|
#
|
329
373
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
330
374
|
# |device_identifier_constant|
|
331
375
|
def get_identity
|
332
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
376
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
333
377
|
end
|
334
378
|
|
335
379
|
end
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-01-15. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# 4 channel counter up to 4MHz
|
14
16
|
class BrickletIndustrialCounter < Device
|
@@ -117,7 +119,7 @@ module Tinkerforge
|
|
117
119
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
118
120
|
# the IP Connection <tt>ipcon</tt>.
|
119
121
|
def initialize(uid, ipcon)
|
120
|
-
super uid, ipcon
|
122
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
121
123
|
|
122
124
|
@api_version = [2, 0, 0]
|
123
125
|
|
@@ -152,59 +154,58 @@ module Tinkerforge
|
|
152
154
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
153
155
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
154
156
|
|
155
|
-
@callback_formats[CALLBACK_ALL_COUNTER] = 'q4'
|
156
|
-
@callback_formats[CALLBACK_ALL_SIGNAL_DATA] = 'S4 Q4 L4 ?4'
|
157
|
+
@callback_formats[CALLBACK_ALL_COUNTER] = [40, 'q4']
|
158
|
+
@callback_formats[CALLBACK_ALL_SIGNAL_DATA] = [65, 'S4 Q4 L4 ?4']
|
157
159
|
|
160
|
+
@ipcon.add_device self
|
158
161
|
end
|
159
162
|
|
160
163
|
# Returns the current counter value for the given channel.
|
161
164
|
def get_counter(channel)
|
162
|
-
|
165
|
+
check_validity
|
166
|
+
|
167
|
+
send_request FUNCTION_GET_COUNTER, [channel], 'C', 16, 'q'
|
163
168
|
end
|
164
169
|
|
165
170
|
# Returns the current counter values for all four channels.
|
166
171
|
def get_all_counter
|
167
|
-
|
172
|
+
check_validity
|
173
|
+
|
174
|
+
send_request FUNCTION_GET_ALL_COUNTER, [], '', 40, 'q4'
|
168
175
|
end
|
169
176
|
|
170
177
|
# Sets the counter value for the given channel.
|
171
178
|
#
|
172
179
|
# The default value for the counters on startup is 0.
|
173
180
|
def set_counter(channel, counter)
|
174
|
-
|
181
|
+
check_validity
|
182
|
+
|
183
|
+
send_request FUNCTION_SET_COUNTER, [channel, counter], 'C q', 8, ''
|
175
184
|
end
|
176
185
|
|
177
186
|
# Sets the counter values for all four channels.
|
178
187
|
#
|
179
188
|
# The default value for the counters on startup is 0.
|
180
189
|
def set_all_counter(counter)
|
181
|
-
|
190
|
+
check_validity
|
191
|
+
|
192
|
+
send_request FUNCTION_SET_ALL_COUNTER, [counter], 'q4', 8, ''
|
182
193
|
end
|
183
194
|
|
184
195
|
# Returns the signal data (duty cycle, period, frequency and value) for the
|
185
196
|
# given channel.
|
186
|
-
#
|
187
|
-
# The units are:
|
188
|
-
#
|
189
|
-
# * Duty Cycle: 1/100 %
|
190
|
-
# * Period: ns
|
191
|
-
# * Frequency: mHz (1/1000 Hz)
|
192
|
-
# * Value: true = high, false = low
|
193
197
|
def get_signal_data(channel)
|
194
|
-
|
198
|
+
check_validity
|
199
|
+
|
200
|
+
send_request FUNCTION_GET_SIGNAL_DATA, [channel], 'C', 23, 'S Q L ?'
|
195
201
|
end
|
196
202
|
|
197
203
|
# Returns the signal data (duty cycle, period, frequency and value) for all four
|
198
204
|
# channels.
|
199
|
-
#
|
200
|
-
# The units are:
|
201
|
-
#
|
202
|
-
# * Duty Cycle: 1/100 %
|
203
|
-
# * Period: ns
|
204
|
-
# * Frequency: mHz (1/1000 Hz)
|
205
|
-
# * Value: true = high, false = low
|
206
205
|
def get_all_signal_data
|
207
|
-
|
206
|
+
check_validity
|
207
|
+
|
208
|
+
send_request FUNCTION_GET_ALL_SIGNAL_DATA, [], '', 65, 'S4 Q4 L4 ?4'
|
208
209
|
end
|
209
210
|
|
210
211
|
# Activates/deactivates the counter of the given channel.
|
@@ -213,7 +214,9 @@ module Tinkerforge
|
|
213
214
|
#
|
214
215
|
# By default all channels are activated.
|
215
216
|
def set_counter_active(channel, active)
|
216
|
-
|
217
|
+
check_validity
|
218
|
+
|
219
|
+
send_request FUNCTION_SET_COUNTER_ACTIVE, [channel, active], 'C ?', 8, ''
|
217
220
|
end
|
218
221
|
|
219
222
|
# Activates/deactivates the counter of all four channels.
|
@@ -222,21 +225,27 @@ module Tinkerforge
|
|
222
225
|
#
|
223
226
|
# By default all channels are activated.
|
224
227
|
def set_all_counter_active(active)
|
225
|
-
|
228
|
+
check_validity
|
229
|
+
|
230
|
+
send_request FUNCTION_SET_ALL_COUNTER_ACTIVE, [active], '?4', 8, ''
|
226
231
|
end
|
227
232
|
|
228
233
|
# Returns the activation state of the given channel.
|
229
234
|
#
|
230
235
|
# true = activated, false = deactivated.
|
231
236
|
def get_counter_active(channel)
|
232
|
-
|
237
|
+
check_validity
|
238
|
+
|
239
|
+
send_request FUNCTION_GET_COUNTER_ACTIVE, [channel], 'C', 9, '?'
|
233
240
|
end
|
234
241
|
|
235
242
|
# Returns the activation state of all four channels.
|
236
243
|
#
|
237
244
|
# true = activated, false = deactivated.
|
238
245
|
def get_all_counter_active
|
239
|
-
|
246
|
+
check_validity
|
247
|
+
|
248
|
+
send_request FUNCTION_GET_ALL_COUNTER_ACTIVE, [], '', 9, '?4'
|
240
249
|
end
|
241
250
|
|
242
251
|
# Sets the counter configuration for the given channel.
|
@@ -254,15 +263,19 @@ module Tinkerforge
|
|
254
263
|
# `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Counter.html#duty-cycle-prescaler-and-frequency-integration-time>`__
|
255
264
|
# for details.
|
256
265
|
def set_counter_configuration(channel, count_edge, count_direction, duty_cycle_prescaler, frequency_integration_time)
|
257
|
-
|
266
|
+
check_validity
|
267
|
+
|
268
|
+
send_request FUNCTION_SET_COUNTER_CONFIGURATION, [channel, count_edge, count_direction, duty_cycle_prescaler, frequency_integration_time], 'C C C C C', 8, ''
|
258
269
|
end
|
259
270
|
|
260
271
|
# Returns the counter configuration as set by BrickletIndustrialCounter#set_counter_configuration.
|
261
272
|
def get_counter_configuration(channel)
|
262
|
-
|
273
|
+
check_validity
|
274
|
+
|
275
|
+
send_request FUNCTION_GET_COUNTER_CONFIGURATION, [channel], 'C', 12, 'C C C C'
|
263
276
|
end
|
264
277
|
|
265
|
-
# The period
|
278
|
+
# The period is the period with which the CALLBACK_ALL_COUNTER
|
266
279
|
# callback is triggered periodically. A value of 0 turns the callback off.
|
267
280
|
#
|
268
281
|
# If the `value has to change`-parameter is set to true, the callback is only
|
@@ -271,19 +284,21 @@ module Tinkerforge
|
|
271
284
|
#
|
272
285
|
# If it is set to false, the callback is continuously triggered with the period,
|
273
286
|
# independent of the value.
|
274
|
-
#
|
275
|
-
# The default value is (0, false).
|
276
287
|
def set_all_counter_callback_configuration(period, value_has_to_change)
|
277
|
-
|
288
|
+
check_validity
|
289
|
+
|
290
|
+
send_request FUNCTION_SET_ALL_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
278
291
|
end
|
279
292
|
|
280
293
|
# Returns the callback configuration as set by
|
281
294
|
# BrickletIndustrialCounter#set_all_counter_callback_configuration.
|
282
295
|
def get_all_counter_callback_configuration
|
283
|
-
|
296
|
+
check_validity
|
297
|
+
|
298
|
+
send_request FUNCTION_GET_ALL_COUNTER_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
284
299
|
end
|
285
300
|
|
286
|
-
# The period
|
301
|
+
# The period is the period with which the CALLBACK_ALL_SIGNAL_DATA
|
287
302
|
# callback is triggered periodically. A value of 0 turns the callback off.
|
288
303
|
#
|
289
304
|
# If the `value has to change`-parameter is set to true, the callback is only
|
@@ -292,30 +307,34 @@ module Tinkerforge
|
|
292
307
|
#
|
293
308
|
# If it is set to false, the callback is continuously triggered with the period,
|
294
309
|
# independent of the value.
|
295
|
-
#
|
296
|
-
# The default value is (0, false).
|
297
310
|
def set_all_signal_data_callback_configuration(period, value_has_to_change)
|
298
|
-
|
311
|
+
check_validity
|
312
|
+
|
313
|
+
send_request FUNCTION_SET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
299
314
|
end
|
300
315
|
|
301
316
|
# Returns the callback configuration as set by
|
302
317
|
# BrickletIndustrialCounter#set_all_signal_data_callback_configuration.
|
303
318
|
def get_all_signal_data_callback_configuration
|
304
|
-
|
319
|
+
check_validity
|
320
|
+
|
321
|
+
send_request FUNCTION_GET_ALL_SIGNAL_DATA_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
305
322
|
end
|
306
323
|
|
307
324
|
# Each channel has a corresponding LED. You can turn the LED off, on or show a
|
308
325
|
# heartbeat. You can also set the LED to "Channel Status". In this mode the
|
309
326
|
# LED is on if the channel is high and off otherwise.
|
310
|
-
#
|
311
|
-
# By default all channel LEDs are configured as "Channel Status".
|
312
327
|
def set_channel_led_config(channel, config)
|
313
|
-
|
328
|
+
check_validity
|
329
|
+
|
330
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
|
314
331
|
end
|
315
332
|
|
316
333
|
# Returns the channel LED configuration as set by BrickletIndustrialCounter#set_channel_led_config
|
317
334
|
def get_channel_led_config(channel)
|
318
|
-
|
335
|
+
check_validity
|
336
|
+
|
337
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
|
319
338
|
end
|
320
339
|
|
321
340
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -330,7 +349,9 @@ module Tinkerforge
|
|
330
349
|
# The errors counts are for errors that occur on the Bricklet side. All
|
331
350
|
# Bricks have a similar function that returns the errors on the Brick side.
|
332
351
|
def get_spitfp_error_count
|
333
|
-
|
352
|
+
check_validity
|
353
|
+
|
354
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
334
355
|
end
|
335
356
|
|
336
357
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -343,12 +364,16 @@ module Tinkerforge
|
|
343
364
|
# This function is used by Brick Viewer during flashing. It should not be
|
344
365
|
# necessary to call it in a normal user program.
|
345
366
|
def set_bootloader_mode(mode)
|
346
|
-
|
367
|
+
check_validity
|
368
|
+
|
369
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
347
370
|
end
|
348
371
|
|
349
372
|
# Returns the current bootloader mode, see BrickletIndustrialCounter#set_bootloader_mode.
|
350
373
|
def get_bootloader_mode
|
351
|
-
|
374
|
+
check_validity
|
375
|
+
|
376
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
352
377
|
end
|
353
378
|
|
354
379
|
# Sets the firmware pointer for BrickletIndustrialCounter#write_firmware. The pointer has
|
@@ -358,7 +383,9 @@ module Tinkerforge
|
|
358
383
|
# This function is used by Brick Viewer during flashing. It should not be
|
359
384
|
# necessary to call it in a normal user program.
|
360
385
|
def set_write_firmware_pointer(pointer)
|
361
|
-
|
386
|
+
check_validity
|
387
|
+
|
388
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
362
389
|
end
|
363
390
|
|
364
391
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -370,7 +397,9 @@ module Tinkerforge
|
|
370
397
|
# This function is used by Brick Viewer during flashing. It should not be
|
371
398
|
# necessary to call it in a normal user program.
|
372
399
|
def write_firmware(data)
|
373
|
-
|
400
|
+
check_validity
|
401
|
+
|
402
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
374
403
|
end
|
375
404
|
|
376
405
|
# Sets the status LED configuration. By default the LED shows
|
@@ -381,22 +410,28 @@ module Tinkerforge
|
|
381
410
|
#
|
382
411
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
383
412
|
def set_status_led_config(config)
|
384
|
-
|
413
|
+
check_validity
|
414
|
+
|
415
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
385
416
|
end
|
386
417
|
|
387
418
|
# Returns the configuration as set by BrickletIndustrialCounter#set_status_led_config
|
388
419
|
def get_status_led_config
|
389
|
-
|
420
|
+
check_validity
|
421
|
+
|
422
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
390
423
|
end
|
391
424
|
|
392
|
-
# Returns the temperature
|
425
|
+
# Returns the temperature as measured inside the microcontroller. The
|
393
426
|
# value returned is not the ambient temperature!
|
394
427
|
#
|
395
428
|
# The temperature is only proportional to the real temperature and it has bad
|
396
429
|
# accuracy. Practically it is only useful as an indicator for
|
397
430
|
# temperature changes.
|
398
431
|
def get_chip_temperature
|
399
|
-
|
432
|
+
check_validity
|
433
|
+
|
434
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
400
435
|
end
|
401
436
|
|
402
437
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -406,7 +441,9 @@ module Tinkerforge
|
|
406
441
|
# calling functions on the existing ones will result in
|
407
442
|
# undefined behavior!
|
408
443
|
def reset
|
409
|
-
|
444
|
+
check_validity
|
445
|
+
|
446
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
410
447
|
end
|
411
448
|
|
412
449
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -415,25 +452,31 @@ module Tinkerforge
|
|
415
452
|
#
|
416
453
|
# We recommend that you use Brick Viewer to change the UID.
|
417
454
|
def write_uid(uid)
|
418
|
-
|
455
|
+
check_validity
|
456
|
+
|
457
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
419
458
|
end
|
420
459
|
|
421
460
|
# Returns the current UID as an integer. Encode as
|
422
461
|
# Base58 to get the usual string version.
|
423
462
|
def read_uid
|
424
|
-
|
463
|
+
check_validity
|
464
|
+
|
465
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
425
466
|
end
|
426
467
|
|
427
468
|
# Returns the UID, the UID where the Bricklet is connected to,
|
428
469
|
# the position, the hardware and firmware version as well as the
|
429
470
|
# device identifier.
|
430
471
|
#
|
431
|
-
# The position can be 'a', 'b', 'c' or '
|
472
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
473
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
474
|
+
# position 'z'.
|
432
475
|
#
|
433
476
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
434
477
|
# |device_identifier_constant|
|
435
478
|
def get_identity
|
436
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
479
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
437
480
|
end
|
438
481
|
|
439
482
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|