tinkerforge 2.1.22 → 2.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # DMX master and slave
14
16
  class BrickletDMX < Device
@@ -37,15 +39,7 @@ module Tinkerforge
37
39
  # This callback can only be triggered in slave mode.
38
40
  CALLBACK_FRAME_AVAILABLE = 15
39
41
 
40
- # This callback is called as soon as a new frame is available
41
- # (written by the DMX master).
42
- #
43
- # The size of the array is equivalent to the number of channels in
44
- # the frame. Each byte represents one channel.
45
- #
46
- # This callback can be enabled via BrickletDMX#set_frame_callback_config.
47
- #
48
- # This callback can only be triggered in slave mode.
42
+ # See CALLBACK_FRAME
49
43
  CALLBACK_FRAME_LOW_LEVEL = 16
50
44
 
51
45
  # This callback is called if a new error occurs. It returns
@@ -61,6 +55,9 @@ module Tinkerforge
61
55
  # This callback can be enabled via BrickletDMX#set_frame_callback_config.
62
56
  #
63
57
  # This callback can only be triggered in slave mode.
58
+ #
59
+ # .. note::
60
+ # If reconstructing the value fails, the callback is triggered with nil for frame.
64
61
  CALLBACK_FRAME = -16
65
62
 
66
63
  FUNCTION_SET_DMX_MODE = 1 # :nodoc:
@@ -118,7 +115,7 @@ module Tinkerforge
118
115
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
119
116
  # the IP Connection <tt>ipcon</tt>.
120
117
  def initialize(uid, ipcon)
121
- super uid, ipcon
118
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
122
119
 
123
120
  @api_version = [2, 0, 0]
124
121
 
@@ -148,26 +145,29 @@ module Tinkerforge
148
145
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
149
146
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
150
147
 
151
- @callback_formats[CALLBACK_FRAME_STARTED] = ''
152
- @callback_formats[CALLBACK_FRAME_AVAILABLE] = 'L'
153
- @callback_formats[CALLBACK_FRAME_LOW_LEVEL] = 'S S C56 L'
154
- @callback_formats[CALLBACK_FRAME_ERROR_COUNT] = 'L L'
148
+ @callback_formats[CALLBACK_FRAME_STARTED] = [8, '']
149
+ @callback_formats[CALLBACK_FRAME_AVAILABLE] = [12, 'L']
150
+ @callback_formats[CALLBACK_FRAME_LOW_LEVEL] = [72, 'S S C56 L']
151
+ @callback_formats[CALLBACK_FRAME_ERROR_COUNT] = [16, 'L L']
155
152
 
156
153
  @high_level_callbacks[CALLBACK_FRAME] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data', nil], {'fixed_length' => nil, 'single_chunk' => false}, nil]
154
+ @ipcon.add_device self
157
155
  end
158
156
 
159
157
  # Sets the DMX mode to either master or slave.
160
158
  #
161
159
  # Calling this function sets frame number to 0.
162
- #
163
- # The default value is 0 (master).
164
160
  def set_dmx_mode(dmx_mode)
165
- send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 0, ''
161
+ check_validity
162
+
163
+ send_request FUNCTION_SET_DMX_MODE, [dmx_mode], 'C', 8, ''
166
164
  end
167
165
 
168
166
  # Returns the DMX mode, as set by BrickletDMX#set_dmx_mode.
169
167
  def get_dmx_mode
170
- send_request FUNCTION_GET_DMX_MODE, [], '', 1, 'C'
168
+ check_validity
169
+
170
+ send_request FUNCTION_GET_DMX_MODE, [], '', 9, 'C'
171
171
  end
172
172
 
173
173
  # Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
@@ -191,7 +191,9 @@ module Tinkerforge
191
191
  #
192
192
  # This function can only be called in master mode.
193
193
  def write_frame_low_level(frame_length, frame_chunk_offset, frame_chunk_data)
