tinkerforge 2.1.24 → 2.1.25
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 +155 -74
- data/lib/tinkerforge/brick_hat.rb +70 -30
- data/lib/tinkerforge/brick_hat_zero.rb +56 -22
- data/lib/tinkerforge/brick_imu.rb +184 -77
- data/lib/tinkerforge/brick_imu_v2.rb +208 -105
- data/lib/tinkerforge/brick_master.rb +484 -182
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +185 -101
- data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
- data/lib/tinkerforge/brick_stepper.rb +210 -98
- data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
- data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
- data/lib/tinkerforge/bricklet_barometer.rb +66 -26
- data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -18
- data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
- data/lib/tinkerforge/bricklet_co2.rb +34 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
- data/lib/tinkerforge/bricklet_color.rb +69 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
- data/lib/tinkerforge/bricklet_compass.rb +78 -30
- data/lib/tinkerforge/bricklet_current12.rb +58 -24
- data/lib/tinkerforge/bricklet_current25.rb +58 -24
- data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_dmx.rb +88 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
- data/lib/tinkerforge/bricklet_gps.rb +64 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_humidity.rb +51 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_io16.rb +55 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
- data/lib/tinkerforge/bricklet_io4.rb +55 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -28
- data/lib/tinkerforge/bricklet_joystick.rb +59 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
- data/lib/tinkerforge/bricklet_line.rb +34 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
- data/lib/tinkerforge/bricklet_moisture.rb +40 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
- data/lib/tinkerforge/bricklet_nfc.rb +123 -58
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
- data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
- data/lib/tinkerforge/bricklet_ptc.rb +74 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_rs232.rb +90 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
- data/lib/tinkerforge/bricklet_rs485.rb +223 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
- data/lib/tinkerforge/bricklet_temperature.rb +40 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
- data/lib/tinkerforge/bricklet_tilt.rb +24 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
- data/lib/tinkerforge/bricklet_voltage.rb +52 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
- data/lib/tinkerforge/device_display_names.rb +163 -0
- data/lib/tinkerforge/ip_connection.rb +151 -32
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2020-04-07. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# 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,7 +209,9 @@ 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.
|
@@ -212,7 +219,9 @@ module Tinkerforge
|
|
212
219
|
# This data is only valid if there is currently a fix as indicated by
|
213
220
|
# BrickletGPSV2#get_status.
|
214
221
|
def get_altitude
|
215
|
-
|
222
|
+
check_validity
|
223
|
+
|
224
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 16, 'l l'
|
216
225
|
end
|
217
226
|
|
218
227
|
# Returns the current course and speed. A course of 0° means the Bricklet is
|
@@ -224,7 +233,9 @@ module Tinkerforge
|
|
224
233
|
# This data is only valid if there is currently a fix as indicated by
|
225
234
|
# BrickletGPSV2#get_status.
|
226
235
|
def get_motion
|
227
|
-
|
236
|
+
check_validity
|
237
|
+
|
238
|
+
send_request FUNCTION_GET_MOTION, [], '', 16, 'L L'
|
228
239
|
end
|
229
240
|
|
230
241
|
# Returns the current date and time. The date is
|
@@ -232,7 +243,9 @@ module Tinkerforge
|
|
232
243
|
# in the format ``hhmmss.sss``. For example, 140713 means
|
233
244
|
# 14.07.13 as date and 195923568 means 19:59:23.568 as time.
|
234
245
|
def get_date_time
|
235
|
-
|
246
|
+
check_validity
|
247
|
+
|
248
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 16, 'L L'
|
236
249
|
end
|
237
250
|
|
238
251
|
# Restarts the GPS Bricklet, the following restart types are available:
|
@@ -244,7 +257,9 @@ module Tinkerforge
|
|
244
257
|
# "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
|
245
258
|
# "3", "Factory reset (clear all system/user configurations at restart)"
|
246
259
|
def restart(restart_type)
|
247
|
-
|
260
|
+
check_validity
|
261
|
+
|
262
|
+
send_request FUNCTION_RESTART, [restart_type], 'C', 8, ''
|
248
263
|
end
|
249
264
|
|
250
265
|
# Returns the
|
@@ -262,7 +277,9 @@ module Tinkerforge
|
|
262
277
|
# the numbers of the satellites that are currently utilized. The number 0 is not
|
263
278
|
# a valid satellite number and can be ignored in the list.
|
264
279
|
def get_satellite_system_status_low_level(satellite_system)
|
265
|
-
|
280
|
+
check_validity
|
281
|
+
|
282
|
+
send_request FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 28, 'C C12 C S S S'
|
266
283
|
end
|
267
284
|
|
268
285
|
# Returns the current elevation, azimuth and SNR
|
@@ -273,7 +290,9 @@ module Tinkerforge
|
|
273
290
|
#
|
274
291
|
# Galileo is not yet supported.
|
275
292
|
def get_satellite_status(satellite_system, satellite_number)
|
276
|
-
|
293
|
+
check_validity
|
294
|
+
|
295
|
+
send_request FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 14, 's s s'
|
277
296
|
end
|
278
297
|
|
279
298
|
# Sets the fix LED configuration. By default the LED shows if
|
@@ -285,12 +304,16 @@ module Tinkerforge
|
|
285
304
|
#
|
286
305
|
# If the Bricklet is in bootloader mode, the LED is off.
|
287
306
|
def set_fix_led_config(config)
|
288
|
-
|
307
|
+
check_validity
|
308
|
+
|
309
|
+
send_request FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 8, ''
|
289
310
|
end
|
290
311
|
|
291
312
|
# Returns the configuration as set by BrickletGPSV2#set_fix_led_config
|
292
313
|
def get_fix_led_config
|
293
|
-
|
314
|
+
check_validity
|
315
|
+
|
316
|
+
send_request FUNCTION_GET_FIX_LED_CONFIG, [], '', 9, 'C'
|
294
317
|
end
|
295
318
|
|
296
319
|
# Sets the period with which the CALLBACK_COORDINATES callback is triggered
|
@@ -299,12 +322,16 @@ module Tinkerforge
|
|
299
322
|
# The CALLBACK_COORDINATES callback is only triggered if the coordinates changed
|
300
323
|
# since the last triggering.
|
301
324
|
def set_coordinates_callback_period(period)
|
302
|
-
|
325
|
+
check_validity
|
326
|
+
|
327
|
+
send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 8, ''
|
303
328
|
end
|
304
329
|
|
305
330
|
# Returns the period as set by BrickletGPSV2#set_coordinates_callback_period.
|
306
331
|
def get_coordinates_callback_period
|
307
|
-
|
332
|
+
check_validity
|
333
|
+
|
334
|
+
send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 12, 'L'
|
308
335
|
end
|
309
336
|
|
310
337
|
# Sets the period with which the CALLBACK_STATUS callback is triggered
|
@@ -313,12 +340,16 @@ module Tinkerforge
|
|
313
340
|
# The CALLBACK_STATUS callback is only triggered if the status changed since the
|
314
341
|
# last triggering.
|
315
342
|
def set_status_callback_period(period)
|
316
|
-
|
343
|
+
check_validity
|
344
|
+
|
345
|
+
send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 8, ''
|
317
346
|
end
|
318
347
|
|
319
348
|
# Returns the period as set by BrickletGPSV2#set_status_callback_period.
|
320
349
|
def get_status_callback_period
|
321
|
-
|
350
|
+
check_validity
|
351
|
+
|
352
|
+
send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 12, 'L'
|
322
353
|
end
|
323
354
|
|
324
355
|
# Sets the period with which the CALLBACK_ALTITUDE callback is triggered
|
@@ -327,12 +358,16 @@ module Tinkerforge
|
|
327
358
|
# The CALLBACK_ALTITUDE callback is only triggered if the altitude changed since the
|
328
359
|
# last triggering.
|
329
360
|
def set_altitude_callback_period(period)
|
330
|
-
|
361
|
+
check_validity
|
362
|
+
|
363
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
331
364
|
end
|
332
365
|
|
333
366
|
# Returns the period as set by BrickletGPSV2#set_altitude_callback_period.
|
334
367
|
def get_altitude_callback_period
|
335
|
-
|
368
|
+
check_validity
|
369
|
+
|
370
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
|
336
371
|
end
|
337
372
|
|
338
373
|
# Sets the period with which the CALLBACK_MOTION callback is triggered
|
@@ -341,12 +376,16 @@ module Tinkerforge
|
|
341
376
|
# The CALLBACK_MOTION callback is only triggered if the motion changed since the
|
342
377
|
# last triggering.
|
343
378
|
def set_motion_callback_period(period)
|
344
|
-
|
379
|
+
check_validity
|
380
|
+
|
381
|
+
send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 8, ''
|
345
382
|
end
|
346
383
|
|
347
384
|
# Returns the period as set by BrickletGPSV2#set_motion_callback_period.
|
348
385
|
def get_motion_callback_period
|
349
|
-
|
386
|
+
check_validity
|
387
|
+
|
388
|
+
send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 12, 'L'
|
350
389
|
end
|
351
390
|
|
352
391
|
# Sets the period with which the CALLBACK_DATE_TIME callback is triggered
|
@@ -355,30 +394,36 @@ module Tinkerforge
|
|
355
394
|
# The CALLBACK_DATE_TIME callback is only triggered if the date or time changed
|
356
395
|
# since the last triggering.
|
357
396
|
def set_date_time_callback_period(period)
|
358
|
-
|
397
|
+
check_validity
|
398
|
+
|
399
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 8, ''
|
359
400
|
end
|
360
401
|
|
361
402
|
# Returns the period as set by BrickletGPSV2#set_date_time_callback_period.
|
362
403
|
def get_date_time_callback_period
|
363
|
-
|
404
|
+
check_validity
|
405
|
+
|
406
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 12, 'L'
|
364
407
|
end
|
365
408
|
|
366
409
|
# If `SBAS <https://en.wikipedia.org/wiki/GNSS_augmentation#Satellite-based_augmentation_system>`__ is enabled,
|
367
410
|
# the position accuracy increases (if SBAS satellites are in view),
|
368
411
|
# but the update rate is limited to 5Hz. With SBAS disabled the update rate is increased to 10Hz.
|
369
412
|
#
|
370
|
-
# By default SBAS is enabled and the update rate is 5Hz.
|
371
|
-
#
|
372
413
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
373
414
|
def set_sbas_config(sbas_config)
|
374
|
-
|
415
|
+
check_validity
|
416
|
+
|
417
|
+
send_request FUNCTION_SET_SBAS_CONFIG, [sbas_config], 'C', 8, ''
|
375
418
|
end
|
376
419
|
|
377
420
|
# Returns the SBAS configuration as set by BrickletGPSV2#set_sbas_config
|
378
421
|
#
|
379
422
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
380
423
|
def get_sbas_config
|
381
|
-
|
424
|
+
check_validity
|
425
|
+
|
426
|
+
send_request FUNCTION_GET_SBAS_CONFIG, [], '', 9, 'C'
|
382
427
|
end
|
383
428
|
|
384
429
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -393,7 +438,9 @@ module Tinkerforge
|
|
393
438
|
# The errors counts are for errors that occur on the Bricklet side. All
|
394
439
|
# Bricks have a similar function that returns the errors on the Brick side.
|
395
440
|
def get_spitfp_error_count
|
396
|
-
|
441
|
+
check_validity
|
442
|
+
|
443
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
397
444
|
end
|
398
445
|
|
399
446
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -406,12 +453,16 @@ module Tinkerforge
|
|
406
453
|
# This function is used by Brick Viewer during flashing. It should not be
|
407
454
|
# necessary to call it in a normal user program.
|
408
455
|
def set_bootloader_mode(mode)
|
409
|
-
|
456
|
+
check_validity
|
457
|
+
|
458
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
410
459
|
end
|
411
460
|
|
412
461
|
# Returns the current bootloader mode, see BrickletGPSV2#set_bootloader_mode.
|
413
462
|
def get_bootloader_mode
|
414
|
-
|
463
|
+
check_validity
|
464
|
+
|
465
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
415
466
|
end
|
416
467
|
|
417
468
|
# Sets the firmware pointer for BrickletGPSV2#write_firmware. The pointer has
|
@@ -421,7 +472,9 @@ module Tinkerforge
|
|
421
472
|
# This function is used by Brick Viewer during flashing. It should not be
|
422
473
|
# necessary to call it in a normal user program.
|
423
474
|
def set_write_firmware_pointer(pointer)
|
424
|
-
|
475
|
+
check_validity
|
476
|
+
|
477
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
425
478
|
end
|
426
479
|
|
427
480
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -433,7 +486,9 @@ module Tinkerforge
|
|
433
486
|
# This function is used by Brick Viewer during flashing. It should not be
|
434
487
|
# necessary to call it in a normal user program.
|
435
488
|
def write_firmware(data)
|
436
|
-
|
489
|
+
check_validity
|
490
|
+
|
491
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
437
492
|
end
|
438
493
|
|
439
494
|
# Sets the status LED configuration. By default the LED shows
|
@@ -444,22 +499,28 @@ module Tinkerforge
|
|
444
499
|
#
|
445
500
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
446
501
|
def set_status_led_config(config)
|
447
|
-
|
502
|
+
check_validity
|
503
|
+
|
504
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
448
505
|
end
|
449
506
|
|
450
507
|
# Returns the configuration as set by BrickletGPSV2#set_status_led_config
|
451
508
|
def get_status_led_config
|
452
|
-
|
509
|
+
check_validity
|
510
|
+
|
511
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
453
512
|
end
|
454
513
|
|
455
|
-
# Returns the temperature
|
514
|
+
# Returns the temperature as measured inside the microcontroller. The
|
456
515
|
# value returned is not the ambient temperature!
|
457
516
|
#
|
458
517
|
# The temperature is only proportional to the real temperature and it has bad
|
459
518
|
# accuracy. Practically it is only useful as an indicator for
|
460
519
|
# temperature changes.
|
461
520
|
def get_chip_temperature
|
462
|
-
|
521
|
+
check_validity
|
522
|
+
|
523
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
463
524
|
end
|
464
525
|
|
465
526
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -469,7 +530,9 @@ module Tinkerforge
|
|
469
530
|
# calling functions on the existing ones will result in
|
470
531
|
# undefined behavior!
|
471
532
|
def reset
|
472
|
-
|
533
|
+
check_validity
|
534
|
+
|
535
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
473
536
|
end
|
474
537
|
|
475
538
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -478,25 +541,32 @@ module Tinkerforge
|
|
478
541
|
#
|
479
542
|
# We recommend that you use Brick Viewer to change the UID.
|
480
543
|
def write_uid(uid)
|
481
|
-
|
544
|
+
check_validity
|
545
|
+
|
546
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
482
547
|
end
|
483
548
|
|
484
549
|
# Returns the current UID as an integer. Encode as
|
485
550
|
# Base58 to get the usual string version.
|
486
551
|
def read_uid
|
487
|
-
|
552
|
+
check_validity
|
553
|
+
|
554
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
488
555
|
end
|
489
556
|
|
490
557
|
# Returns the UID, the UID where the Bricklet is connected to,
|
491
558
|
# the position, the hardware and firmware version as well as the
|
492
559
|
# device identifier.
|
493
560
|
#
|
494
|
-
# 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
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
563
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
564
|
+
# position 'z'.
|
495
565
|
#
|
496
566
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
497
567
|
# |device_identifier_constant|
|
498
568
|
def get_identity
|
499
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
569
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
500
570
|
end
|
501
571
|
|
502
572
|
# 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-04-07. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# 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,35 +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
103
|
def set_edge_count_config(edge_type, debounce)
|
99
|
-
|
104
|
+
check_validity
|
105
|
+
|
106
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [edge_type, debounce], 'C C', 8, ''
|
100
107
|
end
|
101
108
|
|
102
109
|
# Returns the edge type and debounce time as set by BrickletHallEffect#set_edge_count_config.
|
103
110
|
def get_edge_count_config
|
104
|
-
|
111
|
+
check_validity
|
112
|
+
|
113
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [], '', 10, 'C C'
|
105
114
|
end
|
106
115
|
|
107
116
|
# Sets the number of edges until an interrupt is invoked.
|
@@ -109,15 +118,17 @@ module Tinkerforge
|
|
109
118
|
# If *edges* is set to n, an interrupt is invoked for every n-th detected edge.
|
110
119
|
#
|
111
120
|
# If *edges* is set to 0, the interrupt is disabled.
|
112
|
-
#
|
113
|
-
# Default value is 0.
|
114
121
|
def set_edge_interrupt(edges)
|
115
|
-
|
122
|
+
check_validity
|
123
|
+
|
124
|
+
send_request FUNCTION_SET_EDGE_INTERRUPT, [edges], 'L', 8, ''
|
116
125
|
end
|
117
126
|
|
118
127
|
# Returns the edges as set by BrickletHallEffect#set_edge_interrupt.
|
119
128
|
def get_edge_interrupt
|
120
|
-
|
129
|
+
check_validity
|
130
|
+
|
131
|
+
send_request FUNCTION_GET_EDGE_INTERRUPT, [], '', 12, 'L'
|
121
132
|
end
|
122
133
|
|
123
134
|
# Sets the period with which the CALLBACK_EDGE_COUNT callback is triggered
|
@@ -126,12 +137,16 @@ module Tinkerforge
|
|
126
137
|
# The CALLBACK_EDGE_COUNT callback is only triggered if the edge count has changed
|
127
138
|
# since the last triggering.
|
128
139
|
def set_edge_count_callback_period(period)
|
129
|
-
|
140
|
+
check_validity
|
141
|
+
|
142
|
+
send_request FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD, [period], 'L', 8, ''
|
130
143
|
end
|
131
144
|
|
132
145
|
# Returns the period as set by BrickletHallEffect#set_edge_count_callback_period.
|
133
146
|
def get_edge_count_callback_period
|
134
|
-
|
147
|
+
check_validity
|
148
|
+
|
149
|
+
send_request FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD, [], '', 12, 'L'
|
135
150
|
end
|
136
151
|
|
137
152
|
# This callback is triggered every n-th count, as configured with
|
@@ -139,19 +154,24 @@ module Tinkerforge
|
|
139
154
|
# current count and the current value (see BrickletHallEffect#get_value and
|
140
155
|
# BrickletHallEffect#get_edge_count).
|
141
156
|
def edge_interrupt
|
142
|
-
|
157
|
+
check_validity
|
158
|
+
|
159
|
+
send_request FUNCTION_EDGE_INTERRUPT, [], '', 13, 'L ?'
|
143
160
|
end
|
144
161
|
|
145
162
|
# Returns the UID, the UID where the Bricklet is connected to,
|
146
163
|
# the position, the hardware and firmware version as well as the
|
147
164
|
# device identifier.
|
148
165
|
#
|
149
|
-
# 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
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
168
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
169
|
+
# position 'z'.
|
150
170
|
#
|
151
171
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
152
172
|
# |device_identifier_constant|
|
153
173
|
def get_identity
|
154
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
174
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
155
175
|
end
|
156
176
|
|
157
177
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|