tinkerforge 2.1.17 → 2.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +6 -6
- data/lib/tinkerforge/brick_imu.rb +6 -6
- data/lib/tinkerforge/brick_imu_v2.rb +13 -6
- data/lib/tinkerforge/brick_master.rb +6 -6
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +9 -7
- data/lib/tinkerforge/brick_silent_stepper.rb +13 -13
- data/lib/tinkerforge/brick_stepper.rb +6 -6
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_air_quality.rb +514 -0
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +5 -5
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +210 -0
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer_v2.rb +497 -0
- data/lib/tinkerforge/bricklet_can.rb +2 -2
- data/lib/tinkerforge/bricklet_can_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_co2.rb +2 -2
- data/lib/tinkerforge/bricklet_color.rb +2 -2
- data/lib/tinkerforge/bricklet_current12.rb +2 -2
- data/lib/tinkerforge/bricklet_current25.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +398 -0
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_dmx.rb +7 -5
- data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +283 -0
- data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_dust_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_gps_v2.rb +6 -6
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +336 -0
- data/lib/tinkerforge/bricklet_industrial_counter.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +7 -7
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +302 -0
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +382 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +374 -0
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -5
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +11 -11
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io16_v2.rb +418 -0
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_io4_v2.rb +6 -6
- data/lib/tinkerforge/bricklet_isolator.rb +282 -0
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +486 -0
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +8 -8
- data/lib/tinkerforge/bricklet_line.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell.rb +2 -2
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_moisture.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +6 -6
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +5 -5
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc.rb +6 -6
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64.rb +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +387 -0
- data/lib/tinkerforge/bricklet_oled_64x48.rb +2 -2
- data/lib/tinkerforge/bricklet_one_wire.rb +305 -0
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +5 -5
- data/lib/tinkerforge/bricklet_particulate_matter.rb +5 -5
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_real_time_clock.rb +2 -2
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +5 -5
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +5 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_rs232_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_rs485.rb +5 -5
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +9 -9
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_temperature_v2.rb +278 -0
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +5 -5
- data/lib/tinkerforge/bricklet_thermocouple.rb +2 -2
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +5 -5
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light.rb +6 -5
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +430 -0
- data/lib/tinkerforge/bricklet_voltage.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +5 -5
- data/lib/tinkerforge/version.rb +1 -1
- metadata +18 -2
@@ -0,0 +1,497 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
#############################################################
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
|
+
# #
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
6
|
+
# #
|
7
|
+
# If you have a bugfix for this file and want to commit it, #
|
8
|
+
# please fix the bug in the generator. You can find a link #
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
|
+
#############################################################
|
11
|
+
|
12
|
+
module Tinkerforge
|
13
|
+
# Measures air pressure and altitude changes
|
14
|
+
class BrickletBarometerV2 < Device
|
15
|
+
DEVICE_IDENTIFIER = 2117 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Barometer Bricklet 2.0' # :nodoc:
|
17
|
+
|
18
|
+
# This callback is triggered periodically according to the configuration set by
|
19
|
+
# BrickletBarometerV2#set_air_pressure_callback_configuration.
|
20
|
+
#
|
21
|
+
# The parameter is the same as BrickletBarometerV2#get_air_pressure.
|
22
|
+
CALLBACK_AIR_PRESSURE = 4
|
23
|
+
|
24
|
+
# This callback is triggered periodically according to the configuration set by
|
25
|
+
# BrickletBarometerV2#set_altitude_callback_configuration.
|
26
|
+
#
|
27
|
+
# The parameter is the same as BrickletBarometerV2#get_altitude.
|
28
|
+
CALLBACK_ALTITUDE = 8
|
29
|
+
|
30
|
+
# This callback is triggered periodically according to the configuration set by
|
31
|
+
# BrickletBarometerV2#set_temperature_callback_configuration.
|
32
|
+
#
|
33
|
+
# The parameter is the same as BrickletBarometerV2#get_temperature.
|
34
|
+
CALLBACK_TEMPERATURE = 12
|
35
|
+
|
36
|
+
FUNCTION_GET_AIR_PRESSURE = 1 # :nodoc:
|
37
|
+
FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION = 2 # :nodoc:
|
38
|
+
FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION = 3 # :nodoc:
|
39
|
+
FUNCTION_GET_ALTITUDE = 5 # :nodoc:
|
40
|
+
FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION = 6 # :nodoc:
|
41
|
+
FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION = 7 # :nodoc:
|
42
|
+
FUNCTION_GET_TEMPERATURE = 9 # :nodoc:
|
43
|
+
FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION = 10 # :nodoc:
|
44
|
+
FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION = 11 # :nodoc:
|
45
|
+
FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION = 13 # :nodoc:
|
46
|
+
FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION = 14 # :nodoc:
|
47
|
+
FUNCTION_SET_REFERENCE_AIR_PRESSURE = 15 # :nodoc:
|
48
|
+
FUNCTION_GET_REFERENCE_AIR_PRESSURE = 16 # :nodoc:
|
49
|
+
FUNCTION_SET_CALIBRATION = 17 # :nodoc:
|
50
|
+
FUNCTION_GET_CALIBRATION = 18 # :nodoc:
|
51
|
+
FUNCTION_SET_SENSOR_CONFIGURATION = 19 # :nodoc:
|
52
|
+
FUNCTION_GET_SENSOR_CONFIGURATION = 20 # :nodoc:
|
53
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
|
54
|
+
FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
|
55
|
+
FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
|
56
|
+
FUNCTION_SET_WRITE_FIRMWARE_POINTER = 237 # :nodoc:
|
57
|
+
FUNCTION_WRITE_FIRMWARE = 238 # :nodoc:
|
58
|
+
FUNCTION_SET_STATUS_LED_CONFIG = 239 # :nodoc:
|
59
|
+
FUNCTION_GET_STATUS_LED_CONFIG = 240 # :nodoc:
|
60
|
+
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
61
|
+
FUNCTION_RESET = 243 # :nodoc:
|
62
|
+
FUNCTION_WRITE_UID = 248 # :nodoc:
|
63
|
+
FUNCTION_READ_UID = 249 # :nodoc:
|
64
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
65
|
+
|
66
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
67
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
68
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
69
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
70
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
71
|
+
DATA_RATE_OFF = 0 # :nodoc:
|
72
|
+
DATA_RATE_1HZ = 1 # :nodoc:
|
73
|
+
DATA_RATE_10HZ = 2 # :nodoc:
|
74
|
+
DATA_RATE_25HZ = 3 # :nodoc:
|
75
|
+
DATA_RATE_50HZ = 4 # :nodoc:
|
76
|
+
DATA_RATE_75HZ = 5 # :nodoc:
|
77
|
+
LOW_PASS_FILTER_OFF = 0 # :nodoc:
|
78
|
+
LOW_PASS_FILTER_1_9TH = 1 # :nodoc:
|
79
|
+
LOW_PASS_FILTER_1_20TH = 2 # :nodoc:
|
80
|
+
BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
|
81
|
+
BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
|
82
|
+
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
|
83
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT = 3 # :nodoc:
|
84
|
+
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT = 4 # :nodoc:
|
85
|
+
BOOTLOADER_STATUS_OK = 0 # :nodoc:
|
86
|
+
BOOTLOADER_STATUS_INVALID_MODE = 1 # :nodoc:
|
87
|
+
BOOTLOADER_STATUS_NO_CHANGE = 2 # :nodoc:
|
88
|
+
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT = 3 # :nodoc:
|
89
|
+
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT = 4 # :nodoc:
|
90
|
+
BOOTLOADER_STATUS_CRC_MISMATCH = 5 # :nodoc:
|
91
|
+
STATUS_LED_CONFIG_OFF = 0 # :nodoc:
|
92
|
+
STATUS_LED_CONFIG_ON = 1 # :nodoc:
|
93
|
+
STATUS_LED_CONFIG_SHOW_HEARTBEAT = 2 # :nodoc:
|
94
|
+
STATUS_LED_CONFIG_SHOW_STATUS = 3 # :nodoc:
|
95
|
+
|
96
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
97
|
+
# the IP Connection <tt>ipcon</tt>.
|
98
|
+
def initialize(uid, ipcon)
|
99
|
+
super uid, ipcon
|
100
|
+
|
101
|
+
@api_version = [2, 0, 0]
|
102
|
+
|
103
|
+
@response_expected[FUNCTION_GET_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
104
|
+
@response_expected[FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
105
|
+
@response_expected[FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
106
|
+
@response_expected[FUNCTION_GET_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
107
|
+
@response_expected[FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
108
|
+
@response_expected[FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
109
|
+
@response_expected[FUNCTION_GET_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
110
|
+
@response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
|
111
|
+
@response_expected[FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
112
|
+
@response_expected[FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
113
|
+
@response_expected[FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
114
|
+
@response_expected[FUNCTION_SET_REFERENCE_AIR_PRESSURE] = RESPONSE_EXPECTED_FALSE
|
115
|
+
@response_expected[FUNCTION_GET_REFERENCE_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
116
|
+
@response_expected[FUNCTION_SET_CALIBRATION] = RESPONSE_EXPECTED_FALSE
|
117
|
+
@response_expected[FUNCTION_GET_CALIBRATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
118
|
+
@response_expected[FUNCTION_SET_SENSOR_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
119
|
+
@response_expected[FUNCTION_GET_SENSOR_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
120
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
121
|
+
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
122
|
+
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
123
|
+
@response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
|
124
|
+
@response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
125
|
+
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
126
|
+
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
127
|
+
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
128
|
+
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
129
|
+
@response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
|
130
|
+
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
131
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
132
|
+
|
133
|
+
@callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
|
134
|
+
@callback_formats[CALLBACK_ALTITUDE] = 'l'
|
135
|
+
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
# Returns the measured air pressure. The value has a range of
|
140
|
+
# 260000 to 1260000 and is given in mbar/1000, i.e. a value of
|
141
|
+
# 1001092 means that an air pressure of 1001.092 mbar is measured.
|
142
|
+
#
|
143
|
+
#
|
144
|
+
# If you want to get the value periodically, it is recommended to use the
|
145
|
+
# CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
|
146
|
+
# with BrickletBarometerV2#set_air_pressure_callback_configuration.
|
147
|
+
def get_air_pressure
|
148
|
+
send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
|
149
|
+
end
|
150
|
+
|
151
|
+
# The period in ms is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
|
152
|
+
# periodically. A value of 0 turns the callback off.
|
153
|
+
#
|
154
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
155
|
+
# triggered after the value has changed. If the value didn't change
|
156
|
+
# within the period, the callback is triggered immediately on change.
|
157
|
+
#
|
158
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
159
|
+
# independent of the value.
|
160
|
+
#
|
161
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
162
|
+
#
|
163
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_AIR_PRESSURE callback.
|
164
|
+
#
|
165
|
+
# The following options are possible:
|
166
|
+
#
|
167
|
+
# "Option", "Description"
|
168
|
+
#
|
169
|
+
# "'x'", "Threshold is turned off"
|
170
|
+
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
171
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
172
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
173
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
174
|
+
#
|
175
|
+
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
176
|
+
#
|
177
|
+
# The default value is (0, false, 'x', 0, 0).
|
178
|
+
def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
|
179
|
+
send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the callback configuration as set by BrickletBarometerV2#set_air_pressure_callback_configuration.
|
183
|
+
def get_air_pressure_callback_configuration
|
184
|
+
send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the relative altitude of the air pressure sensor. The value
|
188
|
+
# is given in mm and is calculated based on the difference between the
|
189
|
+
# current air pressure and the reference air pressure that can be set
|
190
|
+
# with BrickletBarometerV2#set_reference_air_pressure.
|
191
|
+
#
|
192
|
+
#
|
193
|
+
# If you want to get the value periodically, it is recommended to use the
|
194
|
+
# CALLBACK_ALTITUDE callback. You can set the callback configuration
|
195
|
+
# with BrickletBarometerV2#set_altitude_callback_configuration.
|
196
|
+
def get_altitude
|
197
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
|
198
|
+
end
|
199
|
+
|
200
|
+
# The period in ms is the period with which the CALLBACK_ALTITUDE callback is triggered
|
201
|
+
# periodically. A value of 0 turns the callback off.
|
202
|
+
#
|
203
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
204
|
+
# triggered after the value has changed. If the value didn't change
|
205
|
+
# within the period, the callback is triggered immediately on change.
|
206
|
+
#
|
207
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
208
|
+
# independent of the value.
|
209
|
+
#
|
210
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
211
|
+
#
|
212
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_ALTITUDE callback.
|
213
|
+
#
|
214
|
+
# The following options are possible:
|
215
|
+
#
|
216
|
+
# "Option", "Description"
|
217
|
+
#
|
218
|
+
# "'x'", "Threshold is turned off"
|
219
|
+
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
220
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
221
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
222
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
223
|
+
#
|
224
|
+
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
225
|
+
#
|
226
|
+
# The default value is (0, false, 'x', 0, 0).
|
227
|
+
def set_altitude_callback_configuration(period, value_has_to_change, option, min, max)
|
228
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
|
229
|
+
end
|
230
|
+
|
231
|
+
# Returns the callback configuration as set by BrickletBarometerV2#set_altitude_callback_configuration.
|
232
|
+
def get_altitude_callback_configuration
|
233
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns the temperature of the air pressure sensor. The value
|
237
|
+
# has a range of -4000 to 8500 and is given in °C/100, i.e. a value
|
238
|
+
# of 2007 means that a temperature of 20.07 °C is measured.
|
239
|
+
#
|
240
|
+
# This temperature is used internally for temperature compensation
|
241
|
+
# of the air pressure measurement. It is not as accurate as the
|
242
|
+
# temperature measured by the :ref:`temperature_v2_bricklet` or the
|
243
|
+
# :ref:`temperature_ir_v2_bricklet`.
|
244
|
+
#
|
245
|
+
#
|
246
|
+
# If you want to get the value periodically, it is recommended to use the
|
247
|
+
# CALLBACK_TEMPERATURE callback. You can set the callback configuration
|
248
|
+
# with BrickletBarometerV2#set_temperature_callback_configuration.
|
249
|
+
def get_temperature
|
250
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
|
251
|
+
end
|
252
|
+
|
253
|
+
# The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
|
254
|
+
# periodically. A value of 0 turns the callback off.
|
255
|
+
#
|
256
|
+
# If the `value has to change`-parameter is set to true, the callback is only
|
257
|
+
# triggered after the value has changed. If the value didn't change
|
258
|
+
# within the period, the callback is triggered immediately on change.
|
259
|
+
#
|
260
|
+
# If it is set to false, the callback is continuously triggered with the period,
|
261
|
+
# independent of the value.
|
262
|
+
#
|
263
|
+
# It is furthermore possible to constrain the callback with thresholds.
|
264
|
+
#
|
265
|
+
# The `option`-parameter together with min/max sets a threshold for the CALLBACK_TEMPERATURE callback.
|
266
|
+
#
|
267
|
+
# The following options are possible:
|
268
|
+
#
|
269
|
+
# "Option", "Description"
|
270
|
+
#
|
271
|
+
# "'x'", "Threshold is turned off"
|
272
|
+
# "'o'", "Threshold is triggered when the value is *outside* the min and max values"
|
273
|
+
# "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
|
274
|
+
# "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
|
275
|
+
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
276
|
+
#
|
277
|
+
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
278
|
+
#
|
279
|
+
# The default value is (0, false, 'x', 0, 0).
|
280
|
+
def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
281
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
|
282
|
+
end
|
283
|
+
|
284
|
+
# Returns the callback configuration as set by BrickletBarometerV2#set_temperature_callback_configuration.
|
285
|
+
def get_temperature_callback_configuration
|
286
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
|
287
|
+
end
|
288
|
+
|
289
|
+
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
290
|
+
# for the air pressure and temperature measurements.
|
291
|
+
#
|
292
|
+
# Setting the length to 1 will turn the averaging off. With less
|
293
|
+
# averaging, there is more noise on the data.
|
294
|
+
#
|
295
|
+
# The range for the averaging is 1-1000.
|
296
|
+
#
|
297
|
+
# If you want to do long term measurements the longest moving average will give
|
298
|
+
# the cleanest results.
|
299
|
+
#
|
300
|
+
# The default value is 100.
|
301
|
+
def set_moving_average_configuration(moving_average_length_air_pressure, moving_average_length_temperature)
|
302
|
+
send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_air_pressure, moving_average_length_temperature], 'S S', 0, ''
|
303
|
+
end
|
304
|
+
|
305
|
+
# Returns the moving average configuration as set by
|
306
|
+
# BrickletBarometerV2#set_moving_average_configuration.
|
307
|
+
def get_moving_average_configuration
|
308
|
+
send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
|
309
|
+
end
|
310
|
+
|
311
|
+
# Sets the reference air pressure in mbar/1000 for the altitude calculation.
|
312
|
+
# Valid values are between 260000 and 1260000. Setting the reference to the
|
313
|
+
# current air pressure results in a calculated altitude of 0mm. Passing 0 is
|
314
|
+
# a shortcut for passing the current air pressure as reference.
|
315
|
+
#
|
316
|
+
# Well known reference values are the Q codes
|
317
|
+
# `QNH <https://en.wikipedia.org/wiki/QNH>`__ and
|
318
|
+
# `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
|
319
|
+
# used in aviation.
|
320
|
+
#
|
321
|
+
# The default value is 1013.25mbar.
|
322
|
+
def set_reference_air_pressure(air_pressure)
|
323
|
+
send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
|
324
|
+
end
|
325
|
+
|
326
|
+
# Returns the reference air pressure as set by BrickletBarometerV2#set_reference_air_pressure.
|
327
|
+
def get_reference_air_pressure
|
328
|
+
send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
|
329
|
+
end
|
330
|
+
|
331
|
+
# Sets the one point calibration (OPC) values for the air pressure measurement.
|
332
|
+
#
|
333
|
+
# Before the Bricklet can be calibrated any previous calibration has to be removed
|
334
|
+
# by setting ``measured air pressure`` and ``actual air pressure`` to 0.
|
335
|
+
#
|
336
|
+
# Then the current air pressure has to be measured using the Bricklet
|
337
|
+
# (``measured air pressure``) and with and accurate reference barometer
|
338
|
+
# (``actual air pressure``) at the same time and passed to this function in
|
339
|
+
# mbar/1000.
|
340
|
+
#
|
341
|
+
# After proper calibration the air pressure measurement can achieve an accuracy
|
342
|
+
# up to 0.2 mbar.
|
343
|
+
#
|
344
|
+
# The calibration is saved in the EEPROM of the Bricklet and only needs to be
|
345
|
+
# configured once.
|
346
|
+
def set_calibration(measured_air_pressure, actual_air_pressure)
|
347
|
+
send_request FUNCTION_SET_CALIBRATION, [measured_air_pressure, actual_air_pressure], 'l l', 0, ''
|
348
|
+
end
|
349
|
+
|
350
|
+
# Returns the air pressure one point calibration values as set by
|
351
|
+
# BrickletBarometerV2#set_calibration.
|
352
|
+
def get_calibration
|
353
|
+
send_request FUNCTION_GET_CALIBRATION, [], '', 8, 'l l'
|
354
|
+
end
|
355
|
+
|
356
|
+
# Configures the data rate and air pressure low pass filter. The low pass filter
|
357
|
+
# cut-off frequency (if enabled) can be set to 1/9th or 1/20th of the configure
|
358
|
+
# data rate to decrease the noise on the air pressure data.
|
359
|
+
#
|
360
|
+
# The low pass filter configuration only applies to the air pressure measurement.
|
361
|
+
# There is no low pass filter for the temperature measurement.
|
362
|
+
#
|
363
|
+
# The default values are 50Hz data rate and 1/9th low pass filter.
|
364
|
+
def set_sensor_configuration(data_rate, air_pressure_low_pass_filter)
|
365
|
+
send_request FUNCTION_SET_SENSOR_CONFIGURATION, [data_rate, air_pressure_low_pass_filter], 'C C', 0, ''
|
366
|
+
end
|
367
|
+
|
368
|
+
# Returns the sensor configuration as set by BrickletBarometerV2#set_sensor_configuration.
|
369
|
+
def get_sensor_configuration
|
370
|
+
send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 2, 'C C'
|
371
|
+
end
|
372
|
+
|
373
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
374
|
+
#
|
375
|
+
# The errors are divided into
|
376
|
+
#
|
377
|
+
# * ACK checksum errors,
|
378
|
+
# * message checksum errors,
|
379
|
+
# * framing errors and
|
380
|
+
# * overflow errors.
|
381
|
+
#
|
382
|
+
# The errors counts are for errors that occur on the Bricklet side. All
|
383
|
+
# Bricks have a similar function that returns the errors on the Brick side.
|
384
|
+
def get_spitfp_error_count
|
385
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
386
|
+
end
|
387
|
+
|
388
|
+
# Sets the bootloader mode and returns the status after the requested
|
389
|
+
# mode change was instigated.
|
390
|
+
#
|
391
|
+
# You can change from bootloader mode to firmware mode and vice versa. A change
|
392
|
+
# from bootloader mode to firmware mode will only take place if the entry function,
|
393
|
+
# device identifier and CRC are present and correct.
|
394
|
+
#
|
395
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
396
|
+
# necessary to call it in a normal user program.
|
397
|
+
def set_bootloader_mode(mode)
|
398
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
399
|
+
end
|
400
|
+
|
401
|
+
# Returns the current bootloader mode, see BrickletBarometerV2#set_bootloader_mode.
|
402
|
+
def get_bootloader_mode
|
403
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
404
|
+
end
|
405
|
+
|
406
|
+
# Sets the firmware pointer for BrickletBarometerV2#write_firmware. The pointer has
|
407
|
+
# to be increased by chunks of size 64. The data is written to flash
|
408
|
+
# every 4 chunks (which equals to one page of size 256).
|
409
|
+
#
|
410
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
411
|
+
# necessary to call it in a normal user program.
|
412
|
+
def set_write_firmware_pointer(pointer)
|
413
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
414
|
+
end
|
415
|
+
|
416
|
+
# Writes 64 Bytes of firmware at the position as written by
|
417
|
+
# BrickletBarometerV2#set_write_firmware_pointer before. The firmware is written
|
418
|
+
# to flash every 4 chunks.
|
419
|
+
#
|
420
|
+
# You can only write firmware in bootloader mode.
|
421
|
+
#
|
422
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
423
|
+
# necessary to call it in a normal user program.
|
424
|
+
def write_firmware(data)
|
425
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
426
|
+
end
|
427
|
+
|
428
|
+
# Sets the status LED configuration. By default the LED shows
|
429
|
+
# communication traffic between Brick and Bricklet, it flickers once
|
430
|
+
# for every 10 received data packets.
|
431
|
+
#
|
432
|
+
# You can also turn the LED permanently on/off or show a heartbeat.
|
433
|
+
#
|
434
|
+
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
435
|
+
def set_status_led_config(config)
|
436
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
437
|
+
end
|
438
|
+
|
439
|
+
# Returns the configuration as set by BrickletBarometerV2#set_status_led_config
|
440
|
+
def get_status_led_config
|
441
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
442
|
+
end
|
443
|
+
|
444
|
+
# Returns the temperature in °C as measured inside the microcontroller. The
|
445
|
+
# value returned is not the ambient temperature!
|
446
|
+
#
|
447
|
+
# The temperature is only proportional to the real temperature and it has bad
|
448
|
+
# accuracy. Practically it is only useful as an indicator for
|
449
|
+
# temperature changes.
|
450
|
+
def get_chip_temperature
|
451
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
452
|
+
end
|
453
|
+
|
454
|
+
# Calling this function will reset the Bricklet. All configurations
|
455
|
+
# will be lost.
|
456
|
+
#
|
457
|
+
# After a reset you have to create new device objects,
|
458
|
+
# calling functions on the existing ones will result in
|
459
|
+
# undefined behavior!
|
460
|
+
def reset
|
461
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
462
|
+
end
|
463
|
+
|
464
|
+
# Writes a new UID into flash. If you want to set a new UID
|
465
|
+
# you have to decode the Base58 encoded UID string into an
|
466
|
+
# integer first.
|
467
|
+
#
|
468
|
+
# We recommend that you use Brick Viewer to change the UID.
|
469
|
+
def write_uid(uid)
|
470
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
471
|
+
end
|
472
|
+
|
473
|
+
# Returns the current UID as an integer. Encode as
|
474
|
+
# Base58 to get the usual string version.
|
475
|
+
def read_uid
|
476
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
477
|
+
end
|
478
|
+
|
479
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
480
|
+
# the position, the hardware and firmware version as well as the
|
481
|
+
# device identifier.
|
482
|
+
#
|
483
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
484
|
+
#
|
485
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
486
|
+
# |device_identifier_constant|
|
487
|
+
def get_identity
|
488
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
489
|
+
end
|
490
|
+
|
491
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
492
|
+
def register_callback(id, &block)
|
493
|
+
callback = block
|
494
|
+
@registered_callbacks[id] = callback
|
495
|
+
end
|
496
|
+
end
|
497
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -456,9 +456,9 @@ module Tinkerforge
|
|
456
456
|
#
|
457
457
|
# The errors are divided into
|
458
458
|
#
|
459
|
-
# *
|
459
|
+
# * ACK checksum errors,
|
460
460
|
# * message checksum errors,
|
461
|
-
# *
|
461
|
+
# * framing errors and
|
462
462
|
# * overflow errors.
|
463
463
|
#
|
464
464
|
# The errors counts are for errors that occur on the Bricklet side. All
|
@@ -472,7 +472,7 @@ module Tinkerforge
|
|
472
472
|
#
|
473
473
|
# You can change from bootloader mode to firmware mode and vice versa. A change
|
474
474
|
# from bootloader mode to firmware mode will only take place if the entry function,
|
475
|
-
# device identifier
|
475
|
+
# device identifier and CRC are present and correct.
|
476
476
|
#
|
477
477
|
# This function is used by Brick Viewer during flashing. It should not be
|
478
478
|
# necessary to call it in a normal user program.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2018-
|
3
|
+
# This file was automatically generated on 2018-09-28. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.18 #
|
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 #
|