194
- send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_length, frame_chunk_offset, frame_chunk_data], 'S S C60', 0, ''
194
+ check_validity
195
+
196
+ send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_length, frame_chunk_offset, frame_chunk_data], 'S S C60', 8, ''
195
197
  end
196
198
 
197
199
  # Returns the last frame that was written by the DMX master. The size of the array
@@ -214,10 +216,12 @@ module Tinkerforge
214
216
  #
215
217
  # This function can only be called in slave mode.
216
218
  def read_frame_low_level
217
- send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 64, 'S S C56 L'
219
+ check_validity
220
+
221
+ send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 72, 'S S C56 L'
218
222
  end
219
223
 
220
- # Sets the duration of a frame in ms.
224
+ # Sets the duration of a frame.
221
225
  #
222
226
  # Example: If you want to achieve 20 frames per second, you should
223
227
  # set the frame duration to 50ms (50ms * 20 = 1 second).
@@ -226,20 +230,24 @@ module Tinkerforge
226
230
  # this value to 0.
227
231
  #
228
232
  # This setting is only used in master mode.
229
- #
230
- # Default value: 100ms (10 frames per second).
231
233
  def set_frame_duration(frame_duration)
232
- send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 8, ''
233
237
  end
234
238
 
235
239
  # Returns the frame duration as set by BrickletDMX#set_frame_duration.
236
240
  def get_frame_duration
237
- send_request FUNCTION_GET_FRAME_DURATION, [], '', 2, 'S'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
238
244
  end
239
245
 
240
246
  # Returns the current number of overrun and framing errors.
241
247
  def get_frame_error_count
242
- send_request FUNCTION_GET_FRAME_ERROR_COUNT, [], '', 8, 'L L'
248
+ check_validity
249
+
250
+ send_request FUNCTION_GET_FRAME_ERROR_COUNT, [], '', 16, 'L L'
243
251
  end
244
252
 
245
253
  # Sets the communication LED configuration. By default the LED shows
@@ -249,12 +257,16 @@ module Tinkerforge
249
257
  #
250
258
  # If the Bricklet is in bootloader mode, the LED is off.
251
259
  def set_communication_led_config(config)
252
- send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 0, ''
260
+ check_validity
261
+
262
+ send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 8, ''
253
263
  end
254
264
 
255
265
  # Returns the configuration as set by BrickletDMX#set_communication_led_config
256
266
  def get_communication_led_config
257
- send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
267
+ check_validity
268
+
269
+ send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
258
270
  end
259
271
 
260
272
  # Sets the error LED configuration.
@@ -267,12 +279,16 @@ module Tinkerforge
267
279
  #
268
280
  # If the Bricklet is in bootloader mode, the LED is off.
269
281
  def set_error_led_config(config)
270
- send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 0, ''
282
+ check_validity
283
+
284
+ send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 8, ''
271
285
  end
272
286
 
273
287
  # Returns the configuration as set by BrickletDMX#set_error_led_config.
274
288
  def get_error_led_config
275
- send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 1, 'C'
289
+ check_validity
290
+
291
+ send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 9, 'C'
276
292
  end
277
293
 
278
294
  # Enables/Disables the different callbacks. By default the
@@ -283,12 +299,16 @@ module Tinkerforge
283
299
  # the cb:`Frame Available` callback at the same time. It becomes redundant in
284
300
  # this case.
285
301
  def set_frame_callback_config(frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled)
286
- send_request FUNCTION_SET_FRAME_CALLBACK_CONFIG, [frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled], '? ? ? ?', 0, ''
302
+ check_validity
303
+
304
+ send_request FUNCTION_SET_FRAME_CALLBACK_CONFIG, [frame_started_callback_enabled, frame_available_callback_enabled, frame_callback_enabled, frame_error_count_callback_enabled], '? ? ? ?', 8, ''
287
305
  end
288
306
 
289
307
  # Returns the frame callback config as set by BrickletDMX#set_frame_callback_config.
