tinkerforge 2.1.22 → 2.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Measures AC/DC current between -25A and +25A
14
16
  class BrickletCurrent25 < Device
@@ -76,7 +78,7 @@ module Tinkerforge
76
78
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
77
79
  # the IP Connection <tt>ipcon</tt>.
78
80
  def initialize(uid, ipcon)
79
- super uid, ipcon
81
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
80
82
 
81
83
  @api_version = [2, 0, 0]
82
84
 
@@ -96,22 +98,24 @@ module Tinkerforge
96
98
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
99
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
100
 
99
- @callback_formats[CALLBACK_CURRENT] = 's'
100
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
101
- @callback_formats[CALLBACK_CURRENT_REACHED] = 's'
102
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
103
- @callback_formats[CALLBACK_OVER_CURRENT] = ''
101
+ @callback_formats[CALLBACK_CURRENT] = [10, 's']
102
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
103
+ @callback_formats[CALLBACK_CURRENT_REACHED] = [10, 's']
104
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
105
+ @callback_formats[CALLBACK_OVER_CURRENT] = [8, '']
104
106
 
107
+ @ipcon.add_device self
105
108
  end
106
109
 
107
- # Returns the current of the sensor. The value is in mA
108
- # and between -25000mA and 25000mA.
110
+ # Returns the current of the sensor.
109
111
  #
110
112
  # If you want to get the current periodically, it is recommended to use the
111
113
  # CALLBACK_CURRENT callback and set the period with
112
114
  # BrickletCurrent25#set_current_callback_period.
113
115
  def get_current
114
- send_request FUNCTION_GET_CURRENT, [], '', 2, 's'
116
+ check_validity
117
+
118
+ send_request FUNCTION_GET_CURRENT, [], '', 10, 's'
115
119
  end
116
120
 
117
121
  # Calibrates the 0 value of the sensor. You have to call this function
@@ -126,7 +130,9 @@ module Tinkerforge
126
130
  # The resulting calibration will be saved on the EEPROM of the Current
127
131
  # Bricklet.
128
132
  def calibrate
129
- send_request FUNCTION_CALIBRATE, [], '', 0, ''
133
+ check_validity
134
+
135
+ send_request FUNCTION_CALIBRATE, [], '', 8, ''
130
136
  end
131
137
 
132
138
  # Returns *true* if more than 25A were measured.
@@ -134,11 +140,12 @@ module Tinkerforge
134
140
  # .. note::
135
141
  # To reset this value you have to power cycle the Bricklet.
136
142
  def is_over_current
137
- send_request FUNCTION_IS_OVER_CURRENT, [], '', 1, '?'
143
+ check_validity
144
+
145
+ send_request FUNCTION_IS_OVER_CURRENT, [], '', 9, '?'
138
146
  end
139
147
 
140
148
  # Returns the value as read by a 12-bit analog-to-digital converter.
141
- # The value is between 0 and 4095.
142
149
  #
143
150
  # .. note::
144
151
  # The value returned by BrickletCurrent25#get_current is averaged over several samples
@@ -150,39 +157,45 @@ module Tinkerforge
150
157
  # CALLBACK_ANALOG_VALUE callback and set the period with
151
158
  # BrickletCurrent25#set_analog_value_callback_period.
152
159
  def get_analog_value
153
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
160
+ check_validity
161
+
162
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
154
163
  end
155
164
 
156
- # Sets the period in ms with which the CALLBACK_CURRENT callback is triggered
165
+ # Sets the period with which the CALLBACK_CURRENT callback is triggered
157
166
  # periodically. A value of 0 turns the callback off.
158
167
  #
159
168
  # The CALLBACK_CURRENT callback is only triggered if the current has changed since
160
169
  # the last triggering.
161
- #
162
- # The default value is 0.
163
170
  def set_current_callback_period(period)
164
- send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
171
+ check_validity
172
+
173
+ send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [period], 'L', 8, ''
165
174
  end
166
175
 
167
176
  # Returns the period as set by BrickletCurrent25#set_current_callback_period.
168
177
  def get_current_callback_period
169
- send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
178
+ check_validity
179
+
180
+ send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [], '', 12, 'L'
170
181
  end
171
182
 
172
- # Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
183
+ # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
173
184
  # periodically. A value of 0 turns the callback off.
