tinkerforge 2.1.24 → 2.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 CO2 concentration, temperature and humidity
14
16
  class BrickletCO2V2 < Device
@@ -96,7 +98,7 @@ module Tinkerforge
96
98
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
97
99
  # the IP Connection <tt>ipcon</tt>.
98
100
  def initialize(uid, ipcon)
99
- super uid, ipcon
101
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
100
102
 
101
103
  @api_version = [2, 0, 0]
102
104
 
@@ -129,11 +131,12 @@ module Tinkerforge
129
131
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
130
132
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
133
 
132
- @callback_formats[CALLBACK_ALL_VALUES] = 'S s S'
133
- @callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
134
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
135
- @callback_formats[CALLBACK_HUMIDITY] = 'S'
134
+ @callback_formats[CALLBACK_ALL_VALUES] = [14, 'S s S']
135
+ @callback_formats[CALLBACK_CO2_CONCENTRATION] = [10, 'S']
136
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
137
+ @callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
136
138
 
139
+ @ipcon.add_device self
137
140
  end
138
141
 
139
142
  # Returns all values measured by the CO2 Bricklet 2.0.
@@ -146,10 +149,12 @@ module Tinkerforge
146
149
  # The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
147
150
  # Exposing the Bricklet to higher temperatures might result in permanent damage.
148
151
  def get_all_values
149
- send_request FUNCTION_GET_ALL_VALUES, [], '', 6, 'S s S'
152
+ check_validity
153
+
154
+ send_request FUNCTION_GET_ALL_VALUES, [], '', 14, 'S s S'
150
155
  end
151
156
 
152
- # The CO2 concentration (among other things) depends on the ambient air pressure.
157
+ # The CO2 concentration depends (among other things) on the ambient air pressure.
153
158
  #
154
159
  # To increase the accuracy of the CO2 Bricklet 2.0 you can set the current air pressure.
155
160
  # You use the :ref:`Barometer Bricklet 2.0 <barometer_v2_bricklet>` or the
@@ -161,12 +166,16 @@ module Tinkerforge
161
166
  #
162
167
  # It is sufficient to update the value every few minutes.
163
168
  def set_air_pressure(air_pressure)
164
- send_request FUNCTION_SET_AIR_PRESSURE, [air_pressure], 'S', 0, ''
169
+ check_validity
170
+
171
+ send_request FUNCTION_SET_AIR_PRESSURE, [air_pressure], 'S', 8, ''
165
172
  end
166
173
 
167
174
  # Returns the ambient air pressure as set by BrickletCO2V2#set_air_pressure.
168
175
  def get_air_pressure
169
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 2, 'S'
176
+ check_validity
177
+
178
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 10, 'S'
170
179
  end
171
180
 
172
181
  # Sets a temperature offset. A offset of 10 will decrease
@@ -188,13 +197,17 @@ module Tinkerforge
188
197
  # It is sufficient to set the temperature offset once. The offset is saved in
189
198
  # non-volatile memory and is applied again after a power loss.
190
199
  def set_temperature_offset(offset)
191
- send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'S', 0, ''
200
+ check_validity
201
+
202
+ send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'S', 8, ''
192
203
  end
193
204
 
194
205
  # Returns the temperature offset as set by
195
206
  # BrickletCO2V2#set_temperature_offset.
196
207
  def get_temperature_offset
197
- send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 2, 'S'
208
+ check_validity
209
+
210
+ send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 10, 'S'
198
211
  end
199
212
 
200
213
  # The period is the period with which the CALLBACK_ALL_VALUES
@@ -207,13 +220,17 @@ module Tinkerforge
207
220
  # If it is set to false, the callback is continuously triggered with the period,
208
221
  # independent of the value.
209
222
  def set_all_values_callback_configuration(period, value_has_to_change)
210
- send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
223
+ check_validity
224
+
225
+ send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
211
226
  end
212
227
 
213
228
  # Returns the callback configuration as set by
214
229
  # BrickletCO2V2#set_all_values_callback_configuration.
215
230
  def get_all_values_callback_configuration
216
- send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
231
+ check_validity
232
+
233
+ send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
217
234
  end
