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 galvanically isolated digital outputs
14
16
  class BrickletIndustrialDigitalOut4V2 < Device
@@ -65,7 +67,7 @@ module Tinkerforge
65
67
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
66
68
  # the IP Connection <tt>ipcon</tt>.
67
69
  def initialize(uid, ipcon)
68
- super uid, ipcon
70
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
69
71
 
70
72
  @api_version = [2, 0, 0]
71
73
 
@@ -91,8 +93,9 @@ module Tinkerforge
91
93
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
94
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
95
 
94
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
96
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
101
  # Sets the output value of all four channels. A value of *true* or *false* outputs
@@ -105,12 +108,16 @@ module Tinkerforge
105
108
  # For example: (True, True, False, False) will turn the channels 0-1 high and the
106
109
  # channels 2-3 low.
107
110
  def set_value(value)
108
- send_request FUNCTION_SET_VALUE, [value], '?4', 0, ''
111
+ check_validity
112
+
113
+ send_request FUNCTION_SET_VALUE, [value], '?4', 8, ''
109
114
  end
110
115
 
111
116
  # Returns the logic levels that are currently output on the channels.
112
117
  def get_value
113
- send_request FUNCTION_GET_VALUE, [], '', 4, '?4'
118
+ check_validity
119
+
120
+ send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
114
121
  end
115
122
 
116
123
  # Sets the output value of a specific channel without affecting the other channels.
@@ -118,7 +125,9 @@ module Tinkerforge
118
125
  # A running monoflop timer or PWM for the specified channel will be aborted if this
119
126
  # function is called.
120
127
  def set_selected_value(channel, value)
121
- send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
128
+ check_validity
129
+
130
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
122
131
  end
123
132
 
124
133
  # The first parameter is the desired state of the channel (*true* means output *high*
@@ -136,7 +145,9 @@ module Tinkerforge
136
145
  # of two seconds. The channel will be *high* all the time. If now the RS485
137
146
  # connection is lost, the channel will turn *low* in at most two seconds.
138
147
  def set_monoflop(channel, value, time)
139
- send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
140
151
  end
141
152
 
142
153
  # Returns (for the given channel) the current value and the time as set by
@@ -145,7 +156,9 @@ module Tinkerforge
145
156
  # If the timer is not running currently, the remaining time will be returned
146
157
  # as 0.
147
158
  def get_monoflop(channel)
148
- send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
159
+ check_validity
160
+
161
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
149
162
  end
150
163
 
151
164
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -154,12 +167,16 @@ module Tinkerforge
154
167
  #
155
168
  # By default all channel LEDs are configured as "Channel Status".
156
169
  def set_channel_led_config(channel, config)
157
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
170
+ check_validity
171
+
172
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
158
173
  end
159
174
 
160
175
  # Returns the channel LED configuration as set by BrickletIndustrialDigitalOut4V2#set_channel_led_config
161
176
  def get_channel_led_config(channel)
162
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
177
+ check_validity
178
+
179
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
163
180
  end
164
181
 
165
182
  # Activates a PWM for the given channel.
@@ -174,12 +191,16 @@ module Tinkerforge
174
191
  # A running monoflop timer for the given channel will be aborted if this function
175
192
  # is called.
176
193
  def set_pwm_configuration(channel, frequency, duty_cycle)
177
- send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 0, ''
194
+ check_validity
195
+
196
+ send_request FUNCTION_SET_PWM_CONFIGURATION, [channel, frequency, duty_cycle], 'C L S', 8, ''
178
197
  end
179
198
 
180
199
  # Returns the PWM configuration as set by BrickletIndustrialDigitalOut4V2#set_pwm_configuration.
181
200
  def get_pwm_configuration(channel)
182
- send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 6, 'L S'
201
+ check_validity
202
+
203
+ send_request FUNCTION_GET_PWM_CONFIGURATION, [channel], 'C', 14, 'L S'
183
204
  end
184
205
 
185
206
  # Returns the error count for the communication between Brick and Bricklet.
@@ -194,7 +215,9 @@ module Tinkerforge
194
215
  # The errors counts are for errors that occur on the Bricklet side. All
195
216
  # Bricks have a similar function that returns the errors on the Brick side.
196
217
  def get_spitfp_error_count
197
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
218
+ check_validity
219
+
220
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
198
221
  end
199
222
 
200
223
  # Sets the bootloader mode and returns the status after the requested
@@ -207,12 +230,16 @@ module Tinkerforge
207
230
  # This function is used by Brick Viewer during flashing. It should not be
208
231
  # necessary to call it in a normal user program.
