tinkerforge 2.1.23 → 2.1.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +109 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +191 -86
  6. data/lib/tinkerforge/brick_imu_v2.rb +219 -118
  7. data/lib/tinkerforge/brick_master.rb +495 -195
  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 +248 -168
  11. data/lib/tinkerforge/brick_stepper.rb +212 -100
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +75 -47
  31. data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
  32. data/lib/tinkerforge/bricklet_compass.rb +81 -40
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +68 -33
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +81 -40
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +99 -51
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -39
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +75 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_performance_dc.rb +676 -0
  102. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  103. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  104. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  105. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  106. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  107. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  108. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  109. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  110. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  111. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  112. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  113. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  114. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  115. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  116. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  117. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  118. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
  119. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  120. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  121. data/lib/tinkerforge/bricklet_rs485.rb +250 -164
  122. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  123. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  124. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  125. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  126. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  127. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  128. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  129. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  130. data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
  131. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
  132. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  133. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  134. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  135. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  136. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  137. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  138. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  139. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  140. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  141. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
  142. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
  143. data/lib/tinkerforge/device_display_names.rb +167 -0
  144. data/lib/tinkerforge/ip_connection.rb +156 -33
  145. data/lib/tinkerforge/version.rb +1 -1
  146. metadata +8 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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 DC voltage between 0V and 45V
14
16
  class BrickletAnalogIn < Device
@@ -80,7 +82,7 @@ module Tinkerforge
80
82
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
81
83
  # the IP Connection <tt>ipcon</tt>.
82
84
  def initialize(uid, ipcon)
83
- super uid, ipcon
85
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
84
86
 
85
87
  @api_version = [2, 0, 3]
86
88
 
@@ -102,26 +104,27 @@ module Tinkerforge
102
104
  @response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
103
105
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
104
106
 
105
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
106
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
107
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
108
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
107
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
108
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
109
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [10, 'S']
110
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
109
111
 
112
+ @ipcon.add_device self
110
113
  end
111
114
 
112
- # Returns the voltage of the sensor. The value is in mV and
113
- # between 0V and 45V. The resolution between 0 and 6V is about 2mV.
115
+ # Returns the voltage of the sensor. The resolution between 0 and 6V is about 2mV.
114
116
  # Between 6 and 45V the resolution is about 10mV.
115
117
  #
116
118
  # If you want to get the voltage periodically, it is recommended to use the
117
119
  # CALLBACK_VOLTAGE callback and set the period with
118
120
  # BrickletAnalogIn#set_voltage_callback_period.
119
121
  def get_voltage
120
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
121
125
  end
122
126
 
123
127
  # Returns the value as read by a 12-bit analog-to-digital converter.
124
- # The value is between 0 and 4095.
125
128
  #
126
129
  # .. note::
127
130
  # The value returned by BrickletAnalogIn#get_voltage is averaged over several samples
@@ -133,39 +136,45 @@ module Tinkerforge
133
136
  # CALLBACK_ANALOG_VALUE callback and set the period with
134
137
  # BrickletAnalogIn#set_analog_value_callback_period.
135
138
  def get_analog_value
136
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
139
+ check_validity
140
+
141
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
137
142
  end
138
143
 
139
- # Sets the period in ms with which the CALLBACK_VOLTAGE callback is triggered
144
+ # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
140
145
  # periodically. A value of 0 turns the callback off.
141
146
  #
142
147
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since
143
148
  # the last triggering.
144
- #
145
- # The default value is 0.
146
149
  def set_voltage_callback_period(period)
147
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
150
+ check_validity
151
+
152
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
148
153
  end
149
154
 
150
155
  # Returns the period as set by BrickletAnalogIn#set_voltage_callback_period.
151
156
  def get_voltage_callback_period
152
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
157
+ check_validity
158
+
159
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
153
160
  end
154
161
 
155
- # Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
162
+ # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
156
163
  # periodically. A value of 0 turns the callback off.
157
164
  #
158
165
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
159
166
  # changed since the last triggering.
160
- #
161
- # The default value is 0.
162
167
  def set_analog_value_callback_period(period)
163
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
164
171
  end
165
172
 
166
173
  # Returns the period as set by BrickletAnalogIn#set_analog_value_callback_period.
167
174
  def get_analog_value_callback_period
168
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
175
+ check_validity
176
+
177
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
169
178
  end
170
179
 
171
180
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
@@ -179,15 +188,17 @@ module Tinkerforge
179
188
  # "'i'", "Callback is triggered when the voltage is *inside* the min and max values"
180
189
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
181
190
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
182
- #
183
- # The default value is ('x', 0, 0).
184
191
  def set_voltage_callback_threshold(option, min, max)
185
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
192
+ check_validity
193
+
194
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
186
195
  end
187
196
 
188
197
  # Returns the threshold as set by BrickletAnalogIn#set_voltage_callback_threshold.
189
198
  def get_voltage_callback_threshold
190
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
199
+ check_validity
200
+
201
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
191
202
  end
192
203
 
