tinkerforge 2.1.24 → 2.1.25
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.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +155 -74
- data/lib/tinkerforge/brick_hat.rb +70 -30
- data/lib/tinkerforge/brick_hat_zero.rb +56 -22
- data/lib/tinkerforge/brick_imu.rb +184 -77
- data/lib/tinkerforge/brick_imu_v2.rb +208 -105
- data/lib/tinkerforge/brick_master.rb +484 -182
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +185 -101
- data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
- data/lib/tinkerforge/brick_stepper.rb +210 -98
- data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
- data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
- data/lib/tinkerforge/bricklet_barometer.rb +66 -26
- data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -18
- data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
- data/lib/tinkerforge/bricklet_co2.rb +34 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
- data/lib/tinkerforge/bricklet_color.rb +69 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
- data/lib/tinkerforge/bricklet_compass.rb +78 -30
- data/lib/tinkerforge/bricklet_current12.rb +58 -24
- data/lib/tinkerforge/bricklet_current25.rb +58 -24
- data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_dmx.rb +88 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
- data/lib/tinkerforge/bricklet_gps.rb +64 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_humidity.rb +51 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_io16.rb +55 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
- data/lib/tinkerforge/bricklet_io4.rb +55 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -28
- data/lib/tinkerforge/bricklet_joystick.rb +59 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
- data/lib/tinkerforge/bricklet_line.rb +34 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
- data/lib/tinkerforge/bricklet_moisture.rb +40 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
- data/lib/tinkerforge/bricklet_nfc.rb +123 -58
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
- data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
- data/lib/tinkerforge/bricklet_ptc.rb +74 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_rs232.rb +90 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
- data/lib/tinkerforge/bricklet_rs485.rb +223 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
- data/lib/tinkerforge/bricklet_temperature.rb +40 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
- data/lib/tinkerforge/bricklet_tilt.rb +24 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
- data/lib/tinkerforge/bricklet_voltage.rb +52 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
- data/lib/tinkerforge/device_display_names.rb +163 -0
- data/lib/tinkerforge/ip_connection.rb +151 -32
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
|
@@ -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 2020-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
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,7 +149,9 @@ 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
|
-
|
|
152
|
+
check_validity
|
|
153
|
+
|
|
154
|
+
send_request FUNCTION_GET_ALL_VALUES, [], '', 14, 'S s S'
|
|
150
155
|
end
|
|
151
156
|
|
|
152
157
|
# The CO2 concentration (among other things) depends on the ambient air pressure.
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
470
|
+
check_validity
|
|
471
|
+
|
|
472
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
424
473
|
end
|
|
425
474
|
|
|
426
|
-
# Returns the temperature
|
|
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
|
-
|
|
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
|
-
|
|
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,32 @@ module Tinkerforge
|
|
|
449
502
|
#
|
|
450
503
|
# We recommend that you use Brick Viewer to change the UID.
|
|
451
504
|
def write_uid(uid)
|
|
452
|
-
|
|
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
|
-
|
|
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 '
|
|
522
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
523
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
524
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
525
|
+
# position 'z'.
|
|
466
526
|
#
|
|
467
527
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
468
528
|
# |device_identifier_constant|
|
|
469
529
|
def get_identity
|
|
470
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
530
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
471
531
|
end
|
|
472
532
|
|
|
473
533
|
# 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 2020-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,31 @@ 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
|
-
|
|
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
|
-
|
|
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 '
|
|
339
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
340
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
341
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
342
|
+
# position 'z'.
|
|
301
343
|
#
|
|
302
344
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
303
345
|
# |device_identifier_constant|
|
|
304
346
|
def get_identity
|
|
305
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
347
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
306
348
|
end
|
|
307
349
|
|
|
308
350
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|