209
232
  def set_bootloader_mode(mode)
210
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
233
+ check_validity
234
+
235
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
211
236
  end
212
237
 
213
238
  # Returns the current bootloader mode, see BrickletIndustrialDigitalOut4V2#set_bootloader_mode.
214
239
  def get_bootloader_mode
215
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
240
+ check_validity
241
+
242
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
216
243
  end
217
244
 
218
245
  # Sets the firmware pointer for BrickletIndustrialDigitalOut4V2#write_firmware. The pointer has
@@ -222,7 +249,9 @@ module Tinkerforge
222
249
  # This function is used by Brick Viewer during flashing. It should not be
223
250
  # necessary to call it in a normal user program.
224
251
  def set_write_firmware_pointer(pointer)
225
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
252
+ check_validity
253
+
254
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
226
255
  end
227
256
 
228
257
  # Writes 64 Bytes of firmware at the position as written by
@@ -234,7 +263,9 @@ module Tinkerforge
234
263
  # This function is used by Brick Viewer during flashing. It should not be
235
264
  # necessary to call it in a normal user program.
236
265
  def write_firmware(data)
237
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
266
+ check_validity
267
+
268
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
238
269
  end
239
270
 
240
271
  # Sets the status LED configuration. By default the LED shows
@@ -245,22 +276,28 @@ module Tinkerforge
245
276
  #
246
277
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
247
278
  def set_status_led_config(config)
248
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
279
+ check_validity
280
+
281
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
249
282
  end
250
283
 
251
284
  # Returns the configuration as set by BrickletIndustrialDigitalOut4V2#set_status_led_config
252
285
  def get_status_led_config
253
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
286
+ check_validity
287
+
288
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
254
289
  end
255
290
 
256
- # Returns the temperature in °C as measured inside the microcontroller. The
291
+ # Returns the temperature as measured inside the microcontroller. The
257
292
  # value returned is not the ambient temperature!
258
293
  #
259
294
  # The temperature is only proportional to the real temperature and it has bad
260
295
  # accuracy. Practically it is only useful as an indicator for
261
296
  # temperature changes.
262
297
  def get_chip_temperature
263
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
298
+ check_validity
299
+
300
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
264
301
  end
265
302
 
266
303
  # Calling this function will reset the Bricklet. All configurations
@@ -270,7 +307,9 @@ module Tinkerforge
270
307
  # calling functions on the existing ones will result in
271
308
  # undefined behavior!
272
309
  def reset
273
- send_request FUNCTION_RESET, [], '', 0, ''
310
+ check_validity
311
+
312
+ send_request FUNCTION_RESET, [], '', 8, ''
274
313
  end
275
314
 
276
315
  # Writes a new UID into flash. If you want to set a new UID
@@ -279,25 +318,31 @@ module Tinkerforge
279
318
  #
280
319
  # We recommend that you use Brick Viewer to change the UID.
281
320
  def write_uid(uid)
282
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
321
+ check_validity
322
+
323
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
283
324
  end
284
325
 
285
326
  # Returns the current UID as an integer. Encode as
286
327
  # Base58 to get the usual string version.
287
328
  def read_uid
288
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
329
+ check_validity
330
+
331
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
289
332
  end
290
333
 
291
334
  # Returns the UID, the UID where the Bricklet is connected to,
292
335
  # the position, the hardware and firmware version as well as the
293
336
  # device identifier.
294
337
  #
295
- # The position can be 'a', 'b', 'c' or 'd'.
338
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
339
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
340
+ # position 'z'.
296
341
  #
297
342
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
298
343
  # |device_identifier_constant|
299
344
  def get_identity
300
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
345
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
301
346
  end
302
347
 
303
348
  # 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
  # Measures two DC currents between 0mA and 20mA (IEC 60381-1)
14
16
  class BrickletIndustrialDual020mA < Device
@@ -55,7 +57,7 @@ module Tinkerforge
55
57
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
56
58
  # the IP Connection <tt>ipcon</tt>.
57
59
  def initialize(uid, ipcon)
58
- super uid, ipcon
60
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
59
61
 
60
62
  @api_version = [2, 0, 0]
61
63
 