218
235
 
219
236
  # Returns CO2 concentration.
@@ -223,7 +240,9 @@ module Tinkerforge
223
240
  # CALLBACK_CO2_CONCENTRATION callback. You can set the callback configuration
224
241
  # with BrickletCO2V2#set_co2_concentration_callback_configuration.
225
242
  def get_co2_concentration
226
- send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 2, 'S'
243
+ check_validity
244
+
245
+ send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 10, 'S'
227
246
  end
228
247
 
229
248
  # The period is the period with which the CALLBACK_CO2_CONCENTRATION callback is triggered
@@ -252,12 +271,16 @@ module Tinkerforge
252
271
  #
253
272
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
254
273
  def set_co2_concentration_callback_configuration(period, value_has_to_change, option, min, max)
255
- send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
274
+ check_validity
275
+
276
+ send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
256
277
  end
257
278
 
258
279
  # Returns the callback configuration as set by BrickletCO2V2#set_co2_concentration_callback_configuration.
259
280
  def get_co2_concentration_callback_configuration
260
- send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
281
+ check_validity
282
+
283
+ send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
261
284
  end
262
285
 
263
286
  # Returns temperature.
@@ -271,7 +294,9 @@ module Tinkerforge
271
294
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
272
295
  # with BrickletCO2V2#set_temperature_callback_configuration.
273
296
  def get_temperature
274
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
297
+ check_validity
298
+
299
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
275
300
  end
276
301
 
277
302
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -300,12 +325,16 @@ module Tinkerforge
300
325
  #
301
326
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
302
327
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
303
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
328
+ check_validity
329
+
330
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
304
331
  end
305
332
 
306
333
  # Returns the callback configuration as set by BrickletCO2V2#set_temperature_callback_configuration.
307
334
  def get_temperature_callback_configuration
308
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
335
+ check_validity
336
+
337
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
309
338
  end
310
339
 
311
340
  # Returns relative humidity.
@@ -315,7 +344,9 @@ module Tinkerforge
315
344
  # CALLBACK_HUMIDITY callback. You can set the callback configuration
316
345
  # with BrickletCO2V2#set_humidity_callback_configuration.
317
346
  def get_humidity
318
- send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
347
+ check_validity
348
+
349
+ send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
319
350
  end
320
351
 
321
352
  # The period is the period with which the CALLBACK_HUMIDITY callback is triggered
@@ -344,12 +375,16 @@ module Tinkerforge
344
375
  #
345
376
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
346
377
  def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
347
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
378
+ check_validity
379
+
380
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
348
381
  end
349
382
 
350
383
  # Returns the callback configuration as set by BrickletCO2V2#set_humidity_callback_configuration.
351
384
  def get_humidity_callback_configuration
352
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
385
+ check_validity
386
+
387
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
353
388
  end
354
389
 
355
390
  # Returns the error count for the communication between Brick and Bricklet.
@@ -364,7 +399,9 @@ module Tinkerforge
364
399
  # The errors counts are for errors that occur on the Bricklet side. All
365
400
  # Bricks have a similar function that returns the errors on the Brick side.
366
401
  def get_spitfp_error_count
367
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
402
+ check_validity
403
+
404
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
368
405
  end
369
406
 
370
407
  # Sets the bootloader mode and returns the status after the requested
@@ -377,12 +414,16 @@ module Tinkerforge
377
414
  # This function is used by Brick Viewer during flashing. It should not be
378
415
  # necessary to call it in a normal user program.
379
416
  def set_bootloader_mode(mode)
380
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
417
+ check_validity
418
+
419
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
381
420
  end
382
421
 
383
422
  # Returns the current bootloader mode, see BrickletCO2V2#set_bootloader_mode.
384
423
  def get_bootloader_mode
385
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
424
+ check_validity
425
+
426
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
386
427
  end
387
428
 
388
429
  # Sets the firmware pointer for BrickletCO2V2#write_firmware. The pointer has
@@ -392,7 +433,9 @@ module Tinkerforge
392
433
  # This function is used by Brick Viewer during flashing. It should not be
393
434
  # necessary to call it in a normal user program.