174
185
  #
175
186
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
176
187
  # changed since the last triggering.
177
- #
178
- # The default value is 0.
179
188
  def set_analog_value_callback_period(period)
180
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
181
192
  end
182
193
 
183
194
  # Returns the period as set by BrickletCurrent25#set_analog_value_callback_period.
184
195
  def get_analog_value_callback_period
185
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
186
199
  end
187
200
 
188
201
  # Sets the thresholds for the CALLBACK_CURRENT_REACHED callback.
@@ -196,15 +209,17 @@ module Tinkerforge
196
209
  # "'i'", "Callback is triggered when the current is *inside* the min and max values"
197
210
  # "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
198
211
  # "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
199
- #
200
- # The default value is ('x', 0, 0).
201
212
  def set_current_callback_threshold(option, min, max)
202
- send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
213
+ check_validity
214
+
215
+ send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
203
216
  end
204
217
 
205
218
  # Returns the threshold as set by BrickletCurrent25#set_current_callback_threshold.
206
219
  def get_current_callback_threshold
207
- send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
220
+ check_validity
221
+
222
+ send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
208
223
  end
209
224
 
210
225
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -218,18 +233,20 @@ module Tinkerforge
218
233
  # "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
219
234
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
220
235
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
221
- #
222
- # The default value is ('x', 0, 0).
223
236
  def set_analog_value_callback_threshold(option, min, max)
224
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
237
+ check_validity
238
+
239
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
225
240
  end
226
241
 
227
242
  # Returns the threshold as set by BrickletCurrent25#set_analog_value_callback_threshold.
228
243
  def get_analog_value_callback_threshold
229
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
244
+ check_validity
245
+
246
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
230
247
  end
231
248
 
232
- # Sets the period in ms with which the threshold callbacks
249
+ # Sets the period with which the threshold callbacks
233
250
  #
234
251
  # * CALLBACK_CURRENT_REACHED,
235
252
  # * CALLBACK_ANALOG_VALUE_REACHED
@@ -240,27 +257,31 @@ module Tinkerforge
240
257
  # * BrickletCurrent25#set_analog_value_callback_threshold
241
258
  #
242
259
  # keep being reached.
243
- #
244
- # The default value is 100.
245
260
  def set_debounce_period(debounce)
246
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
261
+ check_validity
262
+
263
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
247
264
  end
248
265
 
249
266
  # Returns the debounce period as set by BrickletCurrent25#set_debounce_period.
250
267
  def get_debounce_period
251
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
268
+ check_validity
269
+
270
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
252
271
  end
253
272
 
254
273
  # Returns the UID, the UID where the Bricklet is connected to,
255
274
  # the position, the hardware and firmware version as well as the
256
275
  # device identifier.
257
276
  #
258
- # The position can be 'a', 'b', 'c' or 'd'.
277
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
278
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
279
+ # position 'z'.
259
280
  #
260
281
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
261
282
  # |device_identifier_constant|
262
283
  def get_identity
263
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
284
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
264
285
  end
265
286
 
266
287
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Measures distance up to 150cm with infrared light
14
16
  class BrickletDistanceIR < Device
@@ -72,7 +74,7 @@ module Tinkerforge
72
74
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
73
75
  # the IP Connection <tt>ipcon</tt>.
74
76
  def initialize(uid, ipcon)
75
- super uid, ipcon
77
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
76
78
 
77
79
  @api_version = [2, 0, 1]
78
80
 
@@ -92,14 +94,15 @@ module Tinkerforge
92
94
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
95
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
96
 
95
- @callback_formats[CALLBACK_DISTANCE] = 'S'
96
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
97
- @callback_formats[CALLBACK_DISTANCE_REACHED] = 'S'
98
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
97
+ @callback_formats[CALLBACK_DISTANCE] = [10, 'S']
98
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
99
+ @callback_formats[CALLBACK_DISTANCE_REACHED] = [10, 'S']
100
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
99
101
 
102
+ @ipcon.add_device self
100
103
  end
101
104
 
102
- # Returns the distance measured by the sensor. The value is in mm and possible
105
+ # Returns the distance measured by the sensor. Possible
103
106
  # distance ranges are 40 to 300, 100 to 800 and 200 to 1500, depending on the
104
107
  # selected IR sensor.
