tinkerforge 2.1.24 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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,31 @@ 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
488
+ # position 'z'.
430
489
  #
431
490
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
432
491
  # |device_identifier_constant|
433
492
  def get_identity
434
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
493
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
435
494
  end
436
495
 
437
496
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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
@@ -140,15 +149,19 @@ module Tinkerforge
140
149
  # function corresponds to the maximum baudrate (see BrickletIsolator#set_spitfp_baudrate_config).
141
150
  #
142
151
  # Regulatory testing is done with the default baudrate. If CE compatibility
143
- # or similar is necessary in you applications we recommend to not change
152
+ # or similar is necessary in your 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,31 @@ 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
344
+ # position 'z'.
302
345
  #
303
346
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
304
347
  # |device_identifier_constant|
305
348
  def get_identity
306
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
349
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
307
350
  end
308
351
 
309
352
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.