tinkerforge 2.1.24 → 2.1.25

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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 magnetic flux density between -7mT and +7mT
14
16
  class BrickletHallEffectV2 < 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, 0]
78
80
 
@@ -97,9 +99,10 @@ module Tinkerforge
97
99
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
98
100
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
101
 
100
- @callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = 's'
101
- @callback_formats[CALLBACK_COUNTER] = 'L'
102
+ @callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = [10, 's']
103
+ @callback_formats[CALLBACK_COUNTER] = [12, 'L']
102
104
 
105
+ @ipcon.add_device self
103
106
  end
104
107
 
105
108
  # Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__.
@@ -109,7 +112,9 @@ module Tinkerforge
109
112
  # CALLBACK_MAGNETIC_FLUX_DENSITY callback. You can set the callback configuration
110
113
  # with BrickletHallEffectV2#set_magnetic_flux_density_callback_configuration.
111
114
  def get_magnetic_flux_density
112
- send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 2, 's'
115
+ check_validity
116
+
117
+ send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 10, 's'
113
118
  end
114
119
 
115
120
  # The period is the period with which the CALLBACK_MAGNETIC_FLUX_DENSITY callback is triggered
@@ -138,12 +143,16 @@ module Tinkerforge
138
143
  #
139
144
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
140
145
  def set_magnetic_flux_density_callback_configuration(period, value_has_to_change, option, min, max)
141
- send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
146
+ check_validity
147
+
148
+ send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
142
149
  end
143
150
 
144
151
  # Returns the callback configuration as set by BrickletHallEffectV2#set_magnetic_flux_density_callback_configuration.
145
152
  def get_magnetic_flux_density_callback_configuration
146
- send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
153
+ check_validity
154
+
155
+ send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
147
156
  end
148
157
 
149
158
  # Returns the current value of the counter.
@@ -158,7 +167,9 @@ module Tinkerforge
158
167
  # CALLBACK_COUNTER callback. You can set the callback configuration
159
168
  # with BrickletHallEffectV2#set_counter_callback_configuration.
160
169
  def get_counter(reset_counter)
161
- send_request FUNCTION_GET_COUNTER, [reset_counter], '?', 4, 'L'
170
+ check_validity
171
+
172
+ send_request FUNCTION_GET_COUNTER, [reset_counter], '?', 12, 'L'
162
173
  end
163
174
 
164
175
  # Sets a high and a low threshold as well as a debounce time.
@@ -168,12 +179,16 @@ module Tinkerforge
168
179
  #
169
180
  # The debounce time is the minimum time between two count increments.
170
181
  def set_counter_config(high_threshold, low_threshold, debounce)
171
- send_request FUNCTION_SET_COUNTER_CONFIG, [high_threshold, low_threshold, debounce], 's s L', 0, ''
182
+ check_validity
183
+
184
+ send_request FUNCTION_SET_COUNTER_CONFIG, [high_threshold, low_threshold, debounce], 's s L', 8, ''
172
185
  end
173
186
 
174
187
  # Returns the counter config as set by BrickletHallEffectV2#set_counter_config.
175
188
  def get_counter_config
176
- send_request FUNCTION_GET_COUNTER_CONFIG, [], '', 8, 's s L'
189
+ check_validity
190
+
191
+ send_request FUNCTION_GET_COUNTER_CONFIG, [], '', 16, 's s L'
177
192
  end
178
193
 
179
194
  # The period is the period with which the CALLBACK_COUNTER
@@ -186,13 +201,17 @@ module Tinkerforge
186
201
  # If it is set to false, the callback is continuously triggered with the period,
187
202
  # independent of the value.
188
203
  def set_counter_callback_configuration(period, value_has_to_change)
189
- send_request FUNCTION_SET_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_SET_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
190
207
  end
191
208
 
192
209
  # Returns the callback configuration as set by
193
210
  # BrickletHallEffectV2#set_counter_callback_configuration.
194
211
  def get_counter_callback_configuration
195
- send_request FUNCTION_GET_COUNTER_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
212
+ check_validity
213
+
214
+ send_request FUNCTION_GET_COUNTER_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
196
215
  end
197
216
 
198
217
  # Returns the error count for the communication between Brick and Bricklet.
@@ -207,7 +226,9 @@ module Tinkerforge
207
226
  # The errors counts are for errors that occur on the Bricklet side. All
208
227
  # Bricks have a similar function that returns the errors on the Brick side.