394
435
  def set_write_firmware_pointer(pointer)
395
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
436
+ check_validity
437
+
438
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
396
439
  end
397
440
 
398
441
  # Writes 64 Bytes of firmware at the position as written by
@@ -404,7 +447,9 @@ module Tinkerforge
404
447
  # This function is used by Brick Viewer during flashing. It should not be
405
448
  # necessary to call it in a normal user program.
406
449
  def write_firmware(data)
407
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
450
+ check_validity
451
+
452
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
408
453
  end
409
454
 
410
455
  # Sets the status LED configuration. By default the LED shows
@@ -415,22 +460,28 @@ module Tinkerforge
415
460
  #
416
461
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
417
462
  def set_status_led_config(config)
418
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
463
+ check_validity
464
+
465
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
419
466
  end
420
467
 
421
468
  # Returns the configuration as set by BrickletCO2V2#set_status_led_config
422
469
  def get_status_led_config
423
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
470
+ check_validity
471
+
472
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
424
473
  end
425
474
 
426
- # Returns the temperature in °C as measured inside the microcontroller. The
475
+ # Returns the temperature as measured inside the microcontroller. The
427
476
  # value returned is not the ambient temperature!
428
477
  #
429
478
  # The temperature is only proportional to the real temperature and it has bad
430
479
  # accuracy. Practically it is only useful as an indicator for
431
480
  # temperature changes.
432
481
  def get_chip_temperature
433
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
482
+ check_validity
483
+
484
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
434
485
  end
435
486
 
436
487
  # Calling this function will reset the Bricklet. All configurations
@@ -440,7 +491,9 @@ module Tinkerforge
440
491
  # calling functions on the existing ones will result in
441
492
  # undefined behavior!
442
493
  def reset
443
- send_request FUNCTION_RESET, [], '', 0, ''
494
+ check_validity
495
+
496
+ send_request FUNCTION_RESET, [], '', 8, ''
444
497
  end
445
498
 
446
499
  # Writes a new UID into flash. If you want to set a new UID
@@ -449,25 +502,31 @@ module Tinkerforge
449
502
  #
450
503
  # We recommend that you use Brick Viewer to change the UID.
451
504
  def write_uid(uid)
452
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
505
+ check_validity
506
+
507
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
453
508
  end
454
509
 
455
510
  # Returns the current UID as an integer. Encode as
456
511
  # Base58 to get the usual string version.
457
512
  def read_uid
458
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
513
+ check_validity
514
+
515
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
459
516
  end
460
517
 
461
518
  # Returns the UID, the UID where the Bricklet is connected to,
462
519
  # the position, the hardware and firmware version as well as the
463
520
  # device identifier.
464
521
  #
465
- # The position can be 'a', 'b', 'c' or 'd'.
522
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
523
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
524
+ # position 'z'.
466
525
  #
467
526
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
468
527
  # |device_identifier_constant|
469
528
  def get_identity
470
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
529
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
471
530
  end
472
531
 
473
532
  # 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 color (RGB value), illuminance and color temperature
14
16
  class BrickletColor < Device
@@ -88,7 +90,7 @@ module Tinkerforge
88
90
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
89
91
  # the IP Connection <tt>ipcon</tt>.
90
92
  def initialize(uid, ipcon)
91
- super uid, ipcon
93
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
92
94
 
93
95
  @api_version = [2, 0, 0]
94
96
 