290
308
  def get_frame_callback_config
291
- send_request FUNCTION_GET_FRAME_CALLBACK_CONFIG, [], '', 4, '? ? ? ?'
309
+ check_validity
310
+
311
+ send_request FUNCTION_GET_FRAME_CALLBACK_CONFIG, [], '', 12, '? ? ? ?'
292
312
  end
293
313
 
294
314
  # Returns the error count for the communication between Brick and Bricklet.
@@ -303,7 +323,9 @@ module Tinkerforge
303
323
  # The errors counts are for errors that occur on the Bricklet side. All
304
324
  # Bricks have a similar function that returns the errors on the Brick side.
305
325
  def get_spitfp_error_count
306
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
326
+ check_validity
327
+
328
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
307
329
  end
308
330
 
309
331
  # Sets the bootloader mode and returns the status after the requested
@@ -316,12 +338,16 @@ module Tinkerforge
316
338
  # This function is used by Brick Viewer during flashing. It should not be
317
339
  # necessary to call it in a normal user program.
318
340
  def set_bootloader_mode(mode)
319
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
341
+ check_validity
342
+
343
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
320
344
  end
321
345
 
322
346
  # Returns the current bootloader mode, see BrickletDMX#set_bootloader_mode.
323
347
  def get_bootloader_mode
324
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
348
+ check_validity
349
+
350
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
325
351
  end
326
352
 
327
353
  # Sets the firmware pointer for BrickletDMX#write_firmware. The pointer has
@@ -331,7 +357,9 @@ module Tinkerforge
331
357
  # This function is used by Brick Viewer during flashing. It should not be
332
358
  # necessary to call it in a normal user program.
333
359
  def set_write_firmware_pointer(pointer)
334
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
360
+ check_validity
361
+
362
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
335
363
  end
336
364
 
337
365
  # Writes 64 Bytes of firmware at the position as written by
@@ -343,7 +371,9 @@ module Tinkerforge
343
371
  # This function is used by Brick Viewer during flashing. It should not be
344
372
  # necessary to call it in a normal user program.
345
373
  def write_firmware(data)
346
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
374
+ check_validity
375
+
376
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
347
377
  end
348
378
 
349
379
  # Sets the status LED configuration. By default the LED shows
@@ -354,22 +384,28 @@ module Tinkerforge
354
384
  #
355
385
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
356
386
  def set_status_led_config(config)
357
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
387
+ check_validity
388
+
389
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
358
390
  end
359
391
 
360
392
  # Returns the configuration as set by BrickletDMX#set_status_led_config
361
393
  def get_status_led_config
362
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
394
+ check_validity
395
+
396
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
363
397
  end
364
398
 
365
- # Returns the temperature in °C as measured inside the microcontroller. The
399
+ # Returns the temperature as measured inside the microcontroller. The
366
400
  # value returned is not the ambient temperature!
367
401
  #
368
402
  # The temperature is only proportional to the real temperature and it has bad
369
403
  # accuracy. Practically it is only useful as an indicator for
370
404
  # temperature changes.
371
405
  def get_chip_temperature
372
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
406
+ check_validity
407
+
408
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
373
409
  end
374
410
 
375
411
  # Calling this function will reset the Bricklet. All configurations
@@ -379,7 +415,9 @@ module Tinkerforge
379
415
  # calling functions on the existing ones will result in
380
416
  # undefined behavior!
381
417
  def reset
382
- send_request FUNCTION_RESET, [], '', 0, ''
418
+ check_validity
419
+
420
+ send_request FUNCTION_RESET, [], '', 8, ''
383
421
  end
384
422
 
385
423
  # Writes a new UID into flash. If you want to set a new UID
@@ -388,25 +426,31 @@ module Tinkerforge
388
426
  #
389
427
  # We recommend that you use Brick Viewer to change the UID.
390
428
  def write_uid(uid)
