tinkerforge 2.1.22 → 2.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- 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 +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- 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 +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -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-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures magnetic flux density between -7mT and +7mT
|
|
14
16
|
class BrickletHallEffectV2 < Device
|
|
@@ -72,7 +74,7 @@ module Tinkerforge
|
|
|
72
74
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
73
75
|
# the IP Connection <tt>ipcon</tt>.
|
|
74
76
|
def initialize(uid, ipcon)
|
|
75
|
-
super uid, ipcon
|
|
77
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
76
78
|
|
|
77
79
|
@api_version = [2, 0, 0]
|
|
78
80
|
|
|
@@ -97,23 +99,25 @@ module Tinkerforge
|
|
|
97
99
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
98
100
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
99
101
|
|
|
100
|
-
@callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = 's'
|
|
101
|
-
@callback_formats[CALLBACK_COUNTER] = 'L'
|
|
102
|
+
@callback_formats[CALLBACK_MAGNETIC_FLUX_DENSITY] = [10, 's']
|
|
103
|
+
@callback_formats[CALLBACK_COUNTER] = [12, 'L']
|
|
102
104
|
|
|
105
|
+
@ipcon.add_device self
|
|
103
106
|
end
|
|
104
107
|
|
|
105
|
-
# Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__
|
|
106
|
-
# in `µT (micro Tesla) <https://en.wikipedia.org/wiki/Tesla_(unit)>`__.
|
|
108
|
+
# Returns the `magnetic flux density (magnetic induction) <https://en.wikipedia.org/wiki/Magnetic_flux>`__.
|
|
107
109
|
#
|
|
108
110
|
#
|
|
109
111
|
# If you want to get the value periodically, it is recommended to use the
|
|
110
112
|
# CALLBACK_MAGNETIC_FLUX_DENSITY callback. You can set the callback configuration
|
|
111
113
|
# with BrickletHallEffectV2#set_magnetic_flux_density_callback_configuration.
|
|
112
114
|
def get_magnetic_flux_density
|
|
113
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY, [], '', 10, 's'
|
|
114
118
|
end
|
|
115
119
|
|
|
116
|
-
# The period
|
|
120
|
+
# The period is the period with which the CALLBACK_MAGNETIC_FLUX_DENSITY callback is triggered
|
|
117
121
|
# periodically. A value of 0 turns the callback off.
|
|
118
122
|
#
|
|
119
123
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -138,21 +142,23 @@ module Tinkerforge
|
|
|
138
142
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
139
143
|
#
|
|
140
144
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
141
|
-
#
|
|
142
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
143
145
|
def set_magnetic_flux_density_callback_configuration(period, value_has_to_change, option, min, max)
|
|
144
|
-
|
|
146
|
+
check_validity
|
|
147
|
+
|
|
148
|
+
send_request FUNCTION_SET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
|
|
145
149
|
end
|
|
146
150
|
|
|
147
151
|
# Returns the callback configuration as set by BrickletHallEffectV2#set_magnetic_flux_density_callback_configuration.
|
|
148
152
|
def get_magnetic_flux_density_callback_configuration
|
|
149
|
-
|
|
153
|
+
check_validity
|
|
154
|
+
|
|
155
|
+
send_request FUNCTION_GET_MAGNETIC_FLUX_DENSITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
150
156
|
end
|
|
151
157
|
|
|
152
158
|
# Returns the current value of the counter.
|
|
153
159
|
#
|
|
154
|
-
# You can configure the low/high thresholds
|
|
155
|
-
#
|
|
160
|
+
# You can configure the low/high thresholds and the debounce time
|
|
161
|
+
# with BrickletHallEffectV2#set_counter_config.
|
|
156
162
|
#
|
|
157
163
|
# If you set reset counter to *true*, the count is set back to 0
|
|
158
164
|
# directly after it is read.
|
|
@@ -161,31 +167,31 @@ module Tinkerforge
|
|
|
161
167
|
# CALLBACK_COUNTER callback. You can set the callback configuration
|
|
162
168
|
# with BrickletHallEffectV2#set_counter_callback_configuration.
|
|
163
169
|
def get_counter(reset_counter)
|
|
164
|
-
|
|
170
|
+
check_validity
|
|
171
|
+
|
|
172
|
+
send_request FUNCTION_GET_COUNTER, [reset_counter], '?', 12, 'L'
|
|
165
173
|
end
|
|
166
174
|
|
|
167
|
-
# Sets a high and a low threshold
|
|
175
|
+
# Sets a high and a low threshold as well as a debounce time.
|
|
168
176
|
#
|
|
169
177
|
# If the measured magnetic flux density goes above the high threshold or
|
|
170
178
|
# below the low threshold, the count of the counter is increased by 1.
|
|
171
179
|
#
|
|
172
180
|
# The debounce time is the minimum time between two count increments.
|
|
173
|
-
#
|
|
174
|
-
# The default values are
|
|
175
|
-
#
|
|
176
|
-
# * High Threshold: 2000µT
|
|
177
|
-
# * Low Threshold: -2000µT
|
|
178
|
-
# * Debounce: 100000µs (100ms)
|
|
179
181
|
def set_counter_config(high_threshold, low_threshold, debounce)
|
|
180
|
-
|
|
182
|
+
check_validity
|
|
183
|
+
|
|
184
|
+
send_request FUNCTION_SET_COUNTER_CONFIG, [high_threshold, low_threshold, debounce], 's s L', 8, ''
|
|
181
185
|
end
|
|
182
186
|
|
|
183
187
|
# Returns the counter config as set by BrickletHallEffectV2#set_counter_config.
|
|
184
188
|
def get_counter_config
|
|
185
|
-
|
|
189
|
+
check_validity
|
|
190
|
+
|
|
191
|
+
send_request FUNCTION_GET_COUNTER_CONFIG, [], '', 16, 's s L'
|
|
186
192
|
end
|
|
187
193
|
|
|
188
|
-
# The period
|
|
194
|
+
# The period is the period with which the CALLBACK_COUNTER
|
|
189
195
|
# callback is triggered periodically. A value of 0 turns the callback off.
|
|
190
196
|
#
|
|
191
197
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -194,16 +200,18 @@ module Tinkerforge
|
|
|
194
200
|
#
|
|
195
201
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
196
202
|
# independent of the value.
|
|
197
|
-
#
|
|
198
|
-
# The default value is (0, false).
|
|
199
203
|
def set_counter_callback_configuration(period, value_has_to_change)
|
|
200
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_SET_COUNTER_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
201
207
|
end
|
|
202
208
|
|
|
203
209
|
# Returns the callback configuration as set by
|
|
204
210
|
# BrickletHallEffectV2#set_counter_callback_configuration.
|
|
205
211
|
def get_counter_callback_configuration
|
|
206
|
-
|
|
212
|
+
check_validity
|
|
213
|
+
|
|
214
|
+
send_request FUNCTION_GET_COUNTER_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
207
215
|
end
|
|
208
216
|
|
|
209
217
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -218,7 +226,9 @@ module Tinkerforge
|
|
|
218
226
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
219
227
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
220
228
|
def get_spitfp_error_count
|
|
221
|
-
|
|
229
|
+
check_validity
|
|
230
|
+
|
|
231
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
222
232
|
end
|
|
223
233
|
|
|
224
234
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -231,12 +241,16 @@ module Tinkerforge
|
|
|
231
241
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
232
242
|
# necessary to call it in a normal user program.
|
|
233
243
|
def set_bootloader_mode(mode)
|
|
234
|
-
|
|
244
|
+
check_validity
|
|
245
|
+
|
|
246
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
235
247
|
end
|
|
236
248
|
|
|
237
249
|
# Returns the current bootloader mode, see BrickletHallEffectV2#set_bootloader_mode.
|
|
238
250
|
def get_bootloader_mode
|
|
239
|
-
|
|
251
|
+
check_validity
|
|
252
|
+
|
|
253
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
240
254
|
end
|
|
241
255
|
|
|
242
256
|
# Sets the firmware pointer for BrickletHallEffectV2#write_firmware. The pointer has
|
|
@@ -246,7 +260,9 @@ module Tinkerforge
|
|
|
246
260
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
247
261
|
# necessary to call it in a normal user program.
|
|
248
262
|
def set_write_firmware_pointer(pointer)
|
|
249
|
-
|
|
263
|
+
check_validity
|
|
264
|
+
|
|
265
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
250
266
|
end
|
|
251
267
|
|
|
252
268
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -258,7 +274,9 @@ module Tinkerforge
|
|
|
258
274
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
259
275
|
# necessary to call it in a normal user program.
|
|
260
276
|
def write_firmware(data)
|
|
261
|
-
|
|
277
|
+
check_validity
|
|
278
|
+
|
|
279
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
262
280
|
end
|
|
263
281
|
|
|
264
282
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -269,22 +287,28 @@ module Tinkerforge
|
|
|
269
287
|
#
|
|
270
288
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
271
289
|
def set_status_led_config(config)
|
|
272
|
-
|
|
290
|
+
check_validity
|
|
291
|
+
|
|
292
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
273
293
|
end
|
|
274
294
|
|
|
275
295
|
# Returns the configuration as set by BrickletHallEffectV2#set_status_led_config
|
|
276
296
|
def get_status_led_config
|
|
277
|
-
|
|
297
|
+
check_validity
|
|
298
|
+
|
|
299
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
278
300
|
end
|
|
279
301
|
|
|
280
|
-
# Returns the temperature
|
|
302
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
281
303
|
# value returned is not the ambient temperature!
|
|
282
304
|
#
|
|
283
305
|
# The temperature is only proportional to the real temperature and it has bad
|
|
284
306
|
# accuracy. Practically it is only useful as an indicator for
|
|
285
307
|
# temperature changes.
|
|
286
308
|
def get_chip_temperature
|
|
287
|
-
|
|
309
|
+
check_validity
|
|
310
|
+
|
|
311
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
288
312
|
end
|
|
289
313
|
|
|
290
314
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -294,7 +318,9 @@ module Tinkerforge
|
|
|
294
318
|
# calling functions on the existing ones will result in
|
|
295
319
|
# undefined behavior!
|
|
296
320
|
def reset
|
|
297
|
-
|
|
321
|
+
check_validity
|
|
322
|
+
|
|
323
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
298
324
|
end
|
|
299
325
|
|
|
300
326
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -303,25 +329,31 @@ module Tinkerforge
|
|
|
303
329
|
#
|
|
304
330
|
# We recommend that you use Brick Viewer to change the UID.
|
|
305
331
|
def write_uid(uid)
|
|
306
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
307
335
|
end
|
|
308
336
|
|
|
309
337
|
# Returns the current UID as an integer. Encode as
|
|
310
338
|
# Base58 to get the usual string version.
|
|
311
339
|
def read_uid
|
|
312
|
-
|
|
340
|
+
check_validity
|
|
341
|
+
|
|
342
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
313
343
|
end
|
|
314
344
|
|
|
315
345
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
316
346
|
# the position, the hardware and firmware version as well as the
|
|
317
347
|
# device identifier.
|
|
318
348
|
#
|
|
319
|
-
# The position can be 'a', 'b', 'c' or '
|
|
349
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
350
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
351
|
+
# position 'z'.
|
|
320
352
|
#
|
|
321
353
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
322
354
|
# |device_identifier_constant|
|
|
323
355
|
def get_identity
|
|
324
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
356
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
325
357
|
end
|
|
326
358
|
|
|
327
359
|
# 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-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures relative humidity
|
|
14
16
|
class BrickletHumidity < 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,26 +90,26 @@ 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_HUMIDITY] = 'S'
|
|
92
|
-
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
|
93
|
-
@callback_formats[CALLBACK_HUMIDITY_REACHED] = 'S'
|
|
94
|
-
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
|
93
|
+
@callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
|
|
94
|
+
@callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
|
|
95
|
+
@callback_formats[CALLBACK_HUMIDITY_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
|
-
# Returns the humidity of the sensor.
|
|
99
|
-
# has a range of 0 to 1000 and is given in %RH/10 (Relative Humidity),
|
|
100
|
-
# i.e. a value of 421 means that a humidity of 42.1 %RH is measured.
|
|
101
|
+
# Returns the humidity of the sensor.
|
|
101
102
|
#
|
|
102
103
|
# If you want to get the humidity periodically, it is recommended to use the
|
|
103
104
|
# CALLBACK_HUMIDITY callback and set the period with
|
|
104
105
|
# BrickletHumidity#set_humidity_callback_period.
|
|
105
106
|
def get_humidity
|
|
106
|
-
|
|
107
|
+
check_validity
|
|
108
|
+
|
|
109
|
+
send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
|
|
107
110
|
end
|
|
108
111
|
|
|
109
112
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
|
110
|
-
# The value is between 0 and 4095.
|
|
111
113
|
#
|
|
112
114
|
# .. note::
|
|
113
115
|
# The value returned by BrickletHumidity#get_humidity is averaged over several samples
|
|
@@ -122,39 +124,45 @@ module Tinkerforge
|
|
|
122
124
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
|
123
125
|
# BrickletHumidity#set_analog_value_callback_period.
|
|
124
126
|
def get_analog_value
|
|
125
|
-
|
|
127
|
+
check_validity
|
|
128
|
+
|
|
129
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
|
|
126
130
|
end
|
|
127
131
|
|
|
128
|
-
# Sets the period
|
|
132
|
+
# Sets the period with which the CALLBACK_HUMIDITY callback is triggered
|
|
129
133
|
# periodically. A value of 0 turns the callback off.
|
|
130
134
|
#
|
|
131
135
|
# The CALLBACK_HUMIDITY callback is only triggered if the humidity has changed
|
|
132
136
|
# since the last triggering.
|
|
133
|
-
#
|
|
134
|
-
# The default value is 0.
|
|
135
137
|
def set_humidity_callback_period(period)
|
|
136
|
-
|
|
138
|
+
check_validity
|
|
139
|
+
|
|
140
|
+
send_request FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
137
141
|
end
|
|
138
142
|
|
|
139
143
|
# Returns the period as set by BrickletHumidity#set_humidity_callback_period.
|
|
140
144
|
def get_humidity_callback_period
|
|
141
|
-
|
|
145
|
+
check_validity
|
|
146
|
+
|
|
147
|
+
send_request FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
142
148
|
end
|
|
143
149
|
|
|
144
|
-
# Sets the period
|
|
150
|
+
# Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
|
|
145
151
|
# periodically. A value of 0 turns the callback off.
|
|
146
152
|
#
|
|
147
153
|
# The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
|
|
148
154
|
# changed since the last triggering.
|
|
149
|
-
#
|
|
150
|
-
# The default value is 0.
|
|
151
155
|
def set_analog_value_callback_period(period)
|
|
152
|
-
|
|
156
|
+
check_validity
|
|
157
|
+
|
|
158
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
153
159
|
end
|
|
154
160
|
|
|
155
161
|
# Returns the period as set by BrickletHumidity#set_analog_value_callback_period.
|
|
156
162
|
def get_analog_value_callback_period
|
|
157
|
-
|
|
163
|
+
check_validity
|
|
164
|
+
|
|
165
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
158
166
|
end
|
|
159
167
|
|
|
160
168
|
# Sets the thresholds for the CALLBACK_HUMIDITY_REACHED callback.
|
|
@@ -168,15 +176,17 @@ module Tinkerforge
|
|
|
168
176
|
# "'i'", "Callback is triggered when the humidity is *inside* the min and max values"
|
|
169
177
|
# "'<'", "Callback is triggered when the humidity is smaller than the min value (max is ignored)"
|
|
170
178
|
# "'>'", "Callback is triggered when the humidity is greater than the min value (max is ignored)"
|
|
171
|
-
#
|
|
172
|
-
# The default value is ('x', 0, 0).
|
|
173
179
|
def set_humidity_callback_threshold(option, min, max)
|
|
174
|
-
|
|
180
|
+
check_validity
|
|
181
|
+
|
|
182
|
+
send_request FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
175
183
|
end
|
|
176
184
|
|
|
177
185
|
# Returns the threshold as set by BrickletHumidity#set_humidity_callback_threshold.
|
|
178
186
|
def get_humidity_callback_threshold
|
|
179
|
-
|
|
187
|
+
check_validity
|
|
188
|
+
|
|
189
|
+
send_request FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
180
190
|
end
|
|
181
191
|
|
|
182
192
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
|
@@ -190,18 +200,20 @@ module Tinkerforge
|
|
|
190
200
|
# "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
|
|
191
201
|
# "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
|
|
192
202
|
# "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
|
|
193
|
-
#
|
|
194
|
-
# The default value is ('x', 0, 0).
|
|
195
203
|
def set_analog_value_callback_threshold(option, min, max)
|
|
196
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
197
207
|
end
|
|
198
208
|
|
|
199
209
|
# Returns the threshold as set by BrickletHumidity#set_analog_value_callback_threshold.
|
|
200
210
|
def get_analog_value_callback_threshold
|
|
201
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
202
214
|
end
|
|
203
215
|
|
|
204
|
-
# Sets the period
|
|
216
|
+
# Sets the period with which the threshold callbacks
|
|
205
217
|
#
|
|
206
218
|
# * CALLBACK_HUMIDITY_REACHED,
|
|
207
219
|
# * CALLBACK_ANALOG_VALUE_REACHED
|
|
@@ -212,27 +224,31 @@ module Tinkerforge
|
|
|
212
224
|
# * BrickletHumidity#set_analog_value_callback_threshold
|
|
213
225
|
#
|
|
214
226
|
# keep being reached.
|
|
215
|
-
#
|
|
216
|
-
# The default value is 100.
|
|
217
227
|
def set_debounce_period(debounce)
|
|
218
|
-
|
|
228
|
+
check_validity
|
|
229
|
+
|
|
230
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
219
231
|
end
|
|
220
232
|
|
|
221
233
|
# Returns the debounce period as set by BrickletHumidity#set_debounce_period.
|
|
222
234
|
def get_debounce_period
|
|
223
|
-
|
|
235
|
+
check_validity
|
|
236
|
+
|
|
237
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
224
238
|
end
|
|
225
239
|
|
|
226
240
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
227
241
|
# the position, the hardware and firmware version as well as the
|
|
228
242
|
# device identifier.
|
|
229
243
|
#
|
|
230
|
-
# The position can be 'a', 'b', 'c' or '
|
|
244
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
245
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
246
|
+
# position 'z'.
|
|
231
247
|
#
|
|
232
248
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
233
249
|
# |device_identifier_constant|
|
|
234
250
|
def get_identity
|
|
235
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
251
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
236
252
|
end
|
|
237
253
|
|
|
238
254
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|