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
  # 16-channel digital input/output
14
16
  class BrickletIO16V2 < Device
@@ -87,7 +89,7 @@ module Tinkerforge
87
89
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
88
90
  # the IP Connection <tt>ipcon</tt>.
89
91
  def initialize(uid, ipcon)
90
- super uid, ipcon
92
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
91
93
 
92
94
  @api_version = [2, 0, 0]
93
95
 
@@ -118,10 +120,11 @@ module Tinkerforge
118
120
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
119
121
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
120
122
 
121
- @callback_formats[CALLBACK_INPUT_VALUE] = 'C ? ?'
122
- @callback_formats[CALLBACK_ALL_INPUT_VALUE] = '?16 ?16'
123
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
123
+ @callback_formats[CALLBACK_INPUT_VALUE] = [11, 'C ? ?']
124
+ @callback_formats[CALLBACK_ALL_INPUT_VALUE] = [12, '?16 ?16']
125
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
124
126
 
127
+ @ipcon.add_device self
125
128
  end
126
129
 
127
130
  # Sets the output value of all sixteen channels. A value of *true* or *false* outputs
@@ -138,14 +141,18 @@ module Tinkerforge
138
141
  # This function does nothing for channels that are configured as input. Pull-up
139
142
  # resistors can be switched on with BrickletIO16V2#set_configuration.
140
143
  def set_value(value)
141
- send_request FUNCTION_SET_VALUE, [value], '?16', 0, ''
144
+ check_validity
145
+
146
+ send_request FUNCTION_SET_VALUE, [value], '?16', 8, ''
142
147
  end
143
148
 
144
149
  # Returns the logic levels that are currently measured on the channels.
145
150
  # This function works if the channel is configured as input as well as if it is
146
151
  # configured as output.
147
152
  def get_value
148
- send_request FUNCTION_GET_VALUE, [], '', 16, '?16'
153
+ check_validity
154
+
155
+ send_request FUNCTION_GET_VALUE, [], '', 10, '?16'
149
156
  end
150
157
 
151
158
  # Sets the output value of a specific channel without affecting the other channels.
@@ -157,7 +164,9 @@ module Tinkerforge
157
164
  # This function does nothing for channels that are configured as input. Pull-up
158
165
  # resistors can be switched on with BrickletIO16V2#set_configuration.
159
166
  def set_selected_value(channel, value)
160
- send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
167
+ check_validity
168
+
169
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
161
170
  end
162
171
 
163
172
  # Configures the value and direction of a specific channel. Possible directions
@@ -179,12 +188,16 @@ module Tinkerforge
179
188
  # A running monoflop timer for the specific channel will be aborted if this
180
189
  # function is called.
181
190
  def set_configuration(channel, direction, value)
182
- send_request FUNCTION_SET_CONFIGURATION, [channel, direction, value], 'C k ?', 0, ''
191
+ check_validity
192
+
193
+ send_request FUNCTION_SET_CONFIGURATION, [channel, direction, value], 'C k ?', 8, ''
183
194
  end
184
195
 
185
196
  # Returns the channel configuration as set by BrickletIO16V2#set_configuration.
186
197
  def get_configuration(channel)
187
- send_request FUNCTION_GET_CONFIGURATION, [channel], 'C', 2, 'k ?'
198
+ check_validity
199
+
200
+ send_request FUNCTION_GET_CONFIGURATION, [channel], 'C', 10, 'k ?'
188
201
  end
189
202
 
190
203
  # This callback can be configured per channel.
@@ -199,13 +212,17 @@ module Tinkerforge
199
212
  # If it is set to false, the callback is continuously triggered with the period,
200
213
  # independent of the value.
201
214
  def set_input_value_callback_configuration(channel, period, value_has_to_change)
202
- send_request FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 0, ''
215
+ check_validity
216
+
217
+ send_request FUNCTION_SET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 8, ''
203
218
  end
204
219
 
205
220
  # Returns the callback configuration as set by
206
221
  # BrickletIO16V2#set_input_value_callback_configuration.
207
222
  def get_input_value_callback_configuration(channel)
208
- send_request FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 5, 'L ?'
223
+ check_validity
224
+
225
+ send_request FUNCTION_GET_INPUT_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 13, 'L ?'
209
226
  end
210
227
 
211
228
  # The period is the period with which the CALLBACK_ALL_INPUT_VALUE
@@ -218,13 +235,17 @@ module Tinkerforge
218
235
  # If it is set to false, the callback is continuously triggered with the period,
219
236
  # independent of the value.
220
237
  def set_all_input_value_callback_configuration(period, value_has_to_change)
221
- send_request FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
238
+ check_validity
239
+
240
+ send_request FUNCTION_SET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
222
241
  end