209
228
  def get_spitfp_error_count
210
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
229
+ check_validity
230
+
231
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
211
232
  end
212
233
 
213
234
  # Sets the bootloader mode and returns the status after the requested
@@ -220,12 +241,16 @@ module Tinkerforge
220
241
  # This function is used by Brick Viewer during flashing. It should not be
221
242
  # necessary to call it in a normal user program.
222
243
  def set_bootloader_mode(mode)
223
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
244
+ check_validity
245
+
246
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
224
247
  end
225
248
 
226
249
  # Returns the current bootloader mode, see BrickletHallEffectV2#set_bootloader_mode.
227
250
  def get_bootloader_mode
228
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
251
+ check_validity
252
+
253
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
229
254
  end
230
255
 
231
256
  # Sets the firmware pointer for BrickletHallEffectV2#write_firmware. The pointer has
@@ -235,7 +260,9 @@ module Tinkerforge
235
260
  # This function is used by Brick Viewer during flashing. It should not be
236
261
  # necessary to call it in a normal user program.
237
262
  def set_write_firmware_pointer(pointer)
238
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
239
266
  end
240
267
 
241
268
  # Writes 64 Bytes of firmware at the position as written by
@@ -247,7 +274,9 @@ module Tinkerforge
247
274
  # This function is used by Brick Viewer during flashing. It should not be
248
275
  # necessary to call it in a normal user program.
249
276
  def write_firmware(data)
250
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
277
+ check_validity
278
+
279
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
251
280
  end
252
281
 
253
282
  # Sets the status LED configuration. By default the LED shows
@@ -258,22 +287,28 @@ module Tinkerforge
258
287
  #
259
288
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
260
289
  def set_status_led_config(config)
261
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
290
+ check_validity
291
+
292
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
262
293
  end
263
294
 
264
295
  # Returns the configuration as set by BrickletHallEffectV2#set_status_led_config
265
296
  def get_status_led_config
266
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
297
+ check_validity
298
+
299
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
267
300
  end
268
301
 
269
- # Returns the temperature in °C as measured inside the microcontroller. The
302
+ # Returns the temperature as measured inside the microcontroller. The
270
303
  # value returned is not the ambient temperature!
271
304
  #
272
305
  # The temperature is only proportional to the real temperature and it has bad
273
306
  # accuracy. Practically it is only useful as an indicator for
274
307
  # temperature changes.
275
308
  def get_chip_temperature
276
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
309
+ check_validity
310
+
311
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
277
312
  end
278
313
 
279
314
  # Calling this function will reset the Bricklet. All configurations
@@ -283,7 +318,9 @@ module Tinkerforge
283
318
  # calling functions on the existing ones will result in
284
319
  # undefined behavior!
285
320
  def reset
286
- send_request FUNCTION_RESET, [], '', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_RESET, [], '', 8, ''
287
324
  end
288
325
 
289
326
  # Writes a new UID into flash. If you want to set a new UID
@@ -292,25 +329,32 @@ module Tinkerforge
292
329
  #
293
330
  # We recommend that you use Brick Viewer to change the UID.
294
331
  def write_uid(uid)
295
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
332
+ check_validity
333
+
334
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
296
335
  end
297
336
 
298
337
  # Returns the current UID as an integer. Encode as
299
338
  # Base58 to get the usual string version.
300
339
  def read_uid
301
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
340
+ check_validity
341
+
342
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
302
343
  end
303
344
 
304
345
  # Returns the UID, the UID where the Bricklet is connected to,
305
346
  # the position, the hardware and firmware version as well as the
306
347
  # device identifier.
307
348
  #
308
- # The position can be 'a', 'b', 'c' or 'd'.
349
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
350
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
351
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
352
+ # position 'z'.
309
353
  #
310
354
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
311
355
  # |device_identifier_constant|
312
356
  def get_identity
313
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
357
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
314
358
  end
315
359
 
316
360
  # 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-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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 relative humidity
14
16
  class BrickletHumidity < 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, 1]
76
78
 
@@ -88,11 +90,12 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
 
91
- @callback_formats[CALLBACK_HUMIDITY] = 'S'
92
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
93
- @callback_formats[CALLBACK_HUMIDITY_REACHED] = 'S'
94
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
93
+ @callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
94
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
95
+ @callback_formats[CALLBACK_HUMIDITY_REACHED] = [10, 'S']
96
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
101
  # Returns the humidity of the sensor.
