tinkerforge 2.1.13 → 2.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/lib/tinkerforge/brick_dc.rb +122 -34
  2. data/lib/tinkerforge/brick_imu.rb +135 -49
  3. data/lib/tinkerforge/brick_imu_v2.rb +137 -54
  4. data/lib/tinkerforge/brick_master.rb +206 -120
  5. data/lib/tinkerforge/brick_red.rb +64 -69
  6. data/lib/tinkerforge/brick_servo.rb +133 -44
  7. data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
  8. data/lib/tinkerforge/brick_stepper.rb +139 -51
  9. data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
  10. data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
  11. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
  12. data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
  13. data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
  14. data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
  15. data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
  16. data/lib/tinkerforge/bricklet_barometer.rb +21 -24
  17. data/lib/tinkerforge/bricklet_can.rb +14 -14
  18. data/lib/tinkerforge/bricklet_co2.rb +11 -12
  19. data/lib/tinkerforge/bricklet_color.rb +22 -25
  20. data/lib/tinkerforge/bricklet_current12.rb +18 -22
  21. data/lib/tinkerforge/bricklet_current25.rb +18 -22
  22. data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
  23. data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
  24. data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
  25. data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
  26. data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
  27. data/lib/tinkerforge/bricklet_gps.rb +21 -25
  28. data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
  29. data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
  30. data/lib/tinkerforge/bricklet_humidity.rb +16 -19
  31. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
  32. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
  33. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
  34. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
  35. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
  36. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
  37. data/lib/tinkerforge/bricklet_io16.rb +18 -19
  38. data/lib/tinkerforge/bricklet_io4.rb +18 -19
  39. data/lib/tinkerforge/bricklet_joystick.rb +18 -23
  40. data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
  41. data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
  42. data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
  43. data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
  44. data/lib/tinkerforge/bricklet_line.rb +11 -12
  45. data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
  46. data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
  47. data/lib/tinkerforge/bricklet_moisture.rb +13 -14
  48. data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
  49. data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
  50. data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
  51. data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
  52. data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
  53. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
  54. data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
  55. data/lib/tinkerforge/bricklet_ptc.rb +23 -26
  56. data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
  57. data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
  58. data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
  59. data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
  60. data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
  61. data/lib/tinkerforge/bricklet_rs232.rb +12 -13
  62. data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
  63. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
  64. data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
  65. data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
  66. data/lib/tinkerforge/bricklet_temperature.rb +13 -14
  67. data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
  68. data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
  69. data/lib/tinkerforge/bricklet_tilt.rb +8 -8
  70. data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
  71. data/lib/tinkerforge/bricklet_voltage.rb +16 -19
  72. data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
  73. data/lib/tinkerforge/ip_connection.rb +207 -138
  74. data/lib/tinkerforge/version.rb +1 -1
  75. metadata +3 -2
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2017-05-11. #
3
+ # This file was automatically generated on 2017-07-27. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.13 #
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 #
@@ -75,7 +75,12 @@ module Tinkerforge
75
75
  FUNCTION_ENABLE_VELOCITY_REACHED_CALLBACK = 32 # :nodoc:
76
76
  FUNCTION_DISABLE_VELOCITY_REACHED_CALLBACK = 33 # :nodoc:
77
77
  FUNCTION_IS_VELOCITY_REACHED_CALLBACK_ENABLED = 34 # :nodoc:
78
+ FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
79
+ FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
78
80
  FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
81
+ FUNCTION_SET_SPITFP_BAUDRATE = 234 # :nodoc:
82
+ FUNCTION_GET_SPITFP_BAUDRATE = 235 # :nodoc:
83
+ FUNCTION_GET_SPITFP_ERROR_COUNT = 237 # :nodoc:
79
84
  FUNCTION_ENABLE_STATUS_LED = 238 # :nodoc:
80
85
  FUNCTION_DISABLE_STATUS_LED = 239 # :nodoc:
81
86
  FUNCTION_IS_STATUS_LED_ENABLED = 240 # :nodoc:
