tinkerforge 2.1.24 → 2.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 4-channel digital input/output
14
16
  class BrickletIO4V2 < Device
@@ -89,7 +91,7 @@ module Tinkerforge
89
91
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
90
92
  # the IP Connection <tt>ipcon</tt>.
91
93
  def initialize(uid, ipcon)
92
- super uid, ipcon
94
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
93
95
 
94
96
  @api_version = [2, 0, 0]
95
97
 
@@ -122,10 +124,11 @@ module Tinkerforge
122
124
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
123
125
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
126
 
125
- @callback_formats[CALLBACK_INPUT_VALUE] = 'C ? ?'
126
- @callback_formats[CALLBACK_ALL_INPUT_VALUE] = '?4 ?4'
127
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
127
+ @callback_formats[CALLBACK_INPUT_VALUE] = [11, 'C ? ?']
128
+ @callback_formats[CALLBACK_ALL_INPUT_VALUE] = [10, '?4 ?4']
129
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
128
130
 
131
+ @ipcon.add_device self
129
132
  end
130
133
 
131
134
  # Sets the output value of all four channels. A value of *true* or *false* outputs
@@ -142,14 +145,18 @@ module Tinkerforge
142
145
  # This function does nothing for channels that are configured as input. Pull-up
143
146
  # resistors can be switched on with BrickletIO4V2#set_configuration.
144
147
  def set_value(value)
145
- send_request FUNCTION_SET_VALUE, [value], '?4', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_VALUE, [value], '?4', 8, ''
146
151
  end
147
152
 
148
153
  # Returns the logic levels that are currently measured on the channels.
149
154
  # This function works if the channel is configured as input as well as if it is
150
155
  # configured as output.
151
156
  def get_value
152
- send_request FUNCTION_GET_VALUE, [], '', 4, '?4'
157
+ check_validity
158
+
159
+ send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
153
160
  end
154
161
 
155
162
  # Sets the output value of a specific channel without affecting the other channels.
@@ -161,7 +168,9 @@ module Tinkerforge
161
168
  # This function does nothing for channels that are configured as input. Pull-up
162
169
  # resistors can be switched on with BrickletIO4V2#set_configuration.
163
170
  def set_selected_value(channel, value)
164
- send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
171
+ check_validity
172
+
173
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
165
174
  end
166
175
 
167
176
  # Configures the value and direction of a specific channel. Possible directions
@@ -183,12 +192,16 @@ module Tinkerforge
183
192
  # A running monoflop timer or PWM for the specific channel will be aborted if this
184
193
  # function is called.
185
194
  def set_configuration(channel, direction, value)
186
- send_request FUNCTION_SET_CONFIGURATION, [channel, direction, value], 'C k ?', 0, ''
195
+ check_validity
196
+
197
+ send_request FUNCTION_SET_CONFIGURATION, [channel, direction, value], 'C k ?', 8, ''
187
198
  end
188
199
 
189
200
  # Returns the channel configuration as set by BrickletIO4V2#set_configuration.
190
201
  def get_configuration(channel)
191
- send_request FUNCTION_GET_CONFIGURATION, [channel], 'C', 2, 'k ?'
202
+ check_validity
203
+
204
+ send_request FUNCTION_GET_CONFIGURATION, [channel], 'C', 10, 'k ?'
192
205
  end
193
206
 
194
207
  # This callback can be configured per channel.
@@ -203,13 +216,17 @@ module Tinkerforge
203
216
  # If it is set to false, the callback is continuously triggered with the period,
204
217
  # independent of the value.
205
218
  def set_input_value_callback_configuration(channel, period, value_has_to_change)
206
- send_request FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 0, ''
219
+ check_validity
220
+
221
+ send_request FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 8, ''
207
222
  end
208
223
 
209
224
  # Returns the callback configuration for the given channel as set by
210
225
  # BrickletIO4V2#set_input_value_callback_configuration.
211
226
  def get_input_value_callback_configuration(channel)
212
- send_request FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 5, 'L ?'
227
+ check_validity
228
+
229
+ send_request FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 13, 'L ?'
213
230
  end
214
231
 
215
232
  # The period is the period with which the CALLBACK_ALL_INPUT_VALUE