@@ -101,7 +104,9 @@ module Tinkerforge
101
104
  # CALLBACK_HUMIDITY callback and set the period with
102
105
  # BrickletHumidity#set_humidity_callback_period.
103
106
  def get_humidity
104
- send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
107
+ check_validity
108
+
109
+ send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
105
110
  end
106
111
 
107
112
  # Returns the value as read by a 12-bit analog-to-digital converter.
@@ -119,7 +124,9 @@ module Tinkerforge
119
124
  # CALLBACK_ANALOG_VALUE callback and set the period with
120
125
  # BrickletHumidity#set_analog_value_callback_period.
121
126
  def get_analog_value
122
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
127
+ check_validity
128
+
129
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
123
130
  end
124
131
 
125
132
  # Sets the period with which the CALLBACK_HUMIDITY callback is triggered
@@ -128,12 +135,16 @@ module Tinkerforge
128
135
  # The CALLBACK_HUMIDITY callback is only triggered if the humidity has changed
129
136
  # since the last triggering.
130
137
  def set_humidity_callback_period(period)
131
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, [period], 'L', 0, ''
138
+ check_validity
139
+
140
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, [period], 'L', 8, ''
132
141
  end
133
142
 
134
143
  # Returns the period as set by BrickletHumidity#set_humidity_callback_period.
135
144
  def get_humidity_callback_period
136
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD, [], '', 4, 'L'
145
+ check_validity
146
+
147
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD, [], '', 12, 'L'
137
148
  end
138
149
 
139
150
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -142,12 +153,16 @@ module Tinkerforge
142
153
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
143
154
  # changed since the last triggering.
144
155
  def set_analog_value_callback_period(period)
145
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
156
+ check_validity
157
+
158
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
146
159
  end
147
160
 
148
161
  # Returns the period as set by BrickletHumidity#set_analog_value_callback_period.
149
162
  def get_analog_value_callback_period
150
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
163
+ check_validity
164
+
165
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
151
166
  end
152
167
 
153
168
  # Sets the thresholds for the CALLBACK_HUMIDITY_REACHED callback.
@@ -162,12 +177,16 @@ module Tinkerforge
162
177
  # "'<'", "Callback is triggered when the humidity is smaller than the min value (max is ignored)"
163
178
  # "'>'", "Callback is triggered when the humidity is greater than the min value (max is ignored)"
164
179
  def set_humidity_callback_threshold(option, min, max)
165
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
166
183
  end
167
184
 
168
185
  # Returns the threshold as set by BrickletHumidity#set_humidity_callback_threshold.
169
186
  def get_humidity_callback_threshold
170
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
171
190
  end
172
191
 
173
192
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -182,12 +201,16 @@ module Tinkerforge
182
201
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
183
202
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
184
203
  def set_analog_value_callback_threshold(option, min, max)
185
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
186
207
  end
187
208
 
188
209
  # Returns the threshold as set by BrickletHumidity#set_analog_value_callback_threshold.
189
210
  def get_analog_value_callback_threshold
190
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
211
+ check_validity
212
+
213
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
191
214
  end
192
215
 
193
216
  # Sets the period with which the threshold callbacks
@@ -202,24 +225,31 @@ module Tinkerforge
202
225
  #
203
226
  # keep being reached.
204
227
  def set_debounce_period(debounce)
205
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
228
+ check_validity
229
+
230
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
206
231
  end
207
232
 
208
233
  # Returns the debounce period as set by BrickletHumidity#set_debounce_period.
209
234
  def get_debounce_period
210
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
235
+ check_validity
236
+
237
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
211
238
  end
212
239
 
213
240
  # Returns the UID, the UID where the Bricklet is connected to,
214
241
  # the position, the hardware and firmware version as well as the
215
242
  # device identifier.
216
243
  #
217
- # The position can be 'a', 'b', 'c' or 'd'.
244
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
245
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
246
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
247
+ # position 'z'.
218
248
  #
219
249
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
220
250
  # |device_identifier_constant|
221
251
  def get_identity
222
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
252
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
223
253
  end
224
254
 
225
255
  # 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-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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 relative humidity
14
16
  class BrickletHumidityV2 < Device
@@ -84,7 +86,7 @@ module Tinkerforge
84
86
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
85
87
  # the IP Connection <tt>ipcon</tt>.
86
88
  def initialize(uid, ipcon)
