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
|
# Determine position, velocity and altitude using GPS
|
|
14
16
|
class BrickletGPSV2 < Device
|
|
@@ -138,7 +140,7 @@ module Tinkerforge
|
|
|
138
140
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
139
141
|
# the IP Connection <tt>ipcon</tt>.
|
|
140
142
|
def initialize(uid, ipcon)
|
|
141
|
-
super uid, ipcon
|
|
143
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
142
144
|
|
|
143
145
|
@api_version = [2, 0, 1]
|
|
144
146
|
|
|
@@ -177,13 +179,14 @@ module Tinkerforge
|
|
|
177
179
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
178
180
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
179
181
|
|
|
180
|
-
@callback_formats[CALLBACK_PULSE_PER_SECOND] = ''
|
|
181
|
-
@callback_formats[CALLBACK_COORDINATES] = 'L k L k'
|
|
182
|
-
@callback_formats[CALLBACK_STATUS] = '? C'
|
|
183
|
-
@callback_formats[CALLBACK_ALTITUDE] = 'l l'
|
|
184
|
-
@callback_formats[CALLBACK_MOTION] = 'L L'
|
|
185
|
-
@callback_formats[CALLBACK_DATE_TIME] = 'L L'
|
|
182
|
+
@callback_formats[CALLBACK_PULSE_PER_SECOND] = [8, '']
|
|
183
|
+
@callback_formats[CALLBACK_COORDINATES] = [18, 'L k L k']
|
|
184
|
+
@callback_formats[CALLBACK_STATUS] = [10, '? C']
|
|
185
|
+
@callback_formats[CALLBACK_ALTITUDE] = [16, 'l l']
|
|
186
|
+
@callback_formats[CALLBACK_MOTION] = [16, 'L L']
|
|
187
|
+
@callback_formats[CALLBACK_DATE_TIME] = [16, 'L L']
|
|
186
188
|
|
|
189
|
+
@ipcon.add_device self
|
|
187
190
|
end
|
|
188
191
|
|
|
189
192
|
# Returns the GPS coordinates. Latitude and longitude are given in the
|
|
@@ -195,7 +198,9 @@ module Tinkerforge
|
|
|
195
198
|
# This data is only valid if there is currently a fix as indicated by
|
|
196
199
|
# BrickletGPSV2#get_status.
|
|
197
200
|
def get_coordinates
|
|
198
|
-
|
|
201
|
+
check_validity
|
|
202
|
+
|
|
203
|
+
send_request FUNCTION_GET_COORDINATES, [], '', 18, 'L k L k'
|
|
199
204
|
end
|
|
200
205
|
|
|
201
206
|
# Returns if a fix is currently available as well as the, the number of
|
|
@@ -204,21 +209,22 @@ module Tinkerforge
|
|
|
204
209
|
# There is also a :ref:`green LED <gps_v2_bricklet_fix_led>` on the Bricklet that
|
|
205
210
|
# indicates the fix status.
|
|
206
211
|
def get_status
|
|
207
|
-
|
|
212
|
+
check_validity
|
|
213
|
+
|
|
214
|
+
send_request FUNCTION_GET_STATUS, [], '', 10, '? C'
|
|
208
215
|
end
|
|
209
216
|
|
|
210
217
|
# Returns the current altitude and corresponding geoidal separation.
|
|
211
218
|
#
|
|
212
|
-
# Both values are given in cm.
|
|
213
|
-
#
|
|
214
219
|
# This data is only valid if there is currently a fix as indicated by
|
|
215
220
|
# BrickletGPSV2#get_status.
|
|
216
221
|
def get_altitude
|
|
217
|
-
|
|
222
|
+
check_validity
|
|
223
|
+
|
|
224
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 16, 'l l'
|
|
218
225
|
end
|
|
219
226
|
|
|
220
|
-
# Returns the current course and speed.
|
|
221
|
-
# and speed is given in hundredths km/h. A course of 0° means the Bricklet is
|
|
227
|
+
# Returns the current course and speed. A course of 0° means the Bricklet is
|
|
222
228
|
# traveling north bound and 90° means it is traveling east bound.
|
|
223
229
|
#
|
|
224
230
|
# Please note that this only returns useful values if an actual movement
|
|
@@ -227,15 +233,19 @@ module Tinkerforge
|
|
|
227
233
|
# This data is only valid if there is currently a fix as indicated by
|
|
228
234
|
# BrickletGPSV2#get_status.
|
|
229
235
|
def get_motion
|
|
230
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_GET_MOTION, [], '', 16, 'L L'
|
|
231
239
|
end
|
|
232
240
|
|
|
233
241
|
# Returns the current date and time. The date is
|
|
234
242
|
# given in the format ``ddmmyy`` and the time is given
|
|
235
243
|
# in the format ``hhmmss.sss``. For example, 140713 means
|
|
236
|
-
# 14.
|
|
244
|
+
# 14.07.13 as date and 195923568 means 19:59:23.568 as time.
|
|
237
245
|
def get_date_time
|
|
238
|
-
|
|
246
|
+
check_validity
|
|
247
|
+
|
|
248
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 16, 'L L'
|
|
239
249
|
end
|
|
240
250
|
|
|
241
251
|
# Restarts the GPS Bricklet, the following restart types are available:
|
|
@@ -247,7 +257,9 @@ module Tinkerforge
|
|
|
247
257
|
# "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
|
|
248
258
|
# "3", "Factory reset (clear all system/user configurations at restart)"
|
|
249
259
|
def restart(restart_type)
|
|
250
|
-
|
|
260
|
+
check_validity
|
|
261
|
+
|
|
262
|
+
send_request FUNCTION_RESTART, [restart_type], 'C', 8, ''
|
|
251
263
|
end
|
|
252
264
|
|
|
253
265
|
# Returns the
|
|
@@ -265,15 +277,12 @@ module Tinkerforge
|
|
|
265
277
|
# the numbers of the satellites that are currently utilized. The number 0 is not
|
|
266
278
|
# a valid satellite number and can be ignored in the list.
|
|
267
279
|
def get_satellite_system_status_low_level(satellite_system)
|
|
268
|
-
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 28, 'C C12 C S S S'
|
|
269
283
|
end
|
|
270
284
|
|
|
271
|
-
# Returns the current
|
|
272
|
-
#
|
|
273
|
-
# * elevation (0° - 90°),
|
|
274
|
-
# * azimuth (0° - 359°) and
|
|
275
|
-
# * SNR (0dB - 99dB)
|
|
276
|
-
#
|
|
285
|
+
# Returns the current elevation, azimuth and SNR
|
|
277
286
|
# for a given satellite and satellite system.
|
|
278
287
|
#
|
|
279
288
|
# The satellite number here always goes from 1 to 32. For GLONASS it corresponds to
|
|
@@ -281,7 +290,9 @@ module Tinkerforge
|
|
|
281
290
|
#
|
|
282
291
|
# Galileo is not yet supported.
|
|
283
292
|
def get_satellite_status(satellite_system, satellite_number)
|
|
284
|
-
|
|
293
|
+
check_validity
|
|
294
|
+
|
|
295
|
+
send_request FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 14, 's s s'
|
|
285
296
|
end
|
|
286
297
|
|
|
287
298
|
# Sets the fix LED configuration. By default the LED shows if
|
|
@@ -293,110 +304,126 @@ module Tinkerforge
|
|
|
293
304
|
#
|
|
294
305
|
# If the Bricklet is in bootloader mode, the LED is off.
|
|
295
306
|
def set_fix_led_config(config)
|
|
296
|
-
|
|
307
|
+
check_validity
|
|
308
|
+
|
|
309
|
+
send_request FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 8, ''
|
|
297
310
|
end
|
|
298
311
|
|
|
299
312
|
# Returns the configuration as set by BrickletGPSV2#set_fix_led_config
|
|
300
313
|
def get_fix_led_config
|
|
301
|
-
|
|
314
|
+
check_validity
|
|
315
|
+
|
|
316
|
+
send_request FUNCTION_GET_FIX_LED_CONFIG, [], '', 9, 'C'
|
|
302
317
|
end
|
|
303
318
|
|
|
304
|
-
# Sets the period
|
|
319
|
+
# Sets the period with which the CALLBACK_COORDINATES callback is triggered
|
|
305
320
|
# periodically. A value of 0 turns the callback off.
|
|
306
321
|
#
|
|
307
322
|
# The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
|
|
308
323
|
# since the last triggering.
|
|
309
|
-
#
|
|
310
|
-
# The default value is 0.
|
|
311
324
|
def set_coordinates_callback_period(period)
|
|
312
|
-
|
|
325
|
+
check_validity
|
|
326
|
+
|
|
327
|
+
send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
313
328
|
end
|
|
314
329
|
|
|
315
330
|
# Returns the period as set by BrickletGPSV2#set_coordinates_callback_period.
|
|
316
331
|
def get_coordinates_callback_period
|
|
317
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
318
335
|
end
|
|
319
336
|
|
|
320
|
-
# Sets the period
|
|
337
|
+
# Sets the period with which the CALLBACK_STATUS callback is triggered
|
|
321
338
|
# periodically. A value of 0 turns the callback off.
|
|
322
339
|
#
|
|
323
340
|
# The CALLBACK_STATUS callback is only triggered if the status changed since the
|
|
324
341
|
# last triggering.
|
|
325
|
-
#
|
|
326
|
-
# The default value is 0.
|
|
327
342
|
def set_status_callback_period(period)
|
|
328
|
-
|
|
343
|
+
check_validity
|
|
344
|
+
|
|
345
|
+
send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
329
346
|
end
|
|
330
347
|
|
|
331
348
|
# Returns the period as set by BrickletGPSV2#set_status_callback_period.
|
|
332
349
|
def get_status_callback_period
|
|
333
|
-
|
|
350
|
+
check_validity
|
|
351
|
+
|
|
352
|
+
send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
334
353
|
end
|
|
335
354
|
|
|
336
|
-
# Sets the period
|
|
355
|
+
# Sets the period with which the CALLBACK_ALTITUDE callback is triggered
|
|
337
356
|
# periodically. A value of 0 turns the callback off.
|
|
338
357
|
#
|
|
339
358
|
# The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the
|
|
340
359
|
# last triggering.
|
|
341
|
-
#
|
|
342
|
-
# The default value is 0.
|
|
343
360
|
def set_altitude_callback_period(period)
|
|
344
|
-
|
|
361
|
+
check_validity
|
|
362
|
+
|
|
363
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
345
364
|
end
|
|
346
365
|
|
|
347
366
|
# Returns the period as set by BrickletGPSV2#set_altitude_callback_period.
|
|
348
367
|
def get_altitude_callback_period
|
|
349
|
-
|
|
368
|
+
check_validity
|
|
369
|
+
|
|
370
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
350
371
|
end
|
|
351
372
|
|
|
352
|
-
# Sets the period
|
|
373
|
+
# Sets the period with which the CALLBACK_MOTION callback is triggered
|
|
353
374
|
# periodically. A value of 0 turns the callback off.
|
|
354
375
|
#
|
|
355
376
|
# The CALLBACK_MOTION callback is only triggered if the motion changed since the
|
|
356
377
|
# last triggering.
|
|
357
|
-
#
|
|
358
|
-
# The default value is 0.
|
|
359
378
|
def set_motion_callback_period(period)
|
|
360
|
-
|
|
379
|
+
check_validity
|
|
380
|
+
|
|
381
|
+
send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
361
382
|
end
|
|
362
383
|
|
|
363
384
|
# Returns the period as set by BrickletGPSV2#set_motion_callback_period.
|
|
364
385
|
def get_motion_callback_period
|
|
365
|
-
|
|
386
|
+
check_validity
|
|
387
|
+
|
|
388
|
+
send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
366
389
|
end
|
|
367
390
|
|
|
368
|
-
# Sets the period
|
|
391
|
+
# Sets the period with which the CALLBACK_DATE_TIME callback is triggered
|
|
369
392
|
# periodically. A value of 0 turns the callback off.
|
|
370
393
|
#
|
|
371
394
|
# The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
|
|
372
395
|
# since the last triggering.
|
|
373
|
-
#
|
|
374
|
-
# The default value is 0.
|
|
375
396
|
def set_date_time_callback_period(period)
|
|
376
|
-
|
|
397
|
+
check_validity
|
|
398
|
+
|
|
399
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
377
400
|
end
|
|
378
401
|
|
|
379
402
|
# Returns the period as set by BrickletGPSV2#set_date_time_callback_period.
|
|
380
403
|
def get_date_time_callback_period
|
|
381
|
-
|
|
404
|
+
check_validity
|
|
405
|
+
|
|
406
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
382
407
|
end
|
|
383
408
|
|
|
384
409
|
# If `SBAS <https://en.wikipedia.org/wiki/GNSS_augmentation#Satellite-based_augmentation_system>`__ is enabled,
|
|
385
410
|
# the position accuracy increases (if SBAS satellites are in view),
|
|
386
411
|
# but the update rate is limited to 5Hz. With SBAS disabled the update rate is increased to 10Hz.
|
|
387
412
|
#
|
|
388
|
-
# By default SBAS is enabled and the update rate is 5Hz.
|
|
389
|
-
#
|
|
390
413
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
391
414
|
def set_sbas_config(sbas_config)
|
|
392
|
-
|
|
415
|
+
check_validity
|
|
416
|
+
|
|
417
|
+
send_request FUNCTION_SET_SBAS_CONFIG, [sbas_config], 'C', 8, ''
|
|
393
418
|
end
|
|
394
419
|
|
|
395
420
|
# Returns the SBAS configuration as set by BrickletGPSV2#set_sbas_config
|
|
396
421
|
#
|
|
397
422
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
398
423
|
def get_sbas_config
|
|
399
|
-
|
|
424
|
+
check_validity
|
|
425
|
+
|
|
426
|
+
send_request FUNCTION_GET_SBAS_CONFIG, [], '', 9, 'C'
|
|
400
427
|
end
|
|
401
428
|
|
|
402
429
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -411,7 +438,9 @@ module Tinkerforge
|
|
|
411
438
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
412
439
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
413
440
|
def get_spitfp_error_count
|
|
414
|
-
|
|
441
|
+
check_validity
|
|
442
|
+
|
|
443
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
415
444
|
end
|
|
416
445
|
|
|
417
446
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -424,12 +453,16 @@ module Tinkerforge
|
|
|
424
453
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
425
454
|
# necessary to call it in a normal user program.
|
|
426
455
|
def set_bootloader_mode(mode)
|
|
427
|
-
|
|
456
|
+
check_validity
|
|
457
|
+
|
|
458
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
428
459
|
end
|
|
429
460
|
|
|
430
461
|
# Returns the current bootloader mode, see BrickletGPSV2#set_bootloader_mode.
|
|
431
462
|
def get_bootloader_mode
|
|
432
|
-
|
|
463
|
+
check_validity
|
|
464
|
+
|
|
465
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
433
466
|
end
|
|
434
467
|
|
|
435
468
|
# Sets the firmware pointer for BrickletGPSV2#write_firmware. The pointer has
|
|
@@ -439,7 +472,9 @@ module Tinkerforge
|
|
|
439
472
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
440
473
|
# necessary to call it in a normal user program.
|
|
441
474
|
def set_write_firmware_pointer(pointer)
|
|
442
|
-
|
|
475
|
+
check_validity
|
|
476
|
+
|
|
477
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
443
478
|
end
|
|
444
479
|
|
|
445
480
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -451,7 +486,9 @@ module Tinkerforge
|
|
|
451
486
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
452
487
|
# necessary to call it in a normal user program.
|
|
453
488
|
def write_firmware(data)
|
|
454
|
-
|
|
489
|
+
check_validity
|
|
490
|
+
|
|
491
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
455
492
|
end
|
|
456
493
|
|
|
457
494
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -462,22 +499,28 @@ module Tinkerforge
|
|
|
462
499
|
#
|
|
463
500
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
464
501
|
def set_status_led_config(config)
|
|
465
|
-
|
|
502
|
+
check_validity
|
|
503
|
+
|
|
504
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
466
505
|
end
|
|
467
506
|
|
|
468
507
|
# Returns the configuration as set by BrickletGPSV2#set_status_led_config
|
|
469
508
|
def get_status_led_config
|
|
470
|
-
|
|
509
|
+
check_validity
|
|
510
|
+
|
|
511
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
471
512
|
end
|
|
472
513
|
|
|
473
|
-
# Returns the temperature
|
|
514
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
474
515
|
# value returned is not the ambient temperature!
|
|
475
516
|
#
|
|
476
517
|
# The temperature is only proportional to the real temperature and it has bad
|
|
477
518
|
# accuracy. Practically it is only useful as an indicator for
|
|
478
519
|
# temperature changes.
|
|
479
520
|
def get_chip_temperature
|
|
480
|
-
|
|
521
|
+
check_validity
|
|
522
|
+
|
|
523
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
481
524
|
end
|
|
482
525
|
|
|
483
526
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -487,7 +530,9 @@ module Tinkerforge
|
|
|
487
530
|
# calling functions on the existing ones will result in
|
|
488
531
|
# undefined behavior!
|
|
489
532
|
def reset
|
|
490
|
-
|
|
533
|
+
check_validity
|
|
534
|
+
|
|
535
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
491
536
|
end
|
|
492
537
|
|
|
493
538
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -496,25 +541,31 @@ module Tinkerforge
|
|
|
496
541
|
#
|
|
497
542
|
# We recommend that you use Brick Viewer to change the UID.
|
|
498
543
|
def write_uid(uid)
|
|
499
|
-
|
|
544
|
+
check_validity
|
|
545
|
+
|
|
546
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
500
547
|
end
|
|
501
548
|
|
|
502
549
|
# Returns the current UID as an integer. Encode as
|
|
503
550
|
# Base58 to get the usual string version.
|
|
504
551
|
def read_uid
|
|
505
|
-
|
|
552
|
+
check_validity
|
|
553
|
+
|
|
554
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
506
555
|
end
|
|
507
556
|
|
|
508
557
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
509
558
|
# the position, the hardware and firmware version as well as the
|
|
510
559
|
# device identifier.
|
|
511
560
|
#
|
|
512
|
-
# The position can be 'a', 'b', 'c' or '
|
|
561
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
562
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
563
|
+
# position 'z'.
|
|
513
564
|
#
|
|
514
565
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
515
566
|
# |device_identifier_constant|
|
|
516
567
|
def get_identity
|
|
517
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
568
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
518
569
|
end
|
|
519
570
|
|
|
520
571
|
# Returns the
|
|
@@ -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
|
# Detects presence of magnetic field
|
|
14
16
|
class BrickletHallEffect < Device
|
|
@@ -42,7 +44,7 @@ module Tinkerforge
|
|
|
42
44
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
43
45
|
# the IP Connection <tt>ipcon</tt>.
|
|
44
46
|
def initialize(uid, ipcon)
|
|
45
|
-
super uid, ipcon
|
|
47
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
46
48
|
|
|
47
49
|
@api_version = [2, 0, 0]
|
|
48
50
|
|
|
@@ -57,13 +59,16 @@ module Tinkerforge
|
|
|
57
59
|
@response_expected[FUNCTION_EDGE_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
58
60
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
59
61
|
|
|
60
|
-
@callback_formats[CALLBACK_EDGE_COUNT] = 'L ?'
|
|
62
|
+
@callback_formats[CALLBACK_EDGE_COUNT] = [13, 'L ?']
|
|
61
63
|
|
|
64
|
+
@ipcon.add_device self
|
|
62
65
|
end
|
|
63
66
|
|
|
64
|
-
# Returns *true* if a magnetic field of
|
|
67
|
+
# Returns *true* if a magnetic field of 3.5 millitesla or greater is detected.
|
|
65
68
|
def get_value
|
|
66
|
-
|
|
69
|
+
check_validity
|
|
70
|
+
|
|
71
|
+
send_request FUNCTION_GET_VALUE, [], '', 9, '?'
|
|
67
72
|
end
|
|
68
73
|
|
|
69
74
|
# Returns the current value of the edge counter. You can configure
|
|
@@ -73,37 +78,39 @@ module Tinkerforge
|
|
|
73
78
|
# If you set the reset counter to *true*, the count is set back to 0
|
|
74
79
|
# directly after it is read.
|
|
75
80
|
def get_edge_count(reset_counter)
|
|
76
|
-
|
|
81
|
+
check_validity
|
|
82
|
+
|
|
83
|
+
send_request FUNCTION_GET_EDGE_COUNT, [reset_counter], '?', 12, 'L'
|
|
77
84
|
end
|
|
78
85
|
|
|
79
86
|
# The edge type parameter configures if rising edges, falling edges or
|
|
80
87
|
# both are counted. Possible edge types are:
|
|
81
88
|
#
|
|
82
|
-
# * 0 = rising
|
|
89
|
+
# * 0 = rising
|
|
83
90
|
# * 1 = falling
|
|
84
91
|
# * 2 = both
|
|
85
92
|
#
|
|
86
|
-
# A magnetic field of
|
|
87
|
-
# magnetic field of
|
|
93
|
+
# A magnetic field of 3.5 millitesla or greater causes a falling edge and a
|
|
94
|
+
# magnetic field of 2.5 millitesla or smaller causes a rising edge.
|
|
88
95
|
#
|
|
89
96
|
# If a magnet comes near the Bricklet the signal goes low (falling edge), if
|
|
90
97
|
# a magnet is removed from the vicinity the signal goes high (rising edge).
|
|
91
98
|
#
|
|
92
|
-
# The debounce time is given in ms.
|
|
93
|
-
#
|
|
94
99
|
# Configuring an edge counter resets its value to 0.
|
|
95
100
|
#
|
|
96
101
|
# If you don't know what any of this means, just leave it at default. The
|
|
97
102
|
# default configuration is very likely OK for you.
|
|
98
|
-
#
|
|
99
|
-
# Default values: 0 (edge type) and 100ms (debounce time)
|
|
100
103
|
def set_edge_count_config(edge_type, debounce)
|
|
101
|
-
|
|
104
|
+
check_validity
|
|
105
|
+
|
|
106
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [edge_type, debounce], 'C C', 8, ''
|
|
102
107
|
end
|
|
103
108
|
|
|
104
109
|
# Returns the edge type and debounce time as set by BrickletHallEffect#set_edge_count_config.
|
|
105
110
|
def get_edge_count_config
|
|
106
|
-
|
|
111
|
+
check_validity
|
|
112
|
+
|
|
113
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [], '', 10, 'C C'
|
|
107
114
|
end
|
|
108
115
|
|
|
109
116
|
# Sets the number of edges until an interrupt is invoked.
|
|
@@ -111,31 +118,35 @@ module Tinkerforge
|
|
|
111
118
|
# If *edges* is set to n, an interrupt is invoked for every n-th detected edge.
|
|
112
119
|
#
|
|
113
120
|
# If *edges* is set to 0, the interrupt is disabled.
|
|
114
|
-
#
|
|
115
|
-
# Default value is 0.
|
|
116
121
|
def set_edge_interrupt(edges)
|
|
117
|
-
|
|
122
|
+
check_validity
|
|
123
|
+
|
|
124
|
+
send_request FUNCTION_SET_EDGE_INTERRUPT, [edges], 'L', 8, ''
|
|
118
125
|
end
|
|
119
126
|
|
|
120
127
|
# Returns the edges as set by BrickletHallEffect#set_edge_interrupt.
|
|
121
128
|
def get_edge_interrupt
|
|
122
|
-
|
|
129
|
+
check_validity
|
|
130
|
+
|
|
131
|
+
send_request FUNCTION_GET_EDGE_INTERRUPT, [], '', 12, 'L'
|
|
123
132
|
end
|
|
124
133
|
|
|
125
|
-
# Sets the period
|
|
134
|
+
# Sets the period with which the CALLBACK_EDGE_COUNT callback is triggered
|
|
126
135
|
# periodically. A value of 0 turns the callback off.
|
|
127
136
|
#
|
|
128
137
|
# The CALLBACK_EDGE_COUNT callback is only triggered if the edge count has changed
|
|
129
138
|
# since the last triggering.
|
|
130
|
-
#
|
|
131
|
-
# The default value is 0.
|
|
132
139
|
def set_edge_count_callback_period(period)
|
|
133
|
-
|
|
140
|
+
check_validity
|
|
141
|
+
|
|
142
|
+
send_request FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
134
143
|
end
|
|
135
144
|
|
|
136
145
|
# Returns the period as set by BrickletHallEffect#set_edge_count_callback_period.
|
|
137
146
|
def get_edge_count_callback_period
|
|
138
|
-
|
|
147
|
+
check_validity
|
|
148
|
+
|
|
149
|
+
send_request FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
139
150
|
end
|
|
140
151
|
|
|
141
152
|
# This callback is triggered every n-th count, as configured with
|
|
@@ -143,19 +154,23 @@ module Tinkerforge
|
|
|
143
154
|
# current count and the current value (see BrickletHallEffect#get_value and
|
|
144
155
|
# BrickletHallEffect#get_edge_count).
|
|
145
156
|
def edge_interrupt
|
|
146
|
-
|
|
157
|
+
check_validity
|
|
158
|
+
|
|
159
|
+
send_request FUNCTION_EDGE_INTERRUPT, [], '', 13, 'L ?'
|
|
147
160
|
end
|
|
148
161
|
|
|
149
162
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
150
163
|
# the position, the hardware and firmware version as well as the
|
|
151
164
|
# device identifier.
|
|
152
165
|
#
|
|
153
|
-
# The position can be 'a', 'b', 'c' or '
|
|
166
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
167
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
168
|
+
# position 'z'.
|
|
154
169
|
#
|
|
155
170
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
156
171
|
# |device_identifier_constant|
|
|
157
172
|
def get_identity
|
|
158
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
173
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
159
174
|
end
|
|
160
175
|
|
|
161
176
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|