@@ -125,16 +130,18 @@ module Tinkerforge
125
130
  @response_expected[FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
131
  @response_expected[FUNCTION_SET_MINIMUM_VOLTAGE] = RESPONSE_EXPECTED_TRUE
127
132
  @response_expected[FUNCTION_GET_MINIMUM_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
128
- @response_expected[CALLBACK_UNDER_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_FALSE
129
- @response_expected[CALLBACK_POSITION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
130
- @response_expected[CALLBACK_VELOCITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
131
133
  @response_expected[FUNCTION_ENABLE_POSITION_REACHED_CALLBACK] = RESPONSE_EXPECTED_TRUE
132
134
  @response_expected[FUNCTION_DISABLE_POSITION_REACHED_CALLBACK] = RESPONSE_EXPECTED_TRUE
133
135
  @response_expected[FUNCTION_IS_POSITION_REACHED_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
134
136
  @response_expected[FUNCTION_ENABLE_VELOCITY_REACHED_CALLBACK] = RESPONSE_EXPECTED_TRUE
135
137
  @response_expected[FUNCTION_DISABLE_VELOCITY_REACHED_CALLBACK] = RESPONSE_EXPECTED_TRUE
136
138
  @response_expected[FUNCTION_IS_VELOCITY_REACHED_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
139
+ @response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
140
+ @response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
137
141
  @response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
142
+ @response_expected[FUNCTION_SET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_FALSE
143
+ @response_expected[FUNCTION_GET_SPITFP_BAUDRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
144
+ @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
145
  @response_expected[FUNCTION_ENABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
139
146
  @response_expected[FUNCTION_DISABLE_STATUS_LED] = RESPONSE_EXPECTED_FALSE
140
147
  @response_expected[FUNCTION_IS_STATUS_LED_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -146,23 +153,24 @@ module Tinkerforge
146
153
  @callback_formats[CALLBACK_UNDER_VOLTAGE] = 'S'
147
154
  @callback_formats[CALLBACK_POSITION_REACHED] = 'C s'
148
155
  @callback_formats[CALLBACK_VELOCITY_REACHED] = 'C s'
156
+
149
157
  end
150
158
 
151
159
  # Enables a servo (0 to 6). If a servo is enabled, the configured position,
152
160
  # velocity, acceleration, etc. are applied immediately.
153
161
  def enable(servo_num)
154
- send_request(FUNCTION_ENABLE, [servo_num], 'C', 0, '')
162
+ send_request FUNCTION_ENABLE, [servo_num], 'C', 0, ''
155
163
  end
156
164
 
157
165
  # Disables a servo (0 to 6). Disabled servos are not driven at all, i.e. a
158
166
  # disabled servo will not hold its position if a load is applied.
159
167
  def disable(servo_num)
160
- send_request(FUNCTION_DISABLE, [servo_num], 'C', 0, '')
168
+ send_request FUNCTION_DISABLE, [servo_num], 'C', 0, ''
161
169
  end
162
170
 
163
171
  # Returns *true* if the specified servo is enabled, *false* otherwise.
164
172
  def is_enabled(servo_num)
165
- send_request(FUNCTION_IS_ENABLED, [servo_num], 'C', 1, '?')
173
+ send_request FUNCTION_IS_ENABLED, [servo_num], 'C', 1, '?'
166
174
  end
167
175
 
168
176
  # Sets the position in °/100 for the specified servo.
@@ -174,19 +182,19 @@ module Tinkerforge
174
182
  # similar with the Servo Brick, you can also define lengths or speeds with
175
183
  # BrickServo#set_degree.
176
184
  def set_position(servo_num, position)
177
- send_request(FUNCTION_SET_POSITION, [servo_num, position], 'C s', 0, '')
185
+ send_request FUNCTION_SET_POSITION, [servo_num, position], 'C s', 0, ''
178
186
  end
179
187
 
180
188
  # Returns the position of the specified servo as set by BrickServo#set_position.
181
189
  def get_position(servo_num)
182
- send_request(FUNCTION_GET_POSITION, [servo_num], 'C', 2, 's')
190
+ send_request FUNCTION_GET_POSITION, [servo_num], 'C', 2, 's'
183
191
  end
184
192
 
185
193
  # Returns the *current* position of the specified servo. This may not be the
186
194
  # value of BrickServo#set_position if the servo is currently approaching a
187
195
  # position goal.
188
196
  def get_current_position(servo_num)
189
- send_request(FUNCTION_GET_CURRENT_POSITION, [servo_num], 'C', 2, 's')
197
+ send_request FUNCTION_GET_CURRENT_POSITION, [servo_num], 'C', 2, 's'
190
198
  end
191
199
 
192
200
  # Sets the maximum velocity of the specified servo in °/100s. The velocity
@@ -197,19 +205,19 @@ module Tinkerforge
197
205
  #
198
206
  # The default value is 65535.
199
207
  def set_velocity(servo_num, velocity)
200
- send_request(FUNCTION_SET_VELOCITY, [servo_num, velocity], 'C S', 0, '')
208
+ send_request FUNCTION_SET_VELOCITY, [servo_num, velocity], 'C S', 0, ''
201
209
  end
202
210
 
203
211
  # Returns the velocity of the specified servo as set by BrickServo#set_velocity.
204
212
  def get_velocity(servo_num)
205
- send_request(FUNCTION_GET_VELOCITY, [servo_num], 'C', 2, 'S')
213
+ send_request FUNCTION_GET_VELOCITY, [servo_num], 'C', 2, 'S'
206
214
  end
207
215
 
208
216
  # Returns the *current* velocity of the specified servo. This may not be the
209
217
  # value of BrickServo#set_velocity if the servo is currently approaching a
210
218
  # velocity goal.
211
219
  def get_current_velocity(servo_num)
212
- send_request(FUNCTION_GET_CURRENT_VELOCITY, [servo_num], 'C', 2, 'S')
220
+ send_request FUNCTION_GET_CURRENT_VELOCITY, [servo_num], 'C', 2, 'S'
213
221
  end
214
222
 
215
223
  # Sets the acceleration of the specified servo in °/100s².
@@ -219,13 +227,13 @@ module Tinkerforge
219
227
  #
220
228
  # The default value is 65535.
221
229
  def set_acceleration(servo_num, acceleration)
222
- send_request(FUNCTION_SET_ACCELERATION, [servo_num, acceleration], 'C S', 0, '')
230
+ send_request FUNCTION_SET_ACCELERATION, [servo_num, acceleration], 'C S', 0, ''
223
231
  end
224
232
 
225
233
  # Returns the acceleration for the specified servo as set by
226
234
  # BrickServo#set_acceleration.
227
235
  def get_acceleration(servo_num)
228
- send_request(FUNCTION_GET_ACCELERATION, [servo_num], 'C', 2, 'S')
236
+ send_request FUNCTION_GET_ACCELERATION, [servo_num], 'C', 2, 'S'
229
237
  end
230
238
 
231
239
  # Sets the output voltages with which the servos are driven in mV.
@@ -239,12 +247,12 @@ module Tinkerforge
239
247
  #
240
248
  # The default value is 5000.
241
249
  def set_output_voltage(voltage)
242
- send_request(FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, '')
250
+ send_request FUNCTION_SET_OUTPUT_VOLTAGE, [voltage], 'S', 0, ''
243
251
  end
244
252
 
245
253
  # Returns the output voltage as specified by BrickServo#set_output_voltage.
246
254
  def get_output_voltage
247
- send_request(FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S')
255
+ send_request FUNCTION_GET_OUTPUT_VOLTAGE, [], '', 2, 'S'
248
256
  end
249
257
 
250
258
  # Sets the minimum and maximum pulse width of the specified servo in µs.
@@ -265,13 +273,13 @@ module Tinkerforge
265
273
  # The default values are 1000µs (1ms) and 2000µs (2ms) for minimum and
266
274
  # maximum pulse width.
267
275
  def set_pulse_width(servo_num, min, max)
268
- send_request(FUNCTION_SET_PULSE_WIDTH, [servo_num, min, max], 'C S S', 0, '')
276
+ send_request FUNCTION_SET_PULSE_WIDTH, [servo_num, min, max], 'C S S', 0, ''
269
277
  end
270
278
 
271
279
  # Returns the minimum and maximum pulse width for the specified servo as set by
272
280
  # BrickServo#set_pulse_width.
273
281
  def get_pulse_width(servo_num)
274
- send_request(FUNCTION_GET_PULSE_WIDTH, [servo_num], 'C', 4, 'S S')
282
+ send_request FUNCTION_GET_PULSE_WIDTH, [servo_num], 'C', 4, 'S S'
275
283
  end
276
284
 
277
285
  # Sets the minimum and maximum degree for the specified servo (by default
@@ -305,13 +313,13 @@ module Tinkerforge
305
313
  #
306
314
  # The default values are -9000 and 9000 for the minimum and maximum degree.
307
315
  def set_degree(servo_num, min, max)
308
- send_request(FUNCTION_SET_DEGREE, [servo_num, min, max], 'C s s', 0, '')
316
+ send_request FUNCTION_SET_DEGREE, [servo_num, min, max], 'C s s', 0, ''
309
317
  end
310
318
 
311
319
  # Returns the minimum and maximum degree for the specified servo as set by
312
320
  # BrickServo#set_degree.
313
321
  def get_degree(servo_num)
314
- send_request(FUNCTION_GET_DEGREE, [servo_num], 'C', 4, 's s')
322
+ send_request FUNCTION_GET_DEGREE, [servo_num], 'C', 4, 's s'
315
323
  end
316
324
 
317
325
  # Sets the period of the specified servo in µs.
@@ -330,29 +338,29 @@ module Tinkerforge
330
338
  #
331
339
  # The default value is 19.5ms (19500µs).
332
340
  def set_period(servo_num, period)
333
- send_request(FUNCTION_SET_PERIOD, [servo_num, period], 'C S', 0, '')
341
+ send_request FUNCTION_SET_PERIOD, [servo_num, period], 'C S', 0, ''
334
342
  end
335
343
 
336
344
  # Returns the period for the specified servo as set by BrickServo#set_period.
337
345
  def get_period(servo_num)
338
- send_request(FUNCTION_GET_PERIOD, [servo_num], 'C', 2, 'S')
346
+ send_request FUNCTION_GET_PERIOD, [servo_num], 'C', 2, 'S'
339
347
  end
340
348
 
341
349
  # Returns the current consumption of the specified servo in mA.
342
350
  def get_servo_current(servo_num)
343
- send_request(FUNCTION_GET_SERVO_CURRENT, [servo_num], 'C', 2, 'S')
351
+ send_request FUNCTION_GET_SERVO_CURRENT, [servo_num], 'C', 2, 'S'
344
352
  end
345
353
 
346
354
  # Returns the current consumption of all servos together in mA.
347
355
  def get_overall_current
348
- send_request(FUNCTION_GET_OVERALL_CURRENT, [], '', 2, 'S')
356
+ send_request FUNCTION_GET_OVERALL_CURRENT, [], '', 2, 'S'
349
357
  end
350
358
 
351
359
  # Returns the stack input voltage in mV. The stack input voltage is the
352
360
  # voltage that is supplied via the stack, i.e. it is given by a
353
361
  # Step-Down or Step-Up Power Supply.
354
362
  def get_stack_input_voltage
355
- send_request(FUNCTION_GET_STACK_INPUT_VOLTAGE, [], '', 2, 'S')
363
+ send_request FUNCTION_GET_STACK_INPUT_VOLTAGE, [], '', 2, 'S'
356
364
  end
357
365
 
358
366
  # Returns the external input voltage in mV. The external input voltage is
@@ -368,7 +376,7 @@ module Tinkerforge
368
376
  # the external connection, it will immediately be driven by the high
369
377
  # stack voltage
370
378
  def get_external_input_voltage
371
- send_request(FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE, [], '', 2, 'S')
379
+ send_request FUNCTION_GET_EXTERNAL_INPUT_VOLTAGE, [], '', 2, 'S'
372
380
  end
373
381
 
374
382
  # Sets the minimum voltage in mV, below which the CALLBACK_UNDER_VOLTAGE callback
@@ -379,12 +387,12 @@ module Tinkerforge
379
387
  #
380
388
  # The default value is 5V (5000mV).
381
389
  def set_minimum_voltage(voltage)
382
- send_request(FUNCTION_SET_MINIMUM_VOLTAGE, [voltage], 'S', 0, '')
390
+ send_request FUNCTION_SET_MINIMUM_VOLTAGE, [voltage], 'S', 0, ''
383
391
  end
384
392
 
385
393
  # Returns the minimum voltage as set by BrickServo#set_minimum_voltage
386
394
  def get_minimum_voltage
387
- send_request(FUNCTION_GET_MINIMUM_VOLTAGE, [], '', 2, 'S')
395
+ send_request FUNCTION_GET_MINIMUM_VOLTAGE, [], '', 2, 'S'
388
396
  end
389
397
 
390
398
  # Enables the CALLBACK_POSITION_REACHED callback.
@@ -393,7 +401,7 @@ module Tinkerforge
393
401
  #
394
402
  # .. versionadded:: 2.0.1$nbsp;(Firmware)
395
403
  def enable_position_reached_callback
396
- send_request(FUNCTION_ENABLE_POSITION_REACHED_CALLBACK, [], '', 0, '')
404
+ send_request FUNCTION_ENABLE_POSITION_REACHED_CALLBACK, [], '', 0, ''
397
405
  end
398
406
 
399
407
  # Disables the CALLBACK_POSITION_REACHED callback.
@@ -402,14 +410,14 @@ module Tinkerforge
402
410
  #
403
411
  # .. versionadded:: 2.0.1$nbsp;(Firmware)
404
412
  def disable_position_reached_callback
405
- send_request(FUNCTION_DISABLE_POSITION_REACHED_CALLBACK, [], '', 0, '')
413
+ send_request FUNCTION_DISABLE_POSITION_REACHED_CALLBACK, [], '', 0, ''
406
414
  end
407
415
 
408
416
  # Returns *true* if CALLBACK_POSITION_REACHED callback is enabled, *false* otherwise.
409
417
  #
410
418
  # .. versionadded:: 2.0.1$nbsp;(Firmware)
411
419
  def is_position_reached_callback_enabled
412
- send_request(FUNCTION_IS_POSITION_REACHED_CALLBACK_ENABLED, [], '', 1, '?')
420
+ send_request FUNCTION_IS_POSITION_REACHED_CALLBACK_ENABLED, [], '', 1, '?'
413
421
  end
414
422
 
415
423
  # Enables the CALLBACK_VELOCITY_REACHED callback.
@@ -418,7 +426,7 @@ module Tinkerforge
418
426
  #
419
427
  # .. versionadded:: 2.0.1$nbsp;(Firmware)
420
428
  def enable_velocity_reached_callback
421
- send_request(FUNCTION_ENABLE_VELOCITY_REACHED_CALLBACK, [], '', 0, '')
429
+ send_request FUNCTION_ENABLE_VELOCITY_REACHED_CALLBACK, [], '', 0, ''
422
430
  end
423
431
 
424
432
  # Disables the CALLBACK_VELOCITY_REACHED callback.
@@ -427,14 +435,49 @@ module Tinkerforge
427
435
  #
428
436
  # .. versionadded:: 2.0.1$nbsp;(Firmware)
429
437
  def disable_velocity_reached_callback
430
- send_request(FUNCTION_DISABLE_VELOCITY_REACHED_CALLBACK, [], '', 0, '')
438
+ send_request FUNCTION_DISABLE_VELOCITY_REACHED_CALLBACK, [], '', 0, ''
431
439
  end
432
440
 
433
441
  # Returns *true* if CALLBACK_VELOCITY_REACHED callback is enabled, *false* otherwise.
434
442
  #
435
443
  # .. versionadded:: 2.0.1$nbsp;(Firmware)
436
444
  def is_velocity_reached_callback_enabled
437
- send_request(FUNCTION_IS_VELOCITY_REACHED_CALLBACK_ENABLED, [], '', 1, '?')
445
+ send_request FUNCTION_IS_VELOCITY_REACHED_CALLBACK_ENABLED, [], '', 1, '?'
446
+ end
447
+
448
+ # The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
449
+ # enabled, the Brick will try to adapt the baudrate for the communication
450
+ # between Bricks and Bricklets according to the amount of data that is transferred.
451
+ #
452
+ # The baudrate will be increased exponetially if lots of data is send/receieved and
453
+ # decreased linearly if little data is send/received.
454
+ #
455
+ # This lowers the baudrate in applications where little data is transferred (e.g.
456
+ # a weather station) and increases the robustness. If there is lots of data to transfer
457
+ # (e.g. Thermal Imaging Bricklet) it automatically increases the baudrate as needed.
458
+ #
459
+ # In cases where some data has to transferred as fast as possible every few seconds
460
+ # (e.g. RS485 Bricklet with a high baudrate but small payload) you may want to turn
461
+ # the dynamic baudrate off to get the highest possible performance.
462
+ #
463
+ # The maximum value of the baudrate can be set per port with the function
464
+ # BrickServo#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
465
+ # as set by BrickServo#set_spitfp_baudrate will be used statically.
466
+ #
467
+ # The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
468
+ #
469
+ # By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
470
+ #
471
+ # .. versionadded:: 2.3.4$nbsp;(Firmware)
472
+ def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
473
+ send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
474
+ end
475
+
476
+ # Returns the baudrate config, see BrickServo#set_spitfp_baudrate_config.
477
+ #
478
+ # .. versionadded:: 2.3.4$nbsp;(Firmware)
479
+ def get_spitfp_baudrate_config
480
+ send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
438
481
  end
439
482
 
440
483
  # Returns the timeout count for the different communication methods.
@@ -446,7 +489,53 @@ module Tinkerforge
446
489
  #
447
490
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
448
491
  def get_send_timeout_count(communication_method)
449
- send_request(FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L')
492
+ send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
493
+ end
494
+
495
+ # Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
496
+ # baudrate can be in the range 400000 to 2000000.
497
+ #
498
+ # If you want to increase the throughput of Bricklets you can increase
499
+ # the baudrate. If you get a high error count because of high
500
+ # interference (see BrickServo#get_spitfp_error_count) you can decrease the
501
+ # baudrate.
502
+ #
503
+ # If the dynamic baudrate feature is enabled, the baudrate set by this
504
+ # function corresponds to the maximum baudrate (see BrickServo#set_spitfp_baudrate_config).
505
+ #
506
+ # Regulatory testing is done with the default baudrate. If CE compatability
507
+ # or similar is necessary in you applications we recommend to not change
508
+ # the baudrate.
509
+ #
510
+ # The default baudrate for all ports is 1400000.
511
+ #
512
+ # .. versionadded:: 2.3.2$nbsp;(Firmware)
513
+ def set_spitfp_baudrate(bricklet_port, baudrate)
514
+ send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
515
+ end
516
+
517
+ # Returns the baudrate for a given Bricklet port, see BrickServo#set_spitfp_baudrate.
518
+ #
519
+ # .. versionadded:: 2.3.2$nbsp;(Firmware)
520
+ def get_spitfp_baudrate(bricklet_port)
521
+ send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
522
+ end
523
+
524
+ # Returns the error count for the communication between Brick and Bricklet.
525
+ #
526
+ # The errors are divided into
527
+ #
528
+ # * ACK checksum errors,
529
+ # * message checksum errors,
530
+ # * frameing errors and
531
+ # * overflow errors.
532
+ #
533
+ # The errors counts are for errors that occur on the Brick side. All
534
+ # Bricklets have a similar function that returns the errors on the Bricklet side.
535
+ #
536
+ # .. versionadded:: 2.3.2$nbsp;(Firmware)
537
+ def get_spitfp_error_count(bricklet_port)
538
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
450
539
  end
451
540
 
452
541
  # Enables the status LED.
@@ -458,7 +547,7 @@ module Tinkerforge
458
547
  #
459
548
  # .. versionadded:: 2.3.1$nbsp;(Firmware)
460
549
  def enable_status_led
461
- send_request(FUNCTION_ENABLE_STATUS_LED, [], '', 0, '')
550
+ send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
462
551
  end
463
552
 
464
553
  # Disables the status LED.
@@ -470,14 +559,14 @@ module Tinkerforge
470
559
  #
471
560
  # .. versionadded:: 2.3.1$nbsp;(Firmware)
472
561
  def disable_status_led
473
- send_request(FUNCTION_DISABLE_STATUS_LED, [], '', 0, '')
562
+ send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
474
563
  end
475
564
 
476
565
  # Returns *true* if the status LED is enabled, *false* otherwise.
477
566
  #
478
567
  # .. versionadded:: 2.3.1$nbsp;(Firmware)
479
568
  def is_status_led_enabled
480
- send_request(FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?')
569
+ send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
481
570
  end
482
571
 
483
572
  # Returns the firmware and protocol version and the name of the Bricklet for a
@@ -486,7 +575,7 @@ module Tinkerforge
486
575
  # This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
487
576
  # plugins.
488
577
  def get_protocol1_bricklet_name(port)
489
- send_request(FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40')
578
+ send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
490
579
  end
491
580
 
492
581
  # Returns the temperature in °C/10 as measured inside the microcontroller. The
@@ -496,7 +585,7 @@ module Tinkerforge
496
585
  # accuracy of +-15%. Practically it is only useful as an indicator for
497
586
  # temperature changes.
498
587
  def get_chip_temperature
499
- send_request(FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's')
588
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
500
589
  end
501
590
 
502
591
  # Calling this function will reset the Brick. Calling this function
@@ -506,7 +595,7 @@ module Tinkerforge
506
595
  # calling functions on the existing ones will result in
507
596
  # undefined behavior!
508
597
  def reset
509
- send_request(FUNCTION_RESET, [], '', 0, '')
598
+ send_request FUNCTION_RESET, [], '', 0, ''
510
599
  end
511
600
 
512
601
  # Returns the UID, the UID where the Brick is connected to,
@@ -518,7 +607,7 @@ module Tinkerforge
518
607
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
519
608
  # |device_identifier_constant|
520
609
  def get_identity
521
- send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
610
+ send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
522
611
  end
523
612
 
524
613
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.