87
- super uid, ipcon
89
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
88
90
 
89
91
  @api_version = [2, 0, 2]
90
92
 
@@ -113,9 +115,10 @@ module Tinkerforge
113
115
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
116
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
117
 
116
- @callback_formats[CALLBACK_HUMIDITY] = 'S'
117
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
118
+ @callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
119
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
118
120
 
121
+ @ipcon.add_device self
119
122
  end
120
123
 
121
124
  # Returns the humidity measured by the sensor.
@@ -125,7 +128,9 @@ module Tinkerforge
125
128
  # CALLBACK_HUMIDITY callback. You can set the callback configuration
126
129
  # with BrickletHumidityV2#set_humidity_callback_configuration.
127
130
  def get_humidity
128
- send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
131
+ check_validity
132
+
133
+ send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
129
134
  end
130
135
 
131
136
  # The period is the period with which the CALLBACK_HUMIDITY callback is triggered
@@ -154,12 +159,16 @@ module Tinkerforge
154
159
  #
155
160
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
156
161
  def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
157
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
162
+ check_validity
163
+
164
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
158
165
  end
159
166
 
160
167
  # Returns the callback configuration as set by BrickletHumidityV2#set_humidity_callback_configuration.
161
168
  def get_humidity_callback_configuration
162
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
169
+ check_validity
170
+
171
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
163
172
  end
164
173
 
165
174
  # Returns the temperature measured by the sensor.
@@ -169,7 +178,9 @@ module Tinkerforge
169
178
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
170
179
  # with BrickletHumidityV2#set_temperature_callback_configuration.
171
180
  def get_temperature
172
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
173
184
  end
174
185
 
175
186
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -198,23 +209,31 @@ module Tinkerforge
198
209
  #
199
210
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
200
211
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
201
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
212
+ check_validity
213
+
214
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
202
215
  end
203
216
 
204
217
  # Returns the callback configuration as set by BrickletHumidityV2#set_temperature_callback_configuration.
205
218
  def get_temperature_callback_configuration
206
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
219
+ check_validity
220
+
221
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
207
222
  end
208
223
 
209
224
  # Enables/disables the heater. The heater can be used to dry the sensor in
210
225
  # extremely wet conditions.
211
226
  def set_heater_configuration(heater_config)
212
- send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 0, ''
227
+ check_validity
228
+
229
+ send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 8, ''
213
230
  end
214
231
 
215
232
  # Returns the heater configuration as set by BrickletHumidityV2#set_heater_configuration.
216
233
  def get_heater_configuration
217
- send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 1, 'C'
234
+ check_validity
235
+
236
+ send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 9, 'C'
218
237
  end
219
238
 
220
239
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -232,12 +251,16 @@ module Tinkerforge
232
251
  # of th IC, changed the default value from 20 samples per second to 1. With 1 sample per second
233
252
  # a moving average length of 1000 would result in an averaging window of 1000 seconds!
234
253
  def set_moving_average_configuration(moving_average_length_humidity, moving_average_length_temperature)
235
- send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_humidity, moving_average_length_temperature], 'S S', 0, ''
254
+ check_validity
255
+
256
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_humidity, moving_average_length_temperature], 'S S', 8, ''
236
257
  end
237
258
 
238
259
  # Returns the moving average configuration as set by BrickletHumidityV2#set_moving_average_configuration.
239
260
  def get_moving_average_configuration
240
- send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
261
+ check_validity
262
+
263
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 12, 'S S'
241
264
  end
242
265
 
243
266
  # Sets the samples per second that are gathered by the humidity/temperature sensor HDC1080.
@@ -252,14 +275,18 @@ module Tinkerforge
252
275
  #
253
276
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
254
277
  def set_samples_per_second(sps)
255
- send_request FUNCTION_SET_SAMPLES_PER_SECOND, [sps], 'C', 0, ''
278
+ check_validity
279
+
280
+ send_request FUNCTION_SET_SAMPLES_PER_SECOND, [sps], 'C', 8, ''
256
281
  end
257
282
 
258
283
  # Returnes the samples per second, as set by BrickletHumidityV2#set_samples_per_second.
259
284
  #
260
285
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
261
286
  def get_samples_per_second
262
- send_request FUNCTION_GET_SAMPLES_PER_SECOND, [], '', 1, 'C'
287
+ check_validity
288
+
289
+ send_request FUNCTION_GET_SAMPLES_PER_SECOND, [], '', 9, 'C'
263
290
  end
