tinkerforge 2.1.13 → 2.1.14
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.
- 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 #
|
|
@@ -81,7 +81,12 @@ module Tinkerforge
|
|
|
81
81
|
FUNCTION_ORIENTATION_CALCULATION_ON = 37 # :nodoc:
|
|
82
82
|
FUNCTION_ORIENTATION_CALCULATION_OFF = 38 # :nodoc:
|
|
83
83
|
FUNCTION_IS_ORIENTATION_CALCULATION_ON = 39 # :nodoc:
|
|
84
|
+
FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
|
|
85
|
+
FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
|
|
84
86
|
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
|
87
|
+
FUNCTION_SET_SPITFP_BAUDRATE = 234 # :nodoc:
|
|
88
|
+
FUNCTION_GET_SPITFP_BAUDRATE = 235 # :nodoc:
|
|
89
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 237 # :nodoc:
|
|
85
90
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
|
86
91
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
|
87
92
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
|
@@ -142,16 +147,15 @@ module Tinkerforge
|
|
|
142
147
|
@response_expected[FUNCTION_GET_ORIENTATION_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
143
148
|
@response_expected[FUNCTION_SET_QUATERNION_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
144
149
|
@response_expected[FUNCTION_GET_QUATERNION_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
145
|
-
@response_expected[CALLBACK_ACCELERATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
146
|
-
@response_expected[CALLBACK_MAGNETIC_FIELD] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
147
|
-
@response_expected[CALLBACK_ANGULAR_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
148
|
-
@response_expected[CALLBACK_ALL_DATA] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
149
|
-
@response_expected[CALLBACK_ORIENTATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
150
|
-
@response_expected[CALLBACK_QUATERNION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
151
150
|
@response_expected[FUNCTION_ORIENTATION_CALCULATION_ON] = RESPONSE_EXPECTED_FALSE
|
|
152
151
|
@response_expected[FUNCTION_ORIENTATION_CALCULATION_OFF] = RESPONSE_EXPECTED_FALSE
|
|
153
152
|
@response_expected[FUNCTION_IS_ORIENTATION_CALCULATION_ON] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
153
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
154
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
154
155
|
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
156
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_FALSE
|
|
157
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
158
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
155
159
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
|
156
160
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
|
157
161
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -166,6 +170,7 @@ module Tinkerforge
|
|
|
166
170
|
@callback_formats[CALLBACK_ALL_DATA] = 's s s s s s s s s s'
|
|
167
171
|
@callback_formats[CALLBACK_ORIENTATION] = 's s s'
|
|
168
172
|
@callback_formats[CALLBACK_QUATERNION] = 'e e e e'
|
|
173
|
+
|
|
169
174
|
end
|
|
170
175
|
|
|
171
176
|
# Returns the calibrated acceleration from the accelerometer for the
|
|
@@ -175,7 +180,7 @@ module Tinkerforge
|
|
|
175
180
|
# to use the CALLBACK_ACCELERATION callback and set the period with
|
|
176
181
|
# BrickIMU#set_acceleration_period.
|
|
177
182
|
def get_acceleration
|
|
178
|
-
send_request
|
|
183
|
+
send_request FUNCTION_GET_ACCELERATION, [], '', 6, 's s s'
|
|
179
184
|
end
|
|
180
185
|
|
|
181
186
|
# Returns the calibrated magnetic field from the magnetometer for the
|
|
@@ -185,7 +190,7 @@ module Tinkerforge
|
|
|
185
190
|
# to use the CALLBACK_MAGNETIC_FIELD callback and set the period with
|
|
186
191
|
# BrickIMU#set_magnetic_field_period.
|
|
187
192
|
def get_magnetic_field
|
|
188
|
-
send_request
|
|
193
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD, [], '', 6, 's s s'
|
|
189
194
|
end
|
|
190
195
|
|
|
191
196
|
# Returns the calibrated angular velocity from the gyroscope for the
|
|
@@ -196,7 +201,7 @@ module Tinkerforge
|
|
|
196
201
|
# to use the CALLBACK_ANGULAR_VELOCITY callback and set the period with
|
|
197
202
|
# BrickIMU#set_angular_velocity_period.
|
|
198
203
|
def get_angular_velocity
|
|
199
|
-
send_request
|
|
204
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY, [], '', 6, 's s s'
|
|
200
205
|
end
|
|
201
206
|
|
|
202
207
|
# Returns the data from BrickIMU#get_acceleration, BrickIMU#get_magnetic_field
|
|
@@ -208,7 +213,7 @@ module Tinkerforge
|
|
|
208
213
|
# to use the CALLBACK_ALL_DATA callback and set the period with
|
|
209
214
|
# BrickIMU#set_all_data_period.
|
|
210
215
|
def get_all_data
|
|
211
|
-
send_request
|
|
216
|
+
send_request FUNCTION_GET_ALL_DATA, [], '', 20, 's s s s s s s s s s'
|
|
212
217
|
end
|
|
213
218
|
|
|
214
219
|
# Returns the current orientation (roll, pitch, yaw) of the IMU Brick as Euler
|
|
@@ -224,7 +229,7 @@ module Tinkerforge
|
|
|
224
229
|
# to use the CALLBACK_ORIENTATION callback and set the period with
|
|
225
230
|
# BrickIMU#set_orientation_period.
|
|
226
231
|
def get_orientation
|
|
227
|
-
send_request
|
|
232
|
+
send_request FUNCTION_GET_ORIENTATION, [], '', 6, 's s s'
|
|
228
233
|
end
|
|
229
234
|
|
|
230
235
|
# Returns the current orientation (x, y, z, w) of the IMU as
|
|
@@ -259,49 +264,49 @@ module Tinkerforge
|
|
|
259
264
|
# to use the CALLBACK_QUATERNION callback and set the period with
|
|
260
265
|
# BrickIMU#set_quaternion_period.
|
|
261
266
|
def get_quaternion
|
|
262
|
-
send_request
|
|
267
|
+
send_request FUNCTION_GET_QUATERNION, [], '', 16, 'e e e e'
|
|
263
268
|
end
|
|
264
269
|
|
|
265
270
|
# Returns the temperature of the IMU Brick. The temperature is given in
|
|
266
271
|
# °C/100.
|
|
267
272
|
def get_imu_temperature
|
|
268
|
-
send_request
|
|
273
|
+
send_request FUNCTION_GET_IMU_TEMPERATURE, [], '', 2, 's'
|
|
269
274
|
end
|
|
270
275
|
|
|
271
276
|
# Turns the orientation and direction LEDs of the IMU Brick on.
|
|
272
277
|
def leds_on
|
|
273
|
-
send_request
|
|
278
|
+
send_request FUNCTION_LEDS_ON, [], '', 0, ''
|
|
274
279
|
end
|
|
275
280
|
|
|
276
281
|
# Turns the orientation and direction LEDs of the IMU Brick off.
|
|
277
282
|
def leds_off
|
|
278
|
-
send_request
|
|
283
|
+
send_request FUNCTION_LEDS_OFF, [], '', 0, ''
|
|
279
284
|
end
|
|
280
285
|
|
|
281
286
|
# Returns *true* if the orientation and direction LEDs of the IMU Brick
|
|
282
287
|
# are on, *false* otherwise.
|
|
283
288
|
def are_leds_on
|
|
284
|
-
send_request
|
|
289
|
+
send_request FUNCTION_ARE_LEDS_ON, [], '', 1, '?'
|
|
285
290
|
end
|
|
286
291
|
|
|
287
292
|
# Not implemented yet.
|
|
288
293
|
def set_acceleration_range(range)
|
|
289
|
-
send_request
|
|
294
|
+
send_request FUNCTION_SET_ACCELERATION_RANGE, [range], 'C', 0, ''
|
|
290
295
|
end
|
|
291
296
|
|
|
292
297
|
# Not implemented yet.
|
|
293
298
|
def get_acceleration_range
|
|
294
|
-
send_request
|
|
299
|
+
send_request FUNCTION_GET_ACCELERATION_RANGE, [], '', 1, 'C'
|
|
295
300
|
end
|
|
296
301
|
|
|
297
302
|
# Not implemented yet.
|
|
298
303
|
def set_magnetometer_range(range)
|
|
299
|
-
send_request
|
|
304
|
+
send_request FUNCTION_SET_MAGNETOMETER_RANGE, [range], 'C', 0, ''
|
|
300
305
|
end
|
|
301
306
|
|
|
302
307
|
# Not implemented yet.
|
|
303
308
|
def get_magnetometer_range
|
|
304
|
-
send_request
|
|
309
|
+
send_request FUNCTION_GET_MAGNETOMETER_RANGE, [], '', 1, 'C'
|
|
305
310
|
end
|
|
306
311
|
|
|
307
312
|
# Sets the convergence speed of the IMU Brick in °/s. The convergence speed
|
|
@@ -332,12 +337,12 @@ module Tinkerforge
|
|
|
332
337
|
#
|
|
333
338
|
# The default value is 30.
|
|
334
339
|
def set_convergence_speed(speed)
|
|
335
|
-
send_request
|
|
340
|
+
send_request FUNCTION_SET_CONVERGENCE_SPEED, [speed], 'S', 0, ''
|
|
336
341
|
end
|
|
337
342
|
|
|
338
343
|
# Returns the convergence speed as set by BrickIMU#set_convergence_speed.
|
|
339
344
|
def get_convergence_speed
|
|
340
|
-
send_request
|
|
345
|
+
send_request FUNCTION_GET_CONVERGENCE_SPEED, [], '', 2, 'S'
|
|
341
346
|
end
|
|
342
347
|
|
|
343
348
|
# There are several different types that can be calibrated:
|
|
@@ -373,12 +378,12 @@ module Tinkerforge
|
|
|
373
378
|
# We highly recommend that you use the Brick Viewer to calibrate your
|
|
374
379
|
# IMU Brick.
|
|
375
380
|
def set_calibration(typ, data)
|
|
376
|
-
send_request
|
|
381
|
+
send_request FUNCTION_SET_CALIBRATION, [typ, data], 'C s10', 0, ''
|
|
377
382
|
end
|
|
378
383
|
|
|
379
384
|
# Returns the calibration for a given type as set by BrickIMU#set_calibration.
|
|
380
385
|
def get_calibration(typ)
|
|
381
|
-
send_request
|
|
386
|
+
send_request FUNCTION_GET_CALIBRATION, [typ], 'C', 20, 's10'
|
|
382
387
|
end
|
|
383
388
|
|
|
384
389
|
# Sets the period in ms with which the CALLBACK_ACCELERATION callback is triggered
|
|
@@ -386,67 +391,67 @@ module Tinkerforge
|
|
|
386
391
|
#
|
|
387
392
|
# The default value is 0.
|
|
388
393
|
def set_acceleration_period(period)
|
|
389
|
-
send_request
|
|
394
|
+
send_request FUNCTION_SET_ACCELERATION_PERIOD, [period], 'L', 0, ''
|
|
390
395
|
end
|
|
391
396
|
|
|
392
397
|
# Returns the period as set by BrickIMU#set_acceleration_period.
|
|
393
398
|
def get_acceleration_period
|
|
394
|
-
send_request
|
|
399
|
+
send_request FUNCTION_GET_ACCELERATION_PERIOD, [], '', 4, 'L'
|
|
395
400
|
end
|
|
396
401
|
|
|
397
402
|
# Sets the period in ms with which the CALLBACK_MAGNETIC_FIELD callback is
|
|
398
403
|
# triggered periodically. A value of 0 turns the callback off.
|
|
399
404
|
def set_magnetic_field_period(period)
|
|
400
|
-
send_request
|
|
405
|
+
send_request FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 0, ''
|
|
401
406
|
end
|
|
402
407
|
|
|
403
408
|
# Returns the period as set by BrickIMU#set_magnetic_field_period.
|
|
404
409
|
def get_magnetic_field_period
|
|
405
|
-
send_request
|
|
410
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 4, 'L'
|
|
406
411
|
end
|
|
407
412
|
|
|
408
413
|
# Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
|
|
409
414
|
# triggered periodically. A value of 0 turns the callback off.
|
|
410
415
|
def set_angular_velocity_period(period)
|
|
411
|
-
send_request
|
|
416
|
+
send_request FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, ''
|
|
412
417
|
end
|
|
413
418
|
|
|
414
419
|
# Returns the period as set by BrickIMU#set_angular_velocity_period.
|
|
415
420
|
def get_angular_velocity_period
|
|
416
|
-
send_request
|
|
421
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 4, 'L'
|
|
417
422
|
end
|
|
418
423
|
|
|
419
424
|
# Sets the period in ms with which the CALLBACK_ALL_DATA callback is triggered
|
|
420
425
|
# periodically. A value of 0 turns the callback off.
|
|
421
426
|
def set_all_data_period(period)
|
|
422
|
-
send_request
|
|
427
|
+
send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 0, ''
|
|
423
428
|
end
|
|
424
429
|
|
|
425
430
|
# Returns the period as set by BrickIMU#set_all_data_period.
|
|
426
431
|
def get_all_data_period
|
|
427
|
-
send_request
|
|
432
|
+
send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 4, 'L'
|
|
428
433
|
end
|
|
429
434
|
|
|
430
435
|
# Sets the period in ms with which the CALLBACK_ORIENTATION callback is triggered
|
|
431
436
|
# periodically. A value of 0 turns the callback off.
|
|
432
437
|
def set_orientation_period(period)
|
|
433
|
-
send_request
|
|
438
|
+
send_request FUNCTION_SET_ORIENTATION_PERIOD, [period], 'L', 0, ''
|
|
434
439
|
end
|
|
435
440
|
|
|
436
441
|
# Returns the period as set by BrickIMU#set_orientation_period.
|
|
437
442
|
def get_orientation_period
|
|
438
|
-
send_request
|
|
443
|
+
send_request FUNCTION_GET_ORIENTATION_PERIOD, [], '', 4, 'L'
|
|
439
444
|
end
|
|
440
445
|
|
|
441
446
|
# Sets the period in ms with which the CALLBACK_QUATERNION callback is triggered
|
|
442
447
|
# periodically. A value of 0 turns the callback off.
|
|
443
448
|
def set_quaternion_period(period)
|
|
444
|
-
send_request
|
|
449
|
+
send_request FUNCTION_SET_QUATERNION_PERIOD, [period], 'L', 0, ''
|
|
445
450
|
end
|
|
446
451
|
|
|
447
452
|
# Returns the period as set by BrickIMU#set_quaternion_period.
|
|
448
453
|
def get_quaternion_period
|
|
449
|
-
send_request
|
|
454
|
+
send_request FUNCTION_GET_QUATERNION_PERIOD, [], '', 4, 'L'
|
|
450
455
|
end
|
|
451
456
|
|
|
452
457
|
# Turns the orientation calculation of the IMU Brick on.
|
|
@@ -455,7 +460,7 @@ module Tinkerforge
|
|
|
455
460
|
#
|
|
456
461
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
457
462
|
def orientation_calculation_on
|
|
458
|
-
send_request
|
|
463
|
+
send_request FUNCTION_ORIENTATION_CALCULATION_ON, [], '', 0, ''
|
|
459
464
|
end
|
|
460
465
|
|
|
461
466
|
# Turns the orientation calculation of the IMU Brick off.
|
|
@@ -472,7 +477,7 @@ module Tinkerforge
|
|
|
472
477
|
#
|
|
473
478
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
474
479
|
def orientation_calculation_off
|
|
475
|
-
send_request
|
|
480
|
+
send_request FUNCTION_ORIENTATION_CALCULATION_OFF, [], '', 0, ''
|
|
476
481
|
end
|
|
477
482
|
|
|
478
483
|
# Returns *true* if the orientation calculation of the IMU Brick
|
|
@@ -480,7 +485,42 @@ module Tinkerforge
|
|
|
480
485
|
#
|
|
481
486
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
482
487
|
def is_orientation_calculation_on
|
|
483
|
-
send_request
|
|
488
|
+
send_request FUNCTION_IS_ORIENTATION_CALCULATION_ON, [], '', 1, '?'
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
|
492
|
+
# enabled, the Brick will try to adapt the baudrate for the communication
|
|
493
|
+
# between Bricks and Bricklets according to the amount of data that is transferred.
|
|
494
|
+
#
|
|
495
|
+
# The baudrate will be increased exponetially if lots of data is send/receieved and
|
|
496
|
+
# decreased linearly if little data is send/received.
|
|
497
|
+
#
|
|
498
|
+
# This lowers the baudrate in applications where little data is transferred (e.g.
|
|
499
|
+
# a weather station) and increases the robustness. If there is lots of data to transfer
|
|
500
|
+
# (e.g. Thermal Imaging Bricklet) it automatically increases the baudrate as needed.
|
|
501
|
+
#
|
|
502
|
+
# In cases where some data has to transferred as fast as possible every few seconds
|
|
503
|
+
# (e.g. RS485 Bricklet with a high baudrate but small payload) you may want to turn
|
|
504
|
+
# the dynamic baudrate off to get the highest possible performance.
|
|
505
|
+
#
|
|
506
|
+
# The maximum value of the baudrate can be set per port with the function
|
|
507
|
+
# BrickIMU#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
|
508
|
+
# as set by BrickIMU#set_spitfp_baudrate will be used statically.
|
|
509
|
+
#
|
|
510
|
+
# The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
|
|
511
|
+
#
|
|
512
|
+
# By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
|
|
513
|
+
#
|
|
514
|
+
# .. versionadded:: 2.3.5$nbsp;(Firmware)
|
|
515
|
+
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
|
516
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
# Returns the baudrate config, see BrickIMU#set_spitfp_baudrate_config.
|
|
520
|
+
#
|
|
521
|
+
# .. versionadded:: 2.3.5$nbsp;(Firmware)
|
|
522
|
+
def get_spitfp_baudrate_config
|
|
523
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
|
|
484
524
|
end
|
|
485
525
|
|
|
486
526
|
# Returns the timeout count for the different communication methods.
|
|
@@ -492,7 +532,53 @@ module Tinkerforge
|
|
|
492
532
|
#
|
|
493
533
|
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
494
534
|
def get_send_timeout_count(communication_method)
|
|
495
|
-
send_request
|
|
535
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
# Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
|
|
539
|
+
# baudrate can be in the range 400000 to 2000000.
|
|
540
|
+
#
|
|
541
|
+
# If you want to increase the throughput of Bricklets you can increase
|
|
542
|
+
# the baudrate. If you get a high error count because of high
|
|
543
|
+
# interference (see BrickIMU#get_spitfp_error_count) you can decrease the
|
|
544
|
+
# baudrate.
|
|
545
|
+
#
|
|
546
|
+
# If the dynamic baudrate feature is enabled, the baudrate set by this
|
|
547
|
+
# function corresponds to the maximum baudrate (see BrickIMU#set_spitfp_baudrate_config).
|
|
548
|
+
#
|
|
549
|
+
# Regulatory testing is done with the default baudrate. If CE compatability
|
|
550
|
+
# or similar is necessary in you applications we recommend to not change
|
|
551
|
+
# the baudrate.
|
|
552
|
+
#
|
|
553
|
+
# The default baudrate for all ports is 1400000.
|
|
554
|
+
#
|
|
555
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
556
|
+
def set_spitfp_baudrate(bricklet_port, baudrate)
|
|
557
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# Returns the baudrate for a given Bricklet port, see BrickIMU#set_spitfp_baudrate.
|
|
561
|
+
#
|
|
562
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
563
|
+
def get_spitfp_baudrate(bricklet_port)
|
|
564
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
568
|
+
#
|
|
569
|
+
# The errors are divided into
|
|
570
|
+
#
|
|
571
|
+
# * ACK checksum errors,
|
|
572
|
+
# * message checksum errors,
|
|
573
|
+
# * frameing errors and
|
|
574
|
+
# * overflow errors.
|
|
575
|
+
#
|
|
576
|
+
# The errors counts are for errors that occur on the Brick side. All
|
|
577
|
+
# Bricklets have a similar function that returns the errors on the Bricklet side.
|
|
578
|
+
#
|
|
579
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
580
|
+
def get_spitfp_error_count(bricklet_port)
|
|
581
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
|
|
496
582
|
end
|
|
497
583
|
|
|
498
584
|
# Enables the status LED.
|
|
@@ -504,7 +590,7 @@ module Tinkerforge
|
|
|
504
590
|
#
|
|
505
591
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
506
592
|
def enable_status_led
|
|
507
|
-
send_request
|
|
593
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
|
|
508
594
|
end
|
|
509
595
|
|
|
510
596
|
# Disables the status LED.
|
|
@@ -516,14 +602,14 @@ module Tinkerforge
|
|
|
516
602
|
#
|
|
517
603
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
518
604
|
def disable_status_led
|
|
519
|
-
send_request
|
|
605
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
|
|
520
606
|
end
|
|
521
607
|
|
|
522
608
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
|
523
609
|
#
|
|
524
610
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
525
611
|
def is_status_led_enabled
|
|
526
|
-
send_request
|
|
612
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
|
|
527
613
|
end
|
|
528
614
|
|
|
529
615
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
|
@@ -532,7 +618,7 @@ module Tinkerforge
|
|
|
532
618
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
|
533
619
|
# plugins.
|
|
534
620
|
def get_protocol1_bricklet_name(port)
|
|
535
|
-
send_request
|
|
621
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
|
|
536
622
|
end
|
|
537
623
|
|
|
538
624
|
# Returns the temperature in °C/10 as measured inside the microcontroller. The
|
|
@@ -542,7 +628,7 @@ module Tinkerforge
|
|
|
542
628
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
|
543
629
|
# temperature changes.
|
|
544
630
|
def get_chip_temperature
|
|
545
|
-
send_request
|
|
631
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
546
632
|
end
|
|
547
633
|
|
|
548
634
|
# Calling this function will reset the Brick. Calling this function
|
|
@@ -552,7 +638,7 @@ module Tinkerforge
|
|
|
552
638
|
# calling functions on the existing ones will result in
|
|
553
639
|
# undefined behavior!
|
|
554
640
|
def reset
|
|
555
|
-
send_request
|
|
641
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
556
642
|
end
|
|
557
643
|
|
|
558
644
|
# Returns the UID, the UID where the Brick is connected to,
|
|
@@ -564,7 +650,7 @@ module Tinkerforge
|
|
|
564
650
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
565
651
|
# |device_identifier_constant|
|
|
566
652
|
def get_identity
|
|
567
|
-
send_request
|
|
653
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
568
654
|
end
|
|
569
655
|
|
|
570
656
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|