193
204
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -201,18 +212,20 @@ module Tinkerforge
201
212
  # "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
202
213
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
203
214
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
204
- #
205
- # The default value is ('x', 0, 0).
206
215
  def set_analog_value_callback_threshold(option, min, max)
207
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
216
+ check_validity
217
+
218
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
208
219
  end
209
220
 
210
221
  # Returns the threshold as set by BrickletAnalogIn#set_analog_value_callback_threshold.
211
222
  def get_analog_value_callback_threshold
212
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
223
+ check_validity
224
+
225
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
213
226
  end
214
227
 
215
- # Sets the period in ms with which the threshold callbacks
228
+ # Sets the period with which the threshold callbacks
216
229
  #
217
230
  # * CALLBACK_VOLTAGE_REACHED,
218
231
  # * CALLBACK_ANALOG_VALUE_REACHED
@@ -223,15 +236,17 @@ module Tinkerforge
223
236
  # * BrickletAnalogIn#set_analog_value_callback_threshold
224
237
  #
225
238
  # keep being reached.
226
- #
227
- # The default value is 100.
228
239
  def set_debounce_period(debounce)
229
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
240
+ check_validity
241
+
242
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
230
243
  end
231
244
 
232
245
  # Returns the debounce period as set by BrickletAnalogIn#set_debounce_period.
233
246
  def get_debounce_period
234
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
247
+ check_validity
248
+
249
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
235
250
  end
236
251
 
237
252
  # Sets the measurement range. Possible ranges:
@@ -243,18 +258,20 @@ module Tinkerforge
243
258
  # * 4: 0V - 45.00V, ~11.25mV resolution
244
259
  # * 5: 0V - 3.3V, ~0.81mV resolution, new in version 2.0.3$nbsp;(Plugin)
245
260
  #
246
- # The default measurement range is 0.
247
- #
248
261
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
249
262
  def set_range(range)
250
- send_request FUNCTION_SET_RANGE, [range], 'C', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_SET_RANGE, [range], 'C', 8, ''
251
266
  end
252
267
 
253
268
  # Returns the measurement range as set by BrickletAnalogIn#set_range.
254
269
  #
255
270
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
256
271
  def get_range
257
- send_request FUNCTION_GET_RANGE, [], '', 1, 'C'
272
+ check_validity
273
+
274
+ send_request FUNCTION_GET_RANGE, [], '', 9, 'C'
258
275
  end
259
276
 
260
277
  # Set the length of a averaging for the voltage value.
@@ -263,30 +280,34 @@ module Tinkerforge
263
280
  # averaging is off, there is more noise on the data, but the data is without
264
281
  # delay.
265
282
  #
266
- # The default value is 50.
267
- #
268
283
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
269
284
  def set_averaging(average)
270
- send_request FUNCTION_SET_AVERAGING, [average], 'C', 0, ''
285
+ check_validity
286
+
287
+ send_request FUNCTION_SET_AVERAGING, [average], 'C', 8, ''
271
288
  end
272
289
 
273
290
  # Returns the averaging configuration as set by BrickletAnalogIn#set_averaging.
274
291
  #
275
292
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
276
293
  def get_averaging
277
- send_request FUNCTION_GET_AVERAGING, [], '', 1, 'C'
294
+ check_validity
295
+
296
+ send_request FUNCTION_GET_AVERAGING, [], '', 9, 'C'
278
297
  end
279
298
 
280
299
  # Returns the UID, the UID where the Bricklet is connected to,
281
300
  # the position, the hardware and firmware version as well as the
282
301
  # device identifier.
283
302
  #
284
- # The position can be 'a', 'b', 'c' or 'd'.
303
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
304
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
305
+ # position 'z'.
285
306
  #
286
307
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
287
308
  # |device_identifier_constant|
288
309
  def get_identity
289
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
310
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
290
311
  end
291
312
 
292
313
  # 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-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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 DC voltage between 0V and 42V
14
16
  class BrickletAnalogInV2 < Device
@@ -72,7 +74,7 @@ module Tinkerforge
72
74
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
73
75
  # the IP Connection <tt>ipcon</tt>.
74
76
  def initialize(uid, ipcon)
75
- super uid, ipcon
77
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
76
78
 
77
79
  @api_version = [2, 0, 1]
78
80
 
@@ -92,63 +94,70 @@ module Tinkerforge
92
94
  @response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
93
95
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
94
96
 
95
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
96
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
97
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
98
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
97
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
98
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
99
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [10, 'S']
100
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
99
101
 
102
+ @ipcon.add_device self
100
103
  end
101
104
 
102
- # Returns the measured voltage. The value is in mV and
103
- # between 0V and 42V. The resolution is approximately 10mV.
105
+ # Returns the measured voltage. The resolution is approximately 10mV.
104
106
  #
105
107
  # If you want to get the voltage periodically, it is recommended to use the
106
108
  # CALLBACK_VOLTAGE callback and set the period with
107
109
  # BrickletAnalogInV2#set_voltage_callback_period.
