tinkerforge 2.1.13 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -96,7 +96,12 @@ module Tinkerforge
|
|
96
96
|
FUNCTION_GET_SENSOR_CONFIGURATION = 42 # :nodoc:
|
97
97
|
FUNCTION_SET_SENSOR_FUSION_MODE = 43 # :nodoc:
|
98
98
|
FUNCTION_GET_SENSOR_FUSION_MODE = 44 # :nodoc:
|
99
|
+
FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
|
100
|
+
FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
|
99
101
|
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
102
|
+
FUNCTION_SET_SPITFP_BAUDRATE = 234 # :nodoc:
|
103
|
+
FUNCTION_GET_SPITFP_BAUDRATE = 235 # :nodoc:
|
104
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 237 # :nodoc:
|
100
105
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
101
106
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
102
107
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
@@ -188,20 +193,16 @@ module Tinkerforge
|
|
188
193
|
@response_expected[FUNCTION_GET_QUATERNION_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
189
194
|
@response_expected[FUNCTION_SET_ALL_DATA_PERIOD] = RESPONSE_EXPECTED_TRUE
|
190
195
|
@response_expected[FUNCTION_GET_ALL_DATA_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
191
|
-
@response_expected[CALLBACK_ACCELERATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
192
|
-
@response_expected[CALLBACK_MAGNETIC_FIELD] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
193
|
-
@response_expected[CALLBACK_ANGULAR_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
194
|
-
@response_expected[CALLBACK_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
195
|
-
@response_expected[CALLBACK_LINEAR_ACCELERATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
196
|
-
@response_expected[CALLBACK_GRAVITY_VECTOR] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
197
|
-
@response_expected[CALLBACK_ORIENTATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
198
|
-
@response_expected[CALLBACK_QUATERNION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
199
|
-
@response_expected[CALLBACK_ALL_DATA] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
200
196
|
@response_expected[FUNCTION_SET_SENSOR_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
201
197
|
@response_expected[FUNCTION_GET_SENSOR_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
202
198
|
@response_expected[FUNCTION_SET_SENSOR_FUSION_MODE] = RESPONSE_EXPECTED_FALSE
|
203
199
|
@response_expected[FUNCTION_GET_SENSOR_FUSION_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
200
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
|
201
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
204
202
|
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
203
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_FALSE
|
204
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
205
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
205
206
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
206
207
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
207
208
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -219,6 +220,7 @@ module Tinkerforge
|
|
219
220
|
@callback_formats[CALLBACK_ORIENTATION] = 's s s'
|
220
221
|
@callback_formats[CALLBACK_QUATERNION] = 's s s s'
|
221
222
|
@callback_formats[CALLBACK_ALL_DATA] = 's3 s3 s3 s3 s4 s3 s3 c C'
|
223
|
+
|
222
224
|
end
|
223
225
|
|
224
226
|
# Returns the calibrated acceleration from the accelerometer for the
|
@@ -228,7 +230,7 @@ module Tinkerforge
|
|
228
230
|
# to use the CALLBACK_ACCELERATION callback and set the period with
|
229
231
|
# BrickIMUV2#set_acceleration_period.
|
230
232
|
def get_acceleration
|
231
|
-
send_request
|
233
|
+
send_request FUNCTION_GET_ACCELERATION, [], '', 6, 's s s'
|
232
234
|
end
|
233
235
|
|
234
236
|
# Returns the calibrated magnetic field from the magnetometer for the
|
@@ -238,7 +240,7 @@ module Tinkerforge
|
|
238
240
|
# to use the CALLBACK_MAGNETIC_FIELD callback and set the period with
|
239
241
|
# BrickIMUV2#set_magnetic_field_period.
|
240
242
|
def get_magnetic_field
|
241
|
-
send_request
|
243
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD, [], '', 6, 's s s'
|
242
244
|
end
|
243
245
|
|
244
246
|
# Returns the calibrated angular velocity from the gyroscope for the
|
@@ -248,14 +250,14 @@ module Tinkerforge
|
|
248
250
|
# to use the CALLBACK_ANGULAR_VELOCITY acallback nd set the period with
|
249
251
|
# BrickIMUV2#set_angular_velocity_period.
|
250
252
|
def get_angular_velocity
|
251
|
-
send_request
|
253
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY, [], '', 6, 's s s'
|
252
254
|
end
|
253
255
|
|
254
256
|
# Returns the temperature of the IMU Brick. The temperature is given in
|
255
257
|
# °C. The temperature is measured in the core of the BNO055 IC, it is not the
|
256
258
|
# ambient temperature
|
257
259
|
def get_temperature
|
258
|
-
send_request
|
260
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 1, 'c'
|
259
261
|
end
|
260
262
|
|
261
263
|
# Returns the current orientation (heading, roll, pitch) of the IMU Brick as
|
@@ -274,7 +276,7 @@ module Tinkerforge
|
|
274
276
|
# to use the CALLBACK_ORIENTATION callback and set the period with
|
275
277
|
# BrickIMUV2#set_orientation_period.
|
276
278
|
def get_orientation
|
277
|
-
send_request
|
279
|
+
send_request FUNCTION_GET_ORIENTATION, [], '', 6, 's s s'
|
278
280
|
end
|
279
281
|
|
280
282
|
# Returns the linear acceleration of the IMU Brick for the
|
@@ -290,7 +292,7 @@ module Tinkerforge
|
|
290
292
|
# to use the CALLBACK_LINEAR_ACCELERATION callback and set the period with
|
291
293
|
# BrickIMUV2#set_linear_acceleration_period.
|
292
294
|
def get_linear_acceleration
|
293
|
-
send_request
|
295
|
+
send_request FUNCTION_GET_LINEAR_ACCELERATION, [], '', 6, 's s s'
|
294
296
|
end
|
295
297
|
|
296
298
|
# Returns the current gravity vector of the IMU Brick for the
|
@@ -306,7 +308,7 @@ module Tinkerforge
|
|
306
308
|
# to use the CALLBACK_GRAVITY_VECTOR callback and set the period with
|
307
309
|
# BrickIMUV2#set_gravity_vector_period.
|
308
310
|
def get_gravity_vector
|
309
|
-
send_request
|
311
|
+
send_request FUNCTION_GET_GRAVITY_VECTOR, [], '', 6, 's s s'
|
310
312
|
end
|
311
313
|
|
312
314
|
# Returns the current orientation (w, x, y, z) of the IMU Brick as
|
@@ -319,7 +321,7 @@ module Tinkerforge
|
|
319
321
|
# to use the CALLBACK_QUATERNION callback and set the period with
|
320
322
|
# BrickIMUV2#set_quaternion_period.
|
321
323
|
def get_quaternion
|
322
|
-
send_request
|
324
|
+
send_request FUNCTION_GET_QUATERNION, [], '', 8, 's s s s'
|
323
325
|
end
|
324
326
|
|
325
327
|
# Return all of the available data of the IMU Brick.
|
@@ -353,23 +355,23 @@ module Tinkerforge
|
|
353
355
|
# to use the CALLBACK_ALL_DATA callback and set the period with
|
354
356
|
# BrickIMUV2#set_all_data_period.
|
355
357
|
def get_all_data
|
356
|
-
send_request
|
358
|
+
send_request FUNCTION_GET_ALL_DATA, [], '', 46, 's3 s3 s3 s3 s4 s3 s3 c C'
|
357
359
|
end
|
358
360
|
|
359
361
|
# Turns the orientation and direction LEDs of the IMU Brick on.
|
360
362
|
def leds_on
|
361
|
-
send_request
|
363
|
+
send_request FUNCTION_LEDS_ON, [], '', 0, ''
|
362
364
|
end
|
363
365
|
|
364
366
|
# Turns the orientation and direction LEDs of the IMU Brick off.
|
365
367
|
def leds_off
|
366
|
-
send_request
|
368
|
+
send_request FUNCTION_LEDS_OFF, [], '', 0, ''
|
367
369
|
end
|
368
370
|
|
369
371
|
# Returns *true* if the orientation and direction LEDs of the IMU Brick
|
370
372
|
# are on, *false* otherwise.
|
371
373
|
def are_leds_on
|
372
|
-
send_request
|
374
|
+
send_request FUNCTION_ARE_LEDS_ON, [], '', 1, '?'
|
373
375
|
end
|
374
376
|
|
375
377
|
# A call of this function saves the current calibration to be used
|
@@ -383,7 +385,7 @@ module Tinkerforge
|
|
383
385
|
# This function is used by the calibration window of the Brick Viewer, you
|
384
386
|
# should not need to call it in your program.
|
385
387
|
def save_calibration
|
386
|
-
send_request
|
388
|
+
send_request FUNCTION_SAVE_CALIBRATION, [], '', 1, '?'
|
387
389
|
end
|
388
390
|
|
389
391
|
# Sets the period in ms with which the CALLBACK_ACCELERATION callback is triggered
|
@@ -391,100 +393,100 @@ module Tinkerforge
|
|
391
393
|
#
|
392
394
|
# The default value is 0.
|
393
395
|
def set_acceleration_period(period)
|
394
|
-
send_request
|
396
|
+
send_request FUNCTION_SET_ACCELERATION_PERIOD, [period], 'L', 0, ''
|
395
397
|
end
|
396
398
|
|
397
399
|
# Returns the period as set by BrickIMUV2#set_acceleration_period.
|
398
400
|
def get_acceleration_period
|
399
|
-
send_request
|
401
|
+
send_request FUNCTION_GET_ACCELERATION_PERIOD, [], '', 4, 'L'
|
400
402
|
end
|
401
403
|
|
402
404
|
# Sets the period in ms with which the CALLBACK_MAGNETIC_FIELD callback is triggered
|
403
405
|
# periodically. A value of 0 turns the callback off.
|
404
406
|
def set_magnetic_field_period(period)
|
405
|
-
send_request
|
407
|
+
send_request FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 0, ''
|
406
408
|
end
|
407
409
|
|
408
410
|
# Returns the period as set by BrickIMUV2#set_magnetic_field_period.
|
409
411
|
def get_magnetic_field_period
|
410
|
-
send_request
|
412
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 4, 'L'
|
411
413
|
end
|
412
414
|
|
413
415
|
# Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
|
414
416
|
# triggered periodically. A value of 0 turns the callback off.
|
415
417
|
def set_angular_velocity_period(period)
|
416
|
-
send_request
|
418
|
+
send_request FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, ''
|
417
419
|
end
|
418
420
|
|
419
421
|
# Returns the period as set by BrickIMUV2#set_angular_velocity_period.
|
420
422
|
def get_angular_velocity_period
|
421
|
-
send_request
|
423
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 4, 'L'
|
422
424
|
end
|
423
425
|
|
424
426
|
# Sets the period in ms with which the CALLBACK_TEMPERATURE callback is triggered
|
425
427
|
# periodically. A value of 0 turns the callback off.
|
426
428
|
def set_temperature_period(period)
|
427
|
-
send_request
|
429
|
+
send_request FUNCTION_SET_TEMPERATURE_PERIOD, [period], 'L', 0, ''
|
428
430
|
end
|
429
431
|
|
430
432
|
# Returns the period as set by BrickIMUV2#set_temperature_period.
|
431
433
|
def get_temperature_period
|
432
|
-
send_request
|
434
|
+
send_request FUNCTION_GET_TEMPERATURE_PERIOD, [], '', 4, 'L'
|
433
435
|
end
|
434
436
|
|
435
437
|
# Sets the period in ms with which the CALLBACK_ORIENTATION callback is triggered
|
436
438
|
# periodically. A value of 0 turns the callback off.
|
437
439
|
def set_orientation_period(period)
|
438
|
-
send_request
|
440
|
+
send_request FUNCTION_SET_ORIENTATION_PERIOD, [period], 'L', 0, ''
|
439
441
|
end
|
440
442
|
|
441
443
|
# Returns the period as set by BrickIMUV2#set_orientation_period.
|
442
444
|
def get_orientation_period
|
443
|
-
send_request
|
445
|
+
send_request FUNCTION_GET_ORIENTATION_PERIOD, [], '', 4, 'L'
|
444
446
|
end
|
445
447
|
|
446
448
|
# Sets the period in ms with which the CALLBACK_LINEAR_ACCELERATION callback is
|
447
449
|
# triggered periodically. A value of 0 turns the callback off.
|
448
450
|
def set_linear_acceleration_period(period)
|
449
|
-
send_request
|
451
|
+
send_request FUNCTION_SET_LINEAR_ACCELERATION_PERIOD, [period], 'L', 0, ''
|
450
452
|
end
|
451
453
|
|
452
454
|
# Returns the period as set by BrickIMUV2#set_linear_acceleration_period.
|
453
455
|
def get_linear_acceleration_period
|
454
|
-
send_request
|
456
|
+
send_request FUNCTION_GET_LINEAR_ACCELERATION_PERIOD, [], '', 4, 'L'
|
455
457
|
end
|
456
458
|
|
457
459
|
# Sets the period in ms with which the CALLBACK_GRAVITY_VECTOR callback is triggered
|
458
460
|
# periodically. A value of 0 turns the callback off.
|
459
461
|
def set_gravity_vector_period(period)
|
460
|
-
send_request
|
462
|
+
send_request FUNCTION_SET_GRAVITY_VECTOR_PERIOD, [period], 'L', 0, ''
|
461
463
|
end
|
462
464
|
|
463
465
|
# Returns the period as set by BrickIMUV2#set_gravity_vector_period.
|
464
466
|
def get_gravity_vector_period
|
465
|
-
send_request
|
467
|
+
send_request FUNCTION_GET_GRAVITY_VECTOR_PERIOD, [], '', 4, 'L'
|
466
468
|
end
|
467
469
|
|
468
470
|
# Sets the period in ms with which the CALLBACK_QUATERNION callback is triggered
|
469
471
|
# periodically. A value of 0 turns the callback off.
|
470
472
|
def set_quaternion_period(period)
|
471
|
-
send_request
|
473
|
+
send_request FUNCTION_SET_QUATERNION_PERIOD, [period], 'L', 0, ''
|
472
474
|
end
|
473
475
|
|
474
476
|
# Returns the period as set by BrickIMUV2#set_quaternion_period.
|
475
477
|
def get_quaternion_period
|
476
|
-
send_request
|
478
|
+
send_request FUNCTION_GET_QUATERNION_PERIOD, [], '', 4, 'L'
|
477
479
|
end
|
478
480
|
|
479
481
|
# Sets the period in ms with which the CALLBACK_ALL_DATA callback is triggered
|
480
482
|
# periodically. A value of 0 turns the callback off.
|
481
483
|
def set_all_data_period(period)
|
482
|
-
send_request
|
484
|
+
send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 0, ''
|
483
485
|
end
|
484
486
|
|
485
487
|
# Returns the period as set by BrickIMUV2#set_all_data_period.
|
486
488
|
def get_all_data_period
|
487
|
-
send_request
|
489
|
+
send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 4, 'L'
|
488
490
|
end
|
489
491
|
|
490
492
|
# Sets the available sensor configuration for the Magnetometer, Gyroscope and
|
@@ -501,14 +503,14 @@ module Tinkerforge
|
|
501
503
|
#
|
502
504
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
503
505
|
def set_sensor_configuration(magnetometer_rate, gyroscope_range, gyroscope_bandwidth, accelerometer_range, accelerometer_bandwidth)
|
504
|
-
send_request
|
506
|
+
send_request FUNCTION_SET_SENSOR_CONFIGURATION, [magnetometer_rate, gyroscope_range, gyroscope_bandwidth, accelerometer_range, accelerometer_bandwidth], 'C C C C C', 0, ''
|
505
507
|
end
|
506
508
|
|
507
509
|
# Returns the sensor configuration as set by BrickIMUV2#set_sensor_configuration.
|
508
510
|
#
|
509
511
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
510
512
|
def get_sensor_configuration
|
511
|
-
send_request
|
513
|
+
send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 5, 'C C C C C'
|
512
514
|
end
|
513
515
|
|
514
516
|
# If the fusion mode is turned off, the functions BrickIMUV2#get_acceleration,
|
@@ -524,14 +526,49 @@ module Tinkerforge
|
|
524
526
|
#
|
525
527
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
526
528
|
def set_sensor_fusion_mode(mode)
|
527
|
-
send_request
|
529
|
+
send_request FUNCTION_SET_SENSOR_FUSION_MODE, [mode], 'C', 0, ''
|
528
530
|
end
|
529
531
|
|
530
532
|
# Returns the sensor fusion mode as set by BrickIMUV2#set_sensor_fusion_mode.
|
531
533
|
#
|
532
534
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
533
535
|
def get_sensor_fusion_mode
|
534
|
-
send_request
|
536
|
+
send_request FUNCTION_GET_SENSOR_FUSION_MODE, [], '', 1, 'C'
|
537
|
+
end
|
538
|
+
|
539
|
+
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
540
|
+
# enabled, the Brick will try to adapt the baudrate for the communication
|
541
|
+
# between Bricks and Bricklets according to the amount of data that is transferred.
|
542
|
+
#
|
543
|
+
# The baudrate will be increased exponetially if lots of data is send/receieved and
|
544
|
+
# decreased linearly if little data is send/received.
|
545
|
+
#
|
546
|
+
# This lowers the baudrate in applications where little data is transferred (e.g.
|
547
|
+
# a weather station) and increases the robustness. If there is lots of data to transfer
|
548
|
+
# (e.g. Thermal Imaging Bricklet) it automatically increases the baudrate as needed.
|
549
|
+
#
|
550
|
+
# In cases where some data has to transferred as fast as possible every few seconds
|
551
|
+
# (e.g. RS485 Bricklet with a high baudrate but small payload) you may want to turn
|
552
|
+
# the dynamic baudrate off to get the highest possible performance.
|
553
|
+
#
|
554
|
+
# The maximum value of the baudrate can be set per port with the function
|
555
|
+
# BrickIMUV2#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
556
|
+
# as set by BrickIMUV2#set_spitfp_baudrate will be used statically.
|
557
|
+
#
|
558
|
+
# The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
|
559
|
+
#
|
560
|
+
# By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
|
561
|
+
#
|
562
|
+
# .. versionadded:: 2.0.10$nbsp;(Firmware)
|
563
|
+
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
564
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
|
565
|
+
end
|
566
|
+
|
567
|
+
# Returns the baudrate config, see BrickIMUV2#set_spitfp_baudrate_config.
|
568
|
+
#
|
569
|
+
# .. versionadded:: 2.0.10$nbsp;(Firmware)
|
570
|
+
def get_spitfp_baudrate_config
|
571
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
|
535
572
|
end
|
536
573
|
|
537
574
|
# Returns the timeout count for the different communication methods.
|
@@ -543,7 +580,53 @@ module Tinkerforge
|
|
543
580
|
#
|
544
581
|
# .. versionadded:: 2.0.7$nbsp;(Firmware)
|
545
582
|
def get_send_timeout_count(communication_method)
|
546
|
-
send_request
|
583
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
|
584
|
+
end
|
585
|
+
|
586
|
+
# Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
|
587
|
+
# baudrate can be in the range 400000 to 2000000.
|
588
|
+
#
|
589
|
+
# If you want to increase the throughput of Bricklets you can increase
|
590
|
+
# the baudrate. If you get a high error count because of high
|
591
|
+
# interference (see BrickIMUV2#get_spitfp_error_count) you can decrease the
|
592
|
+
# baudrate.
|
593
|
+
#
|
594
|
+
# If the dynamic baudrate feature is enabled, the baudrate set by this
|
595
|
+
# function corresponds to the maximum baudrate (see BrickIMUV2#set_spitfp_baudrate_config).
|
596
|
+
#
|
597
|
+
# Regulatory testing is done with the default baudrate. If CE compatability
|
598
|
+
# or similar is necessary in you applications we recommend to not change
|
599
|
+
# the baudrate.
|
600
|
+
#
|
601
|
+
# The default baudrate for all ports is 1400000.
|
602
|
+
#
|
603
|
+
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
604
|
+
def set_spitfp_baudrate(bricklet_port, baudrate)
|
605
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
|
606
|
+
end
|
607
|
+
|
608
|
+
# Returns the baudrate for a given Bricklet port, see BrickIMUV2#set_spitfp_baudrate.
|
609
|
+
#
|
610
|
+
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
611
|
+
def get_spitfp_baudrate(bricklet_port)
|
612
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
|
613
|
+
end
|
614
|
+
|
615
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
616
|
+
#
|
617
|
+
# The errors are divided into
|
618
|
+
#
|
619
|
+
# * ACK checksum errors,
|
620
|
+
# * message checksum errors,
|
621
|
+
# * frameing errors and
|
622
|
+
# * overflow errors.
|
623
|
+
#
|
624
|
+
# The errors counts are for errors that occur on the Brick side. All
|
625
|
+
# Bricklets have a similar function that returns the errors on the Bricklet side.
|
626
|
+
#
|
627
|
+
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
628
|
+
def get_spitfp_error_count(bricklet_port)
|
629
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
|
547
630
|
end
|
548
631
|
|
549
632
|
# Enables the status LED.
|
@@ -553,7 +636,7 @@ module Tinkerforge
|
|
553
636
|
#
|
554
637
|
# The default state is enabled.
|
555
638
|
def enable_status_led
|
556
|
-
send_request
|
639
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
|
557
640
|
end
|
558
641
|
|
559
642
|
# Disables the status LED.
|
@@ -563,12 +646,12 @@ module Tinkerforge
|
|
563
646
|
#
|
564
647
|
# The default state is enabled.
|
565
648
|
def disable_status_led
|
566
|
-
send_request
|
649
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
|
567
650
|
end
|
568
651
|
|
569
652
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
570
653
|
def is_status_led_enabled
|
571
|
-
send_request
|
654
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
|
572
655
|
end
|
573
656
|
|
574
657
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
@@ -577,7 +660,7 @@ module Tinkerforge
|
|
577
660
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
578
661
|
# plugins.
|
579
662
|
def get_protocol1_bricklet_name(port)
|
580
|
-
send_request
|
663
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
|
581
664
|
end
|
582
665
|
|
583
666
|
# Returns the temperature in °C/10 as measured inside the microcontroller. The
|
@@ -587,7 +670,7 @@ module Tinkerforge
|
|
587
670
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
588
671
|
# temperature changes.
|
589
672
|
def get_chip_temperature
|
590
|
-
send_request
|
673
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
591
674
|
end
|
592
675
|
|
593
676
|
# Calling this function will reset the Brick. Calling this function
|
@@ -597,7 +680,7 @@ module Tinkerforge
|
|
597
680
|
# calling functions on the existing ones will result in
|
598
681
|
# undefined behavior!
|
599
682
|
def reset
|
600
|
-
send_request
|
683
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
601
684
|
end
|
602
685
|
|
603
686
|
# Returns the UID, the UID where the Brick is connected to,
|
@@ -609,7 +692,7 @@ module Tinkerforge
|
|
609
692
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
610
693
|
# |device_identifier_constant|
|
611
694
|
def get_identity
|
612
|
-
send_request
|
695
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
613
696
|
end
|
614
697
|
|
615
698
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|