@@ -70,9 +72,10 @@ module Tinkerforge
70
72
  @response_expected[FUNCTION_GET_SAMPLE_RATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
71
73
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
74
 
73
- @callback_formats[CALLBACK_CURRENT] = 'C l'
74
- @callback_formats[CALLBACK_CURRENT_REACHED] = 'C l'
75
+ @callback_formats[CALLBACK_CURRENT] = [13, 'C l']
76
+ @callback_formats[CALLBACK_CURRENT_REACHED] = [13, 'C l']
75
77
 
78
+ @ipcon.add_device self
76
79
  end
77
80
 
78
81
  # Returns the current of the specified sensor.
@@ -88,7 +91,9 @@ module Tinkerforge
88
91
  # CALLBACK_CURRENT callback and set the period with
89
92
  # BrickletIndustrialDual020mA#set_current_callback_period.
90
93
  def get_current(sensor)
91
- send_request FUNCTION_GET_CURRENT, [sensor], 'C', 4, 'l'
94
+ check_validity
95
+
96
+ send_request FUNCTION_GET_CURRENT, [sensor], 'C', 12, 'l'
92
97
  end
93
98
 
94
99
  # Sets the period with which the CALLBACK_CURRENT callback is triggered
@@ -97,12 +102,16 @@ module Tinkerforge
97
102
  # The CALLBACK_CURRENT callback is only triggered if the current has changed since the
98
103
  # last triggering.
99
104
  def set_current_callback_period(sensor, period)
100
- send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [sensor, period], 'C L', 0, ''
105
+ check_validity
106
+
107
+ send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [sensor, period], 'C L', 8, ''
101
108
  end
102
109
 
103
110
  # Returns the period as set by BrickletIndustrialDual020mA#set_current_callback_period.
104
111
  def get_current_callback_period(sensor)
105
- send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [sensor], 'C', 4, 'L'
112
+ check_validity
113
+
114
+ send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [sensor], 'C', 12, 'L'
106
115
  end
107
116
 
108
117
  # Sets the thresholds for the CALLBACK_CURRENT_REACHED callback for the given
@@ -118,12 +127,16 @@ module Tinkerforge
118
127
  # "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
119
128
  # "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
120
129
  def set_current_callback_threshold(sensor, option, min, max)
121
- send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [sensor, option, min, max], 'C k l l', 0, ''
130
+ check_validity
131
+
132
+ send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [sensor, option, min, max], 'C k l l', 8, ''
122
133
  end
123
134
 
124
135
  # Returns the threshold as set by BrickletIndustrialDual020mA#set_current_callback_threshold.
125
136
  def get_current_callback_threshold(sensor)
126
- send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [sensor], 'C', 9, 'k l l'
137
+ check_validity
138
+
139
+ send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [sensor], 'C', 17, 'k l l'
127
140
  end
128
141
 
129
142
  # Sets the period with which the threshold callback
@@ -136,12 +149,16 @@ module Tinkerforge
136
149
  #
137
150
  # keeps being reached.
138
151
  def set_debounce_period(debounce)
139
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
152
+ check_validity
153
+
154
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
140
155
  end
141
156
 
142
157
  # Returns the debounce period as set by BrickletIndustrialDual020mA#set_debounce_period.
143
158
  def get_debounce_period
144
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
159
+ check_validity
160
+
161
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
145
162
  end
146
163
 
147
164
  # Sets the sample rate to either 240, 60, 15 or 4 samples per second.
@@ -154,24 +171,30 @@ module Tinkerforge
154
171
  # "2", "15 samples per second, 16 bit resolution"
155
172
  # "3", "4 samples per second, 18 bit resolution"
156
173
  def set_sample_rate(rate)
157
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
174
+ check_validity
175
+
176
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
158
177
  end
159
178
 
160
179
  # Returns the sample rate as set by BrickletIndustrialDual020mA#set_sample_rate.
161
180
  def get_sample_rate
162
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
163
184
  end
164
185
 
165
186
  # Returns the UID, the UID where the Bricklet is connected to,
166
187
  # the position, the hardware and firmware version as well as the
167
188
  # device identifier.
168
189
  #
169
- # The position can be 'a', 'b', 'c' or 'd'.
190
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
191
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
192
+ # position 'z'.
170
193
  #
171
194
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
172
195
  # |device_identifier_constant|
173
196
  def get_identity
174
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
197
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
175
198
  end
176
199
 
177
200
  # 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
  # Measures two DC currents between 0mA and 20mA (IEC 60381-1)
14
16
  class BrickletIndustrialDual020mAV2 < Device
@@ -83,7 +85,7 @@ module Tinkerforge
83
85
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
84
86
  # the IP Connection <tt>ipcon</tt>.
85
87
  def initialize(uid, ipcon)
86
- super uid, ipcon
88
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
87
89
 
88
90
  @api_version = [2, 0, 0]
89
91
 
@@ -111,8 +113,9 @@ module Tinkerforge
111
113
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
112
114
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
115
 
114
- @callback_formats[CALLBACK_CURRENT] = 'C l'
116
+ @callback_formats[CALLBACK_CURRENT] = [13, 'C l']
115
117
 
118
+ @ipcon.add_device self
116
119
  end
117
120
 
118
121
  # Returns the current of the specified channel.
@@ -129,7 +132,9 @@ module Tinkerforge
129
132
  # CALLBACK_CURRENT callback. You can set the callback configuration
130
133
  # with BrickletIndustrialDual020mAV2#set_current_callback_configuration.
131
134
  def get_current(channel)
132
- send_request FUNCTION_GET_CURRENT, [channel], 'C', 4, 'l'
135
+ check_validity
136
+
137
+ send_request FUNCTION_GET_CURRENT, [channel], 'C', 12, 'l'
133
138
  end
134
139
 
135
140
  # The period is the period with which the CALLBACK_CURRENT callback is triggered
@@ -158,12 +163,16 @@ module Tinkerforge
158
163
  #
159
164
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
160
165
  def set_current_callback_configuration(channel, period, value_has_to_change, option, min, max)
161
- send_request FUNCTION_SET_CURRENT_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 0, ''
166
+ check_validity
167
+
168
+ send_request FUNCTION_SET_CURRENT_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 8, ''
162
169
  end
163
170
 
164
171
  # Returns the callback configuration as set by BrickletIndustrialDual020mAV2#set_current_callback_configuration.
165
172
  def get_current_callback_configuration(channel)
166
- send_request FUNCTION_GET_CURRENT_CALLBACK_CONFIGURATION, [channel], 'C', 14, 'L ? k l l'
173
+ check_validity
174
+
175
+ send_request FUNCTION_GET_CURRENT_CALLBACK_CONFIGURATION, [channel], 'C', 22, 'L ? k l l'
167
176
  end
168
177
 
169
178
  # Sets the sample rate to either 240, 60, 15 or 4 samples per second.
@@ -176,12 +185,16 @@ module Tinkerforge
176
185
  # "2", "15 samples per second, 16 bit resolution"
177
186
  # "3", "4 samples per second, 18 bit resolution"
178
187
  def set_sample_rate(rate)
179
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
188
+ check_validity
189
+
190
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
180
191
  end
181
192
 
182
- # Returns the gain as set by BrickletIndustrialDual020mAV2#set_sample_rate.
193
+ # Returns the sample rate as set by BrickletIndustrialDual020mAV2#set_sample_rate.
183
194
  def get_sample_rate
184
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
185
198
  end
186
199
 
187
200
  # Sets a gain between 1x and 8x. If you want to measure a very small current,
@@ -190,12 +203,16 @@ module Tinkerforge
190
203
  # Example: If you measure 0.5mA with a gain of 8x the return value will be
191
204
  # 4mA.
192
205
  def set_gain(gain)
193
- send_request FUNCTION_SET_GAIN, [gain], 'C', 0, ''
206
+ check_validity
207
+
208
+ send_request FUNCTION_SET_GAIN, [gain], 'C', 8, ''
194
209
  end
195
210
 
196
211
  # Returns the gain as set by BrickletIndustrialDual020mAV2#set_gain.
197
212
  def get_gain
198
- send_request FUNCTION_GET_GAIN, [], '', 1, 'C'
213
+ check_validity
214
+
215
+ send_request FUNCTION_GET_GAIN, [], '', 9, 'C'
199
216
  end
200
217
 
201
218
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -205,12 +222,16 @@ module Tinkerforge
205
222
  #
206
223
  # You can configure the channel status behavior with BrickletIndustrialDual020mAV2#set_channel_led_status_config.
207
224
  def set_channel_led_config(channel, config)
208
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
225
+ check_validity
226
+
227
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
209
228
  end
210
229
 
211
230
  # Returns the channel LED configuration as set by BrickletIndustrialDual020mAV2#set_channel_led_config
212
231
  def get_channel_led_config(channel)
213
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
232
+ check_validity
233
+
234
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
214
235
  end
215
236
 
216
237
  # Sets the channel LED status config. This config is used if the channel LED is
@@ -234,13 +255,17 @@ module Tinkerforge
234
255
  # 4mA and 20mA. If the min value is greater than the max value, the LED brightness
235
256
  # is scaled the other way around.
236
257
  def set_channel_led_status_config(channel, min, max, config)
237
- send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 0, ''
258
+ check_validity
259
+
260
+ send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 8, ''
238
261
  end
239
262
 
240
263
  # Returns the channel LED status configuration as set by
241
264
  # BrickletIndustrialDual020mAV2#set_channel_led_status_config.
242
265
  def get_channel_led_status_config(channel)
243
- send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 9, 'l l C'
266
+ check_validity
267
+
268
+ send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 17, 'l l C'
244
269
  end
245
270
 
246
271
  # Returns the error count for the communication between Brick and Bricklet.
@@ -255,7 +280,9 @@ module Tinkerforge
255
280
  # The errors counts are for errors that occur on the Bricklet side. All
256
281
  # Bricks have a similar function that returns the errors on the Brick side.
257
282
  def get_spitfp_error_count
258
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
283
+ check_validity
284
+
285
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
259
286
  end
260
287
 
261
288
  # Sets the bootloader mode and returns the status after the requested
@@ -268,12 +295,16 @@ module Tinkerforge
268
295
  # This function is used by Brick Viewer during flashing. It should not be
269
296
  # necessary to call it in a normal user program.
270
297
  def set_bootloader_mode(mode)
271
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
298
+ check_validity
299
+
300
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
272
301
  end
273
302
 
274
303
  # Returns the current bootloader mode, see BrickletIndustrialDual020mAV2#set_bootloader_mode.
275
304
  def get_bootloader_mode
276
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
305
+ check_validity
306
+
307
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
277
308
  end
278
309
 
279
310
  # Sets the firmware pointer for BrickletIndustrialDual020mAV2#write_firmware. The pointer has
@@ -283,7 +314,9 @@ module Tinkerforge
283
314
  # This function is used by Brick Viewer during flashing. It should not be
284
315
  # necessary to call it in a normal user program.
285
316
  def set_write_firmware_pointer(pointer)
286
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
317
+ check_validity
318
+
319
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
287
320
  end
288
321
 
289
322
  # Writes 64 Bytes of firmware at the position as written by
@@ -295,7 +328,9 @@ module Tinkerforge
295
328
  # This function is used by Brick Viewer during flashing. It should not be
296
329
  # necessary to call it in a normal user program.
297
330
  def write_firmware(data)
298
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
331
+ check_validity
332
+
333
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
299
334
  end
300
335
 
301
336
  # Sets the status LED configuration. By default the LED shows
@@ -306,22 +341,28 @@ module Tinkerforge
306
341
  #
307
342
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
308
343
  def set_status_led_config(config)
309
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
344
+ check_validity
345
+
346
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
310
347
  end
311
348
 
312
349
  # Returns the configuration as set by BrickletIndustrialDual020mAV2#set_status_led_config
313
350
  def get_status_led_config
314
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
351
+ check_validity
352
+
353
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
315
354
  end
316
355
 
317
- # Returns the temperature in °C as measured inside the microcontroller. The
356
+ # Returns the temperature as measured inside the microcontroller. The
318
357
  # value returned is not the ambient temperature!
319
358
  #
320
359
  # The temperature is only proportional to the real temperature and it has bad
321
360
  # accuracy. Practically it is only useful as an indicator for
322
361
  # temperature changes.
323
362
  def get_chip_temperature
324
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
363
+ check_validity
364
+
365
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
325
366
  end
326
367
 
327
368
  # Calling this function will reset the Bricklet. All configurations
@@ -331,7 +372,9 @@ module Tinkerforge
331
372
  # calling functions on the existing ones will result in
332
373
  # undefined behavior!
333
374
  def reset
334
- send_request FUNCTION_RESET, [], '', 0, ''
375
+ check_validity
376
+
377
+ send_request FUNCTION_RESET, [], '', 8, ''
335
378
  end
336
379
 
337
380
  # Writes a new UID into flash. If you want to set a new UID
@@ -340,25 +383,31 @@ module Tinkerforge
340
383
  #
341
384
  # We recommend that you use Brick Viewer to change the UID.
342
385
  def write_uid(uid)
343
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
386
+ check_validity
387
+
388
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
344
389
  end
345
390
 
346
391
  # Returns the current UID as an integer. Encode as
347
392
  # Base58 to get the usual string version.
348
393
  def read_uid
349
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
394
+ check_validity
395
+
396
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
350
397
  end
351
398
 
352
399
  # Returns the UID, the UID where the Bricklet is connected to,
353
400
  # the position, the hardware and firmware version as well as the
354
401
  # device identifier.
355
402
  #
356
- # The position can be 'a', 'b', 'c' or 'd'.
403
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
404
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
405
+ # position 'z'.
357
406
  #
358
407
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
359
408
  # |device_identifier_constant|
360
409
  def get_identity
361
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
410
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
362
411
  end
363
412
 
364
413
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.