tinkerforge 2.1.24 → 2.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +69 -31
- data/lib/tinkerforge/brick_hat_zero.rb +55 -23
- data/lib/tinkerforge/brick_imu.rb +185 -78
- data/lib/tinkerforge/brick_imu_v2.rb +209 -106
- data/lib/tinkerforge/brick_master.rb +491 -183
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
- data/lib/tinkerforge/brick_stepper.rb +211 -99
- data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
- data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
- data/lib/tinkerforge/bricklet_barometer.rb +100 -27
- data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -19
- data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
- data/lib/tinkerforge/bricklet_co2.rb +33 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
- data/lib/tinkerforge/bricklet_color.rb +68 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
- data/lib/tinkerforge/bricklet_compass.rb +77 -30
- data/lib/tinkerforge/bricklet_current12.rb +57 -24
- data/lib/tinkerforge/bricklet_current25.rb +57 -24
- data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
- data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_dmx.rb +87 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
- data/lib/tinkerforge/bricklet_gps.rb +63 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_humidity.rb +50 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
- data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_io16.rb +54 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
- data/lib/tinkerforge/bricklet_io4.rb +54 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -29
- data/lib/tinkerforge/bricklet_joystick.rb +58 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
- data/lib/tinkerforge/bricklet_line.rb +33 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_moisture.rb +39 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
- data/lib/tinkerforge/bricklet_nfc.rb +126 -62
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
- data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
- data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
- data/lib/tinkerforge/bricklet_ptc.rb +73 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
- data/lib/tinkerforge/bricklet_rs485.rb +222 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
- data/lib/tinkerforge/bricklet_temperature.rb +39 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
- data/lib/tinkerforge/bricklet_voltage.rb +51 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
- data/lib/tinkerforge/device_display_names.rb +170 -0
- data/lib/tinkerforge/ip_connection.rb +153 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +11 -3
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
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 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 hPa
|
173
168
|
def get_all_values
|
174
|
-
|
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
|
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,16 +183,20 @@ 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
|
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
|
-
|
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
|
-
|
197
|
+
check_validity
|
198
|
+
|
199
|
+
send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 12, 'l'
|
200
200
|
end
|
201
201
|
|
202
202
|
# The period is the period with which the CALLBACK_ALL_VALUES
|
@@ -209,17 +209,20 @@ module Tinkerforge
|
|
209
209
|
# If it is set to false, the callback is continuously triggered with the period,
|
210
210
|
# independent of the value.
|
211
211
|
def set_all_values_callback_configuration(period, value_has_to_change)
|
212
|
-
|
212
|
+
check_validity
|
213
|
+
|
214
|
+
send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
213
215
|
end
|
214
216
|
|
215
217
|
# Returns the callback configuration as set by
|
216
218
|
# BrickletAirQuality#set_all_values_callback_configuration.
|
217
219
|
def get_all_values_callback_configuration
|
218
|
-
|
220
|
+
check_validity
|
221
|
+
|
222
|
+
send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
219
223
|
end
|
220
224
|
|
221
|
-
# Returns the IAQ index and accuracy. The IAQ index
|
222
|
-
# 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.
|
223
226
|
#
|
224
227
|
# .. image:: /Images/Misc/bricklet_air_quality_iaq_index.png
|
225
228
|
# :scale: 100 %
|
@@ -231,7 +234,9 @@ module Tinkerforge
|
|
231
234
|
# CALLBACK_IAQ_INDEX callback. You can set the callback configuration
|
232
235
|
# with BrickletAirQuality#set_iaq_index_callback_configuration.
|
233
236
|
def get_iaq_index
|
234
|
-
|
237
|
+
check_validity
|
238
|
+
|
239
|
+
send_request FUNCTION_GET_IAQ_INDEX, [], '', 13, 'l C'
|
235
240
|
end
|
236
241
|
|
237
242
|
# The period is the period with which the CALLBACK_IAQ_INDEX
|
@@ -244,23 +249,29 @@ module Tinkerforge
|
|
244
249
|
# If it is set to false, the callback is continuously triggered with the period,
|
245
250
|
# independent of the value.
|
246
251
|
def set_iaq_index_callback_configuration(period, value_has_to_change)
|
247
|
-
|
252
|
+
check_validity
|
253
|
+
|
254
|
+
send_request FUNCTION_SET_IAQ_INDEX_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
248
255
|
end
|
249
256
|
|
250
257
|
# Returns the callback configuration as set by
|
251
258
|
# BrickletAirQuality#set_iaq_index_callback_configuration.
|
252
259
|
def get_iaq_index_callback_configuration
|
253
|
-
|
260
|
+
check_validity
|
261
|
+
|
262
|
+
send_request FUNCTION_GET_IAQ_INDEX_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
254
263
|
end
|
255
264
|
|
256
|
-
# Returns temperature
|
265
|
+
# Returns temperature.
|
257
266
|
#
|
258
267
|
#
|
259
268
|
# If you want to get the value periodically, it is recommended to use the
|
260
269
|
# CALLBACK_TEMPERATURE callback. You can set the callback configuration
|
261
270
|
# with BrickletAirQuality#set_temperature_callback_configuration.
|
262
271
|
def get_temperature
|
263
|
-
|
272
|
+
check_validity
|
273
|
+
|
274
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
|
264
275
|
end
|
265
276
|
|
266
277
|
# The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
|
@@ -289,22 +300,28 @@ module Tinkerforge
|
|
289
300
|
#
|
290
301
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
291
302
|
def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
292
|
-
|
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, ''
|
293
306
|
end
|
294
307
|
|
295
308
|
# Returns the callback configuration as set by BrickletAirQuality#set_temperature_callback_configuration.
|
296
309
|
def get_temperature_callback_configuration
|
297
|
-
|
310
|
+
check_validity
|
311
|
+
|
312
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
298
313
|
end
|
299
314
|
|
300
|
-
# Returns relative humidity
|
315
|
+
# Returns relative humidity.
|
301
316
|
#
|
302
317
|
#
|
303
318
|
# If you want to get the value periodically, it is recommended to use the
|
304
319
|
# CALLBACK_HUMIDITY callback. You can set the callback configuration
|
305
320
|
# with BrickletAirQuality#set_humidity_callback_configuration.
|
306
321
|
def get_humidity
|
307
|
-
|
322
|
+
check_validity
|
323
|
+
|
324
|
+
send_request FUNCTION_GET_HUMIDITY, [], '', 12, 'l'
|
308
325
|
end
|
309
326
|
|
310
327
|
# The period is the period with which the CALLBACK_HUMIDITY callback is triggered
|
@@ -333,22 +350,28 @@ module Tinkerforge
|
|
333
350
|
#
|
334
351
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
335
352
|
def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
|
336
|
-
|
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, ''
|
337
356
|
end
|
338
357
|
|
339
358
|
# Returns the callback configuration as set by BrickletAirQuality#set_humidity_callback_configuration.
|
340
359
|
def get_humidity_callback_configuration
|
341
|
-
|
360
|
+
check_validity
|
361
|
+
|
362
|
+
send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
342
363
|
end
|
343
364
|
|
344
|
-
# Returns air pressure
|
365
|
+
# Returns air pressure.
|
345
366
|
#
|
346
367
|
#
|
347
368
|
# If you want to get the value periodically, it is recommended to use the
|
348
369
|
# CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
|
349
370
|
# with BrickletAirQuality#set_air_pressure_callback_configuration.
|
350
371
|
def get_air_pressure
|
351
|
-
|
372
|
+
check_validity
|
373
|
+
|
374
|
+
send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
|
352
375
|
end
|
353
376
|
|
354
377
|
# The period is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
|
@@ -377,12 +400,16 @@ module Tinkerforge
|
|
377
400
|
#
|
378
401
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
379
402
|
def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
|
380
|
-
|
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, ''
|
381
406
|
end
|
382
407
|
|
383
408
|
# Returns the callback configuration as set by BrickletAirQuality#set_air_pressure_callback_configuration.
|
384
409
|
def get_air_pressure_callback_configuration
|
385
|
-
|
410
|
+
check_validity
|
411
|
+
|
412
|
+
send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
|
386
413
|
end
|
387
414
|
|
388
415
|
# Deletes the calibration from flash. After you call this function,
|
@@ -396,7 +423,9 @@ module Tinkerforge
|
|
396
423
|
#
|
397
424
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
398
425
|
def remove_calibration
|
399
|
-
|
426
|
+
check_validity
|
427
|
+
|
428
|
+
send_request FUNCTION_REMOVE_CALIBRATION, [], '', 8, ''
|
400
429
|
end
|
401
430
|
|
402
431
|
# The Air Quality Bricklet uses an automatic background calibration mechanism to
|
@@ -422,7 +451,9 @@ module Tinkerforge
|
|
422
451
|
#
|
423
452
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
424
453
|
def set_background_calibration_duration(duration)
|
425
|
-
|
454
|
+
check_validity
|
455
|
+
|
456
|
+
send_request FUNCTION_SET_BACKGROUND_CALIBRATION_DURATION, [duration], 'C', 8, ''
|
426
457
|
end
|
427
458
|
|
428
459
|
# Returns the background calibration duration as set by
|
@@ -430,7 +461,9 @@ module Tinkerforge
|
|
430
461
|
#
|
431
462
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
432
463
|
def get_background_calibration_duration
|
433
|
-
|
464
|
+
check_validity
|
465
|
+
|
466
|
+
send_request FUNCTION_GET_BACKGROUND_CALIBRATION_DURATION, [], '', 9, 'C'
|
434
467
|
end
|
435
468
|
|
436
469
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -445,7 +478,9 @@ module Tinkerforge
|
|
445
478
|
# The errors counts are for errors that occur on the Bricklet side. All
|
446
479
|
# Bricks have a similar function that returns the errors on the Brick side.
|
447
480
|
def get_spitfp_error_count
|
448
|
-
|
481
|
+
check_validity
|
482
|
+
|
483
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
449
484
|
end
|
450
485
|
|
451
486
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -458,12 +493,16 @@ module Tinkerforge
|
|
458
493
|
# This function is used by Brick Viewer during flashing. It should not be
|
459
494
|
# necessary to call it in a normal user program.
|
460
495
|
def set_bootloader_mode(mode)
|
461
|
-
|
496
|
+
check_validity
|
497
|
+
|
498
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
462
499
|
end
|
463
500
|
|
464
501
|
# Returns the current bootloader mode, see BrickletAirQuality#set_bootloader_mode.
|
465
502
|
def get_bootloader_mode
|
466
|
-
|
503
|
+
check_validity
|
504
|
+
|
505
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
467
506
|
end
|
468
507
|
|
469
508
|
# Sets the firmware pointer for BrickletAirQuality#write_firmware. The pointer has
|
@@ -473,7 +512,9 @@ module Tinkerforge
|
|
473
512
|
# This function is used by Brick Viewer during flashing. It should not be
|
474
513
|
# necessary to call it in a normal user program.
|
475
514
|
def set_write_firmware_pointer(pointer)
|
476
|
-
|
515
|
+
check_validity
|
516
|
+
|
517
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
477
518
|
end
|
478
519
|
|
479
520
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -485,7 +526,9 @@ module Tinkerforge
|
|
485
526
|
# This function is used by Brick Viewer during flashing. It should not be
|
486
527
|
# necessary to call it in a normal user program.
|
487
528
|
def write_firmware(data)
|
488
|
-
|
529
|
+
check_validity
|
530
|
+
|
531
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
489
532
|
end
|
490
533
|
|
491
534
|
# Sets the status LED configuration. By default the LED shows
|
@@ -496,22 +539,28 @@ module Tinkerforge
|
|
496
539
|
#
|
497
540
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
498
541
|
def set_status_led_config(config)
|
499
|
-
|
542
|
+
check_validity
|
543
|
+
|
544
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
500
545
|
end
|
501
546
|
|
502
547
|
# Returns the configuration as set by BrickletAirQuality#set_status_led_config
|
503
548
|
def get_status_led_config
|
504
|
-
|
549
|
+
check_validity
|
550
|
+
|
551
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
505
552
|
end
|
506
553
|
|
507
|
-
# Returns the temperature
|
554
|
+
# Returns the temperature as measured inside the microcontroller. The
|
508
555
|
# value returned is not the ambient temperature!
|
509
556
|
#
|
510
557
|
# The temperature is only proportional to the real temperature and it has bad
|
511
558
|
# accuracy. Practically it is only useful as an indicator for
|
512
559
|
# temperature changes.
|
513
560
|
def get_chip_temperature
|
514
|
-
|
561
|
+
check_validity
|
562
|
+
|
563
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
515
564
|
end
|
516
565
|
|
517
566
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -521,7 +570,9 @@ module Tinkerforge
|
|
521
570
|
# calling functions on the existing ones will result in
|
522
571
|
# undefined behavior!
|
523
572
|
def reset
|
524
|
-
|
573
|
+
check_validity
|
574
|
+
|
575
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
525
576
|
end
|
526
577
|
|
527
578
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -530,25 +581,31 @@ module Tinkerforge
|
|
530
581
|
#
|
531
582
|
# We recommend that you use Brick Viewer to change the UID.
|
532
583
|
def write_uid(uid)
|
533
|
-
|
584
|
+
check_validity
|
585
|
+
|
586
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
534
587
|
end
|
535
588
|
|
536
589
|
# Returns the current UID as an integer. Encode as
|
537
590
|
# Base58 to get the usual string version.
|
538
591
|
def read_uid
|
539
|
-
|
592
|
+
check_validity
|
593
|
+
|
594
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
540
595
|
end
|
541
596
|
|
542
597
|
# Returns the UID, the UID where the Bricklet is connected to,
|
543
598
|
# the position, the hardware and firmware version as well as the
|
544
599
|
# device identifier.
|
545
600
|
#
|
546
|
-
# The position can be 'a', 'b', 'c' or '
|
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'.
|
547
604
|
#
|
548
605
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
549
606
|
# |device_identifier_constant|
|
550
607
|
def get_identity
|
551
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
608
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
552
609
|
end
|
553
610
|
|
554
611
|
# 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
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
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 ambient light up to 900lux
|
14
16
|
class BrickletAmbientLight < Device
|
@@ -70,7 +72,7 @@ module Tinkerforge
|
|
70
72
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
71
73
|
# the IP Connection <tt>ipcon</tt>.
|
72
74
|
def initialize(uid, ipcon)
|
73
|
-
super uid, ipcon
|
75
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
74
76
|
|
75
77
|
@api_version = [2, 0, 1]
|
76
78
|
|
@@ -88,11 +90,12 @@ module Tinkerforge
|
|
88
90
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
91
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
90
92
|
|
91
|
-
@callback_formats[CALLBACK_ILLUMINANCE] = 'S'
|
92
|
-
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
93
|
-
@callback_formats[CALLBACK_ILLUMINANCE_REACHED] = 'S'
|
94
|
-
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
93
|
+
@callback_formats[CALLBACK_ILLUMINANCE] = [10, 'S']
|
94
|
+
@callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
|
95
|
+
@callback_formats[CALLBACK_ILLUMINANCE_REACHED] = [10, 'S']
|
96
|
+
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
|
95
97
|
|
98
|
+
@ipcon.add_device self
|
96
99
|
end
|
97
100
|
|
98
101
|
# Returns the illuminance of the ambient light sensor.
|
@@ -101,7 +104,9 @@ module Tinkerforge
|
|
101
104
|
# CALLBACK_ILLUMINANCE callback and set the period with
|
102
105
|
# BrickletAmbientLight#set_illuminance_callback_period.
|
103
106
|
def get_illuminance
|
104
|
-
|
107
|
+
check_validity
|
108
|
+
|
109
|
+
send_request FUNCTION_GET_ILLUMINANCE, [], '', 10, 'S'
|
105
110
|
end
|
106
111
|
|
107
112
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
@@ -120,7 +125,9 @@ module Tinkerforge
|
|
120
125
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
121
126
|
# BrickletAmbientLight#set_analog_value_callback_period.
|
122
127
|
def get_analog_value
|
123
|
-
|
128
|
+
check_validity
|
129
|
+
|
130
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
|
124
131
|
end
|
125
132
|
|
126
133
|
# Sets the period with which the CALLBACK_ILLUMINANCE callback is triggered
|
@@ -129,12 +136,16 @@ module Tinkerforge
|
|
129
136
|
# The CALLBACK_ILLUMINANCE callback is only triggered if the illuminance has changed
|
130
137
|
# since the last triggering.
|
131
138
|
def set_illuminance_callback_period(period)
|
132
|
-
|
139
|
+
check_validity
|
140
|
+
|
141
|
+
send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
133
142
|
end
|
134
143
|
|
135
144
|
# Returns the period as set by BrickletAmbientLight#set_illuminance_callback_period.
|
136
145
|
def get_illuminance_callback_period
|
137
|
-
|
146
|
+
check_validity
|
147
|
+
|
148
|
+
send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 12, 'L'
|
138
149
|
end
|
139
150
|
|
140
151
|
# Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -143,12 +154,16 @@ module Tinkerforge
|
|
143
154
|
# The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
|
144
155
|
# changed since the last triggering.
|
145
156
|
def set_analog_value_callback_period(period)
|
146
|
-
|
157
|
+
check_validity
|
158
|
+
|
159
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
147
160
|
end
|
148
161
|
|
149
162
|
# Returns the period as set by BrickletAmbientLight#set_analog_value_callback_period.
|
150
163
|
def get_analog_value_callback_period
|
151
|
-
|
164
|
+
check_validity
|
165
|
+
|
166
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
|
152
167
|
end
|
153
168
|
|
154
169
|
# Sets the thresholds for the CALLBACK_ILLUMINANCE_REACHED callback.
|
@@ -163,12 +178,16 @@ module Tinkerforge
|
|
163
178
|
# "'<'", "Callback is triggered when the illuminance is smaller than the min value (max is ignored)"
|
164
179
|
# "'>'", "Callback is triggered when the illuminance is greater than the min value (max is ignored)"
|
165
180
|
def set_illuminance_callback_threshold(option, min, max)
|
166
|
-
|
181
|
+
check_validity
|
182
|
+
|
183
|
+
send_request FUNCTION_SET_ILLUMINANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
167
184
|
end
|
168
185
|
|
169
186
|
# Returns the threshold as set by BrickletAmbientLight#set_illuminance_callback_threshold.
|
170
187
|
def get_illuminance_callback_threshold
|
171
|
-
|
188
|
+
check_validity
|
189
|
+
|
190
|
+
send_request FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
172
191
|
end
|
173
192
|
|
174
193
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -183,12 +202,16 @@ module Tinkerforge
|
|
183
202
|
# "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
|
184
203
|
# "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
|
185
204
|
def set_analog_value_callback_threshold(option, min, max)
|
186
|
-
|
205
|
+
check_validity
|
206
|
+
|
207
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
187
208
|
end
|
188
209
|
|
189
210
|
# Returns the threshold as set by BrickletAmbientLight#set_analog_value_callback_threshold.
|
190
211
|
def get_analog_value_callback_threshold
|
191
|
-
|
212
|
+
check_validity
|
213
|
+
|
214
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
192
215
|
end
|
193
216
|
|
194
217
|
# Sets the period with which the threshold callbacks
|
@@ -203,24 +226,30 @@ module Tinkerforge
|
|
203
226
|
#
|
204
227
|
# keep being reached.
|
205
228
|
def set_debounce_period(debounce)
|
206
|
-
|
229
|
+
check_validity
|
230
|
+
|
231
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
207
232
|
end
|
208
233
|
|
209
234
|
# Returns the debounce period as set by BrickletAmbientLight#set_debounce_period.
|
210
235
|
def get_debounce_period
|
211
|
-
|
236
|
+
check_validity
|
237
|
+
|
238
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
212
239
|
end
|
213
240
|
|
214
241
|
# Returns the UID, the UID where the Bricklet is connected to,
|
215
242
|
# the position, the hardware and firmware version as well as the
|
216
243
|
# device identifier.
|
217
244
|
#
|
218
|
-
# The position can be 'a', 'b', 'c' or '
|
245
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
246
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
247
|
+
# position 'z'.
|
219
248
|
#
|
220
249
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
221
250
|
# |device_identifier_constant|
|
222
251
|
def get_identity
|
223
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
252
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
224
253
|
end
|
225
254
|
|
226
255
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|