223
242
 
224
243
  # Returns the callback configuration as set by
225
244
  # BrickletIO16V2#set_all_input_value_callback_configuration.
226
245
  def get_all_input_value_callback_configuration
227
- send_request FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
246
+ check_validity
247
+
248
+ send_request FUNCTION_GET_ALL_INPUT_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
228
249
  end
229
250
 
230
251
  # Configures a monoflop of the specified channel.
@@ -245,7 +266,9 @@ module Tinkerforge
245
266
  # time. If now the RS485 connection is lost, then channel 0 will be opened in at
246
267
  # most two seconds.
247
268
  def set_monoflop(channel, value, time)
248
- send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
269
+ check_validity
270
+
271
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
249
272
  end
250
273
 
251
274
  # Returns (for the given channel) the current value and the time as set by
@@ -254,7 +277,9 @@ module Tinkerforge
254
277
  # If the timer is not running currently, the remaining time will be returned
255
278
  # as 0.
256
279
  def get_monoflop(channel)
257
- send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
280
+ check_validity
281
+
282
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
258
283
  end
259
284
 
260
285
  # Returns the current value of the edge counter for the selected channel. You can
@@ -263,7 +288,9 @@ module Tinkerforge
263
288
  # If you set the reset counter to *true*, the count is set back to 0
264
289
  # directly after it is read.
265
290
  def get_edge_count(channel, reset_counter)
266
- send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 4, 'L'
291
+ check_validity
292
+
293
+ send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 12, 'L'
267
294
  end
268
295
 
269
296
  # Configures the edge counter for a specific channel.
@@ -280,13 +307,17 @@ module Tinkerforge
280
307
  # If you don't know what any of this means, just leave it at default. The
281
308
  # default configuration is very likely OK for you.
282
309
  def set_edge_count_configuration(channel, edge_type, debounce)
283
- send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 0, ''
310
+ check_validity
311
+
312
+ send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 8, ''
284
313
  end
285
314
 
286
315
  # Returns the edge type and debounce time for the selected channel as set by
287
316
  # BrickletIO16V2#set_edge_count_configuration.
288
317
  def get_edge_count_configuration(channel)
289
- send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 2, 'C C'
318
+ check_validity
319
+
320
+ send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 10, 'C C'
290
321
  end
291
322
 
292
323
  # Returns the error count for the communication between Brick and Bricklet.
@@ -301,7 +332,9 @@ module Tinkerforge
301
332
  # The errors counts are for errors that occur on the Bricklet side. All
302
333
  # Bricks have a similar function that returns the errors on the Brick side.
303
334
  def get_spitfp_error_count
304
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
335
+ check_validity
336
+
337
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
305
338
  end
306
339
 
307
340
  # Sets the bootloader mode and returns the status after the requested
@@ -314,12 +347,16 @@ module Tinkerforge
314
347
  # This function is used by Brick Viewer during flashing. It should not be
315
348
  # necessary to call it in a normal user program.
316
349
  def set_bootloader_mode(mode)
317
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
350
+ check_validity
351
+
352
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
318
353
  end
319
354
 
320
355
  # Returns the current bootloader mode, see BrickletIO16V2#set_bootloader_mode.
321
356
  def get_bootloader_mode
322
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
357
+ check_validity
358
+
359
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
323
360
  end
324
361
 
325
362
  # Sets the firmware pointer for BrickletIO16V2#write_firmware. The pointer has
@@ -329,7 +366,9 @@ module Tinkerforge
329
366
  # This function is used by Brick Viewer during flashing. It should not be
330
367
  # necessary to call it in a normal user program.
331
368
  def set_write_firmware_pointer(pointer)
332
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
369
+ check_validity
370
+
371
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
333
372
  end
334
373
 
335
374
  # Writes 64 Bytes of firmware at the position as written by
@@ -341,7 +380,9 @@ module Tinkerforge
341
380
  # This function is used by Brick Viewer during flashing. It should not be
342
381
  # necessary to call it in a normal user program.
343
382
  def write_firmware(data)
344
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
383
+ check_validity
384
+
385
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
345
386
  end
346
387
 
347
388
  # Sets the status LED configuration. By default the LED shows
@@ -352,22 +393,28 @@ module Tinkerforge
352
393
  #
353
394
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
354
395
  def set_status_led_config(config)
355
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
396
+ check_validity
397
+
398
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
356
399
  end
357
400
 
358
401
  # Returns the configuration as set by BrickletIO16V2#set_status_led_config
359
402
  def get_status_led_config
360
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
403
+ check_validity
404
+
405
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
361
406
  end
362
407
 
