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 #
|
|
@@ -77,7 +77,12 @@ module Tinkerforge
|
|
|
77
77
|
FUNCTION_GET_ALL_DATA = 37 # :nodoc:
|
|
78
78
|
FUNCTION_SET_ALL_DATA_PERIOD = 38 # :nodoc:
|
|
79
79
|
FUNCTION_GET_ALL_DATA_PERIOD = 39 # :nodoc:
|
|
80
|
+
FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
|
|
81
|
+
FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
|
|
80
82
|
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
|
83
|
+
FUNCTION_SET_SPITFP_BAUDRATE = 234 # :nodoc:
|
|
84
|
+
FUNCTION_GET_SPITFP_BAUDRATE = 235 # :nodoc:
|
|
85
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 237 # :nodoc:
|
|
81
86
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
|
82
87
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
|
83
88
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
|
@@ -142,8 +147,6 @@ module Tinkerforge
|
|
|
142
147
|
@response_expected[FUNCTION_GET_DECAY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
143
148
|
@response_expected[FUNCTION_SET_MINIMUM_VOLTAGE] = RESPONSE_EXPECTED_TRUE
|
|
144
149
|
@response_expected[FUNCTION_GET_MINIMUM_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
145
|
-
@response_expected[CALLBACK_UNDER_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
146
|
-
@response_expected[CALLBACK_POSITION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
147
150
|
@response_expected[FUNCTION_SET_SYNC_RECT] = RESPONSE_EXPECTED_FALSE
|
|
148
151
|
@response_expected[FUNCTION_IS_SYNC_RECT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
149
152
|
@response_expected[FUNCTION_SET_TIME_BASE] = RESPONSE_EXPECTED_FALSE
|
|
@@ -151,9 +154,12 @@ module Tinkerforge
|
|
|
151
154
|
@response_expected[FUNCTION_GET_ALL_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
152
155
|
@response_expected[FUNCTION_SET_ALL_DATA_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
153
156
|
@response_expected[FUNCTION_GET_ALL_DATA_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
154
|
-
@response_expected[
|
|
155
|
-
@response_expected[
|
|
157
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
158
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
156
159
|
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
160
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_FALSE
|
|
161
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
162
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
157
163
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
|
158
164
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
|
159
165
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -166,6 +172,7 @@ module Tinkerforge
|
|
|
166
172
|
@callback_formats[CALLBACK_POSITION_REACHED] = 'l'
|
|
167
173
|
@callback_formats[CALLBACK_ALL_DATA] = 'S l l S S S'
|
|
168
174
|
@callback_formats[CALLBACK_NEW_STATE] = 'C C'
|
|
175
|
+
|
|
169
176
|
end
|
|
170
177
|
|
|
171
178
|
# Sets the maximum velocity of the stepper motor in steps per second.
|
|
@@ -174,17 +181,17 @@ module Tinkerforge
|
|
|
174
181
|
# either BrickStepper#set_target_position, BrickStepper#set_steps, BrickStepper#drive_forward or
|
|
175
182
|
# BrickStepper#drive_backward.
|
|
176
183
|
def set_max_velocity(velocity)
|
|
177
|
-
send_request
|
|
184
|
+
send_request FUNCTION_SET_MAX_VELOCITY, [velocity], 'S', 0, ''
|
|
178
185
|
end
|
|
179
186
|
|
|
180
187
|
# Returns the velocity as set by BrickStepper#set_max_velocity.
|
|
181
188
|
def get_max_velocity
|
|
182
|
-
send_request
|
|
189
|
+
send_request FUNCTION_GET_MAX_VELOCITY, [], '', 2, 'S'
|
|
183
190
|
end
|
|
184
191
|
|
|
185
192
|
# Returns the *current* velocity of the stepper motor in steps per second.
|
|
186
193
|
def get_current_velocity
|
|
187
|
-
send_request
|
|
194
|
+
send_request FUNCTION_GET_CURRENT_VELOCITY, [], '', 2, 'S'
|
|
188
195
|
end
|
|
189
196
|
|
|
190
197
|
# Sets the acceleration and deacceleration of the stepper motor. The values
|
|
@@ -200,13 +207,13 @@ module Tinkerforge
|
|
|
200
207
|
#
|
|
201
208
|
# The default value is 1000 for both
|
|
202
209
|
def set_speed_ramping(acceleration, deacceleration)
|
|
203
|
-
send_request
|
|
210
|
+
send_request FUNCTION_SET_SPEED_RAMPING, [acceleration, deacceleration], 'S S', 0, ''
|
|
204
211
|
end
|
|
205
212
|
|
|
206
213
|
# Returns the acceleration and deacceleration as set by
|
|
207
214
|
# BrickStepper#set_speed_ramping.
|
|
208
215
|
def get_speed_ramping
|
|
209
|
-
send_request
|
|
216
|
+
send_request FUNCTION_GET_SPEED_RAMPING, [], '', 4, 'S S'
|
|
210
217
|
end
|
|
211
218
|
|
|
212
219
|
# Executes an active full brake.
|
|
@@ -218,14 +225,14 @@ module Tinkerforge
|
|
|
218
225
|
#
|
|
219
226
|
# Call BrickStepper#stop if you just want to stop the motor.
|
|
220
227
|
def full_brake
|
|
221
|
-
send_request
|
|
228
|
+
send_request FUNCTION_FULL_BRAKE, [], '', 0, ''
|
|
222
229
|
end
|
|
223
230
|
|
|
224
231
|
# Sets the current steps of the internal step counter. This can be used to
|
|
225
232
|
# set the current position to 0 when some kind of starting position
|
|
226
233
|
# is reached (e.g. when a CNC machine reaches a corner).
|
|
227
234
|
def set_current_position(position)
|
|
228
|
-
send_request
|
|
235
|
+
send_request FUNCTION_SET_CURRENT_POSITION, [position], 'l', 0, ''
|
|
229
236
|
end
|
|
230
237
|
|
|
231
238
|
# Returns the current position of the stepper motor in steps. On startup
|
|
@@ -234,7 +241,7 @@ module Tinkerforge
|
|
|
234
241
|
# BrickStepper#drive_backward). It also is possible to reset the steps to 0 or
|
|
235
242
|
# set them to any other desired value with BrickStepper#set_current_position.
|
|
236
243
|
def get_current_position
|
|
237
|
-
send_request
|
|
244
|
+
send_request FUNCTION_GET_CURRENT_POSITION, [], '', 4, 'l'
|
|
238
245
|
end
|
|
239
246
|
|
|
240
247
|
# Sets the target position of the stepper motor in steps. For example,
|
|
@@ -247,12 +254,12 @@ module Tinkerforge
|
|
|
247
254
|
# a call of BrickStepper#set_steps with the parameter
|
|
248
255
|
# (*x* - BrickStepper#get_current_position).
|
|
249
256
|
def set_target_position(position)
|
|
250
|
-
send_request
|
|
257
|
+
send_request FUNCTION_SET_TARGET_POSITION, [position], 'l', 0, ''
|
|
251
258
|
end
|
|
252
259
|
|
|
253
260
|
# Returns the last target position as set by BrickStepper#set_target_position.
|
|
254
261
|
def get_target_position
|
|
255
|
-
send_request
|
|
262
|
+
send_request FUNCTION_GET_TARGET_POSITION, [], '', 4, 'l'
|
|
256
263
|
end
|
|
257
264
|
|
|
258
265
|
# Sets the number of steps the stepper motor should run. Positive values
|
|
@@ -260,12 +267,12 @@ module Tinkerforge
|
|
|
260
267
|
# The velocity, acceleration and deacceleration as set by
|
|
261
268
|
# BrickStepper#set_max_velocity and BrickStepper#set_speed_ramping will be used.
|
|
262
269
|
def set_steps(steps)
|
|
263
|
-
send_request
|
|
270
|
+
send_request FUNCTION_SET_STEPS, [steps], 'l', 0, ''
|
|
264
271
|
end
|
|
265
272
|
|
|
266
273
|
# Returns the last steps as set by BrickStepper#set_steps.
|
|
267
274
|
def get_steps
|
|
268
|
-
send_request
|
|
275
|
+
send_request FUNCTION_GET_STEPS, [], '', 4, 'l'
|
|
269
276
|
end
|
|
270
277
|
|
|
271
278
|
# Returns the remaining steps of the last call of BrickStepper#set_steps.
|
|
@@ -273,7 +280,7 @@ module Tinkerforge
|
|
|
273
280
|
# BrickStepper#get_remaining_steps is called after the motor has run for 500 steps,
|
|
274
281
|
# it will return 1500.
|
|
275
282
|
def get_remaining_steps
|
|
276
|
-
send_request
|
|
283
|
+
send_request FUNCTION_GET_REMAINING_STEPS, [], '', 4, 'l'
|
|
277
284
|
end
|
|
278
285
|
|
|
279
286
|
# Sets the step mode of the stepper motor. Possible values are:
|
|
@@ -288,39 +295,39 @@ module Tinkerforge
|
|
|
288
295
|
#
|
|
289
296
|
# The default value is 8 (Eighth Step).
|
|
290
297
|
def set_step_mode(mode)
|
|
291
|
-
send_request
|
|
298
|
+
send_request FUNCTION_SET_STEP_MODE, [mode], 'C', 0, ''
|
|
292
299
|
end
|
|
293
300
|
|
|
294
301
|
# Returns the step mode as set by BrickStepper#set_step_mode.
|
|
295
302
|
def get_step_mode
|
|
296
|
-
send_request
|
|
303
|
+
send_request FUNCTION_GET_STEP_MODE, [], '', 1, 'C'
|
|
297
304
|
end
|
|
298
305
|
|
|
299
306
|
# Drives the stepper motor forward until BrickStepper#drive_backward or
|
|
300
307
|
# BrickStepper#stop is called. The velocity, acceleration and deacceleration as
|
|
301
308
|
# set by BrickStepper#set_max_velocity and BrickStepper#set_speed_ramping will be used.
|
|
302
309
|
def drive_forward
|
|
303
|
-
send_request
|
|
310
|
+
send_request FUNCTION_DRIVE_FORWARD, [], '', 0, ''
|
|
304
311
|
end
|
|
305
312
|
|
|
306
313
|
# Drives the stepper motor backward until BrickStepper#drive_forward or
|
|
307
314
|
# BrickStepper#stop is triggered. The velocity, acceleration and deacceleration as
|
|
308
315
|
# set by BrickStepper#set_max_velocity and BrickStepper#set_speed_ramping will be used.
|
|
309
316
|
def drive_backward
|
|
310
|
-
send_request
|
|
317
|
+
send_request FUNCTION_DRIVE_BACKWARD, [], '', 0, ''
|
|
311
318
|
end
|
|
312
319
|
|
|
313
320
|
# Stops the stepper motor with the deacceleration as set by
|
|
314
321
|
# BrickStepper#set_speed_ramping.
|
|
315
322
|
def stop
|
|
316
|
-
send_request
|
|
323
|
+
send_request FUNCTION_STOP, [], '', 0, ''
|
|
317
324
|
end
|
|
318
325
|
|
|
319
326
|
# Returns the stack input voltage in mV. The stack input voltage is the
|
|
320
327
|
# voltage that is supplied via the stack, i.e. it is given by a
|
|
321
328
|
# Step-Down or Step-Up Power Supply.
|
|
322
329
|
def get_stack_input_voltage
|
|
323
|
-
send_request
|
|
330
|
+
send_request FUNCTION_GET_STACK_INPUT_VOLTAGE, [], '', 2, 'S'
|
|
324
331
|
end
|
|
325
332
|
|
|
326
333
|
# Returns the external input voltage in mV. The external input voltage is
|
|
@@ -336,12 +343,12 @@ module Tinkerforge
|
|
|
336
343
|
# the external connection, it will immediately be driven by the high
|
|
337
344
|
# stack voltage
|
|
338
345
|
def get_external_input_voltage
|
|
339
|
-
send_request
|
|
346
|
+
send_request FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE, [], '', 2, 'S'
|
|
340
347
|
end
|
|
341
348
|
|
|
342
349
|
# Returns the current consumption of the motor in mA.
|
|
343
350
|
def get_current_consumption
|
|
344
|
-
send_request
|
|
351
|
+
send_request FUNCTION_GET_CURRENT_CONSUMPTION, [], '', 2, 'S'
|
|
345
352
|
end
|
|
346
353
|
|
|
347
354
|
# Sets the current in mA with which the motor will be driven.
|
|
@@ -352,29 +359,29 @@ module Tinkerforge
|
|
|
352
359
|
# Do not set this value above the specifications of your stepper motor.
|
|
353
360
|
# Otherwise it may damage your motor.
|
|
354
361
|
def set_motor_current(current)
|
|
355
|
-
send_request
|
|
362
|
+
send_request FUNCTION_SET_MOTOR_CURRENT, [current], 'S', 0, ''
|
|
356
363
|
end
|
|
357
364
|
|
|
358
365
|
# Returns the current as set by BrickStepper#set_motor_current.
|
|
359
366
|
def get_motor_current
|
|
360
|
-
send_request
|
|
367
|
+
send_request FUNCTION_GET_MOTOR_CURRENT, [], '', 2, 'S'
|
|
361
368
|
end
|
|
362
369
|
|
|
363
370
|
# Enables the driver chip. The driver parameters can be configured (maximum velocity,
|
|
364
371
|
# acceleration, etc) before it is enabled.
|
|
365
372
|
def enable
|
|
366
|
-
send_request
|
|
373
|
+
send_request FUNCTION_ENABLE, [], '', 0, ''
|
|
367
374
|
end
|
|
368
375
|
|
|
369
376
|
# Disables the driver chip. The configurations are kept (maximum velocity,
|
|
370
377
|
# acceleration, etc) but the motor is not driven until it is enabled again.
|
|
371
378
|
def disable
|
|
372
|
-
send_request
|
|
379
|
+
send_request FUNCTION_DISABLE, [], '', 0, ''
|
|
373
380
|
end
|
|
374
381
|
|
|
375
382
|
# Returns *true* if the driver chip is enabled, *false* otherwise.
|
|
376
383
|
def is_enabled
|
|
377
|
-
send_request
|
|
384
|
+
send_request FUNCTION_IS_ENABLED, [], '', 1, '?'
|
|
378
385
|
end
|
|
379
386
|
|
|
380
387
|
# Sets the decay mode of the stepper motor. The possible value range is
|
|
@@ -405,12 +412,12 @@ module Tinkerforge
|
|
|
405
412
|
# or the maximum motor speed is too slow, you should try to tinker with
|
|
406
413
|
# the decay value
|
|
407
414
|
def set_decay(decay)
|
|
408
|
-
send_request
|
|
415
|
+
send_request FUNCTION_SET_DECAY, [decay], 'S', 0, ''
|
|
409
416
|
end
|
|
410
417
|
|
|
411
418
|
# Returns the decay mode as set by BrickStepper#set_decay.
|
|
412
419
|
def get_decay
|
|
413
|
-
send_request
|
|
420
|
+
send_request FUNCTION_GET_DECAY, [], '', 2, 'S'
|
|
414
421
|
end
|
|
415
422
|
|
|
416
423
|
# Sets the minimum voltage in mV, below which the CALLBACK_UNDER_VOLTAGE callback
|
|
@@ -421,12 +428,12 @@ module Tinkerforge
|
|
|
421
428
|
#
|
|
422
429
|
# The default value is 8V.
|
|
423
430
|
def set_minimum_voltage(voltage)
|
|
424
|
-
send_request
|
|
431
|
+
send_request FUNCTION_SET_MINIMUM_VOLTAGE, [voltage], 'S', 0, ''
|
|
425
432
|
end
|
|
426
433
|
|
|
427
434
|
# Returns the minimum voltage as set by BrickStepper#set_minimum_voltage.
|
|
428
435
|
def get_minimum_voltage
|
|
429
|
-
send_request
|
|
436
|
+
send_request FUNCTION_GET_MINIMUM_VOLTAGE, [], '', 2, 'S'
|
|
430
437
|
end
|
|
431
438
|
|
|
432
439
|
# Turns synchronous rectification on or off (*true* or *false*).
|
|
@@ -446,12 +453,12 @@ module Tinkerforge
|
|
|
446
453
|
#
|
|
447
454
|
# The default value is *false*.
|
|
448
455
|
def set_sync_rect(sync_rect)
|
|
449
|
-
send_request
|
|
456
|
+
send_request FUNCTION_SET_SYNC_RECT, [sync_rect], '?', 0, ''
|
|
450
457
|
end
|
|
451
458
|
|
|
452
459
|
# Returns *true* if synchronous rectification is enabled, *false* otherwise.
|
|
453
460
|
def is_sync_rect
|
|
454
|
-
send_request
|
|
461
|
+
send_request FUNCTION_IS_SYNC_RECT, [], '', 1, '?'
|
|
455
462
|
end
|
|
456
463
|
|
|
457
464
|
# Sets the time base of the velocity and the acceleration of the stepper brick
|
|
@@ -463,12 +470,12 @@ module Tinkerforge
|
|
|
463
470
|
#
|
|
464
471
|
# The default value is 1.
|
|
465
472
|
def set_time_base(time_base)
|
|
466
|
-
send_request
|
|
473
|
+
send_request FUNCTION_SET_TIME_BASE, [time_base], 'L', 0, ''
|
|
467
474
|
end
|
|
468
475
|
|
|
469
476
|
# Returns the time base as set by BrickStepper#set_time_base.
|
|
470
477
|
def get_time_base
|
|
471
|
-
send_request
|
|
478
|
+
send_request FUNCTION_GET_TIME_BASE, [], '', 4, 'L'
|
|
472
479
|
end
|
|
473
480
|
|
|
474
481
|
# Returns the following parameters: The current velocity,
|
|
@@ -477,18 +484,53 @@ module Tinkerforge
|
|
|
477
484
|
#
|
|
478
485
|
# There is also a callback for this function, see CALLBACK_ALL_DATA callback.
|
|
479
486
|
def get_all_data
|
|
480
|
-
send_request
|
|
487
|
+
send_request FUNCTION_GET_ALL_DATA, [], '', 16, 'S l l S S S'
|
|
481
488
|
end
|
|
482
489
|
|
|
483
490
|
# Sets the period in ms with which the CALLBACK_ALL_DATA callback is triggered
|
|
484
491
|
# periodically. A value of 0 turns the callback off.
|
|
485
492
|
def set_all_data_period(period)
|
|
486
|
-
send_request
|
|
493
|
+
send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 0, ''
|
|
487
494
|
end
|
|
488
495
|
|
|
489
496
|
# Returns the period as set by BrickStepper#set_all_data_period.
|
|
490
497
|
def get_all_data_period
|
|
491
|
-
send_request
|
|
498
|
+
send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 4, 'L'
|
|
499
|
+
end
|
|
500
|
+
|
|
501
|
+
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
|
502
|
+
# enabled, the Brick will try to adapt the baudrate for the communication
|
|
503
|
+
# between Bricks and Bricklets according to the amount of data that is transferred.
|
|
504
|
+
#
|
|
505
|
+
# The baudrate will be increased exponetially if lots of data is send/receieved and
|
|
506
|
+
# decreased linearly if little data is send/received.
|
|
507
|
+
#
|
|
508
|
+
# This lowers the baudrate in applications where little data is transferred (e.g.
|
|
509
|
+
# a weather station) and increases the robustness. If there is lots of data to transfer
|
|
510
|
+
# (e.g. Thermal Imaging Bricklet) it automatically increases the baudrate as needed.
|
|
511
|
+
#
|
|
512
|
+
# In cases where some data has to transferred as fast as possible every few seconds
|
|
513
|
+
# (e.g. RS485 Bricklet with a high baudrate but small payload) you may want to turn
|
|
514
|
+
# the dynamic baudrate off to get the highest possible performance.
|
|
515
|
+
#
|
|
516
|
+
# The maximum value of the baudrate can be set per port with the function
|
|
517
|
+
# BrickStepper#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
|
518
|
+
# as set by BrickStepper#set_spitfp_baudrate will be used statically.
|
|
519
|
+
#
|
|
520
|
+
# The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
|
|
521
|
+
#
|
|
522
|
+
# By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
|
|
523
|
+
#
|
|
524
|
+
# .. versionadded:: 2.3.6$nbsp;(Firmware)
|
|
525
|
+
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
|
526
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
# Returns the baudrate config, see BrickStepper#set_spitfp_baudrate_config.
|
|
530
|
+
#
|
|
531
|
+
# .. versionadded:: 2.3.6$nbsp;(Firmware)
|
|
532
|
+
def get_spitfp_baudrate_config
|
|
533
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
|
|
492
534
|
end
|
|
493
535
|
|
|
494
536
|
# Returns the timeout count for the different communication methods.
|
|
@@ -500,7 +542,53 @@ module Tinkerforge
|
|
|
500
542
|
#
|
|
501
543
|
# .. versionadded:: 2.3.4$nbsp;(Firmware)
|
|
502
544
|
def get_send_timeout_count(communication_method)
|
|
503
|
-
send_request
|
|
545
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
# Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
|
|
549
|
+
# baudrate can be in the range 400000 to 2000000.
|
|
550
|
+
#
|
|
551
|
+
# If you want to increase the throughput of Bricklets you can increase
|
|
552
|
+
# the baudrate. If you get a high error count because of high
|
|
553
|
+
# interference (see BrickStepper#get_spitfp_error_count) you can decrease the
|
|
554
|
+
# baudrate.
|
|
555
|
+
#
|
|
556
|
+
# If the dynamic baudrate feature is enabled, the baudrate set by this
|
|
557
|
+
# function corresponds to the maximum baudrate (see BrickStepper#set_spitfp_baudrate_config).
|
|
558
|
+
#
|
|
559
|
+
# Regulatory testing is done with the default baudrate. If CE compatability
|
|
560
|
+
# or similar is necessary in you applications we recommend to not change
|
|
561
|
+
# the baudrate.
|
|
562
|
+
#
|
|
563
|
+
# The default baudrate for all ports is 1400000.
|
|
564
|
+
#
|
|
565
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
566
|
+
def set_spitfp_baudrate(bricklet_port, baudrate)
|
|
567
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
# Returns the baudrate for a given Bricklet port, see BrickStepper#set_spitfp_baudrate.
|
|
571
|
+
#
|
|
572
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
573
|
+
def get_spitfp_baudrate(bricklet_port)
|
|
574
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
|
578
|
+
#
|
|
579
|
+
# The errors are divided into
|
|
580
|
+
#
|
|
581
|
+
# * ACK checksum errors,
|
|
582
|
+
# * message checksum errors,
|
|
583
|
+
# * frameing errors and
|
|
584
|
+
# * overflow errors.
|
|
585
|
+
#
|
|
586
|
+
# The errors counts are for errors that occur on the Brick side. All
|
|
587
|
+
# Bricklets have a similar function that returns the errors on the Bricklet side.
|
|
588
|
+
#
|
|
589
|
+
# .. versionadded:: 2.3.3$nbsp;(Firmware)
|
|
590
|
+
def get_spitfp_error_count(bricklet_port)
|
|
591
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
|
|
504
592
|
end
|
|
505
593
|
|
|
506
594
|
# Enables the status LED.
|
|
@@ -512,7 +600,7 @@ module Tinkerforge
|
|
|
512
600
|
#
|
|
513
601
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
514
602
|
def enable_status_led
|
|
515
|
-
send_request
|
|
603
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
|
|
516
604
|
end
|
|
517
605
|
|
|
518
606
|
# Disables the status LED.
|
|
@@ -524,14 +612,14 @@ module Tinkerforge
|
|
|
524
612
|
#
|
|
525
613
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
526
614
|
def disable_status_led
|
|
527
|
-
send_request
|
|
615
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
|
|
528
616
|
end
|
|
529
617
|
|
|
530
618
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
|
531
619
|
#
|
|
532
620
|
# .. versionadded:: 2.3.1$nbsp;(Firmware)
|
|
533
621
|
def is_status_led_enabled
|
|
534
|
-
send_request
|
|
622
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
|
|
535
623
|
end
|
|
536
624
|
|
|
537
625
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
|
@@ -540,7 +628,7 @@ module Tinkerforge
|
|
|
540
628
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
|
541
629
|
# plugins.
|
|
542
630
|
def get_protocol1_bricklet_name(port)
|
|
543
|
-
send_request
|
|
631
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
|
|
544
632
|
end
|
|
545
633
|
|
|
546
634
|
# Returns the temperature in °C/10 as measured inside the microcontroller. The
|
|
@@ -550,7 +638,7 @@ module Tinkerforge
|
|
|
550
638
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
|
551
639
|
# temperature changes.
|
|
552
640
|
def get_chip_temperature
|
|
553
|
-
send_request
|
|
641
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
554
642
|
end
|
|
555
643
|
|
|
556
644
|
# Calling this function will reset the Brick. Calling this function
|
|
@@ -560,7 +648,7 @@ module Tinkerforge
|
|
|
560
648
|
# calling functions on the existing ones will result in
|
|
561
649
|
# undefined behavior!
|
|
562
650
|
def reset
|
|
563
|
-
send_request
|
|
651
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
564
652
|
end
|
|
565
653
|
|
|
566
654
|
# Returns the UID, the UID where the Brick is connected to,
|
|
@@ -572,7 +660,7 @@ module Tinkerforge
|
|
|
572
660
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
573
661
|
# |device_identifier_constant|
|
|
574
662
|
def get_identity
|
|
575
|
-
send_request
|
|
663
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
576
664
|
end
|
|
577
665
|
|
|
578
666
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
@@ -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 #
|
|
@@ -91,12 +91,11 @@ module Tinkerforge
|
|
|
91
91
|
@response_expected[FUNCTION_LED_ON] = RESPONSE_EXPECTED_FALSE
|
|
92
92
|
@response_expected[FUNCTION_LED_OFF] = RESPONSE_EXPECTED_FALSE
|
|
93
93
|
@response_expected[FUNCTION_IS_LED_ON] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
94
|
-
@response_expected[CALLBACK_ACCELERATION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
95
|
-
@response_expected[CALLBACK_ACCELERATION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
96
94
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
97
95
|
|
|
98
96
|
@callback_formats[CALLBACK_ACCELERATION] = 's s s'
|
|
99
97
|
@callback_formats[CALLBACK_ACCELERATION_REACHED] = 's s s'
|
|
98
|
+
|
|
100
99
|
end
|
|
101
100
|
|
|
102
101
|
# Returns the acceleration in x, y and z direction. The values
|
|
@@ -106,7 +105,7 @@ module Tinkerforge
|
|
|
106
105
|
# to use the CALLBACK_ACCELERATION callback and set the period with
|
|
107
106
|
# BrickletAccelerometer#set_acceleration_callback_period.
|
|
108
107
|
def get_acceleration
|
|
109
|
-
send_request
|
|
108
|
+
send_request FUNCTION_GET_ACCELERATION, [], '', 6, 's s s'
|
|
110
109
|
end
|
|
111
110
|
|
|
112
111
|
# Sets the period in ms with which the CALLBACK_ACCELERATION callback is triggered
|
|
@@ -117,12 +116,12 @@ module Tinkerforge
|
|
|
117
116
|
#
|
|
118
117
|
# The default value is 0.
|
|
119
118
|
def set_acceleration_callback_period(period)
|
|
120
|
-
send_request
|
|
119
|
+
send_request FUNCTION_SET_ACCELERATION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
121
120
|
end
|
|
122
121
|
|
|
123
122
|
# Returns the period as set by BrickletAccelerometer#set_acceleration_callback_period.
|
|
124
123
|
def get_acceleration_callback_period
|
|
125
|
-
send_request
|
|
124
|
+
send_request FUNCTION_GET_ACCELERATION_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
126
125
|
end
|
|
127
126
|
|
|
128
127
|
# Sets the thresholds for the CALLBACK_ACCELERATION_REACHED callback.
|
|
@@ -139,12 +138,12 @@ module Tinkerforge
|
|
|
139
138
|
#
|
|
140
139
|
# The default value is ('x', 0, 0, 0, 0, 0, 0).
|
|
141
140
|
def set_acceleration_callback_threshold(option, min_x, max_x, min_y, max_y, min_z, max_z)
|
|
142
|
-
send_request
|
|
141
|
+
send_request FUNCTION_SET_ACCELERATION_CALLBACK_THRESHOLD, [option, min_x, max_x, min_y, max_y, min_z, max_z], 'k s s s s s s', 0, ''
|
|
143
142
|
end
|
|
144
143
|
|
|
145
144
|
# Returns the threshold as set by BrickletAccelerometer#set_acceleration_callback_threshold.
|
|
146
145
|
def get_acceleration_callback_threshold
|
|
147
|
-
send_request
|
|
146
|
+
send_request FUNCTION_GET_ACCELERATION_CALLBACK_THRESHOLD, [], '', 13, 'k s s s s s s'
|
|
148
147
|
end
|
|
149
148
|
|
|
150
149
|
# Sets the period in ms with which the threshold callback
|
|
@@ -159,17 +158,17 @@ module Tinkerforge
|
|
|
159
158
|
#
|
|
160
159
|
# The default value is 100.
|
|
161
160
|
def set_debounce_period(debounce)
|
|
162
|
-
send_request
|
|
161
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
|
163
162
|
end
|
|
164
163
|
|
|
165
164
|
# Returns the debounce period as set by BrickletAccelerometer#set_debounce_period.
|
|
166
165
|
def get_debounce_period
|
|
167
|
-
send_request
|
|
166
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
|
168
167
|
end
|
|
169
168
|
|
|
170
169
|
# Returns the temperature of the accelerometer in °C.
|
|
171
170
|
def get_temperature
|
|
172
|
-
send_request
|
|
171
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
|
|
173
172
|
end
|
|
174
173
|
|
|
175
174
|
# Configures the data rate, full scale range and filter bandwidth.
|
|
@@ -185,27 +184,27 @@ module Tinkerforge
|
|
|
185
184
|
# The default values are 100Hz data rate, -4G to +4G range and 200Hz
|
|
186
185
|
# filter bandwidth.
|
|
187
186
|
def set_configuration(data_rate, full_scale, filter_bandwidth)
|
|
188
|
-
send_request
|
|
187
|
+
send_request FUNCTION_SET_CONFIGURATION, [data_rate, full_scale, filter_bandwidth], 'C C C', 0, ''
|
|
189
188
|
end
|
|
190
189
|
|
|
191
190
|
# Returns the configuration as set by BrickletAccelerometer#set_configuration.
|
|
192
191
|
def get_configuration
|
|
193
|
-
send_request
|
|
192
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
|
|
194
193
|
end
|
|
195
194
|
|
|
196
195
|
# Enables the LED on the Bricklet.
|
|
197
196
|
def led_on
|
|
198
|
-
send_request
|
|
197
|
+
send_request FUNCTION_LED_ON, [], '', 0, ''
|
|
199
198
|
end
|
|
200
199
|
|
|
201
200
|
# Disables the LED on the Bricklet.
|
|
202
201
|
def led_off
|
|
203
|
-
send_request
|
|
202
|
+
send_request FUNCTION_LED_OFF, [], '', 0, ''
|
|
204
203
|
end
|
|
205
204
|
|
|
206
205
|
# Returns *true* if the LED is enabled, *false* otherwise.
|
|
207
206
|
def is_led_on
|
|
208
|
-
send_request
|
|
207
|
+
send_request FUNCTION_IS_LED_ON, [], '', 1, '?'
|
|
209
208
|
end
|
|
210
209
|
|
|
211
210
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -217,7 +216,7 @@ module Tinkerforge
|
|
|
217
216
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
218
217
|
# |device_identifier_constant|
|
|
219
218
|
def get_identity
|
|
220
|
-
send_request
|
|
219
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
221
220
|
end
|
|
222
221
|
|
|
223
222
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|