tinkerforge 2.1.24 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
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
  # Controls up to 2048 RGB(W) LEDs
14
16
  class BrickletLEDStripV2 < Device
@@ -104,7 +106,7 @@ module Tinkerforge
104
106
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
105
107
  # the IP Connection <tt>ipcon</tt>.
106
108
  def initialize(uid, ipcon)
107
- super uid, ipcon
109
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
108
110
 
109
111
  @api_version = [2, 0, 0]
110
112
 
@@ -134,12 +136,13 @@ module Tinkerforge
134
136
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
135
137
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
136
138
 
137
- @callback_formats[CALLBACK_FRAME_STARTED] = 'S'
139
+ @callback_formats[CALLBACK_FRAME_STARTED] = [10, 'S']
138
140
 
141
+ @ipcon.add_device self
139
142
  end
140
143
 
141
144
  # Sets the RGB(W) values for the LEDs starting from *index*.
142
- # You can set at most 2048 RGB values or 1536 RGBW values.
145
+ # You can set at most 2048 RGB values or 1536 RGBW values (6144 byte each).
143
146
  #
144
147
  # To make the colors show correctly you need to configure the chip type
145
148
  # (see BrickletLEDStripV2#set_chip_type) and a channel mapping (see BrickletLEDStripV2#set_channel_mapping)
@@ -164,7 +167,9 @@ module Tinkerforge
164
167
  #
165
168
  # This approach ensures that you can change the LED colors with a fixed frame rate.
166
169
  def set_led_values_low_level(index, value_length, value_chunk_offset, value_chunk_data)
167
- send_request FUNCTION_SET_LED_VALUES_LOW_LEVEL, [index, value_length, value_chunk_offset, value_chunk_data], 'S S S C58', 0, ''
170
+ check_validity
171
+
172
+ send_request FUNCTION_SET_LED_VALUES_LOW_LEVEL, [index, value_length, value_chunk_offset, value_chunk_data], 'S S S C58', 8, ''
168
173
  end
169
174
 
170
175
  # Returns *length* RGB(W) values starting from the
@@ -175,10 +180,12 @@ module Tinkerforge
175
180
  # sequence RGBWRGBWRGBW...
176
181
  # (assuming you start at an index divisible by 3 (RGB) or 4 (RGBW)).
177
182
  def get_led_values_low_level(index, length)
178
- send_request FUNCTION_GET_LED_VALUES_LOW_LEVEL, [index, length], 'S S', 64, 'S S C60'
183
+ check_validity
184
+
185
+ send_request FUNCTION_GET_LED_VALUES_LOW_LEVEL, [index, length], 'S S', 72, 'S S C60'
179
186
  end
180
187
 
181
- # Sets the frame duration in ms.
188
+ # Sets the frame duration.
182
189
  #
183
190
  # Example: If you want to achieve 20 frames per second, you should
184
191
  # set the frame duration to 50ms (50ms * 20 = 1 second).
@@ -187,21 +194,26 @@ module Tinkerforge
187
194
  #
188
195
  # Default value: 100ms (10 frames per second).
189
196
  def set_frame_duration(duration)
190
- send_request FUNCTION_SET_FRAME_DURATION, [duration], 'S', 0, ''
197
+ check_validity
198
+
199
+ send_request FUNCTION_SET_FRAME_DURATION, [duration], 'S', 8, ''
191
200
  end
192
201
 
193
- # Returns the frame duration in ms as set by BrickletLEDStripV2#set_frame_duration.
202
+ # Returns the frame duration as set by BrickletLEDStripV2#set_frame_duration.
194
203
  def get_frame_duration
195
- send_request FUNCTION_GET_FRAME_DURATION, [], '', 2, 'S'
204
+ check_validity
205
+
206
+ send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
196
207
  end
197
208
 
198
- # Returns the current supply voltage of the LEDs. The voltage is given in mV.
209
+ # Returns the current supply voltage of the LEDs.
199
210
  def get_supply_voltage
200
- send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 2, 'S'
211
+ check_validity
212
+
213
+ send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 10, 'S'
201
214
  end
202
215
 
203
- # Sets the frequency of the clock in Hz. The range is 10000Hz (10kHz) up to
204
- # 2000000Hz (2MHz).
216
+ # Sets the frequency of the clock.
205
217
  #
206
218
  # The Bricklet will choose the nearest achievable frequency, which may
207
219
  # be off by a few Hz. You can get the exact frequency that is used by
@@ -213,15 +225,17 @@ module Tinkerforge
213
225
  #