@@ -222,13 +239,17 @@ module Tinkerforge
222
239
  # If it is set to false, the callback is continuously triggered with the period,
223
240
  # independent of the value.
224
241
  def set_all_input_value_callback_configuration(period, value_has_to_change)
225
- send_request FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
242
+ check_validity
243
+
244
+ send_request FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
226
245
  end
227
246
 
228
247
  # Returns the callback configuration as set by
229
248
  # BrickletIO4V2#set_all_input_value_callback_configuration.
230
249
  def get_all_input_value_callback_configuration
231
- send_request FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
250
+ check_validity
251
+
252
+ send_request FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
232
253
  end
233
254
 
234
255
  # The first parameter is the desired state of the channel (*true* means output *high*
@@ -246,7 +267,9 @@ module Tinkerforge
246
267
  # of two seconds. The channel will be *high* all the time. If now the RS485
247
268
  # connection is lost, the channel will turn *low* in at most two seconds.
248
269
  def set_monoflop(channel, value, time)
249
- send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
270
+ check_validity
271
+
272
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
250
273
  end
251
274
 
252
275
  # Returns (for the given channel) the current value and the time as set by
@@ -255,7 +278,9 @@ module Tinkerforge
255
278
  # If the timer is not running currently, the remaining time will be returned
256
279
  # as 0.
257
280
  def get_monoflop(channel)
258
- send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
281
+ check_validity
282
+
283
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
259
284
  end
260
285
 
261
286
  # Returns the current value of the edge counter for the selected channel. You can
@@ -267,7 +292,9 @@ module Tinkerforge
267
292
  # .. note::
268
293
  # Calling this function is only allowed for channels configured as input.
269
294
  def get_edge_count(channel, reset_counter)
270
- send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 4, 'L'
295
+ check_validity
296
+
297
+ send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 12, 'L'
271
298
  end
272
299
 
273
300
  # Configures the edge counter for a specific channel.
@@ -287,7 +314,9 @@ module Tinkerforge
287
314
  # .. note::
288
315
  # Calling this function is only allowed for channels configured as input.
289
316
  def set_edge_count_configuration(channel, edge_type, debounce)
290
- send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 0, ''
317
+ check_validity
318
+
319
+ send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 8, ''
291
320
  end
292
321
 
293
322
  # Returns the edge type and debounce time for the selected channel as set by
@@ -296,7 +325,9 @@ module Tinkerforge
296
325
  # .. note::
297
326
  # Calling this function is only allowed for channels configured as input.
298
327
  def get_edge_count_configuration(channel)
299
- send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 2, 'C C'
328
+ check_validity
329
+
330
+ send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 10, 'C C'
300
331
  end
301
332
 
302
333
  # Activates a PWM for the given channel.
@@ -308,12 +339,16 @@ module Tinkerforge
308
339
  # A running monoflop timer for the given channel will be aborted if this function
309
340
  # is called.
310
341
  def set_pwm_configuration(channel, frequency, duty_cycle)
311
- send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 0, ''
342
+ check_validity
343
+
344
+ send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 8, ''
312
345
  end
313
346
 
314
347
  # Returns the PWM configuration as set by BrickletIO4V2#set_pwm_configuration.
315
348
  def get_pwm_configuration(channel)
316
- send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 6, 'L S'
349
+ check_validity
350
+
351
+ send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 14, 'L S'
317
352
  end
318
353
 
319
354
  # Returns the error count for the communication between Brick and Bricklet.
@@ -328,7 +363,9 @@ module Tinkerforge
328
363
  # The errors counts are for errors that occur on the Bricklet side. All
329
364
  # Bricks have a similar function that returns the errors on the Brick side.
330
365
  def get_spitfp_error_count
331
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
366
+ check_validity
367
+
368
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
332
369
  end
333
370
 
334
371
  # Sets the bootloader mode and returns the status after the requested
@@ -341,12 +378,16 @@ module Tinkerforge
341
378
  # This function is used by Brick Viewer during flashing. It should not be
342
379
  # necessary to call it in a normal user program.
343
380
  def set_bootloader_mode(mode)
344
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
381
+ check_validity
382
+
383
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
345
384
  end