105
108
  #
@@ -107,11 +110,12 @@ module Tinkerforge
107
110
  # CALLBACK_DISTANCE callback and set the period with
108
111
  # BrickletDistanceIR#set_distance_callback_period.
109
112
  def get_distance
110
- send_request FUNCTION_GET_DISTANCE, [], '', 2, 'S'
113
+ check_validity
114
+
115
+ send_request FUNCTION_GET_DISTANCE, [], '', 10, 'S'
111
116
  end
112
117
 
113
118
  # Returns the value as read by a 12-bit analog-to-digital converter.
114
- # The value is between 0 and 4095.
115
119
  #
116
120
  # .. note::
117
121
  # The value returned by BrickletDistanceIR#get_distance is averaged over several samples
@@ -123,7 +127,9 @@ module Tinkerforge
123
127
  # CALLBACK_ANALOG_VALUE callback and set the period with
124
128
  # BrickletDistanceIR#set_analog_value_callback_period.
125
129
  def get_analog_value
126
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
130
+ check_validity
131
+
132
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
127
133
  end
128
134
 
129
135
  # Sets a sampling point value to a specific position of the lookup table.
@@ -145,45 +151,53 @@ module Tinkerforge
145
151
  # implemented in the Brick Viewer. If you want to calibrate your Bricklet it is
146
152
  # highly recommended to use this implementation.
147
153
  def set_sampling_point(position, distance)
148
- send_request FUNCTION_SET_SAMPLING_POINT, [position, distance], 'C S', 0, ''
154
+ check_validity
155
+
156
+ send_request FUNCTION_SET_SAMPLING_POINT, [position, distance], 'C S', 8, ''
149
157
  end
150
158
 
151
159
  # Returns the distance to a sampling point position as set by
152
160
  # BrickletDistanceIR#set_sampling_point.
153
161
  def get_sampling_point(position)
154
- send_request FUNCTION_GET_SAMPLING_POINT, [position], 'C', 2, 'S'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_SAMPLING_POINT, [position], 'C', 10, 'S'
155
165
  end
156
166
 
157
- # Sets the period in ms with which the CALLBACK_DISTANCE callback is triggered
167
+ # Sets the period with which the CALLBACK_DISTANCE callback is triggered
158
168
  # periodically. A value of 0 turns the callback off.
159
169
  #
160
170
  # The CALLBACK_DISTANCE callback is only triggered if the distance has changed since the
161
171
  # last triggering.
162
- #
163
- # The default value is 0.
164
172
  def set_distance_callback_period(period)
165
- send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
173
+ check_validity
174
+
175
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
166
176
  end
167
177
 
168
178
  # Returns the period as set by BrickletDistanceIR#set_distance_callback_period.
169
179
  def get_distance_callback_period
170
- send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
180
+ check_validity
181
+
182
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 12, 'L'
171
183
  end
172
184
 
173
- # Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
185
+ # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
174
186
  # periodically. A value of 0 turns the callback off.
175
187
  #
176
188
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
177
189
  # changed since the last triggering.
178
- #
179
- # The default value is 0.
180
190
  def set_analog_value_callback_period(period)
181
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
191
+ check_validity
192
+
193
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
182
194
  end
183
195
 
184
196
  # Returns the period as set by BrickletDistanceIR#set_analog_value_callback_period.
185
197
  def get_analog_value_callback_period
186
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
198
+ check_validity
199
+
200
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
187
201
  end
188
202
 
189
203
  # Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
@@ -197,15 +211,17 @@ module Tinkerforge
197
211
  # "'i'", "Callback is triggered when the distance is *inside* the min and max values"
198
212
  # "'<'", "Callback is triggered when the distance is smaller than the min value (max is ignored)"
199
213
  # "'>'", "Callback is triggered when the distance is greater than the min value (max is ignored)"
200
- #
201
- # The default value is ('x', 0, 0).
202
214
  def set_distance_callback_threshold(option, min, max)
203
- send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
215
+ check_validity
216
+
217
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
204
218
  end
205
219
 
206
220
  # Returns the threshold as set by BrickletDistanceIR#set_distance_callback_threshold.
207
221
  def get_distance_callback_threshold
208
- send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
222
+ check_validity
223
+
224
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
209
225
  end
210
226
 