214
226
  # With a decreasing frequency your maximum frames per second will decrease
215
227
  # too.
216
- #
217
- # The default value is 1.66MHz.
218
228
  def set_clock_frequency(frequency)
219
- send_request FUNCTION_SET_CLOCK_FREQUENCY, [frequency], 'L', 0, ''
229
+ check_validity
230
+
231
+ send_request FUNCTION_SET_CLOCK_FREQUENCY, [frequency], 'L', 8, ''
220
232
  end
221
233
 
222
234
  # Returns the currently used clock frequency as set by BrickletLEDStripV2#set_clock_frequency.
223
235
  def get_clock_frequency
224
- send_request FUNCTION_GET_CLOCK_FREQUENCY, [], '', 4, 'L'
236
+ check_validity
237
+
238
+ send_request FUNCTION_GET_CLOCK_FREQUENCY, [], '', 12, 'L'
225
239
  end
226
240
 
227
241
  # Sets the type of the LED driver chip. We currently support the chips
@@ -233,15 +247,17 @@ module Tinkerforge
233
247
  # * WS2813 / WS2815 (Chip Type = WS2812)
234
248
  # * LPD8806 and
235
249
  # * APA102 / DotStar.
236
- #
237
- # The default value is WS2801 (2801).
238
250
  def set_chip_type(chip)
239
- send_request FUNCTION_SET_CHIP_TYPE, [chip], 'S', 0, ''
251
+ check_validity
252
+
253
+ send_request FUNCTION_SET_CHIP_TYPE, [chip], 'S', 8, ''
240
254
  end
241
255
 
242
256
  # Returns the currently used chip type as set by BrickletLEDStripV2#set_chip_type.
243
257
  def get_chip_type
244
- send_request FUNCTION_GET_CHIP_TYPE, [], '', 2, 'S'
258
+ check_validity
259
+
260
+ send_request FUNCTION_GET_CHIP_TYPE, [], '', 10, 'S'
245
261
  end
246
262
 
247
263
  # Sets the channel mapping for the connected LEDs.
@@ -259,28 +275,32 @@ module Tinkerforge
259
275
  # making them 4-channel chips. Internally the brightness channel is the first
260
276
  # channel, therefore one of the Wxyz channel mappings should be used. Then
261
277
  # the W channel controls the brightness.
262
- #
263
- # The default value is BGR (36).
264
278
  def set_channel_mapping(mapping)
265
- send_request FUNCTION_SET_CHANNEL_MAPPING, [mapping], 'C', 0, ''
279
+ check_validity
280
+
281
+ send_request FUNCTION_SET_CHANNEL_MAPPING, [mapping], 'C', 8, ''
266
282
  end
267
283
 
268
284
  # Returns the currently used channel mapping as set by BrickletLEDStripV2#set_channel_mapping.
269
285
  def get_channel_mapping
270
- send_request FUNCTION_GET_CHANNEL_MAPPING, [], '', 1, 'C'
286
+ check_validity
287
+
288
+ send_request FUNCTION_GET_CHANNEL_MAPPING, [], '', 9, 'C'
271
289
  end
272
290
 
273
291
  # Enables/disables the CALLBACK_FRAME_STARTED callback.
274
- #
275
- # By default the callback is enabled.
276
292
  def set_frame_started_callback_configuration(enable)
277
- send_request FUNCTION_SET_FRAME_STARTED_CALLBACK_CONFIGURATION, [enable], '?', 0, ''
293
+ check_validity
294
+
295
+ send_request FUNCTION_SET_FRAME_STARTED_CALLBACK_CONFIGURATION, [enable], '?', 8, ''
278
296
  end
279
297
 
280
298
  # Returns the configuration as set by
281
299
  # BrickletLEDStripV2#set_frame_started_callback_configuration.
282
300
  def get_frame_started_callback_configuration
283
- send_request FUNCTION_GET_FRAME_STARTED_CALLBACK_CONFIGURATION, [], '', 1, '?'
301
+ check_validity
302
+
303
+ send_request FUNCTION_GET_FRAME_STARTED_CALLBACK_CONFIGURATION, [], '', 9, '?'
284
304
  end
285
305
 
286
306
  # Returns the error count for the communication between Brick and Bricklet.
@@ -295,7 +315,9 @@ module Tinkerforge
295
315
  # The errors counts are for errors that occur on the Bricklet side. All
296
316
  # Bricks have a similar function that returns the errors on the Brick side.
297
317
  def get_spitfp_error_count
298
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
318
+ check_validity
319
+
320
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
299
321
  end
300
322
 
