tinkerforge 2.1.13 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
@@ -60,7 +60,6 @@ module Tinkerforge
|
|
60
60
|
FUNCTION_STOP = 18 # :nodoc:
|
61
61
|
FUNCTION_GET_STACK_INPUT_VOLTAGE = 19 # :nodoc:
|
62
62
|
FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE = 20 # :nodoc:
|
63
|
-
FUNCTION_GET_CURRENT_CONSUMPTION = 21 # :nodoc:
|
64
63
|
FUNCTION_SET_MOTOR_CURRENT = 22 # :nodoc:
|
65
64
|
FUNCTION_GET_MOTOR_CURRENT = 23 # :nodoc:
|
66
65
|
FUNCTION_ENABLE = 24 # :nodoc:
|
@@ -84,7 +83,12 @@ module Tinkerforge
|
|
84
83
|
FUNCTION_GET_ALL_DATA = 44 # :nodoc:
|
85
84
|
FUNCTION_SET_ALL_DATA_PERIOD = 45 # :nodoc:
|
86
85
|
FUNCTION_GET_ALL_DATA_PERIOD = 46 # :nodoc:
|
86
|
+
FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
|
87
|
+
FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
|
87
88
|
FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
|
89
|
+
FUNCTION_SET_SPITFP_BAUDRATE = 234 # :nodoc:
|
90
|
+
FUNCTION_GET_SPITFP_BAUDRATE = 235 # :nodoc:
|
91
|
+
FUNCTION_GET_SPITFP_ERROR_COUNT = 237 # :nodoc:
|
88
92
|
FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
|
89
93
|
FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
|
90
94
|
FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
|
@@ -173,7 +177,6 @@ module Tinkerforge
|
|
173
177
|
@response_expected[FUNCTION_STOP] = RESPONSE_EXPECTED_FALSE
|
174
178
|
@response_expected[FUNCTION_GET_STACK_INPUT_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
175
179
|
@response_expected[FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
176
|
-
@response_expected[FUNCTION_GET_CURRENT_CONSUMPTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
177
180
|
@response_expected[FUNCTION_SET_MOTOR_CURRENT] = RESPONSE_EXPECTED_FALSE
|
178
181
|
@response_expected[FUNCTION_GET_MOTOR_CURRENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
179
182
|
@response_expected[FUNCTION_ENABLE] = RESPONSE_EXPECTED_FALSE
|
@@ -192,16 +195,17 @@ module Tinkerforge
|
|
192
195
|
@response_expected[FUNCTION_GET_DRIVER_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
193
196
|
@response_expected[FUNCTION_SET_MINIMUM_VOLTAGE] = RESPONSE_EXPECTED_TRUE
|
194
197
|
@response_expected[FUNCTION_GET_MINIMUM_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
195
|
-
@response_expected[CALLBACK_UNDER_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
196
|
-
@response_expected[CALLBACK_POSITION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
197
198
|
@response_expected[FUNCTION_SET_TIME_BASE] = RESPONSE_EXPECTED_FALSE
|
198
199
|
@response_expected[FUNCTION_GET_TIME_BASE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
199
200
|
@response_expected[FUNCTION_GET_ALL_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
200
201
|
@response_expected[FUNCTION_SET_ALL_DATA_PERIOD] = RESPONSE_EXPECTED_TRUE
|
201
202
|
@response_expected[FUNCTION_GET_ALL_DATA_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
202
|
-
@response_expected[
|
203
|
-
@response_expected[
|
203
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
|
204
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
204
205
|
@response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
206
|
+
@response_expected[FUNCTION_SET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_FALSE
|
207
|
+
@response_expected[FUNCTION_GET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
208
|
+
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
205
209
|
@response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
206
210
|
@response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
|
207
211
|
@response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -214,6 +218,7 @@ module Tinkerforge
|
|
214
218
|
@callback_formats[CALLBACK_POSITION_REACHED] = 'l'
|
215
219
|
@callback_formats[CALLBACK_ALL_DATA] = 'S l l S S S'
|
216
220
|
@callback_formats[CALLBACK_NEW_STATE] = 'C C'
|
221
|
+
|
217
222
|
end
|
218
223
|
|
219
224
|
# Sets the maximum velocity of the stepper motor in steps per second.
|
@@ -222,17 +227,17 @@ module Tinkerforge
|
|
222
227
|
# either BrickSilentStepper#set_target_position, BrickSilentStepper#set_steps, BrickSilentStepper#drive_forward or
|
223
228
|
# BrickSilentStepper#drive_backward.
|
224
229
|
def set_max_velocity(velocity)
|
225
|
-
send_request
|
230
|
+
send_request FUNCTION_SET_MAX_VELOCITY, [velocity], 'S', 0, ''
|
226
231
|
end
|
227
232
|
|
228
233
|
# Returns the velocity as set by BrickSilentStepper#set_max_velocity.
|
229
234
|
def get_max_velocity
|
230
|
-
send_request
|
235
|
+
send_request FUNCTION_GET_MAX_VELOCITY, [], '', 2, 'S'
|
231
236
|
end
|
232
237
|
|
233
238
|
# Returns the *current* velocity of the stepper motor in steps per second.
|
234
239
|
def get_current_velocity
|
235
|
-
send_request
|
240
|
+
send_request FUNCTION_GET_CURRENT_VELOCITY, [], '', 2, 'S'
|
236
241
|
end
|
237
242
|
|
238
243
|
# Sets the acceleration and deacceleration of the stepper motor. The values
|
@@ -248,13 +253,13 @@ module Tinkerforge
|
|
248
253
|
#
|
249
254
|
# The default value is 1000 for both
|
250
255
|
def set_speed_ramping(acceleration, deacceleration)
|
251
|
-
send_request
|
256
|
+
send_request FUNCTION_SET_SPEED_RAMPING, [acceleration, deacceleration], 'S S', 0, ''
|
252
257
|
end
|
253
258
|
|
254
259
|
# Returns the acceleration and deacceleration as set by
|
255
260
|
# BrickSilentStepper#set_speed_ramping.
|
256
261
|
def get_speed_ramping
|
257
|
-
send_request
|
262
|
+
send_request FUNCTION_GET_SPEED_RAMPING, [], '', 4, 'S S'
|
258
263
|
end
|
259
264
|
|
260
265
|
# Executes an active full brake.
|
@@ -266,14 +271,14 @@ module Tinkerforge
|
|
266
271
|
#
|
267
272
|
# Call BrickSilentStepper#stop if you just want to stop the motor.
|
268
273
|
def full_brake
|
269
|
-
send_request
|
274
|
+
send_request FUNCTION_FULL_BRAKE, [], '', 0, ''
|
270
275
|
end
|
271
276
|
|
272
277
|
# Sets the current steps of the internal step counter. This can be used to
|
273
278
|
# set the current position to 0 when some kind of starting position
|
274
279
|
# is reached (e.g. when a CNC machine reaches a corner).
|
275
280
|
def set_current_position(position)
|
276
|
-
send_request
|
281
|
+
send_request FUNCTION_SET_CURRENT_POSITION, [position], 'l', 0, ''
|
277
282
|
end
|
278
283
|
|
279
284
|
# Returns the current position of the stepper motor in steps. On startup
|
@@ -282,7 +287,7 @@ module Tinkerforge
|
|
282
287
|
# BrickSilentStepper#drive_backward). It also is possible to reset the steps to 0 or
|
283
288
|
# set them to any other desired value with BrickSilentStepper#set_current_position.
|
284
289
|
def get_current_position
|
285
|
-
send_request
|
290
|
+
send_request FUNCTION_GET_CURRENT_POSITION, [], '', 4, 'l'
|
286
291
|
end
|
287
292
|
|
288
293
|
# Sets the target position of the stepper motor in steps. For example,
|
@@ -295,12 +300,12 @@ module Tinkerforge
|
|
295
300
|
# a call of BrickSilentStepper#set_steps with the parameter
|
296
301
|
# (*x* - BrickSilentStepper#get_current_position).
|
297
302
|
def set_target_position(position)
|
298
|
-
send_request
|
303
|
+
send_request FUNCTION_SET_TARGET_POSITION, [position], 'l', 0, ''
|
299
304
|
end
|
300
305
|
|
301
306
|
# Returns the last target position as set by BrickSilentStepper#set_target_position.
|
302
307
|
def get_target_position
|
303
|
-
send_request
|
308
|
+
send_request FUNCTION_GET_TARGET_POSITION, [], '', 4, 'l'
|
304
309
|
end
|
305
310
|
|
306
311
|
# Sets the number of steps the stepper motor should run. Positive values
|
@@ -308,12 +313,12 @@ module Tinkerforge
|
|
308
313
|
# The velocity, acceleration and deacceleration as set by
|
309
314
|
# BrickSilentStepper#set_max_velocity and BrickSilentStepper#set_speed_ramping will be used.
|
310
315
|
def set_steps(steps)
|
311
|
-
send_request
|
316
|
+
send_request FUNCTION_SET_STEPS, [steps], 'l', 0, ''
|
312
317
|
end
|
313
318
|
|
314
319
|
# Returns the last steps as set by BrickSilentStepper#set_steps.
|
315
320
|
def get_steps
|
316
|
-
send_request
|
321
|
+
send_request FUNCTION_GET_STEPS, [], '', 4, 'l'
|
317
322
|
end
|
318
323
|
|
319
324
|
# Returns the remaining steps of the last call of BrickSilentStepper#set_steps.
|
@@ -321,7 +326,7 @@ module Tinkerforge
|
|
321
326
|
# BrickSilentStepper#get_remaining_steps is called after the motor has run for 500 steps,
|
322
327
|
# it will return 1500.
|
323
328
|
def get_remaining_steps
|
324
|
-
send_request
|
329
|
+
send_request FUNCTION_GET_REMAINING_STEPS, [], '', 4, 'l'
|
325
330
|
end
|
326
331
|
|
327
332
|
# Sets the step resolution from full-step up to 1/256-step.
|
@@ -338,39 +343,39 @@ module Tinkerforge
|
|
338
343
|
#
|
339
344
|
# The default is 1/256-step with interpolation on.
|
340
345
|
def set_step_configuration(step_resolution, interpolation)
|
341
|
-
send_request
|
346
|
+
send_request FUNCTION_SET_STEP_CONFIGURATION, [step_resolution, interpolation], 'C ?', 0, ''
|
342
347
|
end
|
343
348
|
|
344
349
|
# Returns the step mode as set by BrickSilentStepper#set_step_configuration.
|
345
350
|
def get_step_configuration
|
346
|
-
send_request
|
351
|
+
send_request FUNCTION_GET_STEP_CONFIGURATION, [], '', 2, 'C ?'
|
347
352
|
end
|
348
353
|
|
349
354
|
# Drives the stepper motor forward until BrickSilentStepper#drive_backward or
|
350
355
|
# BrickSilentStepper#stop is called. The velocity, acceleration and deacceleration as
|
351
356
|
# set by BrickSilentStepper#set_max_velocity and BrickSilentStepper#set_speed_ramping will be used.
|
352
357
|
def drive_forward
|
353
|
-
send_request
|
358
|
+
send_request FUNCTION_DRIVE_FORWARD, [], '', 0, ''
|
354
359
|
end
|
355
360
|
|
356
361
|
# Drives the stepper motor backward until BrickSilentStepper#drive_forward or
|
357
362
|
# BrickSilentStepper#stop is triggered. The velocity, acceleration and deacceleration as
|
358
363
|
# set by BrickSilentStepper#set_max_velocity and BrickSilentStepper#set_speed_ramping will be used.
|
359
364
|
def drive_backward
|
360
|
-
send_request
|
365
|
+
send_request FUNCTION_DRIVE_BACKWARD, [], '', 0, ''
|
361
366
|
end
|
362
367
|
|
363
368
|
# Stops the stepper motor with the deacceleration as set by
|
364
369
|
# BrickSilentStepper#set_speed_ramping.
|
365
370
|
def stop
|
366
|
-
send_request
|
371
|
+
send_request FUNCTION_STOP, [], '', 0, ''
|
367
372
|
end
|
368
373
|
|
369
374
|
# Returns the stack input voltage in mV. The stack input voltage is the
|
370
375
|
# voltage that is supplied via the stack, i.e. it is given by a
|
371
376
|
# Step-Down or Step-Up Power Supply.
|
372
377
|
def get_stack_input_voltage
|
373
|
-
send_request
|
378
|
+
send_request FUNCTION_GET_STACK_INPUT_VOLTAGE, [], '', 2, 'S'
|
374
379
|
end
|
375
380
|
|
376
381
|
# Returns the external input voltage in mV. The external input voltage is
|
@@ -386,12 +391,7 @@ module Tinkerforge
|
|
386
391
|
# the external connection, it will immediately be driven by the high
|
387
392
|
# stack voltage
|
388
393
|
def get_external_input_voltage
|
389
|
-
send_request
|
390
|
-
end
|
391
|
-
|
392
|
-
# Returns the current consumption of the motor in mA.
|
393
|
-
def get_current_consumption
|
394
|
-
send_request(FUNCTION_GET_CURRENT_CONSUMPTION, [], '', 2, 'S')
|
394
|
+
send_request FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE, [], '', 2, 'S'
|
395
395
|
end
|
396
396
|
|
397
397
|
# Sets the current in mA with which the motor will be driven.
|
@@ -402,29 +402,29 @@ module Tinkerforge
|
|
402
402
|
# Do not set this value above the specifications of your stepper motor.
|
403
403
|
# Otherwise it may damage your motor.
|
404
404
|
def set_motor_current(current)
|
405
|
-
send_request
|
405
|
+
send_request FUNCTION_SET_MOTOR_CURRENT, [current], 'S', 0, ''
|
406
406
|
end
|
407
407
|
|
408
408
|
# Returns the current as set by BrickSilentStepper#set_motor_current.
|
409
409
|
def get_motor_current
|
410
|
-
send_request
|
410
|
+
send_request FUNCTION_GET_MOTOR_CURRENT, [], '', 2, 'S'
|
411
411
|
end
|
412
412
|
|
413
413
|
# Enables the driver chip. The driver parameters can be configured (maximum velocity,
|
414
414
|
# acceleration, etc) before it is enabled.
|
415
415
|
def enable
|
416
|
-
send_request
|
416
|
+
send_request FUNCTION_ENABLE, [], '', 0, ''
|
417
417
|
end
|
418
418
|
|
419
419
|
# Disables the driver chip. The configurations are kept (maximum velocity,
|
420
420
|
# acceleration, etc) but the motor is not driven until it is enabled again.
|
421
421
|
def disable
|
422
|
-
send_request
|
422
|
+
send_request FUNCTION_DISABLE, [], '', 0, ''
|
423
423
|
end
|
424
424
|
|
425
425
|
# Returns *true* if the driver chip is enabled, *false* otherwise.
|
426
426
|
def is_enabled
|
427
|
-
send_request
|
427
|
+
send_request FUNCTION_IS_ENABLED, [], '', 1, '?'
|
428
428
|
end
|
429
429
|
|
430
430
|
# Sets the basic configuration parameters for the different modes (Stealth, Coolstep, Classic).
|
@@ -480,12 +480,12 @@ module Tinkerforge
|
|
480
480
|
# * Classic Threshold: 1000
|
481
481
|
# * High Velocity Shopper Mode: false
|
482
482
|
def set_basic_configuration(standstill_current, motor_run_current, standstill_delay_time, power_down_time, stealth_threshold, coolstep_threshold, classic_threshold, high_velocity_chopper_mode)
|
483
|
-
send_request
|
483
|
+
send_request FUNCTION_SET_BASIC_CONFIGURATION, [standstill_current, motor_run_current, standstill_delay_time, power_down_time, stealth_threshold, coolstep_threshold, classic_threshold, high_velocity_chopper_mode], 'S S S S S S S ?', 0, ''
|
484
484
|
end
|
485
485
|
|
486
486
|
# Returns the configuration as set by BrickSilentStepper#set_basic_configuration.
|
487
487
|
def get_basic_configuration
|
488
|
-
send_request
|
488
|
+
send_request FUNCTION_GET_BASIC_CONFIGURATION, [], '', 15, 'S S S S S S S ?'
|
489
489
|
end
|
490
490
|
|
491
491
|
# Note: If you don't know what any of this means you can very likely keep all of
|
@@ -540,12 +540,12 @@ module Tinkerforge
|
|
540
540
|
# * Comparator Blank Time: 1
|
541
541
|
# * Fast Decay Without Comparator: false
|
542
542
|
def set_spreadcycle_configuration(slow_decay_duration, enable_random_slow_decay, fast_decay_duration, hysteresis_start_value, hysteresis_end_value, sine_wave_offset, chopper_mode, comparator_blank_time, fast_decay_without_comparator)
|
543
|
-
send_request
|
543
|
+
send_request FUNCTION_SET_SPREADCYCLE_CONFIGURATION, [slow_decay_duration, enable_random_slow_decay, fast_decay_duration, hysteresis_start_value, hysteresis_end_value, sine_wave_offset, chopper_mode, comparator_blank_time, fast_decay_without_comparator], 'C ? C C c c C C ?', 0, ''
|
544
544
|
end
|
545
545
|
|
546
546
|
# Returns the configuration as set by BrickSilentStepper#set_basic_configuration.
|
547
547
|
def get_spreadcycle_configuration
|
548
|
-
send_request
|
548
|
+
send_request FUNCTION_GET_SPREADCYCLE_CONFIGURATION, [], '', 9, 'C ? C C c c C C ?'
|
549
549
|
end
|
550
550
|
|
551
551
|
# Note: If you don't know what any of this means you can very likely keep all of
|
@@ -581,12 +581,12 @@ module Tinkerforge
|
|
581
581
|
# * Force Symmetric: false
|
582
582
|
# * Freewheel Mode: 0 (Normal)
|
583
583
|
def set_stealth_configuration(enable_stealth, amplitude, gradient, enable_autoscale, force_symmetric, freewheel_mode)
|
584
|
-
send_request
|
584
|
+
send_request FUNCTION_SET_STEALTH_CONFIGURATION, [enable_stealth, amplitude, gradient, enable_autoscale, force_symmetric, freewheel_mode], '? C C ? ? C', 0, ''
|
585
585
|
end
|
586
586
|
|
587
587
|
# Returns the configuration as set by BrickSilentStepper#set_stealth_configuration.
|
588
588
|
def get_stealth_configuration
|
589
|
-
send_request
|
589
|
+
send_request FUNCTION_GET_STEALTH_CONFIGURATION, [], '', 6, '? C C ? ? C'
|
590
590
|
end
|
591
591
|
|
592
592
|
# Note: If you don't know what any of this means you can very likely keep all of
|
@@ -627,12 +627,12 @@ module Tinkerforge
|
|
627
627
|
# * Stallguard Threshold Value: 0
|
628
628
|
# * Stallguard Mode: 0
|
629
629
|
def set_coolstep_configuration(minimum_stallguard_value, maximum_stallguard_value, current_up_step_width, current_down_step_width, minimum_current, stallguard_threshold_value, stallguard_mode)
|
630
|
-
send_request
|
630
|
+
send_request FUNCTION_SET_COOLSTEP_CONFIGURATION, [minimum_stallguard_value, maximum_stallguard_value, current_up_step_width, current_down_step_width, minimum_current, stallguard_threshold_value, stallguard_mode], 'C C C C C c C', 0, ''
|
631
631
|
end
|
632
632
|
|
633
633
|
# Returns the configuration as set by BrickSilentStepper#set_coolstep_configuration.
|
634
634
|
def get_coolstep_configuration
|
635
|
-
send_request
|
635
|
+
send_request FUNCTION_GET_COOLSTEP_CONFIGURATION, [], '', 7, 'C C C C C c C'
|
636
636
|
end
|
637
637
|
|
638
638
|
# Note: If you don't know what any of this means you can very likely keep all of
|
@@ -654,12 +654,12 @@ module Tinkerforge
|
|
654
654
|
# * Disable Short To Ground Protection: 0
|
655
655
|
# * Synchronize Phase Frequency: 0
|
656
656
|
def set_misc_configuration(disable_short_to_ground_protection, synchronize_phase_frequency)
|
657
|
-
send_request
|
657
|
+
send_request FUNCTION_SET_MISC_CONFIGURATION, [disable_short_to_ground_protection, synchronize_phase_frequency], '? C', 0, ''
|
658
658
|
end
|
659
659
|
|
660
660
|
# Returns the configuration as set by BrickSilentStepper#set_misc_configuration.
|
661
661
|
def get_misc_configuration
|
662
|
-
send_request
|
662
|
+
send_request FUNCTION_GET_MISC_CONFIGURATION, [], '', 2, '? C'
|
663
663
|
end
|
664
664
|
|
665
665
|
# Returns the current driver status.
|
@@ -676,7 +676,10 @@ module Tinkerforge
|
|
676
676
|
#
|
677
677
|
# * Motor Stalled: Is true if a motor stall was detected.
|
678
678
|
#
|
679
|
-
# * Actual Motor Current: Indicates the actual current control scaling as used in Coolstep mode.
|
679
|
+
# * Actual Motor Current: Indicates the actual current control scaling as used in Coolstep mode.
|
680
|
+
# The returned value is between 0 and 31. It represents a multiplier of 1/32 to 32/32 of the
|
681
|
+
# ``Motor Run Current`` as set by BrickSilentStepper#set_basic_configuration. Example: If a ``Motor Run Current``
|
682
|
+
# of 1000mA was set and the returned value is 15, the ``Actual Motor Current`` is 16/32*1000mA = 500mA.
|
680
683
|
#
|
681
684
|
# * Stallguard Result: Indicates the load of the motor. A lower value signals a higher load. Per trial and error
|
682
685
|
# you can find out which value corresponds to a suitable torque for the velocity used in your application.
|
@@ -687,7 +690,7 @@ module Tinkerforge
|
|
687
690
|
# * Stealth Voltage Amplitude: Shows the actual PWM scaling. In Stealth mode it can be used to detect motor load and
|
688
691
|
# stall if autoscale is enabled (see BrickSilentStepper#set_stealth_configuration).
|
689
692
|
def get_driver_status
|
690
|
-
send_request
|
693
|
+
send_request FUNCTION_GET_DRIVER_STATUS, [], '', 8, 'C C C ? C ? C C'
|
691
694
|
end
|
692
695
|
|
693
696
|
# Sets the minimum voltage in mV, below which the CALLBACK_UNDER_VOLTAGE callback
|
@@ -699,12 +702,12 @@ module Tinkerforge
|
|
699
702
|
#
|
700
703
|
# The default value is 8V.
|
701
704
|
def set_minimum_voltage(voltage)
|
702
|
-
send_request
|
705
|
+
send_request FUNCTION_SET_MINIMUM_VOLTAGE, [voltage], 'S', 0, ''
|
703
706
|
end
|
704
707
|
|
705
708
|
# Returns the minimum voltage as set by BrickSilentStepper#set_minimum_voltage.
|
706
709
|
def get_minimum_voltage
|
707
|
-
send_request
|
710
|
+
send_request FUNCTION_GET_MINIMUM_VOLTAGE, [], '', 2, 'S'
|
708
711
|
end
|
709
712
|
|
710
713
|
# Sets the time base of the velocity and the acceleration of the Silent Stepper
|
@@ -716,32 +719,75 @@ module Tinkerforge
|
|
716
719
|
#
|
717
720
|
# The default value is 1.
|
718
721
|
def set_time_base(time_base)
|
719
|
-
send_request
|
722
|
+
send_request FUNCTION_SET_TIME_BASE, [time_base], 'L', 0, ''
|
720
723
|
end
|
721
724
|
|
722
725
|
# Returns the time base as set by BrickSilentStepper#set_time_base.
|
723
726
|
def get_time_base
|
724
|
-
send_request
|
727
|
+
send_request FUNCTION_GET_TIME_BASE, [], '', 4, 'L'
|
725
728
|
end
|
726
729
|
|
727
730
|
# Returns the following parameters: The current velocity,
|
728
731
|
# the current position, the remaining steps, the stack voltage, the external
|
729
732
|
# voltage and the current consumption of the stepper motor.
|
730
733
|
#
|
734
|
+
# The current consumption is calculated by multiplying the ``Actual Motor Current``
|
735
|
+
# value (see BrickSilentStepper#set_basic_configuration) with the ``Motor Run Current``
|
736
|
+
# (see BrickSilentStepper#get_driver_status). This is an internal calculation of the
|
737
|
+
# driver, not an independent external measurement.
|
738
|
+
#
|
739
|
+
# The current consumption calculation was broken up to firmware 2.0.1, it is fixed
|
740
|
+
# since firmware 2.0.2.
|
741
|
+
#
|
731
742
|
# There is also a callback for this function, see CALLBACK_ALL_DATA callback.
|
732
743
|
def get_all_data
|
733
|
-
send_request
|
744
|
+
send_request FUNCTION_GET_ALL_DATA, [], '', 16, 'S l l S S S'
|
734
745
|
end
|
735
746
|
|
736
747
|
# Sets the period in ms with which the CALLBACK_ALL_DATA callback is triggered
|
737
748
|
# periodically. A value of 0 turns the callback off.
|
738
749
|
def set_all_data_period(period)
|
739
|
-
send_request
|
750
|
+
send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 0, ''
|
740
751
|
end
|
741
752
|
|
742
753
|
# Returns the period as set by BrickSilentStepper#set_all_data_period.
|
743
754
|
def get_all_data_period
|
744
|
-
send_request
|
755
|
+
send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 4, 'L'
|
756
|
+
end
|
757
|
+
|
758
|
+
# The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
|
759
|
+
# enabled, the Brick will try to adapt the baudrate for the communication
|
760
|
+
# between Bricks and Bricklets according to the amount of data that is transferred.
|
761
|
+
#
|
762
|
+
# The baudrate will be increased exponetially if lots of data is send/receieved and
|
763
|
+
# decreased linearly if little data is send/received.
|
764
|
+
#
|
765
|
+
# This lowers the baudrate in applications where little data is transferred (e.g.
|
766
|
+
# a weather station) and increases the robustness. If there is lots of data to transfer
|
767
|
+
# (e.g. Thermal Imaging Bricklet) it automatically increases the baudrate as needed.
|
768
|
+
#
|
769
|
+
# In cases where some data has to transferred as fast as possible every few seconds
|
770
|
+
# (e.g. RS485 Bricklet with a high baudrate but small payload) you may want to turn
|
771
|
+
# the dynamic baudrate off to get the highest possible performance.
|
772
|
+
#
|
773
|
+
# The maximum value of the baudrate can be set per port with the function
|
774
|
+
# BrickSilentStepper#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
|
775
|
+
# as set by BrickSilentStepper#set_spitfp_baudrate will be used statically.
|
776
|
+
#
|
777
|
+
# The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
|
778
|
+
#
|
779
|
+
# By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
|
780
|
+
#
|
781
|
+
# .. versionadded:: 2.0.4$nbsp;(Firmware)
|
782
|
+
def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
|
783
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
|
784
|
+
end
|
785
|
+
|
786
|
+
# Returns the baudrate config, see BrickSilentStepper#set_spitfp_baudrate_config.
|
787
|
+
#
|
788
|
+
# .. versionadded:: 2.0.4$nbsp;(Firmware)
|
789
|
+
def get_spitfp_baudrate_config
|
790
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
|
745
791
|
end
|
746
792
|
|
747
793
|
# Returns the timeout count for the different communication methods.
|
@@ -751,7 +797,47 @@ module Tinkerforge
|
|
751
797
|
# This function is mostly used for debugging during development, in normal operation
|
752
798
|
# the counters should nearly always stay at 0.
|
753
799
|
def get_send_timeout_count(communication_method)
|
754
|
-
send_request
|
800
|
+
send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
|
801
|
+
end
|
802
|
+
|
803
|
+
# Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
|
804
|
+
# baudrate can be in the range 400000 to 2000000.
|
805
|
+
#
|
806
|
+
# If you want to increase the throughput of Bricklets you can increase
|
807
|
+
# the baudrate. If you get a high error count because of high
|
808
|
+
# interference (see BrickSilentStepper#get_spitfp_error_count) you can decrease the
|
809
|
+
# baudrate.
|
810
|
+
#
|
811
|
+
# If the dynamic baudrate feature is enabled, the baudrate set by this
|
812
|
+
# function corresponds to the maximum baudrate (see BrickSilentStepper#set_spitfp_baudrate_config).
|
813
|
+
#
|
814
|
+
# Regulatory testing is done with the default baudrate. If CE compatability
|
815
|
+
# or similar is necessary in you applications we recommend to not change
|
816
|
+
# the baudrate.
|
817
|
+
#
|
818
|
+
# The default baudrate for all ports is 1400000.
|
819
|
+
def set_spitfp_baudrate(bricklet_port, baudrate)
|
820
|
+
send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
|
821
|
+
end
|
822
|
+
|
823
|
+
# Returns the baudrate for a given Bricklet port, see BrickSilentStepper#set_spitfp_baudrate.
|
824
|
+
def get_spitfp_baudrate(bricklet_port)
|
825
|
+
send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
|
826
|
+
end
|
827
|
+
|
828
|
+
# Returns the error count for the communication between Brick and Bricklet.
|
829
|
+
#
|
830
|
+
# The errors are divided into
|
831
|
+
#
|
832
|
+
# * ACK checksum errors,
|
833
|
+
# * message checksum errors,
|
834
|
+
# * frameing errors and
|
835
|
+
# * overflow errors.
|
836
|
+
#
|
837
|
+
# The errors counts are for errors that occur on the Brick side. All
|
838
|
+
# Bricklets have a similar function that returns the errors on the Bricklet side.
|
839
|
+
def get_spitfp_error_count(bricklet_port)
|
840
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
|
755
841
|
end
|
756
842
|
|
757
843
|
# Enables the status LED.
|
@@ -761,7 +847,7 @@ module Tinkerforge
|
|
761
847
|
#
|
762
848
|
# The default state is enabled.
|
763
849
|
def enable_status_led
|
764
|
-
send_request
|
850
|
+
send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
|
765
851
|
end
|
766
852
|
|
767
853
|
# Disables the status LED.
|
@@ -771,12 +857,12 @@ module Tinkerforge
|
|
771
857
|
#
|
772
858
|
# The default state is enabled.
|
773
859
|
def disable_status_led
|
774
|
-
send_request
|
860
|
+
send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
|
775
861
|
end
|
776
862
|
|
777
863
|
# Returns *true* if the status LED is enabled, *false* otherwise.
|
778
864
|
def is_status_led_enabled
|
779
|
-
send_request
|
865
|
+
send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
|
780
866
|
end
|
781
867
|
|
782
868
|
# Returns the firmware and protocol version and the name of the Bricklet for a
|
@@ -785,7 +871,7 @@ module Tinkerforge
|
|
785
871
|
# This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
|
786
872
|
# plugins.
|
787
873
|
def get_protocol1_bricklet_name(port)
|
788
|
-
send_request
|
874
|
+
send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
|
789
875
|
end
|
790
876
|
|
791
877
|
# Returns the temperature in °C/10 as measured inside the microcontroller. The
|
@@ -795,7 +881,7 @@ module Tinkerforge
|
|
795
881
|
# accuracy of +-15%. Practically it is only useful as an indicator for
|
796
882
|
# temperature changes.
|
797
883
|
def get_chip_temperature
|
798
|
-
send_request
|
884
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
799
885
|
end
|
800
886
|
|
801
887
|
# Calling this function will reset the Brick. Calling this function
|
@@ -805,7 +891,7 @@ module Tinkerforge
|
|
805
891
|
# calling functions on the existing ones will result in
|
806
892
|
# undefined behavior!
|
807
893
|
def reset
|
808
|
-
send_request
|
894
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
809
895
|
end
|
810
896
|
|
811
897
|
# Returns the UID, the UID where the Brick is connected to,
|
@@ -817,7 +903,7 @@ module Tinkerforge
|
|
817
903
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
818
904
|
# |device_identifier_constant|
|
819
905
|
def get_identity
|
820
|
-
send_request
|
906
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
821
907
|
end
|
822
908
|
|
823
909
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|