211
227
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -219,18 +235,20 @@ module Tinkerforge
219
235
  # "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
220
236
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
221
237
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
222
- #
223
- # The default value is ('x', 0, 0).
224
238
  def set_analog_value_callback_threshold(option, min, max)
225
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
239
+ check_validity
240
+
241
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
226
242
  end
227
243
 
228
244
  # Returns the threshold as set by BrickletDistanceIR#set_analog_value_callback_threshold.
229
245
  def get_analog_value_callback_threshold
230
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
246
+ check_validity
247
+
248
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
231
249
  end
232
250
 
233
- # Sets the period in ms with which the threshold callbacks
251
+ # Sets the period with which the threshold callbacks
234
252
  #
235
253
  # * CALLBACK_DISTANCE_REACHED,
236
254
  # * CALLBACK_ANALOG_VALUE_REACHED
@@ -241,27 +259,31 @@ module Tinkerforge
241
259
  # * BrickletDistanceIR#set_analog_value_callback_threshold
242
260
  #
243
261
  # keep being reached.
244
- #
245
- # The default value is 100.
246
262
  def set_debounce_period(debounce)
247
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
248
266
  end
249
267
 
250
268
  # Returns the debounce period as set by BrickletDistanceIR#set_debounce_period.
251
269
  def get_debounce_period
252
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
270
+ check_validity
271
+
272
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
253
273
  end
254
274
 
255
275
  # Returns the UID, the UID where the Bricklet is connected to,
256
276
  # the position, the hardware and firmware version as well as the
257
277
  # device identifier.
258
278
  #
259
- # The position can be 'a', 'b', 'c' or 'd'.
279
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
280
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
281
+ # position 'z'.
260
282
  #
261
283
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
262
284
  # |device_identifier_constant|
263
285
  def get_identity
264
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
286
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
265
287
  end
266
288
 
267
289
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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
  # Measures distance up to 150cm with infrared light
14
16
  class BrickletDistanceIRV2 < Device
@@ -83,7 +85,7 @@ module Tinkerforge
83
85
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
84
86
  # the IP Connection <tt>ipcon</tt>.
85
87
  def initialize(uid, ipcon)
86
- super uid, ipcon
88
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
87
89
 
88
90
  @api_version = [2, 0, 1]
89
91
 
@@ -112,12 +114,13 @@ module Tinkerforge
112
114
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
115
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
116
 
115
- @callback_formats[CALLBACK_DISTANCE] = 'S'
116
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'L'
117
+ @callback_formats[CALLBACK_DISTANCE] = [10, 'S']
118
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [12, 'L']
117
119
 
120
+ @ipcon.add_device self
118
121
  end
119
122
 
120
- # Returns the distance measured by the sensor. The value is in mm and possible
123
+ # Returns the distance measured by the sensor. Possible
121
124
  # distance ranges are 40 to 300, 100 to 800 and 200 to 1500, depending on the
122
125
  # selected IR sensor.
123
126
  #
@@ -126,10 +129,12 @@ module Tinkerforge
126
129
  # CALLBACK_DISTANCE callback. You can set the callback configuration
127
130
  # with BrickletDistanceIRV2#set_distance_callback_configuration.
128
131
  def get_distance
129
- send_request FUNCTION_GET_DISTANCE, [], '', 2, 'S'
132
+ check_validity
133
+
134
+ send_request FUNCTION_GET_DISTANCE, [], '', 10, 'S'
130
135
  end
131
136
 
132
- # The period in ms is the period with which the CALLBACK_DISTANCE callback is triggered
137
+ # The period is the period with which the CALLBACK_DISTANCE callback is triggered
133
138
  # periodically. A value of 0 turns the callback off.
134
139
  #
135
140
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -154,19 +159,20 @@ module Tinkerforge
154
159
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
155
160
  #
156
161
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
157
- #
158
- # The default value is (0, false, 'x', 0, 0).
159
162
  def set_distance_callback_configuration(period, value_has_to_change, option, min, max)
160
- send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
163
+ check_validity
164
+
165
+ send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
161
166
  end
162
167
 
163
168
  # Returns the callback configuration as set by BrickletDistanceIRV2#set_distance_callback_configuration.
164
169
  def get_distance_callback_configuration
165
- send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
166
173
  end
167
174
 