301
323
  # Sets the bootloader mode and returns the status after the requested
@@ -308,12 +330,16 @@ module Tinkerforge
308
330
  # This function is used by Brick Viewer during flashing. It should not be
309
331
  # necessary to call it in a normal user program.
310
332
  def set_bootloader_mode(mode)
311
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
333
+ check_validity
334
+
335
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
312
336
  end
313
337
 
314
338
  # Returns the current bootloader mode, see BrickletLEDStripV2#set_bootloader_mode.
315
339
  def get_bootloader_mode
316
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
340
+ check_validity
341
+
342
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
317
343
  end
318
344
 
319
345
  # Sets the firmware pointer for BrickletLEDStripV2#write_firmware. The pointer has
@@ -323,7 +349,9 @@ module Tinkerforge
323
349
  # This function is used by Brick Viewer during flashing. It should not be
324
350
  # necessary to call it in a normal user program.
325
351
  def set_write_firmware_pointer(pointer)
326
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
352
+ check_validity
353
+
354
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
327
355
  end
328
356
 
329
357
  # Writes 64 Bytes of firmware at the position as written by
@@ -335,7 +363,9 @@ module Tinkerforge
335
363
  # This function is used by Brick Viewer during flashing. It should not be
336
364
  # necessary to call it in a normal user program.
337
365
  def write_firmware(data)
338
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
366
+ check_validity
367
+
368
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
339
369
  end
340
370
 
341
371
  # Sets the status LED configuration. By default the LED shows
@@ -346,22 +376,28 @@ module Tinkerforge
346
376
  #
347
377
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
348
378
  def set_status_led_config(config)
349
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
379
+ check_validity
380
+
381
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
350
382
  end
351
383
 
352
384
  # Returns the configuration as set by BrickletLEDStripV2#set_status_led_config
353
385
  def get_status_led_config
354
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
386
+ check_validity
387
+
388
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
355
389
  end
356
390
 
357
- # Returns the temperature in °C as measured inside the microcontroller. The
391
+ # Returns the temperature as measured inside the microcontroller. The
358
392
  # value returned is not the ambient temperature!
359
393
  #
360
394
  # The temperature is only proportional to the real temperature and it has bad
361
395
  # accuracy. Practically it is only useful as an indicator for
362
396
  # temperature changes.
363
397
  def get_chip_temperature
364
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
398
+ check_validity
399
+
400
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
365
401
  end
366
402
 
367
403
  # Calling this function will reset the Bricklet. All configurations
@@ -371,7 +407,9 @@ module Tinkerforge
371
407
  # calling functions on the existing ones will result in
372
408
  # undefined behavior!
373
409
  def reset
374
- send_request FUNCTION_RESET, [], '', 0, ''
410
+ check_validity
411
+
412
+ send_request FUNCTION_RESET, [], '', 8, ''
375
413
  end
376
414
 
377
415
  # Writes a new UID into flash. If you want to set a new UID
@@ -380,29 +418,35 @@ module Tinkerforge
380
418
  #
381
419
  # We recommend that you use Brick Viewer to change the UID.
382
420
  def write_uid(uid)
383
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
421
+ check_validity
422
+
423
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
384
424
  end
385
425
 
386
426
  # Returns the current UID as an integer. Encode as
387
427
  # Base58 to get the usual string version.
388
428
  def read_uid
389
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
429
+ check_validity
430
+
431
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
390
432
  end
391
433
 
392
434
  # Returns the UID, the UID where the Bricklet is connected to,
393
435
  # the position, the hardware and firmware version as well as the
394
436
  # device identifier.
395
437
  #
396
- # The position can be 'a', 'b', 'c' or 'd'.
438
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
439
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
440
+ # position 'z'.
397
441
  #
398
442
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
399
443
  # |device_identifier_constant|
400
444
  def get_identity
401
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
445
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
402
446
  end
403
447
 
404
448
  # Sets the RGB(W) values for the LEDs starting from *index*.
405
- # You can set at most 2048 RGB values or 1536 RGBW values.
449
+ # You can set at most 2048 RGB values or 1536 RGBW values (6144 byte each).
406
450
  #
407
451
  # To make the colors show correctly you need to configure the chip type
408
452
  # (see BrickletLEDStripV2#set_chip_type) and a channel mapping (see BrickletLEDStripV2#set_channel_mapping)
@@ -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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
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 reflectivity of a surface
14
16
  class BrickletLine < Device
@@ -49,7 +51,7 @@ module Tinkerforge
49
51
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
50
52
  # the IP Connection <tt>ipcon</tt>.