264
291
 
265
292
  # Returns the error count for the communication between Brick and Bricklet.
@@ -274,7 +301,9 @@ module Tinkerforge
274
301
  # The errors counts are for errors that occur on the Bricklet side. All
275
302
  # Bricks have a similar function that returns the errors on the Brick side.
276
303
  def get_spitfp_error_count
277
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
304
+ check_validity
305
+
306
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
278
307
  end
279
308
 
280
309
  # Sets the bootloader mode and returns the status after the requested
@@ -287,12 +316,16 @@ module Tinkerforge
287
316
  # This function is used by Brick Viewer during flashing. It should not be
288
317
  # necessary to call it in a normal user program.
289
318
  def set_bootloader_mode(mode)
290
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
319
+ check_validity
320
+
321
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
291
322
  end
292
323
 
293
324
  # Returns the current bootloader mode, see BrickletHumidityV2#set_bootloader_mode.
294
325
  def get_bootloader_mode
295
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
326
+ check_validity
327
+
328
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
296
329
  end
297
330
 
298
331
  # Sets the firmware pointer for BrickletHumidityV2#write_firmware. The pointer has
@@ -302,7 +335,9 @@ module Tinkerforge
302
335
  # This function is used by Brick Viewer during flashing. It should not be
303
336
  # necessary to call it in a normal user program.
304
337
  def set_write_firmware_pointer(pointer)
305
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
338
+ check_validity
339
+
340
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
306
341
  end
307
342
 
308
343
  # Writes 64 Bytes of firmware at the position as written by
@@ -314,7 +349,9 @@ module Tinkerforge
314
349
  # This function is used by Brick Viewer during flashing. It should not be
315
350
  # necessary to call it in a normal user program.
316
351
  def write_firmware(data)
317
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
352
+ check_validity
353
+
354
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
318
355
  end
319
356
 
320
357
  # Sets the status LED configuration. By default the LED shows
@@ -325,22 +362,28 @@ module Tinkerforge
325
362
  #
326
363
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
327
364
  def set_status_led_config(config)
328
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
365
+ check_validity
366
+
367
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
329
368
  end
330
369
 
331
370
  # Returns the configuration as set by BrickletHumidityV2#set_status_led_config
332
371
  def get_status_led_config
333
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
372
+ check_validity
373
+
374
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
334
375
  end
335
376
 
336
- # Returns the temperature in °C as measured inside the microcontroller. The
377
+ # Returns the temperature as measured inside the microcontroller. The
337
378
  # value returned is not the ambient temperature!
338
379
  #
339
380
  # The temperature is only proportional to the real temperature and it has bad
340
381
  # accuracy. Practically it is only useful as an indicator for
341
382
  # temperature changes.
342
383
  def get_chip_temperature
343
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
384
+ check_validity
385
+
386
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
344
387
  end
345
388
 
346
389
  # Calling this function will reset the Bricklet. All configurations
@@ -350,7 +393,9 @@ module Tinkerforge
350
393
  # calling functions on the existing ones will result in
351
394
  # undefined behavior!
352
395
  def reset
353
- send_request FUNCTION_RESET, [], '', 0, ''
396
+ check_validity
397
+
398
+ send_request FUNCTION_RESET, [], '', 8, ''
354
399
  end
355
400
 
356
401
  # Writes a new UID into flash. If you want to set a new UID
@@ -359,25 +404,32 @@ module Tinkerforge
359
404
  #
360
405
  # We recommend that you use Brick Viewer to change the UID.
361
406
  def write_uid(uid)
362
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
407
+ check_validity
408
+
409
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
363
410
  end
364
411
 
365
412
  # Returns the current UID as an integer. Encode as
366
413
  # Base58 to get the usual string version.
367
414
  def read_uid
368
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
415
+ check_validity
416
+
417
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
369
418
  end
370
419
 
371
420
  # Returns the UID, the UID where the Bricklet is connected to,
372
421
  # the position, the hardware and firmware version as well as the
373
422
  # device identifier.
374
423
  #
375
- # The position can be 'a', 'b', 'c' or 'd'.
424
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
425
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
426
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
427
+ # position 'z'.
376
428
  #
377
429
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
378
430
  # |device_identifier_constant|
379
431
  def get_identity
380
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
432
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
381
433
  end
382
434
 
383
435
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.