391
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
429
+ check_validity
430
+
431
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
392
432
  end
393
433
 
394
434
  # Returns the current UID as an integer. Encode as
395
435
  # Base58 to get the usual string version.
396
436
  def read_uid
397
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
437
+ check_validity
438
+
439
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
398
440
  end
399
441
 
400
442
  # Returns the UID, the UID where the Bricklet is connected to,
401
443
  # the position, the hardware and firmware version as well as the
402
444
  # device identifier.
403
445
  #
404
- # The position can be 'a', 'b', 'c' or 'd'.
446
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
447
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
448
+ # position 'z'.
405
449
  #
406
450
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
407
451
  # |device_identifier_constant|
408
452
  def get_identity
409
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
453
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
410
454
  end
411
455
 
412
456
  # Writes a DMX frame. The maximum frame size is 512 byte. Each byte represents one channel.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Two tactile buttons with built-in blue LEDs
14
16
  class BrickletDualButton < Device
@@ -48,7 +50,7 @@ module Tinkerforge
48
50
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
49
51
  # the IP Connection <tt>ipcon</tt>.
50
52
  def initialize(uid, ipcon)
51
- super uid, ipcon
53
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
52
54
 
53
55
  @api_version = [2, 0, 0]
54
56
 
@@ -58,8 +60,9 @@ module Tinkerforge
58
60
  @response_expected[FUNCTION_SET_SELECTED_LED_STATE] = RESPONSE_EXPECTED_FALSE
59
61
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
60
62
 
61
- @callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
63
+ @callback_formats[CALLBACK_STATE_CHANGED] = [12, 'C C C C']
62
64
 
65
+ @ipcon.add_device self
63
66
  end
64
67
 
65
68
  # Sets the state of the LEDs. Possible states are:
@@ -74,15 +77,17 @@ module Tinkerforge
74
77
  # If you just want to set one of the LEDs and don't know the current state
75
78
  # of the other LED, you can get the state with BrickletDualButton#get_led_state or you
76
79
  # can use BrickletDualButton#set_selected_led_state.
77
- #
78
- # The default value is (1, 1).
79
80
  def set_led_state(led_l, led_r)
80
- send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 0, ''
81
+ check_validity
82
+
83
+ send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 8, ''
81
84
  end
82
85
 
83
86
  # Returns the current state of the LEDs, as set by BrickletDualButton#set_led_state.
84
87
  def get_led_state
85
- send_request FUNCTION_GET_LED_STATE, [], '', 2, 'C C'
88
+ check_validity
89
+
90
+ send_request FUNCTION_GET_LED_STATE, [], '', 10, 'C C'
86
91
  end
87
92
 
88
93
  # Returns the current state for both buttons. Possible states are:
@@ -90,26 +95,32 @@ module Tinkerforge
90
95
  # * 0 = pressed
91
96
  # * 1 = released
92
97
  def get_button_state
93
- send_request FUNCTION_GET_BUTTON_STATE, [], '', 2, 'C C'
98
+ check_validity
99
+
100
+ send_request FUNCTION_GET_BUTTON_STATE, [], '', 10, 'C C'
94
101
  end
95
102
 
96
103
  # Sets the state of the selected LED (0 or 1).
97
104
  #
98
105
  # The other LED remains untouched.
99
106
  def set_selected_led_state(led, state)
100
- send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 0, ''
107
+ check_validity
108
+
109
+ send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 8, ''
101
110
  end
102
111
 
103
112
  # Returns the UID, the UID where the Bricklet is connected to,
104
113
  # the position, the hardware and firmware version as well as the
105
114
  # device identifier.
106
115
  #
107
- # The position can be 'a', 'b', 'c' or 'd'.
116
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
117
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
118
+ # position 'z'.
108
119
  #
109
120
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
110
121
  # |device_identifier_constant|
111
122
  def get_identity
112
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
123
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
113
124
  end
114
125
 