346
385
 
347
386
  # Returns the current bootloader mode, see BrickletIO4V2#set_bootloader_mode.
348
387
  def get_bootloader_mode
349
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
388
+ check_validity
389
+
390
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
350
391
  end
351
392
 
352
393
  # Sets the firmware pointer for BrickletIO4V2#write_firmware. The pointer has
@@ -356,7 +397,9 @@ module Tinkerforge
356
397
  # This function is used by Brick Viewer during flashing. It should not be
357
398
  # necessary to call it in a normal user program.
358
399
  def set_write_firmware_pointer(pointer)
359
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
400
+ check_validity
401
+
402
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
360
403
  end
361
404
 
362
405
  # Writes 64 Bytes of firmware at the position as written by
@@ -368,7 +411,9 @@ module Tinkerforge
368
411
  # This function is used by Brick Viewer during flashing. It should not be
369
412
  # necessary to call it in a normal user program.
370
413
  def write_firmware(data)
371
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
414
+ check_validity
415
+
416
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
372
417
  end
373
418
 
374
419
  # Sets the status LED configuration. By default the LED shows
@@ -379,22 +424,28 @@ module Tinkerforge
379
424
  #
380
425
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
381
426
  def set_status_led_config(config)
382
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
427
+ check_validity
428
+
429
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
383
430
  end
384
431
 
385
432
  # Returns the configuration as set by BrickletIO4V2#set_status_led_config
386
433
  def get_status_led_config
387
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
434
+ check_validity
435
+
436
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
388
437
  end
389
438
 
390
- # Returns the temperature in °C as measured inside the microcontroller. The
439
+ # Returns the temperature as measured inside the microcontroller. The
391
440
  # value returned is not the ambient temperature!
392
441
  #
393
442
  # The temperature is only proportional to the real temperature and it has bad
394
443
  # accuracy. Practically it is only useful as an indicator for
395
444
  # temperature changes.
396
445
  def get_chip_temperature
397
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
446
+ check_validity
447
+
448
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
398
449
  end
399
450
 
400
451
  # Calling this function will reset the Bricklet. All configurations
@@ -404,7 +455,9 @@ module Tinkerforge
404
455
  # calling functions on the existing ones will result in
405
456
  # undefined behavior!
406
457
  def reset
407
- send_request FUNCTION_RESET, [], '', 0, ''
458
+ check_validity
459
+
460
+ send_request FUNCTION_RESET, [], '', 8, ''
408
461
  end
409
462
 
410
463
  # Writes a new UID into flash. If you want to set a new UID
@@ -413,25 +466,32 @@ module Tinkerforge
413
466
  #
414
467
  # We recommend that you use Brick Viewer to change the UID.
415
468
  def write_uid(uid)
416
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
469
+ check_validity
470
+
471
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
417
472
  end
418
473
 
419
474
  # Returns the current UID as an integer. Encode as
420
475
  # Base58 to get the usual string version.
421
476
  def read_uid
422
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
477
+ check_validity
478
+
479
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
423
480
  end
424
481
 
425
482
  # Returns the UID, the UID where the Bricklet is connected to,
426
483
  # the position, the hardware and firmware version as well as the
427
484
  # device identifier.
428
485
  #
429
- # The position can be 'a', 'b', 'c' or 'd'.
486
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
487
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
488
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
489
+ # position 'z'.
430
490
  #
431
491
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
432
492
  # |device_identifier_constant|
433
493
  def get_identity
434
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
494
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
435
495
  end
436
496
 
437
497
  # 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
  # Galvanically isolates any Bricklet from any Brick
14
16
  class BrickletIsolator < Device
@@ -63,7 +65,7 @@ module Tinkerforge
63
65
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
64
66
  # the IP Connection <tt>ipcon</tt>.
65
67
  def initialize(uid, ipcon)
66
- super uid, ipcon
68
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
67
69
 
68
70
  @api_version = [2, 0, 1]
69
71
 
@@ -88,13 +90,16 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
 
91
- @callback_formats[CALLBACK_STATISTICS] = 'L L S Z8'
93
+ @callback_formats[CALLBACK_STATISTICS] = [26, 'L L S Z8']
92
94
 