108
110
  def get_voltage
109
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
111
+ check_validity
112
+
113
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
110
114
  end
111
115
 
112
116
  # Returns the value as read by a 12-bit analog-to-digital converter.
113
- # The value is between 0 and 4095.
114
117
  #
115
118
  # If you want the analog value periodically, it is recommended to use the
116
119
  # CALLBACK_ANALOG_VALUE callback and set the period with
117
120
  # BrickletAnalogInV2#set_analog_value_callback_period.
118
121
  def get_analog_value
119
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
120
125
  end
121
126
 
122
- # Sets the period in ms with which the CALLBACK_VOLTAGE callback is triggered
127
+ # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
123
128
  # periodically. A value of 0 turns the callback off.
124
129
  #
125
130
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since
126
131
  # the last triggering.
127
- #
128
- # The default value is 0.
129
132
  def set_voltage_callback_period(period)
130
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
133
+ check_validity
134
+
135
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
131
136
  end
132
137
 
133
138
  # Returns the period as set by BrickletAnalogInV2#set_voltage_callback_period.
134
139
  def get_voltage_callback_period
135
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
140
+ check_validity
141
+
142
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
136
143
  end
137
144
 
138
- # Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
145
+ # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
139
146
  # periodically. A value of 0 turns the callback off.
140
147
  #
141
148
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
142
149
  # changed since the last triggering.
143
- #
144
- # The default value is 0.
145
150
  def set_analog_value_callback_period(period)
146
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
151
+ check_validity
152
+
153
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
147
154
  end
148
155
 
149
156
  # Returns the period as set by BrickletAnalogInV2#set_analog_value_callback_period.
150
157
  def get_analog_value_callback_period
151
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
158
+ check_validity
159
+
160
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
152
161
  end
153
162
 
154
163
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
@@ -162,15 +171,17 @@ module Tinkerforge
162
171
  # "'i'", "Callback is triggered when the voltage is *inside* the min and max values"
163
172
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
164
173
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
165
- #
166
- # The default value is ('x', 0, 0).
167
174
  def set_voltage_callback_threshold(option, min, max)
168
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
175
+ check_validity
176
+
177
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
169
178
  end
170
179
 
171
180
  # Returns the threshold as set by BrickletAnalogInV2#set_voltage_callback_threshold.
172
181
  def get_voltage_callback_threshold
173
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
182
+ check_validity
183
+
184
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
174
185
  end
175
186
 
176
187
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -184,18 +195,20 @@ module Tinkerforge
184
195
  # "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
185
196
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
186
197
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
187
- #
188
- # The default value is ('x', 0, 0).
189
198
  def set_analog_value_callback_threshold(option, min, max)
190
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
199
+ check_validity
200
+
201
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
191
202
  end
192
203
 
193
204
  # Returns the threshold as set by BrickletAnalogInV2#set_analog_value_callback_threshold.
194
205
  def get_analog_value_callback_threshold
195
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
206
+ check_validity
207
+
208
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
196
209
  end
197
210
 
198
- # Sets the period in ms with which the threshold callbacks
211
+ # Sets the period with which the threshold callbacks
199
212
  #
200
213
  # * CALLBACK_VOLTAGE_REACHED,
201
214
  # * CALLBACK_ANALOG_VALUE_REACHED
@@ -206,15 +219,17 @@ module Tinkerforge
206
219
  # * BrickletAnalogInV2#set_analog_value_callback_threshold
207
220
  #
208
221
  # keep being reached.
209
- #
210
- # The default value is 100.
211
222
  def set_debounce_period(debounce)
212
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
223
+ check_validity
224
+
225
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
213
226
  end
214
227
 
215
228
  # Returns the debounce period as set by BrickletAnalogInV2#set_debounce_period.
216
229
  def get_debounce_period
217
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
230
+ check_validity
231
+
232
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
218
233
  end
219
234
 
220
235
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -222,29 +237,31 @@ module Tinkerforge
222
237
  #
223
238
  # Setting the length to 1 will turn the averaging off. With less
224
239
  # averaging, there is more noise on the data.
225
- #
226
- # The range for the averaging is 1-50.
227
- #
228
- # The default value is 50.
229
240
  def set_moving_average(average)
230
- send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
241
+ check_validity
242
+
243
+ send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 8, ''
231
244
  end
232
245
 
233
246
  # Returns the length of the moving average as set by BrickletAnalogInV2#set_moving_average.
234
247
  def get_moving_average
235
- send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
248
+ check_validity
249
+
250
+ send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 9, 'C'
236
251
  end
237
252
 
238
253
  # Returns the UID, the UID where the Bricklet is connected to,
239
254
  # the position, the hardware and firmware version as well as the
240
255
  # device identifier.
241
256
  #
242
- # The position can be 'a', 'b', 'c' or 'd'.
257
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
258
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
259
+ # position 'z'.
243
260
  #
244
261
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
245
262
  # |device_identifier_constant|
246
263
  def get_identity
247
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
264
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
248
265
  end
249
266
 
250
267
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.