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
  # Measures two DC voltages between -35V and +35V with 24bit resolution each
14
16
  class BrickletIndustrialDualAnalogInV2 < Device
@@ -21,6 +23,14 @@ module Tinkerforge
21
23
  # The parameter is the same as BrickletIndustrialDualAnalogInV2#get_voltage.
22
24
  CALLBACK_VOLTAGE = 4
23
25
 
26
+ # This callback is triggered periodically according to the configuration set by
27
+ # BrickletIndustrialDualAnalogInV2#set_all_voltages_callback_configuration.
28
+ #
29
+ # The parameters are the same as BrickletIndustrialDualAnalogInV2#get_all_voltages.
30
+ #
31
+ # .. versionadded:: 2.0.6$nbsp;(Plugin)
32
+ CALLBACK_ALL_VOLTAGES = 17
33
+
24
34
  FUNCTION_GET_VOLTAGE = 1 # :nodoc:
25
35
  FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION = 2 # :nodoc:
26
36
  FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION = 3 # :nodoc:
@@ -33,6 +43,9 @@ module Tinkerforge
33
43
  FUNCTION_GET_CHANNEL_LED_CONFIG = 11 # :nodoc:
34
44
  FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG = 12 # :nodoc:
35
45
  FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG = 13 # :nodoc:
46
+ FUNCTION_GET_ALL_VOLTAGES = 14 # :nodoc:
47
+ FUNCTION_SET_ALL_VOLTAGES_CALLBACK_CONFIGURATION = 15 # :nodoc:
48
+ FUNCTION_GET_ALL_VOLTAGES_CALLBACK_CONFIGURATION = 16 # :nodoc:
36
49
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
37
50
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
38
51
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -84,9 +97,9 @@ module Tinkerforge
84
97
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
85
98
  # the IP Connection <tt>ipcon</tt>.
86
99
  def initialize(uid, ipcon)
87
- super uid, ipcon
100
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
88
101
 
89
- @api_version = [2, 0, 0]
102
+ @api_version = [2, 0, 1]
90
103
 
