tinkerforge 2.1.22 → 2.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Full fledged AHRS with 9 degrees of freedom
|
|
14
16
|
class BrickIMU < Device
|
|
@@ -93,6 +95,8 @@ module Tinkerforge
|
|
|
93
95
|
FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241 # :nodoc:
|
|
94
96
|
FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
|
|
95
97
|
FUNCTION_RESET = 243 # :nodoc:
|
|
98
|
+
FUNCTION_WRITE_BRICKLET_PLUGIN = 246 # :nodoc:
|
|
99
|
+
FUNCTION_READ_BRICKLET_PLUGIN = 247 # :nodoc:
|
|
96
100
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
97
101
|
|
|
98
102
|
CALIBRATION_TYPE_ACCELEROMETER_GAIN = 0 # :nodoc:
|
|
@@ -113,7 +117,7 @@ module Tinkerforge
|
|
|
113
117
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
114
118
|
# the IP Connection <tt>ipcon</tt>.
|
|
115
119
|
def initialize(uid, ipcon)
|
|
116
|
-
super uid, ipcon
|
|
120
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
117
121
|
|
|
118
122
|
@api_version = [2, 0, 4]
|
|
119
123
|
|
|
@@ -162,35 +166,42 @@ module Tinkerforge
|
|
|
162
166
|
@response_expected[FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
163
167
|
@response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
164
168
|
@response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
|
|
169
|
+
@response_expected[FUNCTION_WRITE_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_FALSE
|
|
170
|
+
@response_expected[FUNCTION_READ_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
165
171
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
166
172
|
|
|
167
|
-
@callback_formats[CALLBACK_ACCELERATION] = 's s s'
|
|
168
|
-
@callback_formats[CALLBACK_MAGNETIC_FIELD] = 's s s'
|
|
169
|
-
@callback_formats[CALLBACK_ANGULAR_VELOCITY] = 's s s'
|
|
170
|
-
@callback_formats[CALLBACK_ALL_DATA] = 's s s s s s s s s s'
|
|
171
|
-
@callback_formats[CALLBACK_ORIENTATION] = 's s s'
|
|
172
|
-
@callback_formats[CALLBACK_QUATERNION] = 'e e e e'
|
|
173
|
+
@callback_formats[CALLBACK_ACCELERATION] = [14, 's s s']
|
|
174
|
+
@callback_formats[CALLBACK_MAGNETIC_FIELD] = [14, 's s s']
|
|
175
|
+
@callback_formats[CALLBACK_ANGULAR_VELOCITY] = [14, 's s s']
|
|
176
|
+
@callback_formats[CALLBACK_ALL_DATA] = [28, 's s s s s s s s s s']
|
|
177
|
+
@callback_formats[CALLBACK_ORIENTATION] = [14, 's s s']
|
|
178
|
+
@callback_formats[CALLBACK_QUATERNION] = [24, 'e e e e']
|
|
173
179
|
|
|
180
|
+
@ipcon.add_device self
|
|
174
181
|
end
|
|
175
182
|
|
|
176
183
|
# Returns the calibrated acceleration from the accelerometer for the
|
|
177
|
-
# x, y and z axis
|
|
184
|
+
# x, y and z axis.
|
|
178
185
|
#
|
|
179
186
|
# If you want to get the acceleration periodically, it is recommended
|
|
180
187
|
# to use the CALLBACK_ACCELERATION callback and set the period with
|
|
181
188
|
# BrickIMU#set_acceleration_period.
|
|
182
189
|
def get_acceleration
|
|
183
|
-
|
|
190
|
+
check_validity
|
|
191
|
+
|
|
192
|
+
send_request FUNCTION_GET_ACCELERATION, [], '', 14, 's s s'
|
|
184
193
|
end
|
|
185
194
|
|
|
186
195
|
# Returns the calibrated magnetic field from the magnetometer for the
|
|
187
|
-
# x, y and z axis
|
|
196
|
+
# x, y and z axis.
|
|
188
197
|
#
|
|
189
198
|
# If you want to get the magnetic field periodically, it is recommended
|
|
190
199
|
# to use the CALLBACK_MAGNETIC_FIELD callback and set the period with
|
|
191
200
|
# BrickIMU#set_magnetic_field_period.
|
|
192
201
|
def get_magnetic_field
|
|
193
|
-
|
|
202
|
+
check_validity
|
|
203
|
+
|
|
204
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD, [], '', 14, 's s s'
|
|
194
205
|
end
|
|
195
206
|
|
|
196
207
|
# Returns the calibrated angular velocity from the gyroscope for the
|
|
@@ -201,23 +212,25 @@ module Tinkerforge
|
|
|
201
212
|
# to use the CALLBACK_ANGULAR_VELOCITY callback and set the period with
|
|
202
213
|
# BrickIMU#set_angular_velocity_period.
|
|
203
214
|
def get_angular_velocity
|
|
204
|
-
|
|
215
|
+
check_validity
|
|
216
|
+
|
|
217
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY, [], '', 14, 's s s'
|
|
205
218
|
end
|
|
206
219
|
|
|
207
220
|
# Returns the data from BrickIMU#get_acceleration, BrickIMU#get_magnetic_field
|
|
208
221
|
# and BrickIMU#get_angular_velocity as well as the temperature of the IMU Brick.
|
|
209
222
|
#
|
|
210
|
-
# The temperature is given in °C/100.
|
|
211
|
-
#
|
|
212
223
|
# If you want to get the data periodically, it is recommended
|
|
213
224
|
# to use the CALLBACK_ALL_DATA callback and set the period with
|
|
214
225
|
# BrickIMU#set_all_data_period.
|
|
215
226
|
def get_all_data
|
|
216
|
-
|
|
227
|
+
check_validity
|
|
228
|
+
|
|
229
|
+
send_request FUNCTION_GET_ALL_DATA, [], '', 28, 's s s s s s s s s s'
|
|
217
230
|
end
|
|
218
231
|
|
|
219
232
|
# Returns the current orientation (roll, pitch, yaw) of the IMU Brick as Euler
|
|
220
|
-
# angles
|
|
233
|
+
# angles. Note that Euler angles always experience a
|
|
221
234
|
# `gimbal lock <https://en.wikipedia.org/wiki/Gimbal_lock>`__.
|
|
222
235
|
#
|
|
223
236
|
# We recommend that you use quaternions instead.
|
|
@@ -229,7 +242,9 @@ module Tinkerforge
|
|
|
229
242
|
# to use the CALLBACK_ORIENTATION callback and set the period with
|
|
230
243
|
# BrickIMU#set_orientation_period.
|
|
231
244
|
def get_orientation
|
|
232
|
-
|
|
245
|
+
check_validity
|
|
246
|
+
|
|
247
|
+
send_request FUNCTION_GET_ORIENTATION, [], '', 14, 's s s'
|
|
233
248
|
end
|
|
234
249
|
|
|
235
250
|
# Returns the current orientation (x, y, z, w) of the IMU as
|
|
@@ -264,52 +279,69 @@ module Tinkerforge
|
|
|
264
279
|
# to use the CALLBACK_QUATERNION callback and set the period with
|
|
265
280
|
# BrickIMU#set_quaternion_period.
|
|
266
281
|
def get_quaternion
|
|
267
|
-
|
|
282
|
+
check_validity
|
|
283
|
+
|
|
284
|
+
send_request FUNCTION_GET_QUATERNION, [], '', 24, 'e e e e'
|
|
268
285
|
end
|
|
269
286
|
|
|
270
|
-
# Returns the temperature of the IMU Brick.
|
|
271
|
-
# °C/100.
|
|
287
|
+
# Returns the temperature of the IMU Brick.
|
|
272
288
|
def get_imu_temperature
|
|
273
|
-
|
|
289
|
+
check_validity
|
|
290
|
+
|
|
291
|
+
send_request FUNCTION_GET_IMU_TEMPERATURE, [], '', 10, 's'
|
|
274
292
|
end
|
|
275
293
|
|
|
276
294
|
# Turns the orientation and direction LEDs of the IMU Brick on.
|
|
277
295
|
def leds_on
|
|
278
|
-
|
|
296
|
+
check_validity
|
|
297
|
+
|
|
298
|
+
send_request FUNCTION_LEDS_ON, [], '', 8, ''
|
|
279
299
|
end
|
|
280
300
|
|
|
281
301
|
# Turns the orientation and direction LEDs of the IMU Brick off.
|
|
282
302
|
def leds_off
|
|
283
|
-
|
|
303
|
+
check_validity
|
|
304
|
+
|
|
305
|
+
send_request FUNCTION_LEDS_OFF, [], '', 8, ''
|
|
284
306
|
end
|
|
285
307
|
|
|
286
308
|
# Returns *true* if the orientation and direction LEDs of the IMU Brick
|
|
287
309
|
# are on, *false* otherwise.
|
|
288
310
|
def are_leds_on
|
|
289
|
-
|
|
311
|
+
check_validity
|
|
312
|
+
|
|
313
|
+
send_request FUNCTION_ARE_LEDS_ON, [], '', 9, '?'
|
|
290
314
|
end
|
|
291
315
|
|
|
292
316
|
# Not implemented yet.
|
|
293
317
|
def set_acceleration_range(range)
|
|
294
|
-
|
|
318
|
+
check_validity
|
|
319
|
+
|
|
320
|
+
send_request FUNCTION_SET_ACCELERATION_RANGE, [range], 'C', 8, ''
|
|
295
321
|
end
|
|
296
322
|
|
|
297
323
|
# Not implemented yet.
|
|
298
324
|
def get_acceleration_range
|
|
299
|
-
|
|
325
|
+
check_validity
|
|
326
|
+
|
|
327
|
+
send_request FUNCTION_GET_ACCELERATION_RANGE, [], '', 9, 'C'
|
|
300
328
|
end
|
|
301
329
|
|
|
302
330
|
# Not implemented yet.
|
|
303
331
|
def set_magnetometer_range(range)
|
|
304
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_SET_MAGNETOMETER_RANGE, [range], 'C', 8, ''
|
|
305
335
|
end
|
|
306
336
|
|
|
307
337
|
# Not implemented yet.
|
|
308
338
|
def get_magnetometer_range
|
|
309
|
-
|
|
339
|
+
check_validity
|
|
340
|
+
|
|
341
|
+
send_request FUNCTION_GET_MAGNETOMETER_RANGE, [], '', 9, 'C'
|
|
310
342
|
end
|
|
311
343
|
|
|
312
|
-
# Sets the convergence speed of the IMU Brick
|
|
344
|
+
# Sets the convergence speed of the IMU Brick. The convergence speed
|
|
313
345
|
# determines how the different sensor measurements are fused.
|
|
314
346
|
#
|
|
315
347
|
# If the orientation of the IMU Brick is off by 10° and the convergence speed is
|
|
@@ -334,15 +366,17 @@ module Tinkerforge
|
|
|
334
366
|
#
|
|
335
367
|
# You might want to play around with the convergence speed in the Brick Viewer to
|
|
336
368
|
# get a feeling for a good value for your application.
|
|
337
|
-
#
|
|
338
|
-
# The default value is 30.
|
|
339
369
|
def set_convergence_speed(speed)
|
|
340
|
-
|
|
370
|
+
check_validity
|
|
371
|
+
|
|
372
|
+
send_request FUNCTION_SET_CONVERGENCE_SPEED, [speed], 'S', 8, ''
|
|
341
373
|
end
|
|
342
374
|
|
|
343
375
|
# Returns the convergence speed as set by BrickIMU#set_convergence_speed.
|
|
344
376
|
def get_convergence_speed
|
|
345
|
-
|
|
377
|
+
check_validity
|
|
378
|
+
|
|
379
|
+
send_request FUNCTION_GET_CONVERGENCE_SPEED, [], '', 10, 'S'
|
|
346
380
|
end
|
|
347
381
|
|
|
348
382
|
# There are several different types that can be calibrated:
|
|
@@ -378,80 +412,106 @@ module Tinkerforge
|
|
|
378
412
|
# We highly recommend that you use the Brick Viewer to calibrate your
|
|
379
413
|
# IMU Brick.
|
|
380
414
|
def set_calibration(typ, data)
|
|
381
|
-
|
|
415
|
+
check_validity
|
|
416
|
+
|
|
417
|
+
send_request FUNCTION_SET_CALIBRATION, [typ, data], 'C s10', 8, ''
|
|
382
418
|
end
|
|
383
419
|
|
|
384
420
|
# Returns the calibration for a given type as set by BrickIMU#set_calibration.
|
|
385
421
|
def get_calibration(typ)
|
|
386
|
-
|
|
422
|
+
check_validity
|
|
423
|
+
|
|
424
|
+
send_request FUNCTION_GET_CALIBRATION, [typ], 'C', 28, 's10'
|
|
387
425
|
end
|
|
388
426
|
|
|
389
|
-
# Sets the period
|
|
427
|
+
# Sets the period with which the CALLBACK_ACCELERATION callback is triggered
|
|
390
428
|
# periodically. A value of 0 turns the callback off.
|
|
391
|
-
#
|
|
392
|
-
# The default value is 0.
|
|
393
429
|
def set_acceleration_period(period)
|
|
394
|
-
|
|
430
|
+
check_validity
|
|
431
|
+
|
|
432
|
+
send_request FUNCTION_SET_ACCELERATION_PERIOD, [period], 'L', 8, ''
|
|
395
433
|
end
|
|
396
434
|
|
|
397
435
|
# Returns the period as set by BrickIMU#set_acceleration_period.
|
|
398
436
|
def get_acceleration_period
|
|
399
|
-
|
|
437
|
+
check_validity
|
|
438
|
+
|
|
439
|
+
send_request FUNCTION_GET_ACCELERATION_PERIOD, [], '', 12, 'L'
|
|
400
440
|
end
|
|
401
441
|
|
|
402
|
-
# Sets the period
|
|
442
|
+
# Sets the period with which the CALLBACK_MAGNETIC_FIELD callback is
|
|
403
443
|
# triggered periodically. A value of 0 turns the callback off.
|
|
404
444
|
def set_magnetic_field_period(period)
|
|
405
|
-
|
|
445
|
+
check_validity
|
|
446
|
+
|
|
447
|
+
send_request FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 8, ''
|
|
406
448
|
end
|
|
407
449
|
|
|
408
450
|
# Returns the period as set by BrickIMU#set_magnetic_field_period.
|
|
409
451
|
def get_magnetic_field_period
|
|
410
|
-
|
|
452
|
+
check_validity
|
|
453
|
+
|
|
454
|
+
send_request FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 12, 'L'
|
|
411
455
|
end
|
|
412
456
|
|
|
413
|
-
# Sets the period
|
|
457
|
+
# Sets the period with which the CALLBACK_ANGULAR_VELOCITY callback is
|
|
414
458
|
# triggered periodically. A value of 0 turns the callback off.
|
|
415
459
|
def set_angular_velocity_period(period)
|
|
416
|
-
|
|
460
|
+
check_validity
|
|
461
|
+
|
|
462
|
+
send_request FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 8, ''
|
|
417
463
|
end
|
|
418
464
|
|
|
419
465
|
# Returns the period as set by BrickIMU#set_angular_velocity_period.
|
|
420
466
|
def get_angular_velocity_period
|
|
421
|
-
|
|
467
|
+
check_validity
|
|
468
|
+
|
|
469
|
+
send_request FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 12, 'L'
|
|
422
470
|
end
|
|
423
471
|
|
|
424
|
-
# Sets the period
|
|
472
|
+
# Sets the period with which the CALLBACK_ALL_DATA callback is triggered
|
|
425
473
|
# periodically. A value of 0 turns the callback off.
|
|
426
474
|
def set_all_data_period(period)
|
|
427
|
-
|
|
475
|
+
check_validity
|
|
476
|
+
|
|
477
|
+
send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 8, ''
|
|
428
478
|
end
|
|
429
479
|
|
|
430
480
|
# Returns the period as set by BrickIMU#set_all_data_period.
|
|
431
481
|
def get_all_data_period
|
|
432
|
-
|
|
482
|
+
check_validity
|
|
483
|
+
|
|
484
|
+
send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 12, 'L'
|
|
433
485
|
end
|
|
434
486
|
|
|
435
|
-
# Sets the period
|
|
487
|
+
# Sets the period with which the CALLBACK_ORIENTATION callback is triggered
|
|
436
488
|
# periodically. A value of 0 turns the callback off.
|
|
437
489
|
def set_orientation_period(period)
|
|
438
|
-
|
|
490
|
+
check_validity
|
|
491
|
+
|
|
492
|
+
send_request FUNCTION_SET_ORIENTATION_PERIOD, [period], 'L', 8, ''
|
|
439
493
|
end
|
|
440
494
|
|
|
441
495
|
# Returns the period as set by BrickIMU#set_orientation_period.
|
|
442
496
|
def get_orientation_period
|
|
443
|
-
|
|
497
|
+
check_validity
|
|
498
|
+
|
|
499
|
+
send_request FUNCTION_GET_ORIENTATION_PERIOD, [], '', 12, 'L'
|
|
444
500
|
end
|
|
445
501
|
|
|
446
|
-
# Sets the period
|
|
502
|
+
# Sets the period with which the CALLBACK_QUATERNION callback is triggered
|
|
447
503
|
# periodically. A value of 0 turns the callback off.
|
|
448
504
|
def set_quaternion_period(period)
|
|
449
|
-
|
|
505
|
+
check_validity
|
|
506
|
+
|
|
507
|
+
send_request FUNCTION_SET_QUATERNION_PERIOD, [period], 'L', 8, ''
|
|
450
508
|
end
|
|
451
509
|
|
|
452
510
|
# Returns the period as set by BrickIMU#set_quaternion_period.
|
|
453
511
|
def get_quaternion_period
|
|
454
|
-
|
|
512
|
+
check_validity
|
|
513
|
+
|
|
514
|
+
send_request FUNCTION_GET_QUATERNION_PERIOD, [], '', 12, 'L'
|
|
455
515
|
end
|
|
456
516
|
|
|
457
517
|
# Turns the orientation calculation of the IMU Brick on.
|
|
@@ -460,7 +520,9 @@ module Tinkerforge
|
|
|
460
520
|
#
|
|
461
521
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
462
522
|
def orientation_calculation_on
|
|
463
|
-
|
|
523
|
+
check_validity
|
|
524
|
+
|
|
525
|
+
send_request FUNCTION_ORIENTATION_CALCULATION_ON, [], '', 8, ''
|
|
464
526
|
end
|
|
465
527
|
|
|
466
528
|
# Turns the orientation calculation of the IMU Brick off.
|
|
@@ -477,7 +539,9 @@ module Tinkerforge
|
|
|
477
539
|
#
|
|
478
540
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
479
541
|
def orientation_calculation_off
|
|
480
|
-
|
|
542
|
+
check_validity
|
|
543
|
+
|
|
544
|
+
send_request FUNCTION_ORIENTATION_CALCULATION_OFF, [], '', 8, ''
|
|
481
545
|
end
|
|
482
546
|
|
|
483
547
|
# Returns *true* if the orientation calculation of the IMU Brick
|
|
@@ -485,15 +549,17 @@ module Tinkerforge
|
|
|
485
549
|
#
|
|
486
550
|
# .. versionadded:: 2.0.2$nbsp;(Firmware)
|
|
487
551
|
def is_orientation_calculation_on
|
|
488
|
-
|
|
552
|
+
check_validity
|
|
553
|
+
|
|
554
|
+
send_request FUNCTION_IS_ORIENTATION_CALCULATION_ON, [], '', 9, '?'
|
|
489
555
|
end
|
|
490
556
|
|
|
491
557
|
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
|
492
558
|
# enabled, the Brick will try to adapt the baudrate for the communication
|
|
493
559
|
# between Bricks and Bricklets according to the amount of data that is transferred.
|
|
494
560
|
#
|
|
495
|
-
# The baudrate will be increased exponentially if lots of data is
|
|
496
|
-
# decreased linearly if little data is
|
|
561
|
+
# The baudrate will be increased exponentially if lots of data is sent/received and
|
|
562
|
+
# decreased linearly if little data is sent/received.
|
|
497
563
|
#
|
|
498
564
|
# This lowers the baudrate in applications where little data is transferred (e.g.
|
|
499
565
|
# a weather station) and increases the robustness. If there is lots of data to transfer
|
|
@@ -507,20 +573,20 @@ module Tinkerforge
|
|
|
507
573
|
# BrickIMU#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
|
508
574
|
# as set by BrickIMU#set_spitfp_baudrate will be used statically.
|
|
509
575
|
#
|
|
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
576
|
# .. versionadded:: 2.3.5$nbsp;(Firmware)
|
|
515
577
|
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
|
516
|
-
|
|
578
|
+
check_validity
|
|
579
|
+
|
|
580
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 8, ''
|
|
517
581
|
end
|
|
518
582
|
|
|
519
583
|
# Returns the baudrate config, see BrickIMU#set_spitfp_baudrate_config.
|
|
520
584
|
#
|
|
521
585
|
# .. versionadded:: 2.3.5$nbsp;(Firmware)
|
|
522
586
|
def get_spitfp_baudrate_config
|
|
523
|
-
|
|
587
|
+
check_validity
|
|
588
|
+
|
|
589
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 13, '? L'
|
|
524
590
|
end
|
|
525
591
|
|
|
526
592
|
# Returns the timeout count for the different communication methods.
|
|
@@ -532,11 +598,12 @@ module Tinkerforge
|
|
|
532
598
|
#
|
|
533
599
|
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
534
600
|
def get_send_timeout_count(communication_method)
|
|
535
|
-
|
|
601
|
+
check_validity
|
|
602
|
+
|
|
603
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 12, 'L'
|
|
536
604
|
end
|
|
537
605
|
|
|
538
|
-
# Sets the baudrate for a specific Bricklet port
|
|
539
|
-
# baudrate can be in the range 400000 to 2000000.
|
|
606
|
+
# Sets the baudrate for a specific Bricklet port.
|
|
540
607
|
#
|
|
541
608
|
# If you want to increase the throughput of Bricklets you can increase
|
|
542
609
|
# the baudrate. If you get a high error count because of high
|
|
@@ -547,21 +614,23 @@ module Tinkerforge
|
|
|
547
614
|
# function corresponds to the maximum baudrate (see BrickIMU#set_spitfp_baudrate_config).
|
|
548
615
|
#
|
|
549
616
|
# Regulatory testing is done with the default baudrate. If CE compatibility
|
|
550
|
-
# or similar is necessary in
|
|
617
|
+
# or similar is necessary in your applications we recommend to not change
|
|
551
618
|
# the baudrate.
|
|
552
619
|
#
|
|
553
|
-
# The default baudrate for all ports is 1400000.
|
|
554
|
-
#
|
|
555
620
|
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
556
621
|
def set_spitfp_baudrate(bricklet_port, baudrate)
|
|
557
|
-
|
|
622
|
+
check_validity
|
|
623
|
+
|
|
624
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 8, ''
|
|
558
625
|
end
|
|
559
626
|
|
|
560
627
|
# Returns the baudrate for a given Bricklet port, see BrickIMU#set_spitfp_baudrate.
|
|
561
628
|
#
|
|
562
629
|
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
563
630
|
def get_spitfp_baudrate(bricklet_port)
|
|
564
|
-
|
|
631
|
+
check_validity
|
|
632
|
+
|
|
633
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 12, 'L'
|
|
565
634
|
end
|
|
566
635
|
|
|
567
636
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -578,7 +647,9 @@ module Tinkerforge
|
|
|
578
647
|
#
|
|
579
648
|
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
580
649
|
def get_spitfp_error_count(bricklet_port)
|
|
581
|
-
|
|
650
|
+
check_validity
|
|
651
|
+
|
|
652
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 24, 'L L L L'
|
|
582
653
|
end
|
|
583
654
|
|
|
584
655
|
# Enables the status LED.
|
|
@@ -590,7 +661,9 @@ module Tinkerforge
|
|
|
590
661
|
#
|
|
591
662
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
592
663
|
def enable_status_led
|
|
593
|
-
|
|
664
|
+
check_validity
|
|
665
|
+
|
|
666
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 8, ''
|
|
594
667
|
end
|
|
595
668
|
|
|
596
669
|
# Disables the status LED.
|
|
@@ -602,14 +675,18 @@ module Tinkerforge
|
|
|
602
675
|
#
|
|
603
676
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
604
677
|
def disable_status_led
|
|
605
|
-
|
|
678
|
+
check_validity
|
|
679
|
+
|
|
680
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 8, ''
|
|
606
681
|
end
|
|
607
682
|
|
|
608
683
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
|
609
684
|
#
|
|
610
685
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
611
686
|
def is_status_led_enabled
|
|
612
|
-
|
|
687
|
+
check_validity
|
|
688
|
+
|
|
689
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 9, '?'
|
|
613
690
|
end
|
|
614
691
|
|
|
615
692
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
|
@@ -618,17 +695,21 @@ module Tinkerforge
|
|
|
618
695
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
|
619
696
|
# plugins.
|
|
620
697
|
def get_protocol1_bricklet_name(port)
|
|
621
|
-
|
|
698
|
+
check_validity
|
|
699
|
+
|
|
700
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 52, 'C C3 Z40'
|
|
622
701
|
end
|
|
623
702
|
|
|
624
|
-
# Returns the temperature
|
|
703
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
625
704
|
# value returned is not the ambient temperature!
|
|
626
705
|
#
|
|
627
706
|
# The temperature is only proportional to the real temperature and it has an
|
|
628
|
-
# accuracy of
|
|
707
|
+
# accuracy of ±15%. Practically it is only useful as an indicator for
|
|
629
708
|
# temperature changes.
|
|
630
709
|
def get_chip_temperature
|
|
631
|
-
|
|
710
|
+
check_validity
|
|
711
|
+
|
|
712
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
632
713
|
end
|
|
633
714
|
|
|
634
715
|
# Calling this function will reset the Brick. Calling this function
|
|
@@ -638,19 +719,43 @@ module Tinkerforge
|
|
|
638
719
|
# calling functions on the existing ones will result in
|
|
639
720
|
# undefined behavior!
|
|
640
721
|
def reset
|
|
641
|
-
|
|
722
|
+
check_validity
|
|
723
|
+
|
|
724
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
725
|
+
end
|
|
726
|
+
|
|
727
|
+
# Writes 32 bytes of firmware to the bricklet attached at the given port.
|
|
728
|
+
# The bytes are written to the position offset * 32.
|
|
729
|
+
#
|
|
730
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
731
|
+
# necessary to call it in a normal user program.
|
|
732
|
+
def write_bricklet_plugin(port, offset, chunk)
|
|
733
|
+
check_validity
|
|
734
|
+
|
|
735
|
+
send_request FUNCTION_WRITE_BRICKLET_PLUGIN, [port, offset, chunk], 'k C C32', 8, ''
|
|
736
|
+
end
|
|
737
|
+
|
|
738
|
+
# Reads 32 bytes of firmware from the bricklet attached at the given port.
|
|
739
|
+
# The bytes are read starting at the position offset * 32.
|
|
740
|
+
#
|
|
741
|
+
# This function is used by Brick Viewer during flashing. It should not be
|
|
742
|
+
# necessary to call it in a normal user program.
|
|
743
|
+
def read_bricklet_plugin(port, offset)
|
|
744
|
+
check_validity
|
|
745
|
+
|
|
746
|
+
send_request FUNCTION_READ_BRICKLET_PLUGIN, [port, offset], 'k C', 40, 'C32'
|
|
642
747
|
end
|
|
643
748
|
|
|
644
749
|
# Returns the UID, the UID where the Brick is connected to,
|
|
645
750
|
# the position, the hardware and firmware version as well as the
|
|
646
751
|
# device identifier.
|
|
647
752
|
#
|
|
648
|
-
# The position
|
|
753
|
+
# The position is the position in the stack from '0' (bottom) to '8' (top).
|
|
649
754
|
#
|
|
650
755
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
651
756
|
# |device_identifier_constant|
|
|
652
757
|
def get_identity
|
|
653
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
758
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
654
759
|
end
|
|
655
760
|
|
|
656
761
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|