115
126
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Two tactile buttons with built-in blue LEDs
14
16
  class BrickletDualButtonV2 < Device
@@ -78,7 +80,7 @@ module Tinkerforge
78
80
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
79
81
  # the IP Connection <tt>ipcon</tt>.
80
82
  def initialize(uid, ipcon)
81
- super uid, ipcon
83
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
82
84
 
83
85
  @api_version = [2, 0, 0]
84
86
 
@@ -101,8 +103,9 @@ module Tinkerforge
101
103
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
102
104
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
105
 
104
- @callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
106
+ @callback_formats[CALLBACK_STATE_CHANGED] = [12, 'C C C C']
105
107
 
108
+ @ipcon.add_device self
106
109
  end
107
110
 
108
111
  # Sets the state of the LEDs. Possible states are:
@@ -117,15 +120,17 @@ module Tinkerforge
117
120
  # If you just want to set one of the LEDs and don't know the current state
118
121
  # of the other LED, you can get the state with BrickletDualButtonV2#get_led_state or you
119
122
  # can use BrickletDualButtonV2#set_selected_led_state.
120
- #
121
- # The default value is (1, 1).
122
123
  def set_led_state(led_l, led_r)
123
- send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 0, ''
124
+ check_validity
125
+
126
+ send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 8, ''
124
127
  end
125
128
 
126
129
  # Returns the current state of the LEDs, as set by BrickletDualButtonV2#set_led_state.
127
130
  def get_led_state
128
- send_request FUNCTION_GET_LED_STATE, [], '', 2, 'C C'
131
+ check_validity
132
+
133
+ send_request FUNCTION_GET_LED_STATE, [], '', 10, 'C C'
129
134
  end
130
135
 
131
136
  # Returns the current state for both buttons. Possible states are:
@@ -133,27 +138,33 @@ module Tinkerforge
133
138
  # * 0 = pressed
134
139
  # * 1 = released
135
140
  def get_button_state
136
- send_request FUNCTION_GET_BUTTON_STATE, [], '', 2, 'C C'
141
+ check_validity
142
+
143
+ send_request FUNCTION_GET_BUTTON_STATE, [], '', 10, 'C C'
137
144
  end
138
145
 
139
- # Sets the state of the selected LED (0 or 1).
146
+ # Sets the state of the selected LED.
140
147
  #
141
148
  # The other LED remains untouched.
142
149
  def set_selected_led_state(led, state)
143
- send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 0, ''
150
+ check_validity
151
+
152
+ send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 8, ''
144
153
  end
145
154
 
146
155
  # If you enable this callback, the CALLBACK_STATE_CHANGED callback is triggered
147
156
  # every time a button is pressed/released
148
- #
149
- # By default this callback is disabled.
150
157
  def set_state_changed_callback_configuration(enabled)
151
- send_request FUNCTION_SET_STATE_CHANGED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
158
+ check_validity
159
+
160
+ send_request FUNCTION_SET_STATE_CHANGED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
152
161
  end
153
162
 
154
163
  # Returns the configuration as set by BrickletDualButtonV2#set_state_changed_callback_configuration.
155
164
  def get_state_changed_callback_configuration
156
- send_request FUNCTION_GET_STATE_CHANGED_CALLBACK_CONFIGURATION, [], '', 1, '?'
165
+ check_validity
166
+
167
+ send_request FUNCTION_GET_STATE_CHANGED_CALLBACK_CONFIGURATION, [], '', 9, '?'
157
168
  end
158
169
 
159
170
  # Returns the error count for the communication between Brick and Bricklet.
@@ -168,7 +179,9 @@ module Tinkerforge
168
179
  # The errors counts are for errors that occur on the Bricklet side. All
169
180
  # Bricks have a similar function that returns the errors on the Brick side.
170
181
  def get_spitfp_error_count
171
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
182
+ check_validity
183
+
184
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
172
185
  end