91
104
  @response_expected[FUNCTION_GET_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
92
105
  @response_expected[FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
@@ -100,6 +113,9 @@ module Tinkerforge
100
113
  @response_expected[FUNCTION_GET_CHANNEL_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
101
114
  @response_expected[FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG] = RESPONSE_EXPECTED_FALSE
102
115
  @response_expected[FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
+ @response_expected[FUNCTION_GET_ALL_VOLTAGES] = RESPONSE_EXPECTED_ALWAYS_TRUE
117
+ @response_expected[FUNCTION_SET_ALL_VOLTAGES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
118
+ @response_expected[FUNCTION_GET_ALL_VOLTAGES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
119
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
104
120
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
121
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -113,8 +129,10 @@ module Tinkerforge
113
129
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
130
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
131
 
116
- @callback_formats[CALLBACK_VOLTAGE] = 'C l'
132
+ @callback_formats[CALLBACK_VOLTAGE] = [13, 'C l']
133
+ @callback_formats[CALLBACK_ALL_VOLTAGES] = [16, 'l2']
117
134
 
135
+ @ipcon.add_device self
118
136
  end
119
137
 
120
138
  # Returns the voltage for the given channel.
@@ -124,7 +142,9 @@ module Tinkerforge
124
142
  # CALLBACK_VOLTAGE callback. You can set the callback configuration
125
143
  # with BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
126
144
  def get_voltage(channel)
127
- send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l'
145
+ check_validity
146
+
147
+ send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 12, 'l'
128
148
  end
129
149
 
130
150
  # The period is the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -153,24 +173,32 @@ module Tinkerforge
153
173
  #
154
174
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
155
175
  def set_voltage_callback_configuration(channel, period, value_has_to_change, option, min, max)
156
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 0, ''
176
+ check_validity
177
+
178
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change, option, min, max], 'C L ? k l l', 8, ''
157
179
  end
158
180
 
159
181
  # Returns the callback configuration as set by BrickletIndustrialDualAnalogInV2#set_voltage_callback_configuration.
160
182
  def get_voltage_callback_configuration(channel)
161
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [channel], 'C', 14, 'L ? k l l'
183
+ check_validity
184
+
185
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_CONFIGURATION, [channel], 'C', 22, 'L ? k l l'
162
186
  end
163
187
 
164
188
  # Sets the sample rate. The sample rate can be between 1 sample per second
165
189
  # and 976 samples per second. Decreasing the sample rate will also decrease the
166
190
  # noise on the data.
167
191
  def set_sample_rate(rate)
168
- send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
192
+ check_validity
193
+
194
+ send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 8, ''
169
195
  end
170
196
 
171
197
  # Returns the sample rate as set by BrickletIndustrialDualAnalogInV2#set_sample_rate.
172
198
  def get_sample_rate
173
- send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
199
+ check_validity
200
+
201
+ send_request FUNCTION_GET_SAMPLE_RATE, [], '', 9, 'C'
174
202
  end
175
203
 
176
204
  # Sets offset and gain of MCP3911 internal calibration registers.
@@ -179,18 +207,24 @@ module Tinkerforge
179
207
  # is already factory calibrated by Tinkerforge. It should not be necessary
180
208
  # for you to use this function
181
209
  def set_calibration(offset, gain)
182
- send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 0, ''
210
+ check_validity
211
+
212
+ send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 8, ''
183
213
  end
184
214
 
185
215
  # Returns the calibration as set by BrickletIndustrialDualAnalogInV2#set_calibration.
186
216
  def get_calibration
187
- send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l2 l2'
217
+ check_validity
218
+
219
+ send_request FUNCTION_GET_CALIBRATION, [], '', 24, 'l2 l2'
188
220
  end
189
221
 
190
222
  # Returns the ADC values as given by the MCP3911 IC. This function
191
223
  # is needed for proper calibration, see BrickletIndustrialDualAnalogInV2#set_calibration.
192
224
  def get_adc_values
193
- send_request FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2'
225
+ check_validity
226
+
227
+ send_request FUNCTION_GET_ADC_VALUES, [], '', 16, 'l2'
194
228
  end
195
229
 
196
230
  # Each channel has a corresponding LED. You can turn the LED off, on or show a
@@ -202,12 +236,16 @@ module Tinkerforge
202
236
  #
203
237
  # By default all channel LEDs are configured as "Channel Status".
204
238
  def set_channel_led_config(channel, config)
205
- send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 0, ''
239
+ check_validity
240
+
241
+ send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
206
242
  end
207
243
 
208
244
  # Returns the channel LED configuration as set by BrickletIndustrialDualAnalogInV2#set_channel_led_config
209
245
  def get_channel_led_config(channel)
210
- send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 1, 'C'
246
+ check_validity
247
+
248
+ send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
211
249
  end
212
250
 
213
251
  # Sets the channel LED status config. This config is used if the channel LED is
@@ -231,13 +269,57 @@ module Tinkerforge
231
269
  # min value is greater than the max value, the LED brightness is scaled the other
232
270
  # way around.
233
271
  def set_channel_led_status_config(channel, min, max, config)
234
- send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 0, ''
272
+ check_validity
273
+
274
+ send_request FUNCTION_SET_CHANNEL_LED_STATUS_CONFIG, [channel, min, max, config], 'C l l C', 8, ''
235
275
  end
236
276
 
237
277
  # Returns the channel LED status configuration as set by
238
278
  # BrickletIndustrialDualAnalogInV2#set_channel_led_status_config.
239
279
  def get_channel_led_status_config(channel)
240
- send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 9, 'l l C'
280
+ check_validity
281
+
282
+ send_request FUNCTION_GET_CHANNEL_LED_STATUS_CONFIG, [channel], 'C', 17, 'l l C'
283
+ end
284
+
285
+ # Returns the voltages for all channels.
286
+ #
287
+ # If you want to get the value periodically, it is recommended to use the
288
+ # CALLBACK_ALL_VOLTAGES callback. You can set the callback configuration
289
+ # with BrickletIndustrialDualAnalogInV2#set_all_voltages_callback_configuration.
290
+ #
291
+ # .. versionadded:: 2.0.6$nbsp;(Plugin)
292
+ def get_all_voltages
293
+ check_validity
294
+
295
+ send_request FUNCTION_GET_ALL_VOLTAGES, [], '', 16, 'l2'
296
+ end
297
+
298
+ # The period is the period with which the CALLBACK_ALL_VOLTAGES
299
+ # callback is triggered periodically. A value of 0 turns the callback off.
300
+ #
301
+ # If the `value has to change`-parameter is set to true, the callback is only
302
+ # triggered after at least one of the values has changed. If the values didn't
303
+ # change within the period, the callback is triggered immediately on change.
304
+ #
305
+ # If it is set to false, the callback is continuously triggered with the period,
306
+ # independent of the value.
307
+ #
308
+ # .. versionadded:: 2.0.6$nbsp;(Plugin)
309
+ def set_all_voltages_callback_configuration(period, value_has_to_change)
310
+ check_validity
311
+
312
+ send_request FUNCTION_SET_ALL_VOLTAGES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
313
+ end
314
+
315
+ # Returns the callback configuration as set by
316
+ # BrickletIndustrialDualAnalogInV2#set_all_voltages_callback_configuration.
317
+ #
318
+ # .. versionadded:: 2.0.6$nbsp;(Plugin)
319
+ def get_all_voltages_callback_configuration
320
+ check_validity
321
+
322
+ send_request FUNCTION_GET_ALL_VOLTAGES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
241
323
  end
242
324
 
243
325
  # Returns the error count for the communication between Brick and Bricklet.
@@ -252,7 +334,9 @@ module Tinkerforge
252
334
  # The errors counts are for errors that occur on the Bricklet side. All
253
335
  # Bricks have a similar function that returns the errors on the Brick side.
254
336
  def get_spitfp_error_count
255
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
337
+ check_validity
338
+
339
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
256
340
  end
257
341
 
258
342
  # Sets the bootloader mode and returns the status after the requested
@@ -265,12 +349,16 @@ module Tinkerforge
265
349
  # This function is used by Brick Viewer during flashing. It should not be
266
350
  # necessary to call it in a normal user program.
267
351
  def set_bootloader_mode(mode)
268
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
352
+ check_validity
353
+
354
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
269
355
  end
270
356
 
271
357
  # Returns the current bootloader mode, see BrickletIndustrialDualAnalogInV2#set_bootloader_mode.
272
358
  def get_bootloader_mode
273
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
359
+ check_validity
360
+
361
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
274
362
  end
275
363
 
276
364
  # Sets the firmware pointer for BrickletIndustrialDualAnalogInV2#write_firmware. The pointer has
@@ -280,7 +368,9 @@ module Tinkerforge
280
368
  # This function is used by Brick Viewer during flashing. It should not be
281
369
  # necessary to call it in a normal user program.
282
370
  def set_write_firmware_pointer(pointer)
283
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
371
+ check_validity
372
+
373
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
284
374
  end
285
375
 
286
376
  # Writes 64 Bytes of firmware at the position as written by
@@ -292,7 +382,9 @@ module Tinkerforge
292
382
  # This function is used by Brick Viewer during flashing. It should not be
293
383
  # necessary to call it in a normal user program.
294
384
  def write_firmware(data)
295
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
385
+ check_validity
386
+
387
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
296
388
  end
297
389
 
298
390
  # Sets the status LED configuration. By default the LED shows
@@ -303,22 +395,28 @@ module Tinkerforge
303
395
  #
304
396
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
305
397
  def set_status_led_config(config)
306
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
398
+ check_validity
399
+
400
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
307
401
  end
308
402
 
309
403
  # Returns the configuration as set by BrickletIndustrialDualAnalogInV2#set_status_led_config
310
404
  def get_status_led_config
311
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
405
+ check_validity
406
+
407
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
312
408
  end
313
409
 
314
- # Returns the temperature in °C as measured inside the microcontroller. The
410
+ # Returns the temperature as measured inside the microcontroller. The
315
411
  # value returned is not the ambient temperature!
316
412
  #
317
413
  # The temperature is only proportional to the real temperature and it has bad
318
414
  # accuracy. Practically it is only useful as an indicator for
319
415
  # temperature changes.
320
416
  def get_chip_temperature
321
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
417
+ check_validity
418
+
419
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
322
420
  end
323
421
 
324
422
  # Calling this function will reset the Bricklet. All configurations
@@ -328,7 +426,9 @@ module Tinkerforge
328
426
  # calling functions on the existing ones will result in
329
427
  # undefined behavior!
330
428
  def reset
331
- send_request FUNCTION_RESET, [], '', 0, ''
429
+ check_validity
430
+
431
+ send_request FUNCTION_RESET, [], '', 8, ''
332
432
  end
333
433
 
334
434
  # Writes a new UID into flash. If you want to set a new UID
@@ -337,25 +437,31 @@ module Tinkerforge
337
437
  #
338
438
  # We recommend that you use Brick Viewer to change the UID.
339
439
  def write_uid(uid)
340
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
440
+ check_validity
441
+
442
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
341
443
  end
342
444
 
343
445
  # Returns the current UID as an integer. Encode as
344
446
  # Base58 to get the usual string version.
345
447
  def read_uid
346
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
448
+ check_validity
449
+
450
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
347
451
  end
348
452
 
349
453
  # Returns the UID, the UID where the Bricklet is connected to,
350
454
  # the position, the hardware and firmware version as well as the
351
455
  # device identifier.
352
456
  #
353
- # The position can be 'a', 'b', 'c' or 'd'.
457
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
458
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
459
+ # position 'z'.
354
460
  #
355
461
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
356
462
  # |device_identifier_constant|
357
463
  def get_identity
358
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
464
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
359
465
  end
360
466
 
361
467
  # 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
  # Two relays to switch AC/DC devices
14
16
  class BrickletIndustrialDualRelay < Device
@@ -57,7 +59,7 @@ module Tinkerforge
57
59
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
58
60
  # the IP Connection <tt>ipcon</tt>.
59
61
  def initialize(uid, ipcon)
60
- super uid, ipcon
62
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
61
63
 
62
64
  @api_version = [2, 0, 0]
63
65
 
@@ -79,8 +81,9 @@ module Tinkerforge
79
81
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
80
82
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
83
 
82
- @callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
84
+ @callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
83
85
 
86
+ @ipcon.add_device self
84
87
  end
85
88
 
86
89
  # Sets the state of the relays, *true* means on and *false* means off.
@@ -92,12 +95,16 @@ module Tinkerforge
92
95
  #
93
96
  # All running monoflop timers will be aborted if this function is called.
94
97
  def set_value(channel0, channel1)
95
- send_request FUNCTION_SET_VALUE, [channel0, channel1], '? ?', 0, ''
98
+ check_validity
99
+
100
+ send_request FUNCTION_SET_VALUE, [channel0, channel1], '? ?', 8, ''
96
101
  end
97
102
 
98
103
  # Returns the state of the relays, *true* means on and *false* means off.
99
104
  def get_value
100
- send_request FUNCTION_GET_VALUE, [], '', 2, '? ?'
105
+ check_validity
106
+
107
+ send_request FUNCTION_GET_VALUE, [], '', 10, '? ?'
101
108
  end
102
109
 
103
110
  # The first parameter can be 0 or 1 (relay 0 or relay 1). The second parameter
@@ -114,7 +121,9 @@ module Tinkerforge
114
121
  # of two seconds. The relay will be on all the time. If now the RS485
115
122
  # connection is lost, the relay will turn off in at most two seconds.
116
123
  def set_monoflop(channel, value, time)
117
- send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 0, ''
124
+ check_validity
125
+
126
+ send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
118
127
  end
119
128
 
120
129
  # Returns (for the given relay) the current state and the time as set by
@@ -123,7 +132,9 @@ module Tinkerforge
123
132
  # If the timer is not running currently, the remaining time will be returned
124
133
  # as 0.
125
134
  def get_monoflop(channel)
126
- send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 9, '? L L'
135
+ check_validity
136
+
137
+ send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
127
138
  end
128
139
 
129
140
  # Sets the state of the selected relay, *true* means on and *false*
@@ -134,7 +145,9 @@ module Tinkerforge
134
145
  #
135
146
  # The other relay remains untouched.
136
147
  def set_selected_value(channel, value)
137
- send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 0, ''
148
+ check_validity
149
+
150
+ send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
138
151
  end
139
152
 
140
153
  # Returns the error count for the communication between Brick and Bricklet.
@@ -149,7 +162,9 @@ module Tinkerforge
149
162
  # The errors counts are for errors that occur on the Bricklet side. All
150
163
  # Bricks have a similar function that returns the errors on the Brick side.
151
164
  def get_spitfp_error_count
152
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
165
+ check_validity
166
+
167
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
153
168
  end
154
169
 
155
170
  # Sets the bootloader mode and returns the status after the requested
@@ -162,12 +177,16 @@ module Tinkerforge
162
177
  # This function is used by Brick Viewer during flashing. It should not be
163
178
  # necessary to call it in a normal user program.
164
179
  def set_bootloader_mode(mode)
165
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
166
183
  end
167
184
 
168
185
  # Returns the current bootloader mode, see BrickletIndustrialDualRelay#set_bootloader_mode.
169
186
  def get_bootloader_mode
170
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
171
190
  end
172
191
 
173
192
  # Sets the firmware pointer for BrickletIndustrialDualRelay#write_firmware. The pointer has
@@ -177,7 +196,9 @@ module Tinkerforge
177
196
  # This function is used by Brick Viewer during flashing. It should not be
178
197
  # necessary to call it in a normal user program.
179
198
  def set_write_firmware_pointer(pointer)
180
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
199
+ check_validity
200
+
201
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
181
202
  end
182
203
 
183
204
  # Writes 64 Bytes of firmware at the position as written by
@@ -189,7 +210,9 @@ module Tinkerforge
189
210
  # This function is used by Brick Viewer during flashing. It should not be
190
211
  # necessary to call it in a normal user program.
191
212
  def write_firmware(data)
192
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
213
+ check_validity
214
+
215
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
193
216
  end
194
217
 
195
218
  # Sets the status LED configuration. By default the LED shows
@@ -200,22 +223,28 @@ module Tinkerforge
200
223
  #
201
224
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
202
225
  def set_status_led_config(config)
203
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
226
+ check_validity
227
+
228
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
204
229
  end
205
230
 
206
231
  # Returns the configuration as set by BrickletIndustrialDualRelay#set_status_led_config
207
232
  def get_status_led_config
208
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
233
+ check_validity
234
+
235
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
209
236
  end
210
237
 
211
- # Returns the temperature in °C as measured inside the microcontroller. The
238
+ # Returns the temperature as measured inside the microcontroller. The
212
239
  # value returned is not the ambient temperature!
213
240
  #
214
241
  # The temperature is only proportional to the real temperature and it has bad
215
242
  # accuracy. Practically it is only useful as an indicator for
216
243
  # temperature changes.
217
244
  def get_chip_temperature
218
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
245
+ check_validity
246
+
247
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
219
248
  end
220
249
 
221
250
  # Calling this function will reset the Bricklet. All configurations
@@ -225,7 +254,9 @@ module Tinkerforge
225
254
  # calling functions on the existing ones will result in
226
255
  # undefined behavior!
227
256
  def reset
228
- send_request FUNCTION_RESET, [], '', 0, ''
257
+ check_validity
258
+
259
+ send_request FUNCTION_RESET, [], '', 8, ''
229
260
  end
230
261
 
231
262
  # Writes a new UID into flash. If you want to set a new UID
@@ -234,25 +265,31 @@ module Tinkerforge
234
265
  #
235
266
  # We recommend that you use Brick Viewer to change the UID.
236
267
  def write_uid(uid)
237
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
268
+ check_validity
269
+
270
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
238
271
  end
239
272
 
240
273
  # Returns the current UID as an integer. Encode as
241
274
  # Base58 to get the usual string version.
242
275
  def read_uid
243
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
276
+ check_validity
277
+
278
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
244
279
  end
245
280
 
246
281
  # Returns the UID, the UID where the Bricklet is connected to,
247
282
  # the position, the hardware and firmware version as well as the
248
283
  # device identifier.
249
284
  #
250
- # The position can be 'a', 'b', 'c' or 'd'.
285
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
286
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
287
+ # position 'z'.
251
288
  #
252
289
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
253
290
  # |device_identifier_constant|
254
291
  def get_identity
255
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
292
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
256
293
  end
257
294
 
258
295
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.