tinkerforge 2.1.22 → 2.1.27

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 (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  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 +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  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 +335 -0
  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 +416 -0
  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 +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -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 +371 -0
  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 +97 -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_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
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 IAQ index, temperature, humidity and air pressure
14
16
  class BrickletAirQuality < Device
@@ -108,7 +110,7 @@ module Tinkerforge
108
110
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
109
111
  # the IP Connection <tt>ipcon</tt>.
110
112
  def initialize(uid, ipcon)
111
- super uid, ipcon
113
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
112
114
 
113
115
  @api_version = [2, 0, 1]
114
116
 
@@ -145,16 +147,17 @@ module Tinkerforge
145
147
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
146
148
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
147
149
 
148
- @callback_formats[CALLBACK_ALL_VALUES] = 'l C l l l'
149
- @callback_formats[CALLBACK_IAQ_INDEX] = 'l C'
150
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
151
- @callback_formats[CALLBACK_HUMIDITY] = 'l'
152
- @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
150
+ @callback_formats[CALLBACK_ALL_VALUES] = [25, 'l C l l l']
151
+ @callback_formats[CALLBACK_IAQ_INDEX] = [13, 'l C']
152
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
153
+ @callback_formats[CALLBACK_HUMIDITY] = [12, 'l']
154
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
153
155
 
156
+ @ipcon.add_device self
154
157
  end
155
158
 
156
159
  # Returns all values measured by the Air Quality Bricklet. The values are
157
- # IAQ (Indoor Air Quality) Index, IAQ Index Accuracy, Temperature, Humidity and
160
+ # IAQ (Indoor Air Quality) Index (higher value means greater level of air pollution), IAQ Index Accuracy, Temperature, Humidity and
158
161
  # Air Pressure.
159
162
  #
160
163
  # .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
@@ -162,20 +165,13 @@ module Tinkerforge
162
165
  # :alt: Air Quality Index description
163
166
  # :align: center
164
167
  # :target: ../../_images/Misc/bricklet_air_quality_iaq_index.png
165
- #
166
- # The values have these ranges and units:
167
- #
168
- # * IAQ Index: 0 to 500, higher value means greater level of air pollution
169
- # * IAQ Index Accuracy: 0 = unreliable to 3 = high
170
- # * Temperature: in steps of 0.01 °C
171
- # * Humidity: in steps of 0.01 %RH
172
- # * Air Pressure: in steps of 0.01 mbar
173
168
  def get_all_values
174
- send_request FUNCTION_GET_ALL_VALUES, [], '', 17, 'l C l l l'
169
+ check_validity
170
+
171
+ send_request FUNCTION_GET_ALL_VALUES, [], '', 25, 'l C l l l'
175
172
  end
176
173
 
177
- # Sets a temperature offset with resolution 1/100°C. A offset of 10 will decrease
178
- # the measured temperature by 0.1°C.
174
+ # Sets a temperature offset. A offset of 10 will decrease the measured temperature by 0.1 °C.
179
175
  #
180
176
  # If you install this Bricklet into an enclosure and you want to measure the ambient
181
177
  # temperature, you may have to decrease the measured temperature by some value to
@@ -187,19 +183,23 @@ module Tinkerforge
187
183
  #
188
184
  # This temperature offset is used to calculate the relative humidity and
189
185
  # IAQ index measurements. In case the Bricklet is installed in an enclosure, we
190
- # recommend to measure and set the temperature offset to imporve the accuracy of
186
+ # recommend to measure and set the temperature offset to improve the accuracy of
191
187
  # the measurements.
192
188
  def set_temperature_offset(offset)
193
- send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'l', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'l', 8, ''
194
192
  end
195
193
 
196
194
  # Returns the temperature offset as set by
197
195
  # BrickletAirQuality#set_temperature_offset.
198
196
  def get_temperature_offset
199
- send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 4, 'l'
197
+ check_validity
198
+
199
+ send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 12, 'l'
200
200
  end
201
201
 
202
- # The period in ms is the period with which the CALLBACK_ALL_VALUES
202
+ # The period is the period with which the CALLBACK_ALL_VALUES
203
203
  # callback is triggered periodically. A value of 0 turns the callback off.
204
204
  #
205
205
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -208,20 +208,21 @@ module Tinkerforge
208
208
  #
209
209
  # If it is set to false, the callback is continuously triggered with the period,
210
210
  # independent of the value.
211
- #
212
- # The default value is (0, false).
213
211
  def set_all_values_callback_configuration(period, value_has_to_change)
214
- send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
212
+ check_validity
213
+
214
+ send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
215
215
  end
216
216
 
217
217
  # Returns the callback configuration as set by
218
218
  # BrickletAirQuality#set_all_values_callback_configuration.
219
219
  def get_all_values_callback_configuration
220
- send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
220
+ check_validity
221
+
222
+ send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
221
223
  end
222
224
 
223
- # Returns the IAQ index and accuracy. The IAQ index goes from
224
- # 0 to 500. The higher the IAQ index, the greater the level of air pollution.
225
+ # Returns the IAQ index and accuracy. The higher the IAQ index, the greater the level of air pollution.
225
226
  #
226
227
  # .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
227
228
  # :scale: 100 %
@@ -233,10 +234,12 @@ module Tinkerforge
233
234
  # CALLBACK_IAQ_INDEX callback. You can set the callback configuration
234
235
  # with BrickletAirQuality#set_iaq_index_callback_configuration.
235
236
  def get_iaq_index
236
- send_request FUNCTION_GET_IAQ_INDEX, [], '', 5, 'l C'
237
+ check_validity
238
+
239
+ send_request FUNCTION_GET_IAQ_INDEX, [], '', 13, 'l C'
237
240
  end
238
241
 
239
- # The period in ms is the period with which the CALLBACK_IAQ_INDEX
242
+ # The period is the period with which the CALLBACK_IAQ_INDEX
240
243
  # callback is triggered periodically. A value of 0 turns the callback off.
241
244
  #
242
245
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -245,29 +248,33 @@ module Tinkerforge
245
248
  #
246
249
  # If it is set to false, the callback is continuously triggered with the period,
247
250
  # independent of the value.
248
- #
249
- # The default value is (0, false).
250
251
  def set_iaq_index_callback_configuration(period, value_has_to_change)
251
- send_request FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
252
+ check_validity
253
+
254
+ send_request FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
252
255
  end
253
256
 
254
257
  # Returns the callback configuration as set by
255
258
  # BrickletAirQuality#set_iaq_index_callback_configuration.
256
259
  def get_iaq_index_callback_configuration
257
- send_request FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
260
+ check_validity
261
+
262
+ send_request FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
258
263
  end
259
264
 
260
- # Returns temperature in steps of 0.01 °C.
265
+ # Returns temperature.
261
266
  #
262
267
  #
263
268
  # If you want to get the value periodically, it is recommended to use the
264
269
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
265
270
  # with BrickletAirQuality#set_temperature_callback_configuration.
266
271
  def get_temperature
267
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
272
+ check_validity
273
+
274
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
268
275
  end
269
276
 
270
- # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
277
+ # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
271
278
  # periodically. A value of 0 turns the callback off.
272
279
  #
273
280
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -292,28 +299,32 @@ module Tinkerforge
292
299
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
293
300
  #
294
301
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
295
- #
296
- # The default value is (0, false, 'x', 0, 0).
297
302
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
298
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
303
+ check_validity
304
+
305
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
299
306
  end
300
307
 
301
308
  # Returns the callback configuration as set by BrickletAirQuality#set_temperature_callback_configuration.
302
309
  def get_temperature_callback_configuration
303
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
310
+ check_validity
311
+
312
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
304
313
  end
305
314
 
306
- # Returns relative humidity in steps of 0.01 %RH.
315
+ # Returns relative humidity.
307
316
  #
308
317
  #
309
318
  # If you want to get the value periodically, it is recommended to use the
310
319
  # CALLBACK_HUMIDITY callback. You can set the callback configuration
311
320
  # with BrickletAirQuality#set_humidity_callback_configuration.
312
321
  def get_humidity
313
- send_request FUNCTION_GET_HUMIDITY, [], '', 4, 'l'
322
+ check_validity
323
+
324
+ send_request FUNCTION_GET_HUMIDITY, [], '', 12, 'l'
314
325
  end
315
326
 
316
- # The period in ms is the period with which the CALLBACK_HUMIDITY callback is triggered
327
+ # The period is the period with which the CALLBACK_HUMIDITY callback is triggered
317
328
  # periodically. A value of 0 turns the callback off.
318
329
  #
319
330
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -338,28 +349,32 @@ module Tinkerforge
338
349
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
339
350
  #
340
351
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
341
- #
342
- # The default value is (0, false, 'x', 0, 0).
343
352
  def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
344
- send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
353
+ check_validity
354
+
355
+ send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
345
356
  end
346
357
 
347
358
  # Returns the callback configuration as set by BrickletAirQuality#set_humidity_callback_configuration.
348
359
  def get_humidity_callback_configuration
349
- send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
360
+ check_validity
361
+
362
+ send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
350
363
  end
351
364
 
352
- # Returns air pressure in steps of 0.01 mbar.
365
+ # Returns air pressure.
353
366
  #
354
367
  #
355
368
  # If you want to get the value periodically, it is recommended to use the
356
369
  # CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
357
370
  # with BrickletAirQuality#set_air_pressure_callback_configuration.
358
371
  def get_air_pressure
359
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
372
+ check_validity
373
+
374
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
360
375
  end
361
376
 
362
- # The period in ms is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
377
+ # The period is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
363
378
  # periodically. A value of 0 turns the callback off.
364
379
  #
365
380
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -384,15 +399,17 @@ module Tinkerforge
384
399
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
385
400
  #
386
401
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
387
- #
388
- # The default value is (0, false, 'x', 0, 0).
389
402
  def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
390
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
403
+ check_validity
404
+
405
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
391
406
  end
392
407
 
393
408
  # Returns the callback configuration as set by BrickletAirQuality#set_air_pressure_callback_configuration.
394
409
  def get_air_pressure_callback_configuration
395
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
410
+ check_validity
411
+
412
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
396
413
  end
397
414
 
398
415
  # Deletes the calibration from flash. After you call this function,
@@ -406,7 +423,9 @@ module Tinkerforge
406
423
  #
407
424
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
408
425
  def remove_calibration
409
- send_request FUNCTION_REMOVE_CALIBRATION, [], '', 0, ''
426
+ check_validity
427
+
428
+ send_request FUNCTION_REMOVE_CALIBRATION, [], '', 8, ''
410
429
  end
411
430
 
412
431
  # The Air Quality Bricklet uses an automatic background calibration mechanism to
@@ -422,7 +441,7 @@ module Tinkerforge
422
441
  # duration is saved in flash, so you should only have to call this function
423
442
  # once in the lifetime of the Bricklet.
424
443
  #
425
- # The Bricklet has to be power cycled after this function is called
444
+ # The Bricklet has to be power cycled after this function is called
426
445
  # for a duration change to take effect.
427
446
  #
428
447
  # Before firmware version 2.0.3 this was not configurable and the duration was
@@ -432,15 +451,19 @@ module Tinkerforge
432
451
  #
433
452
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
434
453
  def set_background_calibration_duration(duration)
435
- send_request FUNCTION_SET_BACKGROUND_CALIBRATION_DURATION, [duration], 'C', 0, ''
454
+ check_validity
455
+
456
+ send_request FUNCTION_SET_BACKGROUND_CALIBRATION_DURATION, [duration], 'C', 8, ''
436
457
  end
437
458
 
438
- # Returns the background calibration duration as set by
459
+ # Returns the background calibration duration as set by
439
460
  # BrickletAirQuality#set_background_calibration_duration.
440
461
  #
441
462
  # .. versionadded:: 2.0.3$nbsp;(Plugin)
442
463
  def get_background_calibration_duration
443
- send_request FUNCTION_GET_BACKGROUND_CALIBRATION_DURATION, [], '', 1, 'C'
464
+ check_validity
465
+
466
+ send_request FUNCTION_GET_BACKGROUND_CALIBRATION_DURATION, [], '', 9, 'C'
444
467
  end
445
468
 
446
469
  # Returns the error count for the communication between Brick and Bricklet.
@@ -455,7 +478,9 @@ module Tinkerforge
455
478
  # The errors counts are for errors that occur on the Bricklet side. All
456
479
  # Bricks have a similar function that returns the errors on the Brick side.
457
480
  def get_spitfp_error_count
458
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
481
+ check_validity
482
+
483
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
459
484
  end
460
485
 
461
486
  # Sets the bootloader mode and returns the status after the requested
@@ -468,12 +493,16 @@ module Tinkerforge
468
493
  # This function is used by Brick Viewer during flashing. It should not be
469
494
  # necessary to call it in a normal user program.
470
495
  def set_bootloader_mode(mode)
471
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
496
+ check_validity
497
+
498
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
472
499
  end
473
500
 
474
501
  # Returns the current bootloader mode, see BrickletAirQuality#set_bootloader_mode.
475
502
  def get_bootloader_mode
476
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
503
+ check_validity
504
+
505
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
477
506
  end
478
507
 
479
508
  # Sets the firmware pointer for BrickletAirQuality#write_firmware. The pointer has
@@ -483,7 +512,9 @@ module Tinkerforge
483
512
  # This function is used by Brick Viewer during flashing. It should not be
484
513
  # necessary to call it in a normal user program.
485
514
  def set_write_firmware_pointer(pointer)
486
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
515
+ check_validity
516
+
517
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
487
518
  end
488
519
 
489
520
  # Writes 64 Bytes of firmware at the position as written by
@@ -495,7 +526,9 @@ module Tinkerforge
495
526
  # This function is used by Brick Viewer during flashing. It should not be
496
527
  # necessary to call it in a normal user program.
497
528
  def write_firmware(data)
498
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
529
+ check_validity
530
+
531
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
499
532
  end
500
533
 
501
534
  # Sets the status LED configuration. By default the LED shows
@@ -506,22 +539,28 @@ module Tinkerforge
506
539
  #
507
540
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
508
541
  def set_status_led_config(config)
509
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
542
+ check_validity
543
+
544
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
510
545
  end
511
546
 
512
547
  # Returns the configuration as set by BrickletAirQuality#set_status_led_config
513
548
  def get_status_led_config
514
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
549
+ check_validity
550
+
551
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
515
552
  end
516
553
 
517
- # Returns the temperature in °C as measured inside the microcontroller. The
554
+ # Returns the temperature as measured inside the microcontroller. The
518
555
  # value returned is not the ambient temperature!
519
556
  #
520
557
  # The temperature is only proportional to the real temperature and it has bad
521
558
  # accuracy. Practically it is only useful as an indicator for
522
559
  # temperature changes.
523
560
  def get_chip_temperature
524
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
561
+ check_validity
562
+
563
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
525
564
  end
526
565
 
527
566
  # Calling this function will reset the Bricklet. All configurations
@@ -531,7 +570,9 @@ module Tinkerforge
531
570
  # calling functions on the existing ones will result in
532
571
  # undefined behavior!
533
572
  def reset
534
- send_request FUNCTION_RESET, [], '', 0, ''
573
+ check_validity
574
+
575
+ send_request FUNCTION_RESET, [], '', 8, ''
535
576
  end
536
577
 
537
578
  # Writes a new UID into flash. If you want to set a new UID
@@ -540,25 +581,31 @@ module Tinkerforge
540
581
  #
541
582
  # We recommend that you use Brick Viewer to change the UID.
542
583
  def write_uid(uid)
543
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
584
+ check_validity
585
+
586
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
544
587
  end
545
588
 
546
589
  # Returns the current UID as an integer. Encode as
547
590
  # Base58 to get the usual string version.
548
591
  def read_uid
549
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
592
+ check_validity
593
+
594
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
550
595
  end
551
596
 
552
597
  # Returns the UID, the UID where the Bricklet is connected to,
553
598
  # the position, the hardware and firmware version as well as the
554
599
  # device identifier.
555
600
  #
556
- # The position can be 'a', 'b', 'c' or 'd'.
601
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
602
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
603
+ # position 'z'.
557
604
  #
558
605
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
559
606
  # |device_identifier_constant|
560
607
  def get_identity
561
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
608
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
562
609
  end
563
610
 
564
611
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.