@@ -112,11 +114,12 @@ module Tinkerforge
112
114
  @response_expected[FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
113
115
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
116
 
115
- @callback_formats[CALLBACK_COLOR] = 'S S S S'
116
- @callback_formats[CALLBACK_COLOR_REACHED] = 'S S S S'
117
- @callback_formats[CALLBACK_ILLUMINANCE] = 'L'
118
- @callback_formats[CALLBACK_COLOR_TEMPERATURE] = 'S'
117
+ @callback_formats[CALLBACK_COLOR] = [16, 'S S S S']
118
+ @callback_formats[CALLBACK_COLOR_REACHED] = [16, 'S S S S']
119
+ @callback_formats[CALLBACK_ILLUMINANCE] = [12, 'L']
120
+ @callback_formats[CALLBACK_COLOR_TEMPERATURE] = [10, 'S']
119
121
 
122
+ @ipcon.add_device self
120
123
  end
121
124
 
122
125
  # Returns the measured color of the sensor.
@@ -135,7 +138,9 @@ module Tinkerforge
135
138
  # to use the CALLBACK_COLOR callback and set the period with
136
139
  # BrickletColor#set_color_callback_period.
137
140
  def get_color
138
- send_request FUNCTION_GET_COLOR, [], '', 8, 'S S S S'
141
+ check_validity
142
+
143
+ send_request FUNCTION_GET_COLOR, [], '', 16, 'S S S S'
139
144
  end
140
145
 
141
146
  # Sets the period with which the CALLBACK_COLOR callback is triggered
@@ -144,12 +149,16 @@ module Tinkerforge
144
149
  # The CALLBACK_COLOR callback is only triggered if the color has changed since the
145
150
  # last triggering.
146
151
  def set_color_callback_period(period)
147
- send_request FUNCTION_SET_COLOR_CALLBACK_PERIOD, [period], 'L', 0, ''
152
+ check_validity
153
+
154
+ send_request FUNCTION_SET_COLOR_CALLBACK_PERIOD, [period], 'L', 8, ''
148
155
  end
149
156
 
150
157
  # Returns the period as set by BrickletColor#set_color_callback_period.
151
158
  def get_color_callback_period
152
- send_request FUNCTION_GET_COLOR_CALLBACK_PERIOD, [], '', 4, 'L'
159
+ check_validity
160
+
161
+ send_request FUNCTION_GET_COLOR_CALLBACK_PERIOD, [], '', 12, 'L'
153
162
  end
154
163
 
155
164
  # Sets the thresholds for the CALLBACK_COLOR_REACHED callback.
@@ -164,12 +173,16 @@ module Tinkerforge
164
173
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
165
174
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
166
175
  def set_color_callback_threshold(option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c)
167
- send_request FUNCTION_SET_COLOR_CALLBACK_THRESHOLD, [option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c], 'k S S S S S S S S', 0, ''
176
+ check_validity
177
+
178
+ send_request FUNCTION_SET_COLOR_CALLBACK_THRESHOLD, [option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c], 'k S S S S S S S S', 8, ''
168
179
  end
169
180
 
170
181
  # Returns the threshold as set by BrickletColor#set_color_callback_threshold.
171
182
  def get_color_callback_threshold
172
- send_request FUNCTION_GET_COLOR_CALLBACK_THRESHOLD, [], '', 17, 'k S S S S S S S S'
183
+ check_validity
184
+
185
+ send_request FUNCTION_GET_COLOR_CALLBACK_THRESHOLD, [], '', 25, 'k S S S S S S S S'
173
186
  end
174
187
 
175
188
  # Sets the period with which the threshold callback
@@ -182,22 +195,30 @@ module Tinkerforge
182
195
  #
183
196
  # keeps being reached.
184
197
  def set_debounce_period(debounce)
185
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
198
+ check_validity
199
+
200
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
186
201
  end
187
202
 
188
203
  # Returns the debounce period as set by BrickletColor#set_debounce_period.
189
204
  def get_debounce_period
190
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
205
+ check_validity
206
+
207
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
191
208
  end
192
209
 
193
210
  # Turns the LED on.
194
211
  def light_on
195
- send_request FUNCTION_LIGHT_ON, [], '', 0, ''
212
+ check_validity
213
+
214
+ send_request FUNCTION_LIGHT_ON, [], '', 8, ''
196
215
  end
197
216
 
198
217
  # Turns the LED off.
199
218
  def light_off
200
- send_request FUNCTION_LIGHT_OFF, [], '', 0, ''
219
+ check_validity
220
+
221
+ send_request FUNCTION_LIGHT_OFF, [], '', 8, ''
201
222
  end
202
223
 
203
224
  # Returns the state of the LED. Possible values are:
@@ -205,7 +226,9 @@ module Tinkerforge
205
226
  # * 0: On
206
227
  # * 1: Off
207
228
  def is_light_on
208
- send_request FUNCTION_IS_LIGHT_ON, [], '', 1, 'C'
229
+ check_validity
230
+
231
+ send_request FUNCTION_IS_LIGHT_ON, [], '', 9, 'C'
209
232
  end
210
233
 
211
234
  # Sets the configuration of the sensor. Gain and integration time
@@ -234,12 +257,16 @@ module Tinkerforge
234
257
  # be more accurate but it will take longer time to get the conversion
235
258
  # results.
236
259
  def set_config(gain, integration_time)
237
- send_request FUNCTION_SET_CONFIG, [gain, integration_time], 'C C', 0, ''
260
+ check_validity
261
+
262
+ send_request FUNCTION_SET_CONFIG, [gain, integration_time], 'C C', 8, ''
238
263
  end
239
264
 
240
265
  # Returns the configuration as set by BrickletColor#set_config.
241
266
  def get_config
242
- send_request FUNCTION_GET_CONFIG, [], '', 2, 'C C'
267
+ check_validity
268
+
269
+ send_request FUNCTION_GET_CONFIG, [], '', 10, 'C C'
243
270
  end
244
271
 
245
272
  # Returns the illuminance affected by the gain and integration time as
@@ -252,7 +279,9 @@ module Tinkerforge
252
279
  # is saturated if it is equal to the maximum value of 65535.
253
280
  # In that case you have to reduce the gain, see BrickletColor#set_config.
254
281
  def get_illuminance
255
- send_request FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L'
282
+ check_validity
283
+
284
+ send_request FUNCTION_GET_ILLUMINANCE, [], '', 12, 'L'
256
285
  end
257
286
 
258
287
  # Returns the color temperature.
@@ -262,7 +291,9 @@ module Tinkerforge
262
291
  # is saturated if it is equal to the maximum value of 65535.
263
292
  # In that case you have to reduce the gain, see BrickletColor#set_config.
264
293
  def get_color_temperature
265
- send_request FUNCTION_GET_COLOR_TEMPERATURE, [], '', 2, 'S'
294
+ check_validity
295
+
296
+ send_request FUNCTION_GET_COLOR_TEMPERATURE, [], '', 10, 'S'
266
297
  end
267
298
 
268
299
  # Sets the period with which the CALLBACK_ILLUMINANCE callback is triggered
@@ -271,12 +302,16 @@ module Tinkerforge
271
302
  # The CALLBACK_ILLUMINANCE callback is only triggered if the illuminance has changed
272
303
  # since the last triggering.
273
304
  def set_illuminance_callback_period(period)
274
- send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
305
+ check_validity
306
+
307
+ send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
275
308
  end
276
309
 
277
310
  # Returns the period as set by BrickletColor#set_illuminance_callback_period.
278
311
  def get_illuminance_callback_period
279
- send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 4, 'L'
312
+ check_validity
313
+
314
+ send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 12, 'L'
280
315
  end
281
316
 
282
317
  # Sets the period with which the CALLBACK_COLOR_TEMPERATURE callback is
@@ -285,24 +320,30 @@ module Tinkerforge
285
320
  # The CALLBACK_COLOR_TEMPERATURE callback is only triggered if the color temperature
286
321
  # has changed since the last triggering.
287
322
  def set_color_temperature_callback_period(period)
288
- send_request FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
323
+ check_validity
324
+
325
+ send_request FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
289
326
  end
290
327
 
291
328
  # Returns the period as set by BrickletColor#set_color_temperature_callback_period.
292
329
  def get_color_temperature_callback_period
293
- send_request FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
330
+ check_validity
331
+
332
+ send_request FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
294
333
  end
295
334
 
296
335
  # Returns the UID, the UID where the Bricklet is connected to,
297
336
  # the position, the hardware and firmware version as well as the
298
337
  # device identifier.
299
338
  #
300
- # The position can be 'a', 'b', 'c' or 'd'.
339
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
340
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
341
+ # position 'z'.
301
342
  #
302
343
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
303
344
  # |device_identifier_constant|
304
345
  def get_identity
305
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
346
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
306
347
  end
307
348
 
308
349
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.