tinkerforge 2.1.22 → 2.1.27
Sign up to get free protection for your applications and to get access to all the features.
- 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
|
# Full fledged AHRS with 9 degrees of freedom
|
14
16
|
class BrickIMUV2 < Device
|
@@ -52,7 +54,7 @@ module Tinkerforge
|
|
52
54
|
|
53
55
|
# This callback is triggered periodically with the period that is set by
|
54
56
|
# BrickIMUV2#set_quaternion_period. The parameters are the orientation
|
55
|
-
# (x, y, z
|
57
|
+
# (w, x, y, z) of the IMU Brick in quaternions. See BrickIMUV2#get_quaternion
|
56
58
|
# for details.
|
57
59
|
CALLBACK_QUATERNION = 39
|
58
60
|
|
@@ -108,6 +110,8 @@ module Tinkerforge
|
|
108
110
|
FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241 # :nodoc:
|
109
111
|
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
110
112
|
FUNCTION_RESET = 243 # :nodoc:
|
113
|
+
FUNCTION_WRITE_BRICKLET_PLUGIN = 246 # :nodoc:
|
114
|
+
FUNCTION_READ_BRICKLET_PLUGIN = 247 # :nodoc:
|
111
115
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
112
116
|
|
113
117
|
MAGNETOMETER_RATE_2HZ = 0 # :nodoc:
|
@@ -159,7 +163,7 @@ module Tinkerforge
|
|
159
163
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
160
164
|
# the IP Connection <tt>ipcon</tt>.
|
161
165
|
def initialize(uid, ipcon)
|
162
|
-
super uid, ipcon
|
166
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
163
167
|
|
164
168
|
@api_version = [2, 0, 3]
|
165
169
|
|
@@ -210,78 +214,88 @@ module Tinkerforge
|
|
210
214
|
@response_expected[FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
211
215
|
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
212
216
|
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
217
|
+
@response_expected[FUNCTION_WRITE_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_FALSE
|
218
|
+
@response_expected[FUNCTION_READ_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
213
219
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
214
220
|
|
215
|
-
@callback_formats[CALLBACK_ACCELERATION] = 's s s'
|
216
|
-
@callback_formats[CALLBACK_MAGNETIC_FIELD] = 's s s'
|
217
|
-
@callback_formats[CALLBACK_ANGULAR_VELOCITY] = 's s s'
|
218
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 'c'
|
219
|
-
@callback_formats[CALLBACK_LINEAR_ACCELERATION] = 's s s'
|
220
|
-
@callback_formats[CALLBACK_GRAVITY_VECTOR] = 's s s'
|
221
|
-
@callback_formats[CALLBACK_ORIENTATION] = 's s s'
|
222
|
-
@callback_formats[CALLBACK_QUATERNION] = 's s s s'
|
223
|
-
@callback_formats[CALLBACK_ALL_DATA] = 's3 s3 s3 s3 s4 s3 s3 c C'
|
221
|
+
@callback_formats[CALLBACK_ACCELERATION] = [14, 's s s']
|
222
|
+
@callback_formats[CALLBACK_MAGNETIC_FIELD] = [14, 's s s']
|
223
|
+
@callback_formats[CALLBACK_ANGULAR_VELOCITY] = [14, 's s s']
|
224
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [9, 'c']
|
225
|
+
@callback_formats[CALLBACK_LINEAR_ACCELERATION] = [14, 's s s']
|
226
|
+
@callback_formats[CALLBACK_GRAVITY_VECTOR] = [14, 's s s']
|
227
|
+
@callback_formats[CALLBACK_ORIENTATION] = [14, 's s s']
|
228
|
+
@callback_formats[CALLBACK_QUATERNION] = [16, 's s s s']
|
229
|
+
@callback_formats[CALLBACK_ALL_DATA] = [54, 's3 s3 s3 s3 s4 s3 s3 c C']
|
224
230
|
|
231
|
+
@ipcon.add_device self
|
225
232
|
end
|
226
233
|
|
227
234
|
# Returns the calibrated acceleration from the accelerometer for the
|
228
|
-
# x, y and z axis in
|
235
|
+
# x, y and z axis. The acceleration is in the range configured with
|
236
|
+
# BrickIMUV2#set_sensor_configuration.
|
229
237
|
#
|
230
238
|
# If you want to get the acceleration periodically, it is recommended
|
231
239
|
# to use the CALLBACK_ACCELERATION callback and set the period with
|
232
240
|
# BrickIMUV2#set_acceleration_period.
|
233
241
|
def get_acceleration
|
234
|
-
|
242
|
+
check_validity
|
243
|
+
|
244
|
+
send_request FUNCTION_GET_ACCELERATION, [], '', 14, 's s s'
|
235
245
|
end
|
236
246
|
|
237
247
|
# Returns the calibrated magnetic field from the magnetometer for the
|
238
|
-
# x, y and z axis
|
248
|
+
# x, y and z axis.
|
239
249
|
#
|
240
250
|
# If you want to get the magnetic field periodically, it is recommended
|
241
251
|
# to use the CALLBACK_MAGNETIC_FIELD callback and set the period with
|
242
252
|
# BrickIMUV2#set_magnetic_field_period.
|
243
253
|
def get_magnetic_field
|
244
|
-
|
254
|
+
check_validity
|
255
|
+
|
256
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD, [], '', 14, 's s s'
|
245
257
|
end
|
246
258
|
|
247
259
|
# Returns the calibrated angular velocity from the gyroscope for the
|
248
|
-
# x, y and z axis in
|
260
|
+
# x, y and z axis. The angular velocity is in the range configured with
|
261
|
+
# BrickIMUV2#set_sensor_configuration.
|
249
262
|
#
|
250
263
|
# If you want to get the angular velocity periodically, it is recommended
|
251
264
|
# to use the CALLBACK_ANGULAR_VELOCITY acallback nd set the period with
|
252
265
|
# BrickIMUV2#set_angular_velocity_period.
|
253
266
|
def get_angular_velocity
|
254
|
-
|
267
|
+
check_validity
|
268
|
+
|
269
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY, [], '', 14, 's s s'
|
255
270
|
end
|
256
271
|
|
257
|
-
# Returns the temperature of the IMU Brick.
|
258
|
-
#
|
272
|
+
# Returns the temperature of the IMU Brick.
|
273
|
+
# The temperature is measured in the core of the BNO055 IC, it is not the
|
259
274
|
# ambient temperature
|
260
275
|
def get_temperature
|
261
|
-
|
276
|
+
check_validity
|
277
|
+
|
278
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 9, 'c'
|
262
279
|
end
|
263
280
|
|
264
281
|
# Returns the current orientation (heading, roll, pitch) of the IMU Brick as
|
265
|
-
# independent Euler angles
|
282
|
+
# independent Euler angles. Note that Euler angles always
|
266
283
|
# experience a `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__.
|
267
284
|
# We recommend that you use quaternions instead, if you need the absolute
|
268
285
|
# orientation.
|
269
286
|
#
|
270
|
-
# The rotation angle has the following ranges:
|
271
|
-
#
|
272
|
-
# * heading: 0° to 360°
|
273
|
-
# * roll: -90° to +90°
|
274
|
-
# * pitch: -180° to +180°
|
275
|
-
#
|
276
287
|
# If you want to get the orientation periodically, it is recommended
|
277
288
|
# to use the CALLBACK_ORIENTATION callback and set the period with
|
278
289
|
# BrickIMUV2#set_orientation_period.
|
279
290
|
def get_orientation
|
280
|
-
|
291
|
+
check_validity
|
292
|
+
|
293
|
+
send_request FUNCTION_GET_ORIENTATION, [], '', 14, 's s s'
|
281
294
|
end
|
282
295
|
|
283
296
|
# Returns the linear acceleration of the IMU Brick for the
|
284
|
-
# x, y and z axis in
|
297
|
+
# x, y and z axis. The acceleration is in the range configured with
|
298
|
+
# BrickIMUV2#set_sensor_configuration.
|
285
299
|
#
|
286
300
|
# The linear acceleration is the acceleration in each of the three
|
287
301
|
# axis of the IMU Brick with the influences of gravity removed.
|
@@ -293,11 +307,13 @@ module Tinkerforge
|
|
293
307
|
# to use the CALLBACK_LINEAR_ACCELERATION callback and set the period with
|
294
308
|
# BrickIMUV2#set_linear_acceleration_period.
|
295
309
|
def get_linear_acceleration
|
296
|
-
|
310
|
+
check_validity
|
311
|
+
|
312
|
+
send_request FUNCTION_GET_LINEAR_ACCELERATION, [], '', 14, 's s s'
|
297
313
|
end
|
298
314
|
|
299
315
|
# Returns the current gravity vector of the IMU Brick for the
|
300
|
-
# x, y and z axis
|
316
|
+
# x, y and z axis.
|
301
317
|
#
|
302
318
|
# The gravity vector is the acceleration that occurs due to gravity.
|
303
319
|
# Influences of additional linear acceleration are removed.
|
@@ -309,32 +325,36 @@ module Tinkerforge
|
|
309
325
|
# to use the CALLBACK_GRAVITY_VECTOR callback and set the period with
|
310
326
|
# BrickIMUV2#set_gravity_vector_period.
|
311
327
|
def get_gravity_vector
|
312
|
-
|
328
|
+
check_validity
|
329
|
+
|
330
|
+
send_request FUNCTION_GET_GRAVITY_VECTOR, [], '', 14, 's s s'
|
313
331
|
end
|
314
332
|
|
315
333
|
# Returns the current orientation (w, x, y, z) of the IMU Brick as
|
316
334
|
# `quaternions <https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>`__.
|
317
335
|
#
|
318
|
-
# You have to divide the
|
336
|
+
# You have to divide the return values by 16383 (14 bit) to get
|
319
337
|
# the usual range of -1.0 to +1.0 for quaternions.
|
320
338
|
#
|
321
339
|
# If you want to get the quaternions periodically, it is recommended
|
322
340
|
# to use the CALLBACK_QUATERNION callback and set the period with
|
323
341
|
# BrickIMUV2#set_quaternion_period.
|
324
342
|
def get_quaternion
|
325
|
-
|
343
|
+
check_validity
|
344
|
+
|
345
|
+
send_request FUNCTION_GET_QUATERNION, [], '', 16, 's s s s'
|
326
346
|
end
|
327
347
|
|
328
348
|
# Return all of the available data of the IMU Brick.
|
329
349
|
#
|
330
|
-
# * acceleration
|
331
|
-
# * magnetic field
|
332
|
-
# * angular velocity
|
333
|
-
# * Euler angles
|
334
|
-
# * quaternion
|
335
|
-
# * linear acceleration
|
336
|
-
# * gravity vector
|
337
|
-
# * temperature
|
350
|
+
# * acceleration (see BrickIMUV2#get_acceleration)
|
351
|
+
# * magnetic field (see BrickIMUV2#get_magnetic_field)
|
352
|
+
# * angular velocity (see BrickIMUV2#get_angular_velocity)
|
353
|
+
# * Euler angles (see BrickIMUV2#get_orientation)
|
354
|
+
# * quaternion (see BrickIMUV2#get_quaternion)
|
355
|
+
# * linear acceleration (see BrickIMUV2#get_linear_acceleration)
|
356
|
+
# * gravity vector (see BrickIMUV2#get_gravity_vector)
|
357
|
+
# * temperature (see BrickIMUV2#get_temperature)
|
338
358
|
# * calibration status (see below)
|
339
359
|
#
|
340
360
|
# The calibration status consists of four pairs of two bits. Each pair
|
@@ -356,23 +376,31 @@ module Tinkerforge
|
|
356
376
|
# to use the CALLBACK_ALL_DATA callback and set the period with
|
357
377
|
# BrickIMUV2#set_all_data_period.
|
358
378
|
def get_all_data
|
359
|
-
|
379
|
+
check_validity
|
380
|
+
|
381
|
+
send_request FUNCTION_GET_ALL_DATA, [], '', 54, 's3 s3 s3 s3 s4 s3 s3 c C'
|
360
382
|
end
|
361
383
|
|
362
384
|
# Turns the orientation and direction LEDs of the IMU Brick on.
|
363
385
|
def leds_on
|
364
|
-
|
386
|
+
check_validity
|
387
|
+
|
388
|
+
send_request FUNCTION_LEDS_ON, [], '', 8, ''
|
365
389
|
end
|
366
390
|
|
367
391
|
# Turns the orientation and direction LEDs of the IMU Brick off.
|
368
392
|
def leds_off
|
369
|
-
|
393
|
+
check_validity
|
394
|
+
|
395
|
+
send_request FUNCTION_LEDS_OFF, [], '', 8, ''
|
370
396
|
end
|
371
397
|
|
372
398
|
# Returns *true* if the orientation and direction LEDs of the IMU Brick
|
373
399
|
# are on, *false* otherwise.
|
374
400
|
def are_leds_on
|
375
|
-
|
401
|
+
check_validity
|
402
|
+
|
403
|
+
send_request FUNCTION_ARE_LEDS_ON, [], '', 9, '?'
|
376
404
|
end
|
377
405
|
|
378
406
|
# A call of this function saves the current calibration to be used
|
@@ -386,132 +414,164 @@ module Tinkerforge
|
|
386
414
|
# This function is used by the calibration window of the Brick Viewer, you
|
387
415
|
# should not need to call it in your program.
|
388
416
|
def save_calibration
|
389
|
-
|
417
|
+
check_validity
|
418
|
+
|
419
|
+
send_request FUNCTION_SAVE_CALIBRATION, [], '', 9, '?'
|
390
420
|
end
|
391
421
|
|
392
|
-
# Sets the period
|
422
|
+
# Sets the period with which the CALLBACK_ACCELERATION callback is triggered
|
393
423
|
# periodically. A value of 0 turns the callback off.
|
394
|
-
#
|
395
|
-
# The default value is 0.
|
396
424
|
def set_acceleration_period(period)
|
397
|
-
|
425
|
+
check_validity
|
426
|
+
|
427
|
+
send_request FUNCTION_SET_ACCELERATION_PERIOD, [period], 'L', 8, ''
|
398
428
|
end
|
399
429
|
|
400
430
|
# Returns the period as set by BrickIMUV2#set_acceleration_period.
|
401
431
|
def get_acceleration_period
|
402
|
-
|
432
|
+
check_validity
|
433
|
+
|
434
|
+
send_request FUNCTION_GET_ACCELERATION_PERIOD, [], '', 12, 'L'
|
403
435
|
end
|
404
436
|
|
405
|
-
# Sets the period
|
437
|
+
# Sets the period with which the CALLBACK_MAGNETIC_FIELD callback is triggered
|
406
438
|
# periodically. A value of 0 turns the callback off.
|
407
439
|
def set_magnetic_field_period(period)
|
408
|
-
|
440
|
+
check_validity
|
441
|
+
|
442
|
+
send_request FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 8, ''
|
409
443
|
end
|
410
444
|
|
411
445
|
# Returns the period as set by BrickIMUV2#set_magnetic_field_period.
|
412
446
|
def get_magnetic_field_period
|
413
|
-
|
447
|
+
check_validity
|
448
|
+
|
449
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 12, 'L'
|
414
450
|
end
|
415
451
|
|
416
|
-
# Sets the period
|
452
|
+
# Sets the period with which the CALLBACK_ANGULAR_VELOCITY callback is
|
417
453
|
# triggered periodically. A value of 0 turns the callback off.
|
418
454
|
def set_angular_velocity_period(period)
|
419
|
-
|
455
|
+
check_validity
|
456
|
+
|
457
|
+
send_request FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 8, ''
|
420
458
|
end
|
421
459
|
|
422
460
|
# Returns the period as set by BrickIMUV2#set_angular_velocity_period.
|
423
461
|
def get_angular_velocity_period
|
424
|
-
|
462
|
+
check_validity
|
463
|
+
|
464
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 12, 'L'
|
425
465
|
end
|
426
466
|
|
427
|
-
# Sets the period
|
467
|
+
# Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
|
428
468
|
# periodically. A value of 0 turns the callback off.
|
429
469
|
def set_temperature_period(period)
|
430
|
-
|
470
|
+
check_validity
|
471
|
+
|
472
|
+
send_request FUNCTION_SET_TEMPERATURE_PERIOD, [period], 'L', 8, ''
|
431
473
|
end
|
432
474
|
|
433
475
|
# Returns the period as set by BrickIMUV2#set_temperature_period.
|
434
476
|
def get_temperature_period
|
435
|
-
|
477
|
+
check_validity
|
478
|
+
|
479
|
+
send_request FUNCTION_GET_TEMPERATURE_PERIOD, [], '', 12, 'L'
|
436
480
|
end
|
437
481
|
|
438
|
-
# Sets the period
|
482
|
+
# Sets the period with which the CALLBACK_ORIENTATION callback is triggered
|
439
483
|
# periodically. A value of 0 turns the callback off.
|
440
484
|
def set_orientation_period(period)
|
441
|
-
|
485
|
+
check_validity
|
486
|
+
|
487
|
+
send_request FUNCTION_SET_ORIENTATION_PERIOD, [period], 'L', 8, ''
|
442
488
|
end
|
443
489
|
|
444
490
|
# Returns the period as set by BrickIMUV2#set_orientation_period.
|
445
491
|
def get_orientation_period
|
446
|
-
|
492
|
+
check_validity
|
493
|
+
|
494
|
+
send_request FUNCTION_GET_ORIENTATION_PERIOD, [], '', 12, 'L'
|
447
495
|
end
|
448
496
|
|
449
|
-
# Sets the period
|
497
|
+
# Sets the period with which the CALLBACK_LINEAR_ACCELERATION callback is
|
450
498
|
# triggered periodically. A value of 0 turns the callback off.
|
451
499
|
def set_linear_acceleration_period(period)
|
452
|
-
|
500
|
+
check_validity
|
501
|
+
|
502
|
+
send_request FUNCTION_SET_LINEAR_ACCELERATION_PERIOD, [period], 'L', 8, ''
|
453
503
|
end
|
454
504
|
|
455
505
|
# Returns the period as set by BrickIMUV2#set_linear_acceleration_period.
|
456
506
|
def get_linear_acceleration_period
|
457
|
-
|
507
|
+
check_validity
|
508
|
+
|
509
|
+
send_request FUNCTION_GET_LINEAR_ACCELERATION_PERIOD, [], '', 12, 'L'
|
458
510
|
end
|
459
511
|
|
460
|
-
# Sets the period
|
512
|
+
# Sets the period with which the CALLBACK_GRAVITY_VECTOR callback is triggered
|
461
513
|
# periodically. A value of 0 turns the callback off.
|
462
514
|
def set_gravity_vector_period(period)
|
463
|
-
|
515
|
+
check_validity
|
516
|
+
|
517
|
+
send_request FUNCTION_SET_GRAVITY_VECTOR_PERIOD, [period], 'L', 8, ''
|
464
518
|
end
|
465
519
|
|
466
520
|
# Returns the period as set by BrickIMUV2#set_gravity_vector_period.
|
467
521
|
def get_gravity_vector_period
|
468
|
-
|
522
|
+
check_validity
|
523
|
+
|
524
|
+
send_request FUNCTION_GET_GRAVITY_VECTOR_PERIOD, [], '', 12, 'L'
|
469
525
|
end
|
470
526
|
|
471
|
-
# Sets the period
|
527
|
+
# Sets the period with which the CALLBACK_QUATERNION callback is triggered
|
472
528
|
# periodically. A value of 0 turns the callback off.
|
473
529
|
def set_quaternion_period(period)
|
474
|
-
|
530
|
+
check_validity
|
531
|
+
|
532
|
+
send_request FUNCTION_SET_QUATERNION_PERIOD, [period], 'L', 8, ''
|
475
533
|
end
|
476
534
|
|
477
535
|
# Returns the period as set by BrickIMUV2#set_quaternion_period.
|
478
536
|
def get_quaternion_period
|
479
|
-
|
537
|
+
check_validity
|
538
|
+
|
539
|
+
send_request FUNCTION_GET_QUATERNION_PERIOD, [], '', 12, 'L'
|
480
540
|
end
|
481
541
|
|
482
|
-
# Sets the period
|
542
|
+
# Sets the period with which the CALLBACK_ALL_DATA callback is triggered
|
483
543
|
# periodically. A value of 0 turns the callback off.
|
484
544
|
def set_all_data_period(period)
|
485
|
-
|
545
|
+
check_validity
|
546
|
+
|
547
|
+
send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 8, ''
|
486
548
|
end
|
487
549
|
|
488
550
|
# Returns the period as set by BrickIMUV2#set_all_data_period.
|
489
551
|
def get_all_data_period
|
490
|
-
|
552
|
+
check_validity
|
553
|
+
|
554
|
+
send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 12, 'L'
|
491
555
|
end
|
492
556
|
|
493
557
|
# Sets the available sensor configuration for the Magnetometer, Gyroscope and
|
494
558
|
# Accelerometer. The Accelerometer Range is user selectable in all fusion modes,
|
495
559
|
# all other configurations are auto-controlled in fusion mode.
|
496
560
|
#
|
497
|
-
# The default values are:
|
498
|
-
#
|
499
|
-
# * Magnetometer Rate 20Hz
|
500
|
-
# * Gyroscope Range 2000°/s
|
501
|
-
# * Gyroscope Bandwidth 32Hz
|
502
|
-
# * Accelerometer Range +/-4G
|
503
|
-
# * Accelerometer Bandwidth 62.5Hz
|
504
|
-
#
|
505
561
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
506
562
|
def set_sensor_configuration(magnetometer_rate, gyroscope_range, gyroscope_bandwidth, accelerometer_range, accelerometer_bandwidth)
|
507
|
-
|
563
|
+
check_validity
|
564
|
+
|
565
|
+
send_request FUNCTION_SET_SENSOR_CONFIGURATION, [magnetometer_rate, gyroscope_range, gyroscope_bandwidth, accelerometer_range, accelerometer_bandwidth], 'C C C C C', 8, ''
|
508
566
|
end
|
509
567
|
|
510
568
|
# Returns the sensor configuration as set by BrickIMUV2#set_sensor_configuration.
|
511
569
|
#
|
512
570
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
513
571
|
def get_sensor_configuration
|
514
|
-
|
572
|
+
check_validity
|
573
|
+
|
574
|
+
send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 13, 'C C C C C'
|
515
575
|
end
|
516
576
|
|
517
577
|
# If the fusion mode is turned off, the functions BrickIMUV2#get_acceleration,
|
@@ -529,26 +589,28 @@ module Tinkerforge
|
|
529
589
|
# the first time will likely take longer, but small magnetic influences might
|
530
590
|
# not affect the automatic calibration as much.
|
531
591
|
#
|
532
|
-
# By default sensor fusion is on.
|
533
|
-
#
|
534
592
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
535
593
|
def set_sensor_fusion_mode(mode)
|
536
|
-
|
594
|
+
check_validity
|
595
|
+
|
596
|
+
send_request FUNCTION_SET_SENSOR_FUSION_MODE, [mode], 'C', 8, ''
|
537
597
|
end
|
538
598
|
|
539
599
|
# Returns the sensor fusion mode as set by BrickIMUV2#set_sensor_fusion_mode.
|
540
600
|
#
|
541
601
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
542
602
|
def get_sensor_fusion_mode
|
543
|
-
|
603
|
+
check_validity
|
604
|
+
|
605
|
+
send_request FUNCTION_GET_SENSOR_FUSION_MODE, [], '', 9, 'C'
|
544
606
|
end
|
545
607
|
|
546
608
|
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
547
609
|
# enabled, the Brick will try to adapt the baudrate for the communication
|
548
610
|
# between Bricks and Bricklets according to the amount of data that is transferred.
|
549
611
|
#
|
550
|
-
# The baudrate will be increased exponentially if lots of data is
|
551
|
-
# decreased linearly if little data is
|
612
|
+
# The baudrate will be increased exponentially if lots of data is sent/received and
|
613
|
+
# decreased linearly if little data is sent/received.
|
552
614
|
#
|
553
615
|
# This lowers the baudrate in applications where little data is transferred (e.g.
|
554
616
|
# a weather station) and increases the robustness. If there is lots of data to transfer
|
@@ -562,20 +624,20 @@ module Tinkerforge
|
|
562
624
|
# BrickIMUV2#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
563
625
|
# as set by BrickIMUV2#set_spitfp_baudrate will be used statically.
|
564
626
|
#
|
565
|
-
# The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
|
566
|
-
#
|
567
|
-
# By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
|
568
|
-
#
|
569
627
|
# .. versionadded:: 2.0.10$nbsp;(Firmware)
|
570
628
|
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
571
|
-
|
629
|
+
check_validity
|
630
|
+
|
631
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 8, ''
|
572
632
|
end
|
573
633
|
|
574
634
|
# Returns the baudrate config, see BrickIMUV2#set_spitfp_baudrate_config.
|
575
635
|
#
|
576
636
|
# .. versionadded:: 2.0.10$nbsp;(Firmware)
|
577
637
|
def get_spitfp_baudrate_config
|
578
|
-
|
638
|
+
check_validity
|
639
|
+
|
640
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 13, '? L'
|
579
641
|
end
|
580
642
|
|
581
643
|
# Returns the timeout count for the different communication methods.
|
@@ -587,11 +649,12 @@ module Tinkerforge
|
|
587
649
|
#
|
588
650
|
# .. versionadded:: 2.0.7$nbsp;(Firmware)
|
589
651
|
def get_send_timeout_count(communication_method)
|
590
|
-
|
652
|
+
check_validity
|
653
|
+
|
654
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 12, 'L'
|
591
655
|
end
|
592
656
|
|
593
|
-
# Sets the baudrate for a specific Bricklet port
|
594
|
-
# baudrate can be in the range 400000 to 2000000.
|
657
|
+
# Sets the baudrate for a specific Bricklet port.
|
595
658
|
#
|
596
659
|
# If you want to increase the throughput of Bricklets you can increase
|
597
660
|
# the baudrate. If you get a high error count because of high
|
@@ -602,21 +665,23 @@ module Tinkerforge
|
|
602
665
|
# function corresponds to the maximum baudrate (see BrickIMUV2#set_spitfp_baudrate_config).
|
603
666
|
#
|
604
667
|
# Regulatory testing is done with the default baudrate. If CE compatibility
|
605
|
-
# or similar is necessary in
|
668
|
+
# or similar is necessary in your applications we recommend to not change
|
606
669
|
# the baudrate.
|
607
670
|
#
|
608
|
-
# The default baudrate for all ports is 1400000.
|
609
|
-
#
|
610
671
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
611
672
|
def set_spitfp_baudrate(bricklet_port, baudrate)
|
612
|
-
|
673
|
+
check_validity
|
674
|
+
|
675
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 8, ''
|
613
676
|
end
|
614
677
|
|
615
678
|
# Returns the baudrate for a given Bricklet port, see BrickIMUV2#set_spitfp_baudrate.
|
616
679
|
#
|
617
680
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
618
681
|
def get_spitfp_baudrate(bricklet_port)
|
619
|
-
|
682
|
+
check_validity
|
683
|
+
|
684
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 12, 'L'
|
620
685
|
end
|
621
686
|
|
622
687
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -633,7 +698,9 @@ module Tinkerforge
|
|
633
698
|
#
|
634
699
|
# .. versionadded:: 2.0.5$nbsp;(Firmware)
|
635
700
|
def get_spitfp_error_count(bricklet_port)
|
636
|
-
|
701
|
+
check_validity
|
702
|
+
|
703
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 24, 'L L L L'
|
637
704
|
end
|
638
705
|
|
639
706
|
# Enables the status LED.
|
@@ -643,7 +710,9 @@ module Tinkerforge
|
|
643
710
|
#
|
644
711
|
# The default state is enabled.
|
645
712
|
def enable_status_led
|
646
|
-
|
713
|
+
check_validity
|
714
|
+
|
715
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 8, ''
|
647
716
|
end
|
648
717
|
|
649
718
|
# Disables the status LED.
|
@@ -653,12 +722,16 @@ module Tinkerforge
|
|
653
722
|
#
|
654
723
|
# The default state is enabled.
|
655
724
|
def disable_status_led
|
656
|
-
|
725
|
+
check_validity
|
726
|
+
|
727
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 8, ''
|
657
728
|
end
|
658
729
|
|
659
730
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
660
731
|
def is_status_led_enabled
|
661
|
-
|
732
|
+
check_validity
|
733
|
+
|
734
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 9, '?'
|
662
735
|
end
|
663
736
|
|
664
737
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
@@ -667,17 +740,21 @@ module Tinkerforge
|
|
667
740
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
668
741
|
# plugins.
|
669
742
|
def get_protocol1_bricklet_name(port)
|
670
|
-
|
743
|
+
check_validity
|
744
|
+
|
745
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 52, 'C C3 Z40'
|
671
746
|
end
|
672
747
|
|
673
|
-
# Returns the temperature
|
748
|
+
# Returns the temperature as measured inside the microcontroller. The
|
674
749
|
# value returned is not the ambient temperature!
|
675
750
|
#
|
676
751
|
# The temperature is only proportional to the real temperature and it has an
|
677
|
-
# accuracy of
|
752
|
+
# accuracy of ±15%. Practically it is only useful as an indicator for
|
678
753
|
# temperature changes.
|
679
754
|
def get_chip_temperature
|
680
|
-
|
755
|
+
check_validity
|
756
|
+
|
757
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
681
758
|
end
|
682
759
|
|
683
760
|
# Calling this function will reset the Brick. Calling this function
|
@@ -687,19 +764,43 @@ module Tinkerforge
|
|
687
764
|
# calling functions on the existing ones will result in
|
688
765
|
# undefined behavior!
|
689
766
|
def reset
|
690
|
-
|
767
|
+
check_validity
|
768
|
+
|
769
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
770
|
+
end
|
771
|
+
|
772
|
+
# Writes 32 bytes of firmware to the bricklet attached at the given port.
|
773
|
+
# The bytes are written to the position offset * 32.
|
774
|
+
#
|
775
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
776
|
+
# necessary to call it in a normal user program.
|
777
|
+
def write_bricklet_plugin(port, offset, chunk)
|
778
|
+
check_validity
|
779
|
+
|
780
|
+
send_request FUNCTION_WRITE_BRICKLET_PLUGIN, [port, offset, chunk], 'k C C32', 8, ''
|
781
|
+
end
|
782
|
+
|
783
|
+
# Reads 32 bytes of firmware from the bricklet attached at the given port.
|
784
|
+
# The bytes are read starting at the position offset * 32.
|
785
|
+
#
|
786
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
787
|
+
# necessary to call it in a normal user program.
|
788
|
+
def read_bricklet_plugin(port, offset)
|
789
|
+
check_validity
|
790
|
+
|
791
|
+
send_request FUNCTION_READ_BRICKLET_PLUGIN, [port, offset], 'k C', 40, 'C32'
|
691
792
|
end
|
692
793
|
|
693
794
|
# Returns the UID, the UID where the Brick is connected to,
|
694
795
|
# the position, the hardware and firmware version as well as the
|
695
796
|
# device identifier.
|
696
797
|
#
|
697
|
-
# The position
|
798
|
+
# The position is the position in the stack from '0' (bottom) to '8' (top).
|
698
799
|
#
|
699
800
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
700
801
|
# |device_identifier_constant|
|
701
802
|
def get_identity
|
702
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
803
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
703
804
|
end
|
704
805
|
|
705
806
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|