95
+ @ipcon.add_device self
93
96
  end
94
97
 
95
98
  # Returns statistics for the Isolator Bricklet.
96
99
  def get_statistics
97
- send_request FUNCTION_GET_STATISTICS, [], '', 18, 'L L S Z8'
100
+ check_validity
101
+
102
+ send_request FUNCTION_GET_STATISTICS, [], '', 26, 'L L S Z8'
98
103
  end
99
104
 
100
105
  # The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
@@ -104,8 +109,8 @@ module Tinkerforge
104
109
  # The baudrate for communication config between
105
110
  # Brick and Isolator Bricklet can be set through the API of the Brick.
106
111
  #
107
- # The baudrate will be increased exponentially if lots of data is send/received and
108
- # decreased linearly if little data is send/received.
112
+ # The baudrate will be increased exponentially if lots of data is sent/received and
113
+ # decreased linearly if little data is sent/received.
109
114
  #
110
115
  # This lowers the baudrate in applications where little data is transferred (e.g.
111
116
  # a weather station) and increases the robustness. If there is lots of data to transfer
@@ -119,12 +124,16 @@ module Tinkerforge
119
124
  # BrickletIsolator#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
120
125
  # as set by BrickletIsolator#set_spitfp_baudrate will be used statically.
121
126
  def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
122
- send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
127
+ check_validity
128
+
129
+ send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 8, ''
123
130
  end
124
131
 
125
132
  # Returns the baudrate config, see BrickletIsolator#set_spitfp_baudrate_config.
126
133
  def get_spitfp_baudrate_config
127
- send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
134
+ check_validity
135
+
136
+ send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 13, '? L'
128
137
  end
129
138
 
130
139
  # Sets the baudrate for a the communication between Isolator Bricklet
@@ -143,12 +152,16 @@ module Tinkerforge
143
152
  # or similar is necessary in you applications we recommend to not change
144
153
  # the baudrate.
145
154
  def set_spitfp_baudrate(baudrate)
146
- send_request FUNCTION_SET_SPITFP_BAUDRATE, [baudrate], 'L', 0, ''
155
+ check_validity
156
+
157
+ send_request FUNCTION_SET_SPITFP_BAUDRATE, [baudrate], 'L', 8, ''
147
158
  end
148
159
 
149
160
  # Returns the baudrate, see BrickletIsolator#set_spitfp_baudrate.
150
161
  def get_spitfp_baudrate
151
- send_request FUNCTION_GET_SPITFP_BAUDRATE, [], '', 4, 'L'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_SPITFP_BAUDRATE, [], '', 12, 'L'
152
165
  end
153
166
 
154
167
  # Returns the error count for the communication between Isolator Bricklet and
@@ -162,7 +175,9 @@ module Tinkerforge
162
175
  # * framing errors and
163
176
  # * overflow errors.
164
177
  def get_isolator_spitfp_error_count
165
- send_request FUNCTION_GET_ISOLATOR_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
178
+ check_validity
179
+
180
+ send_request FUNCTION_GET_ISOLATOR_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
166
181
  end
167
182
 
168
183
  # The period is the period with which the CALLBACK_STATISTICS
@@ -177,7 +192,9 @@ module Tinkerforge
177
192
  #
178
193
  # .. versionadded:: 2.0.2$nbsp;(Plugin)
179
194
  def set_statistics_callback_configuration(period, value_has_to_change)
180
- send_request FUNCTION_SET_STATISTICS_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
195
+ check_validity
196
+
197
+ send_request FUNCTION_SET_STATISTICS_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
181
198
  end
182
199
 
183
200
  # Returns the callback configuration as set by
@@ -185,7 +202,9 @@ module Tinkerforge
185
202
  #
186
203
  # .. versionadded:: 2.0.2$nbsp;(Plugin)
187
204
  def get_statistics_callback_configuration
188
- send_request FUNCTION_GET_STATISTICS_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
205
+ check_validity
206
+
207
+ send_request FUNCTION_GET_STATISTICS_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
189
208
  end
190
209
 
191
210
  # Returns the error count for the communication between Brick and Bricklet.