51
53
  def initialize(uid, ipcon)
52
- super uid, ipcon
54
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
53
55
 
54
56
  @api_version = [2, 0, 0]
55
57
 
@@ -62,9 +64,10 @@ module Tinkerforge
62
64
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
65
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
64
66
 
65
- @callback_formats[CALLBACK_REFLECTIVITY] = 'S'
66
- @callback_formats[CALLBACK_REFLECTIVITY_REACHED] = 'S'
67
+ @callback_formats[CALLBACK_REFLECTIVITY] = [10, 'S']
68
+ @callback_formats[CALLBACK_REFLECTIVITY_REACHED] = [10, 'S']
67
69
 
70
+ @ipcon.add_device self
68
71
  end
69
72
 
70
73
  # Returns the currently measured reflectivity. The reflectivity is
@@ -77,7 +80,9 @@ module Tinkerforge
77
80
  # to use the CALLBACK_REFLECTIVITY callback and set the period with
78
81
  # BrickletLine#set_reflectivity_callback_period.
79
82
  def get_reflectivity
80
- send_request FUNCTION_GET_REFLECTIVITY, [], '', 2, 'S'
83
+ check_validity
84
+
85
+ send_request FUNCTION_GET_REFLECTIVITY, [], '', 10, 'S'
81
86
  end
82
87
 
83
88
  # Sets the period with which the CALLBACK_REFLECTIVITY callback is triggered
@@ -86,12 +91,16 @@ module Tinkerforge
86
91
  # The CALLBACK_REFLECTIVITY callback is only triggered if the reflectivity has
87
92
  # changed since the last triggering.
88
93
  def set_reflectivity_callback_period(period)
89
- send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_PERIOD, [period], 'L', 0, ''
94
+ check_validity
95
+
96
+ send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_PERIOD, [period], 'L', 8, ''
90
97
  end
91
98
 
92
99
  # Returns the period as set by BrickletLine#set_reflectivity_callback_period.
93
100
  def get_reflectivity_callback_period
94
- send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_PERIOD, [], '', 4, 'L'
101
+ check_validity
102
+
103
+ send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_PERIOD, [], '', 12, 'L'
95
104
  end
96
105
 
97
106
  # Sets the thresholds for the CALLBACK_REFLECTIVITY_REACHED callback.
@@ -106,12 +115,16 @@ module Tinkerforge
106
115
  # "'<'", "Callback is triggered when the reflectivity is smaller than the min value (max is ignored)"
107
116
  # "'>'", "Callback is triggered when the reflectivity is greater than the min value (max is ignored)"
108
117
  def set_reflectivity_callback_threshold(option, min, max)
109
- send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
118
+ check_validity
119
+
120
+ send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
110
121
  end
111
122
 
112
123
  # Returns the threshold as set by BrickletLine#set_reflectivity_callback_threshold.
113
124
  def get_reflectivity_callback_threshold
114
- send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
115
128
  end
116
129
 
117
130
  # Sets the period with which the threshold callback
@@ -124,24 +137,30 @@ module Tinkerforge
124
137
  #
125
138
  # keeps being reached.
126
139
  def set_debounce_period(debounce)
127
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
140
+ check_validity
141
+
142
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
128
143
  end
129
144
 
130
145
  # Returns the debounce period as set by BrickletLine#set_debounce_period.
131
146
  def get_debounce_period
132
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
147
+ check_validity
148
+
149
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
133
150
  end
134
151
 
135
152
  # Returns the UID, the UID where the Bricklet is connected to,
136
153
  # the position, the hardware and firmware version as well as the
137
154
  # device identifier.
138
155
  #
139
- # The position can be 'a', 'b', 'c' or 'd'.
156
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
157
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
158
+ # position 'z'.
140
159
  #
141
160
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
142
161
  # |device_identifier_constant|
143
162
  def get_identity
144
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
163
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
145
164
  end
146
165
 
147
166
  # 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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
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
  # 59mm linear potentiometer
14
16
  class BrickletLinearPoti < 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_POSITION] = 'S'