173
186
 
174
187
  # Sets the bootloader mode and returns the status after the requested
@@ -181,12 +194,16 @@ module Tinkerforge
181
194
  # This function is used by Brick Viewer during flashing. It should not be
182
195
  # necessary to call it in a normal user program.
183
196
  def set_bootloader_mode(mode)
184
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
197
+ check_validity
198
+
199
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
185
200
  end
186
201
 
187
202
  # Returns the current bootloader mode, see BrickletDualButtonV2#set_bootloader_mode.
188
203
  def get_bootloader_mode
189
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
204
+ check_validity
205
+
206
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
190
207
  end
191
208
 
192
209
  # Sets the firmware pointer for BrickletDualButtonV2#write_firmware. The pointer has
@@ -196,7 +213,9 @@ module Tinkerforge
196
213
  # This function is used by Brick Viewer during flashing. It should not be
197
214
  # necessary to call it in a normal user program.
198
215
  def set_write_firmware_pointer(pointer)
199
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
216
+ check_validity
217
+
218
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
200
219
  end
201
220
 
202
221
  # Writes 64 Bytes of firmware at the position as written by
@@ -208,7 +227,9 @@ module Tinkerforge
208
227
  # This function is used by Brick Viewer during flashing. It should not be
209
228
  # necessary to call it in a normal user program.
210
229
  def write_firmware(data)
211
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
230
+ check_validity
231
+
232
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
212
233
  end
213
234
 
214
235
  # Sets the status LED configuration. By default the LED shows
@@ -219,22 +240,28 @@ module Tinkerforge
219
240
  #
220
241
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
221
242
  def set_status_led_config(config)
222
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
243
+ check_validity
244
+
245
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
223
246
  end
224
247
 
225
248
  # Returns the configuration as set by BrickletDualButtonV2#set_status_led_config
226
249
  def get_status_led_config
227
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
250
+ check_validity
251
+
252
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
228
253
  end
229
254
 
230
- # Returns the temperature in °C as measured inside the microcontroller. The
255
+ # Returns the temperature as measured inside the microcontroller. The
231
256
  # value returned is not the ambient temperature!
232
257
  #
233
258
  # The temperature is only proportional to the real temperature and it has bad
234
259
  # accuracy. Practically it is only useful as an indicator for
235
260
  # temperature changes.
236
261
  def get_chip_temperature
237
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
262
+ check_validity
263
+
264
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
238
265
  end
239
266
 
240
267
  # Calling this function will reset the Bricklet. All configurations
@@ -244,7 +271,9 @@ module Tinkerforge
244
271
  # calling functions on the existing ones will result in
245
272
  # undefined behavior!
246
273
  def reset
247
- send_request FUNCTION_RESET, [], '', 0, ''
274
+ check_validity
275
+
276
+ send_request FUNCTION_RESET, [], '', 8, ''
248
277
  end
249
278
 
250
279
  # Writes a new UID into flash. If you want to set a new UID
@@ -253,25 +282,31 @@ module Tinkerforge
253
282
  #
254
283
  # We recommend that you use Brick Viewer to change the UID.
255
284
  def write_uid(uid)
256
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
285
+ check_validity
286
+
287
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
257
288
  end
258
289
 
259
290
  # Returns the current UID as an integer. Encode as
260
291
  # Base58 to get the usual string version.
261
292
  def read_uid
262
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
293
+ check_validity
294
+
295
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
263
296
  end
264
297
 
265
298
  # Returns the UID, the UID where the Bricklet is connected to,
266
299
  # the position, the hardware and firmware version as well as the
267
300
  # device identifier.
268
301
  #
269
- # The position can be 'a', 'b', 'c' or 'd'.
302
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
303
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
304
+ # position 'z'.
270
305
  #
271
306
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
272
307
  # |device_identifier_constant|
273
308
  def get_identity
274
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
309
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
275
310
  end
276
311
 
277
312
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.