tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
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
  # 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,36 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
440
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
441
+ # position 'z'.
397
442
  #
398
443
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
399
444
  # |device_identifier_constant|
400
445
  def get_identity
401
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
446
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
402
447
  end
403
448
 
404
449
  # Sets the RGB(W) values for the LEDs starting from *index*.
405
- # You can set at most 2048 RGB values or 1536 RGBW values.
450
+ # You can set at most 2048 RGB values or 1536 RGBW values (6144 byte each).
406
451
  #
407
452
  # To make the colors show correctly you need to configure the chip type
408
453
  # (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 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 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,31 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
158
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
159
+ # position 'z'.
140
160
  #
141
161
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
142
162
  # |device_identifier_constant|
143
163
  def get_identity
144
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
164
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
145
165
  end
146
166
 
147
167
  # 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
  # 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,31 @@ 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
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
244
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
245
+ # position 'z'.
216
246
  #
217
247
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
218
248
  # |device_identifier_constant|
219
249
  def get_identity
220
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
250
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
221
251
  end
222
252
 
223
253
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.