92
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
93
- @callback_formats[CALLBACK_POSITION_REACHED] = 'S'
94
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
93
+ @callback_formats[CALLBACK_POSITION] = [10, 'S']
94
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
95
+ @callback_formats[CALLBACK_POSITION_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 position of the linear potentiometer. The value is
@@ -102,7 +105,9 @@ module Tinkerforge
102
105
  # CALLBACK_POSITION callback and set the period with
103
106
  # BrickletLinearPoti#set_position_callback_period.
104
107
  def get_position
105
- send_request FUNCTION_GET_POSITION, [], '', 2, 'S'
108
+ check_validity
109
+
110
+ send_request FUNCTION_GET_POSITION, [], '', 10, 'S'
106
111
  end
107
112
 
108
113
  # Returns the value as read by a 12-bit analog-to-digital converter.
@@ -117,7 +122,9 @@ module Tinkerforge
117
122
  # CALLBACK_ANALOG_VALUE callback and set the period with
118
123
  # BrickletLinearPoti#set_analog_value_callback_period.
119
124
  def get_analog_value
120
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
121
128
  end
122
129
 
123
130
  # Sets the period with which the CALLBACK_POSITION callback is triggered
@@ -126,12 +133,16 @@ module Tinkerforge
126
133
  # The CALLBACK_POSITION callback is only triggered if the position has changed
127
134
  # since the last triggering.
128
135
  def set_position_callback_period(period)
129
- send_request FUNCTION_SET_POSITION_CALLBACK_PERIOD, [period], 'L', 0, ''
136
+ check_validity
137
+
138
+ send_request FUNCTION_SET_POSITION_CALLBACK_PERIOD, [period], 'L', 8, ''
130
139
  end
131
140
 
132
141
  # Returns the period as set by BrickletLinearPoti#set_position_callback_period.
133
142
  def get_position_callback_period
134
- send_request FUNCTION_GET_POSITION_CALLBACK_PERIOD, [], '', 4, 'L'
143
+ check_validity
144
+
145
+ send_request FUNCTION_GET_POSITION_CALLBACK_PERIOD, [], '', 12, 'L'
135
146
  end
136
147
 
137
148
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -140,12 +151,16 @@ module Tinkerforge
140
151
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
141
152
  # changed since the last triggering.
142
153
  def set_analog_value_callback_period(period)
143
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
154
+ check_validity
155
+
156
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
144
157
  end
145
158
 
146
159
  # Returns the period as set by BrickletLinearPoti#set_analog_value_callback_period.
147
160
  def get_analog_value_callback_period
148
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
161
+ check_validity
162
+
163
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
149
164
  end
150
165
 
151
166
  # Sets the thresholds for the CALLBACK_POSITION_REACHED callback.
@@ -160,12 +175,16 @@ module Tinkerforge
160
175
  # "'<'", "Callback is triggered when the position is smaller than the min value (max is ignored)"
161
176
  # "'>'", "Callback is triggered when the position is greater than the min value (max is ignored)"
162
177
  def set_position_callback_threshold(option, min, max)
163
- send_request FUNCTION_SET_POSITION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
178
+ check_validity
179
+
180
+ send_request FUNCTION_SET_POSITION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
164
181
  end
165
182
 
166
183
  # Returns the threshold as set by BrickletLinearPoti#set_position_callback_threshold.
167
184
  def get_position_callback_threshold
168
- send_request FUNCTION_GET_POSITION_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
185
+ check_validity
186
+
187
+ send_request FUNCTION_GET_POSITION_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
169
188
  end
170
189
 
171
190
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -180,12 +199,16 @@ module Tinkerforge
180
199
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
181
200
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
182
201
  def set_analog_value_callback_threshold(option, min, max)
183
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
202
+ check_validity
203
+
204
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
184
205
  end
185
206
 
186
207
  # Returns the threshold as set by BrickletLinearPoti#set_analog_value_callback_threshold.
187
208
  def get_analog_value_callback_threshold
188
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
209
+ check_validity
210
+
211
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
189
212
  end
190
213
 
191
214
  # Sets the period with which the threshold callbacks
@@ -200,24 +223,30 @@ module Tinkerforge
200
223
  #
201
224
  # keep being reached.
202
225
  def set_debounce_period(debounce)
203
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
226
+ check_validity
227
+
228
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
204
229
  end
205
230
 
206
231
  # Returns the debounce period as set by BrickletLinearPoti#set_debounce_period.
207
232
  def get_debounce_period
208
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
233
+ check_validity
234
+
235
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
209
236
  end
210
237
 
211
238
  # Returns the UID, the UID where the Bricklet is connected to,
212
239
  # the position, the hardware and firmware version as well as the
213
240
  # device identifier.
214
241
  #
215
- # The position can be 'a', 'b', 'c' or 'd'.
242
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
243
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
244
+ # position 'z'.
216
245
  #
217
246
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
218
247
  # |device_identifier_constant|
219
248
  def get_identity
220
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
249
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
221
250
  end
222
251
 
223
252
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.