363
- # Returns the temperature in °C as measured inside the microcontroller. The
408
+ # Returns the temperature as measured inside the microcontroller. The
364
409
  # value returned is not the ambient temperature!
365
410
  #
366
411
  # The temperature is only proportional to the real temperature and it has bad
367
412
  # accuracy. Practically it is only useful as an indicator for
368
413
  # temperature changes.
369
414
  def get_chip_temperature
370
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
415
+ check_validity
416
+
417
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
371
418
  end
372
419
 
373
420
  # Calling this function will reset the Bricklet. All configurations
@@ -377,7 +424,9 @@ module Tinkerforge
377
424
  # calling functions on the existing ones will result in
378
425
  # undefined behavior!
379
426
  def reset
380
- send_request FUNCTION_RESET, [], '', 0, ''
427
+ check_validity
428
+
429
+ send_request FUNCTION_RESET, [], '', 8, ''
381
430
  end
382
431
 
383
432
  # Writes a new UID into flash. If you want to set a new UID
@@ -386,25 +435,31 @@ module Tinkerforge
386
435
  #
387
436
  # We recommend that you use Brick Viewer to change the UID.
388
437
  def write_uid(uid)
389
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
438
+ check_validity
439
+
440
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
390
441
  end
391
442
 
392
443
  # Returns the current UID as an integer. Encode as
393
444
  # Base58 to get the usual string version.
394
445
  def read_uid
395
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
446
+ check_validity
447
+
448
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
396
449
  end
397
450
 
398
451
  # Returns the UID, the UID where the Bricklet is connected to,
399
452
  # the position, the hardware and firmware version as well as the
400
453
  # device identifier.
401
454
  #
402
- # The position can be 'a', 'b', 'c' or 'd'.
455
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
456
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
457
+ # position 'z'.
403
458
  #
404
459
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
405
460
  # |device_identifier_constant|
406
461
  def get_identity
407
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
462
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
408
463
  end
409
464
 
410
465
  # 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
  # 4-channel digital input/output
14
16
  class BrickletIO4 < Device
@@ -59,7 +61,7 @@ module Tinkerforge
59
61
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
60
62
  # the IP Connection <tt>ipcon</tt>.
61
63
  def initialize(uid, ipcon)
62
- super uid, ipcon
64
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
63
65
 
64
66
  @api_version = [2, 0, 1]
65
67
 
@@ -79,9 +81,10 @@ module Tinkerforge
79
81
  @response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
82
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
83
 
82
- @callback_formats[CALLBACK_INTERRUPT] = 'C C'
83
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C C'
84
+ @callback_formats[CALLBACK_INTERRUPT] = [10, 'C C']
85
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C C']
84
86
 
87
+ @ipcon.add_device self
85
88
  end
86
89
 
87
90
  # Sets the output value (high or low) with a bitmask (4bit). A 1 in the bitmask
@@ -96,14 +99,18 @@ module Tinkerforge
96
99
  # This function does nothing for pins that are configured as input.
97
100
  # Pull-up resistors can be switched on with BrickletIO4#set_configuration.
98
101
  def set_value(value_mask)
99
- send_request FUNCTION_SET_VALUE, [value_mask], 'C', 0, ''
102
+ check_validity
103
+
104
+ send_request FUNCTION_SET_VALUE, [value_mask], 'C', 8, ''
100
105
  end
101
106
 
102
107
  # Returns a bitmask of the values that are currently measured.
103
108
  # This function works if the pin is configured to input
104
109
  # as well as if it is configured to output.
105
110
  def get_value
106
- send_request FUNCTION_GET_VALUE, [], '', 1, 'C'
111
+ check_validity
112
+
113
+ send_request FUNCTION_GET_VALUE, [], '', 9, 'C'
107
114
  end
108
115
 
109
116
  # Configures the value and direction of the specified pins. Possible directions
@@ -125,7 +132,9 @@ module Tinkerforge
125
132
  # Running monoflop timers for the specified pins will be aborted if this
126
133
  # function is called.
127
134
  def set_configuration(selection_mask, direction, value)
128
- send_request FUNCTION_SET_CONFIGURATION, [selection_mask, direction, value], 'C k ?', 0, ''
135
+ check_validity
136
+
137
+ send_request FUNCTION_SET_CONFIGURATION, [selection_mask, direction, value], 'C k ?', 8, ''
129
138
  end
130
139
 
131
140
  # Returns a value bitmask and a direction bitmask. A 1 in the direction bitmask
@@ -139,7 +148,9 @@ module Tinkerforge
139
148
  # * pin 2 is configured as output high and
140
149
  # * pin 3 is are configured as output low.
141
150
  def get_configuration
142
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
151
+ check_validity
152
+
153
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
143
154
  end
144
155
 