168
175
  # Returns the analog value as read by a analog-to-digital converter.
169
- # The value has 21 bit with a range of 0 to 2097151.
170
176
  #
171
177
  # This is unfiltered raw data. We made sure that the integration time
172
178
  # of the ADC is shorter then the measurement interval of the sensor
@@ -180,10 +186,12 @@ module Tinkerforge
180
186
  # CALLBACK_ANALOG_VALUE callback. You can set the callback configuration
181
187
  # with BrickletDistanceIRV2#set_analog_value_callback_configuration.
182
188
  def get_analog_value
183
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 4, 'L'
189
+ check_validity
190
+
191
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 12, 'L'
184
192
  end
185
193
 
186
- # The period in ms is the period with which the CALLBACK_ANALOG_VALUE callback is triggered
194
+ # The period is the period with which the CALLBACK_ANALOG_VALUE callback is triggered
187
195
  # periodically. A value of 0 turns the callback off.
188
196
  #
189
197
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -208,15 +216,17 @@ module Tinkerforge
208
216
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
209
217
  #
210
218
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
211
- #
212
- # The default value is (0, false, 'x', 0, 0).
213
219
  def set_analog_value_callback_configuration(period, value_has_to_change, option, min, max)
214
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 0, ''
220
+ check_validity
221
+
222
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k L L', 8, ''
215
223
  end
216
224
 
217
225
  # Returns the callback configuration as set by BrickletDistanceIRV2#set_analog_value_callback_configuration.
218
226
  def get_analog_value_callback_configuration
219
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k L L'
227
+ check_validity
228
+
229
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k L L'
220
230
  end
221
231
 
222
232
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -225,33 +235,35 @@ module Tinkerforge
225
235
  # Setting the length to 1 will turn the averaging off. With less averaging, there
226
236
  # is more noise on the data.
227
237
  #
228
- # The range for the averaging is 1-1000.
229
- #
230
238
  # New data is gathered every ~10ms. With a moving average of length 1000 the
231
239
  # resulting averaging window has a length of approximately 10s. If you want to do
232
240
  # long term measurements the longest moving average will give the cleanest results.
233
- #
234
- # The default value is 25.
235
241
  def set_moving_average_configuration(moving_average_length)
236
- send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length], 'S', 0, ''
242
+ check_validity
243
+
244
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length], 'S', 8, ''
237
245
  end
238
246
 
239
247
  # Returns the moving average configuration as set by BrickletDistanceIRV2#set_moving_average_configuration.
240
248
  def get_moving_average_configuration
241
- send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 2, 'S'
249
+ check_validity
250
+
251
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 10, 'S'
242
252
  end
243
253
 
244
254
  # Configures the distance LED to be either turned off, turned on, blink in
245
255
  # heartbeat mode or show the distance (brighter = object is nearer).
246
- #
247
- # The default value is 3 (show distance).
248
256
  def set_distance_led_config(config)
249
- send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 0, ''
257
+ check_validity
258
+
259
+ send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 8, ''
250
260
  end
251
261
 
252
262
  # Returns the LED configuration as set by BrickletDistanceIRV2#set_distance_led_config
253
263
  def get_distance_led_config
254
- send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 1, 'C'
264
+ check_validity
265
+
266
+ send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 9, 'C'
255
267
  end
256
268
 
257
269
  # Sets the sensor type.
@@ -263,12 +275,16 @@ module Tinkerforge
263
275
  # If you want to change the sensor you can set the type in Brick Viewer,
264
276
  # you will likely never need to call this function from your program.
265
277
  def set_sensor_type(sensor)
266
- send_request FUNCTION_SET_SENSOR_TYPE, [sensor], 'C', 0, ''
278
+ check_validity
279
+
280
+ send_request FUNCTION_SET_SENSOR_TYPE, [sensor], 'C', 8, ''
267
281
  end
268
282
 
269
283
  # Returns the sensor type as set by BrickletDistanceIRV2#set_sensor_type.
270
284
  def get_sensor_type
271
- send_request FUNCTION_GET_SENSOR_TYPE, [], '', 1, 'C'
285
+ check_validity
286
+
287
+ send_request FUNCTION_GET_SENSOR_TYPE, [], '', 9, 'C'
272
288
  end
273
289
 