@@ -200,7 +219,9 @@ module Tinkerforge
200
219
  # The errors counts are for errors that occur on the Bricklet side. All
201
220
  # Bricks have a similar function that returns the errors on the Brick side.
202
221
  def get_spitfp_error_count
203
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
222
+ check_validity
223
+
224
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
204
225
  end
205
226
 
206
227
  # Sets the bootloader mode and returns the status after the requested
@@ -213,12 +234,16 @@ module Tinkerforge
213
234
  # This function is used by Brick Viewer during flashing. It should not be
214
235
  # necessary to call it in a normal user program.
215
236
  def set_bootloader_mode(mode)
216
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
237
+ check_validity
238
+
239
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
217
240
  end
218
241
 
219
242
  # Returns the current bootloader mode, see BrickletIsolator#set_bootloader_mode.
220
243
  def get_bootloader_mode
221
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
244
+ check_validity
245
+
246
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
222
247
  end
223
248
 
224
249
  # Sets the firmware pointer for BrickletIsolator#write_firmware. The pointer has
@@ -228,7 +253,9 @@ module Tinkerforge
228
253
  # This function is used by Brick Viewer during flashing. It should not be
229
254
  # necessary to call it in a normal user program.
230
255
  def set_write_firmware_pointer(pointer)
231
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
256
+ check_validity
257
+
258
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
232
259
  end
233
260
 
234
261
  # Writes 64 Bytes of firmware at the position as written by
@@ -240,7 +267,9 @@ module Tinkerforge
240
267
  # This function is used by Brick Viewer during flashing. It should not be
241
268
  # necessary to call it in a normal user program.
242
269
  def write_firmware(data)
243
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
270
+ check_validity
271
+
272
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
244
273
  end
245
274
 
246
275
  # Sets the status LED configuration. By default the LED shows
@@ -251,22 +280,28 @@ module Tinkerforge
251
280
  #
252
281
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
253
282
  def set_status_led_config(config)
254
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
283
+ check_validity
284
+
285
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
255
286
  end
256
287
 
257
288
  # Returns the configuration as set by BrickletIsolator#set_status_led_config
258
289
  def get_status_led_config
259
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
290
+ check_validity
291
+
292
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
260
293
  end
261
294
 
262
- # Returns the temperature in °C as measured inside the microcontroller. The
295
+ # Returns the temperature as measured inside the microcontroller. The
263
296
  # value returned is not the ambient temperature!
264
297
  #
265
298
  # The temperature is only proportional to the real temperature and it has bad
266
299
  # accuracy. Practically it is only useful as an indicator for
267
300
  # temperature changes.
268
301
  def get_chip_temperature
269
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
302
+ check_validity
303
+
304
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
270
305
  end
271
306
 
272
307
  # Calling this function will reset the Bricklet. All configurations
@@ -276,7 +311,9 @@ module Tinkerforge
276
311
  # calling functions on the existing ones will result in
277
312
  # undefined behavior!
278
313
  def reset
279
- send_request FUNCTION_RESET, [], '', 0, ''
314
+ check_validity
315
+
316
+ send_request FUNCTION_RESET, [], '', 8, ''
280
317
  end
281
318
 
282
319
  # Writes a new UID into flash. If you want to set a new UID
@@ -285,25 +322,32 @@ module Tinkerforge
285
322
  #
286
323
  # We recommend that you use Brick Viewer to change the UID.
287
324
  def write_uid(uid)
288
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
325
+ check_validity
326
+
327
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
289
328
  end
290
329
 
291
330
  # Returns the current UID as an integer. Encode as
292
331
  # Base58 to get the usual string version.
293
332
  def read_uid
294
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
333
+ check_validity
334
+
335
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
295
336
  end
296
337
 
297
338
  # Returns the UID, the UID where the Bricklet is connected to,
298
339
  # the position, the hardware and firmware version as well as the
299
340
  # device identifier.
300
341
  #
301
- # The position can be 'a', 'b', 'c' or 'd'.
342
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
343
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
344
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
345
+ # position 'z'.
302
346
  #
303
347
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
304
348
  # |device_identifier_constant|
305
349
  def get_identity
306
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
350
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
307
351
  end
308
352
 
309
353
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.