145
156
  # Sets the debounce period of the CALLBACK_INTERRUPT callback.
@@ -148,12 +159,16 @@ module Tinkerforge
148
159
  # maximal every 100ms. This is necessary if something that bounces is
149
160
  # connected to the IO-4 Bricklet, such as a button.
150
161
  def set_debounce_period(debounce)
151
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
162
+ check_validity
163
+
164
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
152
165
  end
153
166
 
154
167
  # Returns the debounce period as set by BrickletIO4#set_debounce_period.
155
168
  def get_debounce_period
156
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
169
+ check_validity
170
+
171
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
157
172
  end
158
173
 
159
174
  # Sets the pins on which an interrupt is activated with a bitmask.
@@ -165,12 +180,16 @@ module Tinkerforge
165
180
  #
166
181
  # The interrupt is delivered with the CALLBACK_INTERRUPT callback.
167
182
  def set_interrupt(interrupt_mask)
168
- send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'C', 0, ''
183
+ check_validity
184
+
185
+ send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'C', 8, ''
169
186
  end
170
187
 
171
188
  # Returns the interrupt bitmask as set by BrickletIO4#set_interrupt.
172
189
  def get_interrupt
173
- send_request FUNCTION_GET_INTERRUPT, [], '', 1, 'C'
190
+ check_validity
191
+
192
+ send_request FUNCTION_GET_INTERRUPT, [], '', 9, 'C'
174
193
  end
175
194
 
176
195
  # Configures a monoflop of the pins specified by the first parameter as 4 bit
@@ -193,7 +212,9 @@ module Tinkerforge
193
212
  # of two seconds and pin 0 set to high. Pin 0 will be high all the time. If now
194
213
  # the RS485 connection is lost, then pin 0 will get low in at most two seconds.
195
214
  def set_monoflop(selection_mask, value_mask, time)
196
- send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'C C L', 0, ''
215
+ check_validity
216
+
217
+ send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'C C L', 8, ''
197
218
  end
198
219
 
199
220
  # Returns (for the given pin) the current value and the time as set by
@@ -202,7 +223,9 @@ module Tinkerforge
202
223
  # If the timer is not running currently, the remaining time will be returned
203
224
  # as 0.
204
225
  def get_monoflop(pin)
205
- send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 9, 'C L L'
226
+ check_validity
227
+
228
+ send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 17, 'C L L'
206
229
  end
207
230
 
208
231
  # Sets the output value (high or low) with a bitmask, according to
@@ -219,7 +242,9 @@ module Tinkerforge
219
242
  # This function does nothing for pins that are configured as input.
220
243
  # Pull-up resistors can be switched on with BrickletIO4#set_configuration.
221
244
  def set_selected_values(selection_mask, value_mask)
222
- send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'C C', 0, ''
245
+ check_validity
246
+
247
+ send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'C C', 8, ''
223
248
  end
224
249
 
225
250
  # Returns the current value of the edge counter for the selected pin. You can
@@ -230,7 +255,9 @@ module Tinkerforge
230
255
  #
231
256
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
232
257
  def get_edge_count(pin, reset_counter)
233
- send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L'
258
+ check_validity
259
+
260
+ send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 12, 'L'
234
261
  end
235
262
 
236
263
  # Configures the edge counter for the selected pins.
@@ -242,8 +269,6 @@ module Tinkerforge
242
269
  # * 1 = falling
243
270
  # * 2 = both
244
271
  #
245
- # The debounce time is given in ms.
246
- #
247
272
  # Configuring an edge counter resets its value to 0.
248
273
  #
249
274
  # If you don't know what any of this means, just leave it at default. The
@@ -251,7 +276,9 @@ module Tinkerforge
251
276
  #
252
277
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
253
278
  def set_edge_count_config(selection_mask, edge_type, debounce)
254
- send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'C C C', 0, ''
279
+ check_validity
280
+
281
+ send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'C C C', 8, ''
255
282
  end
256
283
 
257
284
  # Returns the edge type and debounce time for the selected pin as set by
@@ -259,19 +286,23 @@ module Tinkerforge
259
286
  #
260
287
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
261
288
  def get_edge_count_config(pin)
262
- send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C'
289
+ check_validity
290
+
291
+ send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 10, 'C C'
263
292
  end
264
293
 
265
294
  # Returns the UID, the UID where the Bricklet is connected to,
266
295
  # the position, the hardware and firmware version as well as the
267
296
  # device identifier.
268
297
  #
269
- # The position can be 'a', 'b', 'c' or 'd'.
298
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
299
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
300
+ # position 'z'.
270
301
  #
271
302
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
272
303
  # |device_identifier_constant|
273
304
  def get_identity
274
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
305
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
275
306
  end
276
307
 
277
308
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.