274
290
  # Returns the error count for the communication between Brick and Bricklet.
@@ -283,7 +299,9 @@ module Tinkerforge
283
299
  # The errors counts are for errors that occur on the Bricklet side. All
284
300
  # Bricks have a similar function that returns the errors on the Brick side.
285
301
  def get_spitfp_error_count
286
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
302
+ check_validity
303
+
304
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
287
305
  end
288
306
 
289
307
  # Sets the bootloader mode and returns the status after the requested
@@ -296,12 +314,16 @@ module Tinkerforge
296
314
  # This function is used by Brick Viewer during flashing. It should not be
297
315
  # necessary to call it in a normal user program.
298
316
  def set_bootloader_mode(mode)
299
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
317
+ check_validity
318
+
319
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
300
320
  end
301
321
 
302
322
  # Returns the current bootloader mode, see BrickletDistanceIRV2#set_bootloader_mode.
303
323
  def get_bootloader_mode
304
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
324
+ check_validity
325
+
326
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
305
327
  end
306
328
 
307
329
  # Sets the firmware pointer for BrickletDistanceIRV2#write_firmware. The pointer has
@@ -311,7 +333,9 @@ module Tinkerforge
311
333
  # This function is used by Brick Viewer during flashing. It should not be
312
334
  # necessary to call it in a normal user program.
313
335
  def set_write_firmware_pointer(pointer)
314
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
336
+ check_validity
337
+
338
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
315
339
  end
316
340
 
317
341
  # Writes 64 Bytes of firmware at the position as written by
@@ -323,7 +347,9 @@ module Tinkerforge
323
347
  # This function is used by Brick Viewer during flashing. It should not be
324
348
  # necessary to call it in a normal user program.
325
349
  def write_firmware(data)
326
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
350
+ check_validity
351
+
352
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
327
353
  end
328
354
 
329
355
  # Sets the status LED configuration. By default the LED shows
@@ -334,22 +360,28 @@ module Tinkerforge
334
360
  #
335
361
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
336
362
  def set_status_led_config(config)
337
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
363
+ check_validity
364
+
365
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
338
366
  end
339
367
 
340
368
  # Returns the configuration as set by BrickletDistanceIRV2#set_status_led_config
341
369
  def get_status_led_config
342
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
370
+ check_validity
371
+
372
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
343
373
  end
344
374
 
345
- # Returns the temperature in °C as measured inside the microcontroller. The
375
+ # Returns the temperature as measured inside the microcontroller. The
346
376
  # value returned is not the ambient temperature!
347
377
  #
348
378
  # The temperature is only proportional to the real temperature and it has bad
349
379
  # accuracy. Practically it is only useful as an indicator for
350
380
  # temperature changes.
351
381
  def get_chip_temperature
352
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
382
+ check_validity
383
+
384
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
353
385
  end
354
386
 
355
387
  # Calling this function will reset the Bricklet. All configurations
@@ -359,7 +391,9 @@ module Tinkerforge
359
391
  # calling functions on the existing ones will result in
360
392
  # undefined behavior!
361
393
  def reset
362
- send_request FUNCTION_RESET, [], '', 0, ''
394
+ check_validity
395
+
396
+ send_request FUNCTION_RESET, [], '', 8, ''
363
397
  end
364
398
 
365
399
  # Writes a new UID into flash. If you want to set a new UID
@@ -368,25 +402,31 @@ module Tinkerforge
368
402
  #
369
403
  # We recommend that you use Brick Viewer to change the UID.
370
404
  def write_uid(uid)
371
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
405
+ check_validity
406
+
407
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
372
408
  end
373
409
 
374
410
  # Returns the current UID as an integer. Encode as
375
411
  # Base58 to get the usual string version.
376
412
  def read_uid
377
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
413
+ check_validity
414
+
415
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
378
416
  end
379
417
 
380
418
  # Returns the UID, the UID where the Bricklet is connected to,
381
419
  # the position, the hardware and firmware version as well as the
382
420
  # device identifier.
383
421
  #
384
- # The position can be 'a', 'b', 'c' or 'd'.
422
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
423
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
424
+ # position 'z'.
385
425
  #
386
426
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
387
427
  # |device_identifier_constant|
388
428
  def get_identity
389
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
429
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
390
430
  end
391
431
 
392
432
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.