tinkerforge 2.1.22 → 2.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Basis to build stacks and has 4 Bricklet ports
14
16
  class BrickMaster < Device
@@ -37,7 +39,7 @@ module Tinkerforge
37
39
 
38
40
  # This callback is triggered periodically with the period that is set by
39
41
  # BrickMaster#set_usb_voltage_callback_period. The parameter is the USB
40
- # voltage in mV.
42
+ # voltage.
41
43
  #
42
44
  # The CALLBACK_USB_VOLTAGE callback is only triggered if the USB voltage has changed
43
45
  # since the last triggering.
@@ -49,7 +51,7 @@ module Tinkerforge
49
51
 
50
52
  # This callback is triggered when the threshold as set by
51
53
  # BrickMaster#set_stack_current_callback_threshold is reached.
52
- # The parameter is the stack current in mA.
54
+ # The parameter is the stack current.
53
55
  #
54
56
  # If the threshold keeps being reached, the callback is triggered periodically
55
57
  # with the period as set by BrickMaster#set_debounce_period.
@@ -59,7 +61,7 @@ module Tinkerforge
59
61
 
60
62
  # This callback is triggered when the threshold as set by
61
63
  # BrickMaster#set_stack_voltage_callback_threshold is reached.
62
- # The parameter is the stack voltage in mV.
64
+ # The parameter is the stack voltage.
63
65
  #
64
66
  # If the threshold keeps being reached, the callback is triggered periodically
65
67
  # with the period as set by BrickMaster#set_debounce_period.
@@ -181,6 +183,10 @@ module Tinkerforge
181
183
  FUNCTION_GET_WIFI2_MESH_COMMON_STATUS = 108 # :nodoc:
182
184
  FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS = 109 # :nodoc:
183
185
  FUNCTION_GET_WIFI2_MESH_AP_STATUS = 110 # :nodoc:
186
+ FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG = 111 # :nodoc:
187
+ FUNCTION_SET_BRICKLET_XMC_FLASH_DATA = 112 # :nodoc:
188
+ FUNCTION_SET_BRICKLETS_ENABLED = 113 # :nodoc:
189
+ FUNCTION_GET_BRICKLETS_ENABLED = 114 # :nodoc:
184
190
  FUNCTION_SET_SPITFP_BAUDRATE_CONFIG = 231 # :nodoc:
185
191
  FUNCTION_GET_SPITFP_BAUDRATE_CONFIG = 232 # :nodoc:
186
192
  FUNCTION_GET_SEND_TIMEOUT_COUNT = 233 # :nodoc:
@@ -193,6 +199,8 @@ module Tinkerforge
193
199
  FUNCTION_GET_PROTOCOL1_BRICKLET_NAME = 241 # :nodoc:
194
200
  FUNCTION_GET_CHIP_TEMPERATURE = 242 # :nodoc:
195
201
  FUNCTION_RESET = 243 # :nodoc:
202
+ FUNCTION_WRITE_BRICKLET_PLUGIN = 246 # :nodoc:
203
+ FUNCTION_READ_BRICKLET_PLUGIN = 247 # :nodoc:
196
204
  FUNCTION_GET_IDENTITY = 255 # :nodoc:
197
205
 
198
206
  EXTENSION_TYPE_CHIBI = 1 # :nodoc:
@@ -286,9 +294,9 @@ module Tinkerforge
286
294
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
287
295
  # the IP Connection <tt>ipcon</tt>.
288
296
  def initialize(uid, ipcon)
289
- super uid, ipcon
297
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
290
298
 
291
- @api_version = [2, 0, 9]
299
+ @api_version = [2, 0, 10]
292
300
 
293
301
  @response_expected[FUNCTION_GET_STACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
294
302
  @response_expected[FUNCTION_GET_STACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -394,6 +402,10 @@ module Tinkerforge
394
402
  @response_expected[FUNCTION_GET_WIFI2_MESH_COMMON_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
395
403
  @response_expected[FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
396
404
  @response_expected[FUNCTION_GET_WIFI2_MESH_AP_STATUS] = RESPONSE_EXPECTED_ALWAYS_TRUE
405
+ @response_expected[FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
406
+ @response_expected[FUNCTION_SET_BRICKLET_XMC_FLASH_DATA] = RESPONSE_EXPECTED_ALWAYS_TRUE
407
+ @response_expected[FUNCTION_SET_BRICKLETS_ENABLED] = RESPONSE_EXPECTED_FALSE
408
+ @response_expected[FUNCTION_GET_BRICKLETS_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
397
409
  @response_expected[FUNCTION_SET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_FALSE
398
410
  @response_expected[FUNCTION_GET_SPITFP_BAUDRATE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
399
411
  @response_expected[FUNCTION_GET_SEND_TIMEOUT_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -406,33 +418,46 @@ module Tinkerforge
406
418
  @response_expected[FUNCTION_GET_PROTOCOL1_BRICKLET_NAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
407
419
  @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
408
420
  @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
421
+ @response_expected[FUNCTION_WRITE_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_FALSE
422
+ @response_expected[FUNCTION_READ_BRICKLET_PLUGIN] = RESPONSE_EXPECTED_ALWAYS_TRUE
409
423
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
410
424
 
411
- @callback_formats[CALLBACK_STACK_CURRENT] = 'S'
412
- @callback_formats[CALLBACK_STACK_VOLTAGE] = 'S'
413
- @callback_formats[CALLBACK_USB_VOLTAGE] = 'S'
414
- @callback_formats[CALLBACK_STACK_CURRENT_REACHED] = 'S'
415
- @callback_formats[CALLBACK_STACK_VOLTAGE_REACHED] = 'S'
416
- @callback_formats[CALLBACK_USB_VOLTAGE_REACHED] = 'S'
425
+ @callback_formats[CALLBACK_STACK_CURRENT] = [10, 'S']
426
+ @callback_formats[CALLBACK_STACK_VOLTAGE] = [10, 'S']
427
+ @callback_formats[CALLBACK_USB_VOLTAGE] = [10, 'S']
428
+ @callback_formats[CALLBACK_STACK_CURRENT_REACHED] = [10, 'S']
429
+ @callback_formats[CALLBACK_STACK_VOLTAGE_REACHED] = [10, 'S']
430
+ @callback_formats[CALLBACK_USB_VOLTAGE_REACHED] = [10, 'S']
417
431
 
432
+ @ipcon.add_device self
418
433
  end
419
434
 
420
- # Returns the stack voltage in mV. The stack voltage is the
435
+ # Returns the stack voltage. The stack voltage is the
421
436
  # voltage that is supplied via the stack, i.e. it is given by a
422
437
  # Step-Down or Step-Up Power Supply.
438
+ #
439
+ # .. note::
440
+ # It is not possible to measure voltages supplied per PoE or USB with this function.
423
441
  def get_stack_voltage
424
- send_request FUNCTION_GET_STACK_VOLTAGE, [], '', 2, 'S'
442
+ check_validity
443
+
444
+ send_request FUNCTION_GET_STACK_VOLTAGE, [], '', 10, 'S'
425
445
  end
426
446
 
427
- # Returns the stack current in mA. The stack current is the
447
+ # Returns the stack current. The stack current is the
428
448
  # current that is drawn via the stack, i.e. it is given by a
429
449
  # Step-Down or Step-Up Power Supply.
450
+ #
451
+ # .. note::
452
+ # It is not possible to measure the current drawn via PoE or USB with this function.
430
453
  def get_stack_current
431
- send_request FUNCTION_GET_STACK_CURRENT, [], '', 2, 'S'
454
+ check_validity
455
+
456
+ send_request FUNCTION_GET_STACK_CURRENT, [], '', 10, 'S'
432
457
  end
433
458
 
434
459
  # Writes the extension type to the EEPROM of a specified extension.
435
- # The extension is either 0 or 1 (0 is the on the bottom, 1 is the one on top,
460
+ # The extension is either 0 or 1 (0 is the lower one, 1 is the upper one,
436
461
  # if only one extension is present use 0).
437
462
  #
438
463
  # Possible extension types:
@@ -448,50 +473,64 @@ module Tinkerforge
448
473
  # The extension type is already set when bought and it can be set with the
449
474
  # Brick Viewer, it is unlikely that you need this function.
450
475
  def set_extension_type(extension, exttype)
451
- send_request FUNCTION_SET_EXTENSION_TYPE, [extension, exttype], 'C L', 0, ''
476
+ check_validity
477
+
478
+ send_request FUNCTION_SET_EXTENSION_TYPE, [extension, exttype], 'C L', 8, ''
452
479
  end
453
480
 
454
481
  # Returns the type for a given extension as set by BrickMaster#set_extension_type.
455
482
  def get_extension_type(extension)
456
- send_request FUNCTION_GET_EXTENSION_TYPE, [extension], 'C', 4, 'L'
483
+ check_validity
484
+
485
+ send_request FUNCTION_GET_EXTENSION_TYPE, [extension], 'C', 12, 'L'
457
486
  end
458
487
 
459
488
  # Returns *true* if the Master Brick is at position 0 in the stack and a Chibi
460
489
  # Extension is available.
461
490
  def is_chibi_present
462
- send_request FUNCTION_IS_CHIBI_PRESENT, [], '', 1, '?'
491
+ check_validity
492
+
493
+ send_request FUNCTION_IS_CHIBI_PRESENT, [], '', 9, '?'
463
494
  end
464
495
 
465
- # Sets the address (1-255) belonging to the Chibi Extension.
496
+ # Sets the address belonging to the Chibi Extension.
466
497
  #
467
498
  # It is possible to set the address with the Brick Viewer and it will be
468
499
  # saved in the EEPROM of the Chibi Extension, it does not
469
500
  # have to be set on every startup.
470
501
  def set_chibi_address(address)
471
- send_request FUNCTION_SET_CHIBI_ADDRESS, [address], 'C', 0, ''
502
+ check_validity
503
+
504
+ send_request FUNCTION_SET_CHIBI_ADDRESS, [address], 'C', 8, ''
472
505
  end
473
506
 
474
507
  # Returns the address as set by BrickMaster#set_chibi_address.
475
508
  def get_chibi_address
476
- send_request FUNCTION_GET_CHIBI_ADDRESS, [], '', 1, 'C'
509
+ check_validity
510
+
511
+ send_request FUNCTION_GET_CHIBI_ADDRESS, [], '', 9, 'C'
477
512
  end
478
513
 
479
- # Sets the address (1-255) of the Chibi Master. This address is used if the
514
+ # Sets the address of the Chibi Master. This address is used if the
480
515
  # Chibi Extension is used as slave (i.e. it does not have a USB connection).
481
516
  #
482
517
  # It is possible to set the address with the Brick Viewer and it will be
483
518
  # saved in the EEPROM of the Chibi Extension, it does not
484
519
  # have to be set on every startup.
485
520
  def set_chibi_master_address(address)
486
- send_request FUNCTION_SET_CHIBI_MASTER_ADDRESS, [address], 'C', 0, ''
521
+ check_validity
522
+
523
+ send_request FUNCTION_SET_CHIBI_MASTER_ADDRESS, [address], 'C', 8, ''
487
524
  end
488
525
 
489
526
  # Returns the address as set by BrickMaster#set_chibi_master_address.
490
527
  def get_chibi_master_address
491
- send_request FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 1, 'C'
528
+ check_validity
529
+
530
+ send_request FUNCTION_GET_CHIBI_MASTER_ADDRESS, [], '', 9, 'C'
492
531
  end
493
532
 
494
- # Sets up to 254 slave addresses. Valid addresses are in range 1-255. 0 has a
533
+ # Sets up to 254 slave addresses. 0 has a
495
534
  # special meaning, it is used as list terminator and not allowed as normal slave
496
535
  # address. The address numeration (via num parameter) has to be used
497
536
  # ascending from 0. For example: If you use the Chibi Extension in Master mode
@@ -507,19 +546,25 @@ module Tinkerforge
507
546
  # The slave addresses will be saved in the EEPROM of the Chibi Extension, they
508
547
  # don't have to be set on every startup.
509
548
  def set_chibi_slave_address(num, address)
510
- send_request FUNCTION_SET_CHIBI_SLAVE_ADDRESS, [num, address], 'C C', 0, ''
549
+ check_validity
550
+
551
+ send_request FUNCTION_SET_CHIBI_SLAVE_ADDRESS, [num, address], 'C C', 8, ''
511
552
  end
512
553
 
513
554
  # Returns the slave address for a given num as set by
514
555
  # BrickMaster#set_chibi_slave_address.
515
556
  def get_chibi_slave_address(num)
516
- send_request FUNCTION_GET_CHIBI_SLAVE_ADDRESS, [num], 'C', 1, 'C'
557
+ check_validity
558
+
559
+ send_request FUNCTION_GET_CHIBI_SLAVE_ADDRESS, [num], 'C', 9, 'C'
517
560
  end
518
561
 
519
562
  # Returns the signal strength in dBm. The signal strength updates every time a
520
563
  # packet is received.
521
564
  def get_chibi_signal_strength
522
- send_request FUNCTION_GET_CHIBI_SIGNAL_STRENGTH, [], '', 1, 'C'
565
+ check_validity
566
+
567
+ send_request FUNCTION_GET_CHIBI_SIGNAL_STRENGTH, [], '', 9, 'C'
523
568
  end
524
569
 
525
570
  # Returns underrun, CRC error, no ACK and overflow error counts of the Chibi
@@ -527,7 +572,9 @@ module Tinkerforge
527
572
  # distance between two Chibi stacks is becoming too big or there are
528
573
  # interferences.
529
574
  def get_chibi_error_log
530
- send_request FUNCTION_GET_CHIBI_ERROR_LOG, [], '', 8, 'S S S S'
575
+ check_validity
576
+
577
+ send_request FUNCTION_GET_CHIBI_ERROR_LOG, [], '', 16, 'S S S S'
531
578
  end
532
579
 
533
580
  # Sets the Chibi frequency range for the Chibi Extension. Possible values are:
@@ -543,18 +590,22 @@ module Tinkerforge
543
590
  # saved in the EEPROM of the Chibi Extension, it does not
544
591
  # have to be set on every startup.
545
592
  def set_chibi_frequency(frequency)
546
- send_request FUNCTION_SET_CHIBI_FREQUENCY, [frequency], 'C', 0, ''
593
+ check_validity
594
+
595
+ send_request FUNCTION_SET_CHIBI_FREQUENCY, [frequency], 'C', 8, ''
547
596
  end
548
597
 
549
598
  # Returns the frequency value as set by BrickMaster#set_chibi_frequency.
550
599
  def get_chibi_frequency
551
- send_request FUNCTION_GET_CHIBI_FREQUENCY, [], '', 1, 'C'
600
+ check_validity
601
+
602
+ send_request FUNCTION_GET_CHIBI_FREQUENCY, [], '', 9, 'C'
552
603
  end
553
604
 
554
605
  # Sets the channel used by the Chibi Extension. Possible channels are
555
606
  # different for different frequencies:
556
607
  #
557
- # "Frequency", "Possible Channels"
608
+ # "Frequency", "Possible Channels"
558
609
  #
559
610
  # "OQPSK 868MHz (Europe)", "0"
560
611
  # "OQPSK 915MHz (US)", "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
@@ -565,18 +616,24 @@ module Tinkerforge
565
616
  # saved in the EEPROM of the Chibi Extension, it does not
566
617
  # have to be set on every startup.
567
618
  def set_chibi_channel(channel)
568
- send_request FUNCTION_SET_CHIBI_CHANNEL, [channel], 'C', 0, ''
619
+ check_validity
620
+
621
+ send_request FUNCTION_SET_CHIBI_CHANNEL, [channel], 'C', 8, ''
569
622
  end
570
623
 
571
624
  # Returns the channel as set by BrickMaster#set_chibi_channel.
572
625
  def get_chibi_channel
573
- send_request FUNCTION_GET_CHIBI_CHANNEL, [], '', 1, 'C'
626
+ check_validity
627
+
628
+ send_request FUNCTION_GET_CHIBI_CHANNEL, [], '', 9, 'C'
574
629
  end
575
630
 
576
631
  # Returns *true* if the Master Brick is at position 0 in the stack and a RS485
577
632
  # Extension is available.
578
633
  def is_rs485_present
579
- send_request FUNCTION_IS_RS485_PRESENT, [], '', 1, '?'
634
+ check_validity
635
+
636
+ send_request FUNCTION_IS_RS485_PRESENT, [], '', 9, '?'
580
637
  end
581
638
 
582
639
  # Sets the address (0-255) belonging to the RS485 Extension.
@@ -588,12 +645,16 @@ module Tinkerforge
588
645
  # saved in the EEPROM of the RS485 Extension, it does not
589
646
  # have to be set on every startup.
590
647
  def set_rs485_address(address)
591
- send_request FUNCTION_SET_RS485_ADDRESS, [address], 'C', 0, ''
648
+ check_validity
649
+
650
+ send_request FUNCTION_SET_RS485_ADDRESS, [address], 'C', 8, ''
592
651
  end
593
652
 
594
653
  # Returns the address as set by BrickMaster#set_rs485_address.
595
654
  def get_rs485_address
596
- send_request FUNCTION_GET_RS485_ADDRESS, [], '', 1, 'C'
655
+ check_validity
656
+
657
+ send_request FUNCTION_GET_RS485_ADDRESS, [], '', 9, 'C'
597
658
  end
598
659
 
599
660
  # Sets up to 255 slave addresses. Valid addresses are in range 1-255. 0 has a
@@ -612,13 +673,17 @@ module Tinkerforge
612
673
  # The slave addresses will be saved in the EEPROM of the Chibi Extension, they
613
674
  # don't have to be set on every startup.
614
675
  def set_rs485_slave_address(num, address)
615
- send_request FUNCTION_SET_RS485_SLAVE_ADDRESS, [num, address], 'C C', 0, ''
676
+ check_validity
677
+
678
+ send_request FUNCTION_SET_RS485_SLAVE_ADDRESS, [num, address], 'C C', 8, ''
616
679
  end
617
680
 
618
681
  # Returns the slave address for a given ``num`` as set by
619
682
  # BrickMaster#set_rs485_slave_address.
620
683
  def get_rs485_slave_address(num)
621
- send_request FUNCTION_GET_RS485_SLAVE_ADDRESS, [num], 'C', 1, 'C'
684
+ check_validity
685
+
686
+ send_request FUNCTION_GET_RS485_SLAVE_ADDRESS, [num], 'C', 9, 'C'
622
687
  end
623
688
 
624
689
  # Returns CRC error counts of the RS485 communication.
@@ -626,34 +691,41 @@ module Tinkerforge
626
691
  # between the RS485 nodes is too big or there is some kind of
627
692
  # interference.
628
693
  def get_rs485_error_log
629
- send_request FUNCTION_GET_RS485_ERROR_LOG, [], '', 2, 'S'
694
+ check_validity
695
+
696
+ send_request FUNCTION_GET_RS485_ERROR_LOG, [], '', 10, 'S'
630
697
  end
631
698
 
632
- # Sets the configuration of the RS485 Extension. Speed is given in baud. The
699
+ # Sets the configuration of the RS485 Extension. The
633
700
  # Master Brick will try to match the given baud rate as exactly as possible.
634
- # The maximum recommended baud rate is 2000000 (2Mbit/s).
701
+ # The maximum recommended baud rate is 2000000 (2MBd).
635
702
  # Possible values for parity are 'n' (none), 'e' (even) and 'o' (odd).
636
- # Possible values for stop bits are 1 and 2.
637
703
  #
638
704
  # If your RS485 is unstable (lost messages etc.), the first thing you should
639
705
  # try is to decrease the speed. On very large bus (e.g. 1km), you probably
640
- # should use a value in the range of 100000 (100kbit/s).
706
+ # should use a value in the range of 100000 (100kBd).
641
707
  #
642
708
  # The values are stored in the EEPROM and only applied on startup. That means
643
709
  # you have to restart the Master Brick after configuration.
644
710
  def set_rs485_configuration(speed, parity, stopbits)
645
- send_request FUNCTION_SET_RS485_CONFIGURATION, [speed, parity, stopbits], 'L k C', 0, ''
711
+ check_validity
712
+
713
+ send_request FUNCTION_SET_RS485_CONFIGURATION, [speed, parity, stopbits], 'L k C', 8, ''
646
714
  end
647
715
 
648
716
  # Returns the configuration as set by BrickMaster#set_rs485_configuration.
649
717
  def get_rs485_configuration
650
- send_request FUNCTION_GET_RS485_CONFIGURATION, [], '', 6, 'L k C'
718
+ check_validity
719
+
720
+ send_request FUNCTION_GET_RS485_CONFIGURATION, [], '', 14, 'L k C'
651
721
  end
652
722
 
653
723
  # Returns *true* if the Master Brick is at position 0 in the stack and a WIFI
654
724
  # Extension is available.
655
725
  def is_wifi_present
656
- send_request FUNCTION_IS_WIFI_PRESENT, [], '', 1, '?'
726
+ check_validity
727
+
728
+ send_request FUNCTION_IS_WIFI_PRESENT, [], '', 9, '?'
657
729
  end
658
730
 
659
731
  # Sets the configuration of the WIFI Extension. The ``ssid`` can have a max length
@@ -674,20 +746,23 @@ module Tinkerforge
674
746
  # ``connection`` is set to one of the DHCP options then ``ip``, ``subnet_mask``
675
747
  # and ``gateway`` are ignored, you can set them to 0.
676
748
  #
677
- # The last parameter is the port that your program will connect to. The
678
- # default port, that is used by brickd, is 4223.
749
+ # The last parameter is the port that your program will connect to.
679
750
  #
680
751
  # The values are stored in the EEPROM and only applied on startup. That means
681
752
  # you have to restart the Master Brick after configuration.
682
753
  #
683
754
  # It is recommended to use the Brick Viewer to set the WIFI configuration.
684
755
  def set_wifi_configuration(ssid, connection, ip, subnet_mask, gateway, port)
685
- send_request FUNCTION_SET_WIFI_CONFIGURATION, [ssid, connection, ip, subnet_mask, gateway, port], 'Z32 C C4 C4 C4 S', 0, ''
756
+ check_validity
757
+
758
+ send_request FUNCTION_SET_WIFI_CONFIGURATION, [ssid, connection, ip, subnet_mask, gateway, port], 'Z32 C C4 C4 C4 S', 8, ''
686
759
  end
687
760
 
688
761
  # Returns the configuration as set by BrickMaster#set_wifi_configuration.
689
762
  def get_wifi_configuration
690
- send_request FUNCTION_GET_WIFI_CONFIGURATION, [], '', 47, 'Z32 C C4 C4 C4 S'
763
+ check_validity
764
+
765
+ send_request FUNCTION_GET_WIFI_CONFIGURATION, [], '', 55, 'Z32 C C4 C4 C4 S'
691
766
  end
692
767
 
693
768
  # Sets the encryption of the WIFI Extension. The first parameter is the
@@ -712,7 +787,7 @@ module Tinkerforge
712
787
  #
713
788
  # If you choose WPA Enterprise as encryption, you have to set ``eap_options`` and
714
789
  # the length of the certificates (for other encryption types these parameters
715
- # are ignored). The certificate length are given in byte and the certificates
790
+ # are ignored). The certificates
716
791
  # themselves can be set with BrickMaster#set_wifi_certificate. ``eap_options`` consist
717
792
  # of the outer authentication (bits 1-2), inner authentication (bit 3) and
718
793
  # certificate type (bits 4-5):
@@ -730,7 +805,9 @@ module Tinkerforge
730
805
  #
731
806
  # It is recommended to use the Brick Viewer to set the Wi-Fi encryption.
732
807
  def set_wifi_encryption(encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length)
733
- send_request FUNCTION_SET_WIFI_ENCRYPTION, [encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length], 'C Z50 C C S S S', 0, ''
808
+ check_validity
809
+
810
+ send_request FUNCTION_SET_WIFI_ENCRYPTION, [encryption, key, key_index, eap_options, ca_certificate_length, client_certificate_length, private_key_length], 'C Z50 C C S S S', 8, ''
734
811
  end
735
812
 
736
813
  # Returns the encryption as set by BrickMaster#set_wifi_encryption.
@@ -738,7 +815,9 @@ module Tinkerforge
738
815
  # .. note::
739
816
  # Since Master Brick Firmware version 2.4.4 the key is not returned anymore.
740
817
  def get_wifi_encryption
741
- send_request FUNCTION_GET_WIFI_ENCRYPTION, [], '', 59, 'C Z50 C C S S S'
818
+ check_validity
819
+
820
+ send_request FUNCTION_GET_WIFI_ENCRYPTION, [], '', 67, 'C Z50 C C S S S'
742
821
  end
743
822
 
744
823
  # Returns the status of the WIFI Extension. The ``state`` is updated automatically,
@@ -755,7 +834,9 @@ module Tinkerforge
755
834
  # "3", "Error"
756
835
  # "255", "Not initialized yet"
757
836
  def get_wifi_status
758
- send_request FUNCTION_GET_WIFI_STATUS, [], '', 36, 'C6 C6 C s C4 C4 C4 L L C'
837
+ check_validity
838
+
839
+ send_request FUNCTION_GET_WIFI_STATUS, [], '', 44, 'C6 C6 C s C4 C4 C4 L L C'
759
840
  end
760
841
 
761
842
  # Refreshes the Wi-Fi status (see BrickMaster#get_wifi_status). To read the status
@@ -765,7 +846,9 @@ module Tinkerforge
765
846
  # until the stack with attached WIFI Extension reacts again after this
766
847
  # function is called.
767
848
  def refresh_wifi_status
768
- send_request FUNCTION_REFRESH_WIFI_STATUS, [], '', 0, ''
849
+ check_validity
850
+
851
+ send_request FUNCTION_REFRESH_WIFI_STATUS, [], '', 8, ''
769
852
  end
770
853
 
771
854
  # This function is used to set the certificate as well as password and username
@@ -787,12 +870,16 @@ module Tinkerforge
787
870
  # It is recommended to use the Brick Viewer to set the certificate, username
788
871
  # and password.
789
872
  def set_wifi_certificate(index, data, data_length)
790
- send_request FUNCTION_SET_WIFI_CERTIFICATE, [index, data, data_length], 'S C32 C', 0, ''
873
+ check_validity
874
+
875
+ send_request FUNCTION_SET_WIFI_CERTIFICATE, [index, data, data_length], 'S C32 C', 8, ''
791
876
  end
792
877
 
793
878
  # Returns the certificate for a given index as set by BrickMaster#set_wifi_certificate.
794
879
  def get_wifi_certificate(index)
795
- send_request FUNCTION_GET_WIFI_CERTIFICATE, [index], 'S', 33, 'C32 C'
880
+ check_validity
881
+
882
+ send_request FUNCTION_GET_WIFI_CERTIFICATE, [index], 'S', 41, 'C32 C'
796
883
  end
797
884
 
798
885
  # Sets the power mode of the WIFI Extension. Possible modes are:
@@ -801,15 +888,17 @@ module Tinkerforge
801
888
  #
802
889
  # "0", "Full Speed (high power consumption, high throughput)"
803
890
  # "1", "Low Power (low power consumption, low throughput)"
804
- #
805
- # The default value is 0 (Full Speed).
806
891
  def set_wifi_power_mode(mode)
807
- send_request FUNCTION_SET_WIFI_POWER_MODE, [mode], 'C', 0, ''
892
+ check_validity
893
+
894
+ send_request FUNCTION_SET_WIFI_POWER_MODE, [mode], 'C', 8, ''
808
895
  end
809
896
 
810
897
  # Returns the power mode as set by BrickMaster#set_wifi_power_mode.
811
898
  def get_wifi_power_mode
812
- send_request FUNCTION_GET_WIFI_POWER_MODE, [], '', 1, 'C'
899
+ check_validity
900
+
901
+ send_request FUNCTION_GET_WIFI_POWER_MODE, [], '', 9, 'C'
813
902
  end
814
903
 
815
904
  # Returns informations about the Wi-Fi receive buffer. The Wi-Fi
@@ -827,7 +916,9 @@ module Tinkerforge
827
916
  # Try to not send more then 50 messages at a time without any kind of
828
917
  # break between them.
829
918
  def get_wifi_buffer_info
830
- send_request FUNCTION_GET_WIFI_BUFFER_INFO, [], '', 8, 'L S S'
919
+ check_validity
920
+
921
+ send_request FUNCTION_GET_WIFI_BUFFER_INFO, [], '', 16, 'L S S'
831
922
  end
832
923
 
833
924
  # Sets the regulatory domain of the WIFI Extension. Possible domains are:
@@ -837,20 +928,24 @@ module Tinkerforge
837
928
  # "0", "FCC: Channel 1-11 (N/S America, Australia, New Zealand)"
838
929
  # "1", "ETSI: Channel 1-13 (Europe, Middle East, Africa)"
839
930
  # "2", "TELEC: Channel 1-14 (Japan)"
840
- #
841
- # The default value is 1 (ETSI).
842
931
  def set_wifi_regulatory_domain(domain)
843
- send_request FUNCTION_SET_WIFI_REGULATORY_DOMAIN, [domain], 'C', 0, ''
932
+ check_validity
933
+
934
+ send_request FUNCTION_SET_WIFI_REGULATORY_DOMAIN, [domain], 'C', 8, ''
844
935
  end
845
936
 
846
937
  # Returns the regulatory domain as set by BrickMaster#set_wifi_regulatory_domain.
847
938
  def get_wifi_regulatory_domain
848
- send_request FUNCTION_GET_WIFI_REGULATORY_DOMAIN, [], '', 1, 'C'
939
+ check_validity
940
+
941
+ send_request FUNCTION_GET_WIFI_REGULATORY_DOMAIN, [], '', 9, 'C'
849
942
  end
850
943
 
851
- # Returns the USB voltage in mV. Does not work with hardware version 2.1.
944
+ # Returns the USB voltage. Does not work with hardware version 2.1.
852
945
  def get_usb_voltage
853
- send_request FUNCTION_GET_USB_VOLTAGE, [], '', 2, 'S'
946
+ check_validity
947
+
948
+ send_request FUNCTION_GET_USB_VOLTAGE, [], '', 10, 'S'
854
949
  end
855
950
 
856
951
  # Sets a long Wi-Fi key (up to 63 chars, at least 8 chars) for WPA encryption.
@@ -863,7 +958,9 @@ module Tinkerforge
863
958
  #
864
959
  # .. versionadded:: 2.0.2$nbsp;(Firmware)
865
960
  def set_long_wifi_key(key)
866
- send_request FUNCTION_SET_LONG_WIFI_KEY, [key], 'Z64', 0, ''
961
+ check_validity
962
+
963
+ send_request FUNCTION_SET_LONG_WIFI_KEY, [key], 'Z64', 8, ''
867
964
  end
868
965
 
869
966
  # Returns the encryption key as set by BrickMaster#set_long_wifi_key.
@@ -873,7 +970,9 @@ module Tinkerforge
873
970
  #
874
971
  # .. versionadded:: 2.0.2$nbsp;(Firmware)
875
972
  def get_long_wifi_key
876
- send_request FUNCTION_GET_LONG_WIFI_KEY, [], '', 64, 'Z64'
973
+ check_validity
974
+
975
+ send_request FUNCTION_GET_LONG_WIFI_KEY, [], '', 72, 'Z64'
877
976
  end
878
977
 
879
978
  # Sets the hostname of the WIFI Extension. The hostname will be displayed
@@ -883,7 +982,9 @@ module Tinkerforge
883
982
  #
884
983
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
885
984
  def set_wifi_hostname(hostname)
886
- send_request FUNCTION_SET_WIFI_HOSTNAME, [hostname], 'Z16', 0, ''
985
+ check_validity
986
+
987
+ send_request FUNCTION_SET_WIFI_HOSTNAME, [hostname], 'Z16', 8, ''
887
988
  end
888
989
 
889
990
  # Returns the hostname as set by BrickMaster#set_wifi_hostname.
@@ -892,67 +993,75 @@ module Tinkerforge
892
993
  #
893
994
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
894
995
  def get_wifi_hostname
895
- send_request FUNCTION_GET_WIFI_HOSTNAME, [], '', 16, 'Z16'
996
+ check_validity
997
+
998
+ send_request FUNCTION_GET_WIFI_HOSTNAME, [], '', 24, 'Z16'
896
999
  end
897
1000
 
898
- # Sets the period in ms with which the CALLBACK_STACK_CURRENT callback is triggered
1001
+ # Sets the period with which the CALLBACK_STACK_CURRENT callback is triggered
899
1002
  # periodically. A value of 0 turns the callback off.
900
1003
  #
901
1004
  # The CALLBACK_STACK_CURRENT callback is only triggered if the current has changed
902
1005
  # since the last triggering.
903
1006
  #
904
- # The default value is 0.
905
- #
906
1007
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
907
1008
  def set_stack_current_callback_period(period)
908
- send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
1009
+ check_validity
1010
+
1011
+ send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_PERIOD, [period], 'L', 8, ''
909
1012
  end
910
1013
 
911
1014
  # Returns the period as set by BrickMaster#set_stack_current_callback_period.
912
1015
  #
913
1016
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
914
1017
  def get_stack_current_callback_period
915
- send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
1018
+ check_validity
1019
+
1020
+ send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_PERIOD, [], '', 12, 'L'
916
1021
  end
917
1022
 
918
- # Sets the period in ms with which the CALLBACK_STACK_VOLTAGE callback is triggered
1023
+ # Sets the period with which the CALLBACK_STACK_VOLTAGE callback is triggered
919
1024
  # periodically. A value of 0 turns the callback off.
920
1025
  #
921
1026
  # The CALLBACK_STACK_VOLTAGE callback is only triggered if the voltage has changed
922
1027
  # since the last triggering.
923
1028
  #
924
- # The default value is 0.
925
- #
926
1029
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
927
1030
  def set_stack_voltage_callback_period(period)
928
- send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
1031
+ check_validity
1032
+
1033
+ send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
929
1034
  end
930
1035
 
931
1036
  # Returns the period as set by BrickMaster#set_stack_voltage_callback_period.
932
1037
  #
933
1038
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
934
1039
  def get_stack_voltage_callback_period
935
- send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
1040
+ check_validity
1041
+
1042
+ send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
936
1043
  end
937
1044
 
938
- # Sets the period in ms with which the CALLBACK_USB_VOLTAGE callback is triggered
1045
+ # Sets the period with which the CALLBACK_USB_VOLTAGE callback is triggered
939
1046
  # periodically. A value of 0 turns the callback off.
940
1047
  #
941
1048
  # The CALLBACK_USB_VOLTAGE callback is only triggered if the voltage has changed
942
1049
  # since the last triggering.
943
1050
  #
944
- # The default value is 0.
945
- #
946
1051
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
947
1052
  def set_usb_voltage_callback_period(period)
948
- send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
1053
+ check_validity
1054
+
1055
+ send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
949
1056
  end
950
1057
 
951
1058
  # Returns the period as set by BrickMaster#set_usb_voltage_callback_period.
952
1059
  #
953
1060
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
954
1061
  def get_usb_voltage_callback_period
955
- send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
1062
+ check_validity
1063
+
1064
+ send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
956
1065
  end
957
1066
 
958
1067
  # Sets the thresholds for the CALLBACK_STACK_CURRENT_REACHED callback.
@@ -967,18 +1076,20 @@ module Tinkerforge
967
1076
  # "'<'", "Callback is triggered when the current is smaller than the min value (max is ignored)"
968
1077
  # "'>'", "Callback is triggered when the current is greater than the min value (max is ignored)"
969
1078
  #
970
- # The default value is ('x', 0, 0).
971
- #
972
1079
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
973
1080
  def set_stack_current_callback_threshold(option, min, max)
974
- send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
1081
+ check_validity
1082
+
1083
+ send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
975
1084
  end
976
1085
 
977
1086
  # Returns the threshold as set by BrickMaster#set_stack_current_callback_threshold.
978
1087
  #
979
1088
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
980
1089
  def get_stack_current_callback_threshold
981
- send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1090
+ check_validity
1091
+
1092
+ send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
982
1093
  end
983
1094
 
984
1095
  # Sets the thresholds for the CALLBACK_STACK_VOLTAGE_REACHED callback.
@@ -993,18 +1104,20 @@ module Tinkerforge
993
1104
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
994
1105
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
995
1106
  #
996
- # The default value is ('x', 0, 0).
997
- #
998
1107
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
999
1108
  def set_stack_voltage_callback_threshold(option, min, max)
1000
- send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
1109
+ check_validity
1110
+
1111
+ send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
1001
1112
  end
1002
1113
 
1003
1114
  # Returns the threshold as set by BrickMaster#set_stack_voltage_callback_threshold.
1004
1115
  #
1005
1116
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1006
1117
  def get_stack_voltage_callback_threshold
1007
- send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1118
+ check_validity
1119
+
1120
+ send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
1008
1121
  end
1009
1122
 
1010
1123
  # Sets the thresholds for the CALLBACK_USB_VOLTAGE_REACHED callback.
@@ -1019,21 +1132,23 @@ module Tinkerforge
1019
1132
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
1020
1133
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
1021
1134
  #
1022
- # The default value is ('x', 0, 0).
1023
- #
1024
1135
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1025
1136
  def set_usb_voltage_callback_threshold(option, min, max)
1026
- send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
1137
+ check_validity
1138
+
1139
+ send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
1027
1140
  end
1028
1141
 
1029
1142
  # Returns the threshold as set by BrickMaster#set_usb_voltage_callback_threshold.
1030
1143
  #
1031
1144
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1032
1145
  def get_usb_voltage_callback_threshold
1033
- send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1146
+ check_validity
1147
+
1148
+ send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
1034
1149
  end
1035
1150
 
1036
- # Sets the period in ms with which the threshold callbacks
1151
+ # Sets the period with which the threshold callbacks
1037
1152
  #
1038
1153
  # * CALLBACK_STACK_CURRENT_REACHED,
1039
1154
  # * CALLBACK_STACK_VOLTAGE_REACHED,
@@ -1047,18 +1162,20 @@ module Tinkerforge
1047
1162
  #
1048
1163
  # keep being reached.
1049
1164
  #
1050
- # The default value is 100.
1051
- #
1052
1165
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1053
1166
  def set_debounce_period(debounce)
1054
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
1167
+ check_validity
1168
+
1169
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
1055
1170
  end
1056
1171
 
1057
1172
  # Returns the debounce period as set by BrickMaster#set_debounce_period.
1058
1173
  #
1059
1174
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1060
1175
  def get_debounce_period
1061
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
1176
+ check_validity
1177
+
1178
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
1062
1179
  end
1063
1180
 
1064
1181
  # Returns *true* if the Master Brick is at position 0 in the stack and an Ethernet
@@ -1066,7 +1183,9 @@ module Tinkerforge
1066
1183
  #
1067
1184
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1068
1185
  def is_ethernet_present
1069
- send_request FUNCTION_IS_ETHERNET_PRESENT, [], '', 1, '?'
1186
+ check_validity
1187
+
1188
+ send_request FUNCTION_IS_ETHERNET_PRESENT, [], '', 9, '?'
1070
1189
  end
1071
1190
 
1072
1191
  # Sets the configuration of the Ethernet Extension. Possible values for
@@ -1083,8 +1202,7 @@ module Tinkerforge
1083
1202
  # to the DHCP options then ``ip``, ``subnet_mask`` and ``gateway`` are ignored,
1084
1203
  # you can set them to 0.
1085
1204
  #
1086
- # The last parameter is the port that your program will connect to. The
1087
- # default port, that is used by brickd, is 4223.
1205
+ # The last parameter is the port that your program will connect to.
1088
1206
  #
1089
1207
  # The values are stored in the EEPROM and only applied on startup. That means
1090
1208
  # you have to restart the Master Brick after configuration.
@@ -1093,14 +1211,18 @@ module Tinkerforge
1093
1211
  #
1094
1212
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1095
1213
  def set_ethernet_configuration(connection, ip, subnet_mask, gateway, port)
1096
- send_request FUNCTION_SET_ETHERNET_CONFIGURATION, [connection, ip, subnet_mask, gateway, port], 'C C4 C4 C4 S', 0, ''
1214
+ check_validity
1215
+
1216
+ send_request FUNCTION_SET_ETHERNET_CONFIGURATION, [connection, ip, subnet_mask, gateway, port], 'C C4 C4 C4 S', 8, ''
1097
1217
  end
1098
1218
 
1099
1219
  # Returns the configuration as set by BrickMaster#set_ethernet_configuration.
1100
1220
  #
1101
1221
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1102
1222
  def get_ethernet_configuration
1103
- send_request FUNCTION_GET_ETHERNET_CONFIGURATION, [], '', 15, 'C C4 C4 C4 S'
1223
+ check_validity
1224
+
1225
+ send_request FUNCTION_GET_ETHERNET_CONFIGURATION, [], '', 23, 'C C4 C4 C4 S'
1104
1226
  end
1105
1227
 
1106
1228
  # Returns the status of the Ethernet Extension.
@@ -1115,7 +1237,9 @@ module Tinkerforge
1115
1237
  #
1116
1238
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1117
1239
  def get_ethernet_status
1118
- send_request FUNCTION_GET_ETHERNET_STATUS, [], '', 58, 'C6 C4 C4 C4 L L Z32'
1240
+ check_validity
1241
+
1242
+ send_request FUNCTION_GET_ETHERNET_STATUS, [], '', 66, 'C6 C4 C4 C4 L L Z32'
1119
1243
  end
1120
1244
 
1121
1245
  # Sets the hostname of the Ethernet Extension. The hostname will be displayed
@@ -1127,7 +1251,9 @@ module Tinkerforge
1127
1251
  #
1128
1252
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1129
1253
  def set_ethernet_hostname(hostname)
1130
- send_request FUNCTION_SET_ETHERNET_HOSTNAME, [hostname], 'Z32', 0, ''
1254
+ check_validity
1255
+
1256
+ send_request FUNCTION_SET_ETHERNET_HOSTNAME, [hostname], 'Z32', 8, ''
1131
1257
  end
1132
1258
 
1133
1259
  # Sets the MAC address of the Ethernet Extension. The Ethernet Extension should
@@ -1138,7 +1264,9 @@ module Tinkerforge
1138
1264
  #
1139
1265
  # .. versionadded:: 2.1.0$nbsp;(Firmware)
1140
1266
  def set_ethernet_mac_address(mac_address)
1141
- send_request FUNCTION_SET_ETHERNET_MAC_ADDRESS, [mac_address], 'C6', 0, ''
1267
+ check_validity
1268
+
1269
+ send_request FUNCTION_SET_ETHERNET_MAC_ADDRESS, [mac_address], 'C6', 8, ''
1142
1270
  end
1143
1271
 
1144
1272
  # Sets the Ethernet WebSocket configuration. The first parameter sets the number of socket
@@ -1154,18 +1282,20 @@ module Tinkerforge
1154
1282
  #
1155
1283
  # It is recommended to use the Brick Viewer to set the Ethernet configuration.
1156
1284
  #
1157
- # The default values are 3 for the socket connections and 4280 for the port.
1158
- #
1159
1285
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1160
1286
  def set_ethernet_websocket_configuration(sockets, port)
1161
- send_request FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION, [sockets, port], 'C S', 0, ''
1287
+ check_validity
1288
+
1289
+ send_request FUNCTION_SET_ETHERNET_WEBSOCKET_CONFIGURATION, [sockets, port], 'C S', 8, ''
1162
1290
  end
1163
1291
 
1164
1292
  # Returns the configuration as set by BrickMaster#set_ethernet_configuration.
1165
1293
  #
1166
1294
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1167
1295
  def get_ethernet_websocket_configuration
1168
- send_request FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION, [], '', 3, 'C S'
1296
+ check_validity
1297
+
1298
+ send_request FUNCTION_GET_ETHERNET_WEBSOCKET_CONFIGURATION, [], '', 11, 'C S'
1169
1299
  end
1170
1300
 
1171
1301
  # Sets the Ethernet authentication secret. The secret can be a string of up to 64
@@ -1183,7 +1313,9 @@ module Tinkerforge
1183
1313
  #
1184
1314
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1185
1315
  def set_ethernet_authentication_secret(secret)
1186
- send_request FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET, [secret], 'Z64', 0, ''
1316
+ check_validity
1317
+
1318
+ send_request FUNCTION_SET_ETHERNET_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
1187
1319
  end
1188
1320
 
1189
1321
  # Returns the authentication secret as set by
@@ -1191,7 +1323,9 @@ module Tinkerforge
1191
1323
  #
1192
1324
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1193
1325
  def get_ethernet_authentication_secret
1194
- send_request FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET, [], '', 64, 'Z64'
1326
+ check_validity
1327
+
1328
+ send_request FUNCTION_GET_ETHERNET_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
1195
1329
  end
1196
1330
 
1197
1331
  # Sets the WIFI authentication secret. The secret can be a string of up to 64
@@ -1209,7 +1343,9 @@ module Tinkerforge
1209
1343
  #
1210
1344
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1211
1345
  def set_wifi_authentication_secret(secret)
1212
- send_request FUNCTION_SET_WIFI_AUTHENTICATION_SECRET, [secret], 'Z64', 0, ''
1346
+ check_validity
1347
+
1348
+ send_request FUNCTION_SET_WIFI_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
1213
1349
  end
1214
1350
 
1215
1351
  # Returns the authentication secret as set by
@@ -1217,14 +1353,18 @@ module Tinkerforge
1217
1353
  #
1218
1354
  # .. versionadded:: 2.2.0$nbsp;(Firmware)
1219
1355
  def get_wifi_authentication_secret
1220
- send_request FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 64, 'Z64'
1356
+ check_validity
1357
+
1358
+ send_request FUNCTION_GET_WIFI_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
1221
1359
  end
1222
1360
 
1223
1361
  # Returns the type of the connection over which this function was called.
1224
1362
  #
1225
1363
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1226
1364
  def get_connection_type
1227
- send_request FUNCTION_GET_CONNECTION_TYPE, [], '', 1, 'C'
1365
+ check_validity
1366
+
1367
+ send_request FUNCTION_GET_CONNECTION_TYPE, [], '', 9, 'C'
1228
1368
  end
1229
1369
 
1230
1370
  # Returns *true* if the Master Brick is at position 0 in the stack and a WIFI
@@ -1232,7 +1372,9 @@ module Tinkerforge
1232
1372
  #
1233
1373
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1234
1374
  def is_wifi2_present
1235
- send_request FUNCTION_IS_WIFI2_PRESENT, [], '', 1, '?'
1375
+ check_validity
1376
+
1377
+ send_request FUNCTION_IS_WIFI2_PRESENT, [], '', 9, '?'
1236
1378
  end
1237
1379
 
1238
1380
  # Starts the bootloader of the WIFI Extension 2.0. Returns 0 on success.
@@ -1248,7 +1390,9 @@ module Tinkerforge
1248
1390
  #
1249
1391
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1250
1392
  def start_wifi2_bootloader
1251
- send_request FUNCTION_START_WIFI2_BOOTLOADER, [], '', 1, 'c'
1393
+ check_validity
1394
+
1395
+ send_request FUNCTION_START_WIFI2_BOOTLOADER, [], '', 9, 'c'
1252
1396
  end
1253
1397
 
1254
1398
  # Writes up to 60 bytes (number of bytes to be written specified by ``length``)
@@ -1263,7 +1407,9 @@ module Tinkerforge
1263
1407
  #
1264
1408
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1265
1409
  def write_wifi2_serial_port(data, length)
1266
- send_request FUNCTION_WRITE_WIFI2_SERIAL_PORT, [data, length], 'C60 C', 1, 'c'
1410
+ check_validity
1411
+
1412
+ send_request FUNCTION_WRITE_WIFI2_SERIAL_PORT, [data, length], 'C60 C', 9, 'c'
1267
1413
  end
1268
1414
 
1269
1415
  # Reads up to 60 bytes (number of bytes to be read specified by ``length``)
@@ -1278,7 +1424,9 @@ module Tinkerforge
1278
1424
  #
1279
1425
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1280
1426
  def read_wifi2_serial_port(length)
1281
- send_request FUNCTION_READ_WIFI2_SERIAL_PORT, [length], 'C', 61, 'C60 C'
1427
+ check_validity
1428
+
1429
+ send_request FUNCTION_READ_WIFI2_SERIAL_PORT, [length], 'C', 69, 'C60 C'
1282
1430
  end
1283
1431
 
1284
1432
  # Sets the WIFI authentication secret. The secret can be a string of up to 64
@@ -1296,7 +1444,9 @@ module Tinkerforge
1296
1444
  #
1297
1445
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1298
1446
  def set_wifi2_authentication_secret(secret)
1299
- send_request FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET, [secret], 'Z64', 0, ''
1447
+ check_validity
1448
+
1449
+ send_request FUNCTION_SET_WIFI2_AUTHENTICATION_SECRET, [secret], 'Z64', 8, ''
1300
1450
  end
1301
1451
 
1302
1452
  # Returns the WIFI authentication secret as set by
@@ -1304,22 +1454,24 @@ module Tinkerforge
1304
1454
  #
1305
1455
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1306
1456
  def get_wifi2_authentication_secret
1307
- send_request FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET, [], '', 64, 'Z64'
1457
+ check_validity
1458
+
1459
+ send_request FUNCTION_GET_WIFI2_AUTHENTICATION_SECRET, [], '', 72, 'Z64'
1308
1460
  end
1309
1461
 
1310
1462
  # Sets the general configuration of the WIFI Extension 2.0.
1311
1463
  #
1312
1464
  # The ``port`` parameter sets the port number that your programm will connect
1313
- # to. The default value is 4223.
1465
+ # to.
1314
1466
  #
1315
1467
  # The ``websocket_port`` parameter sets the WebSocket port number that your
1316
- # JavaScript programm will connect to. The default value is 4280.
1468
+ # JavaScript programm will connect to.
1317
1469
  #
1318
1470
  # The ``website_port`` parameter sets the port number for the website of the
1319
- # WIFI Extension 2.0. The default value is 80.
1471
+ # WIFI Extension 2.0.
1320
1472
  #
1321
1473
  # The ``phy_mode`` parameter sets the specific wireless network mode to be used.
1322
- # Possible values are B, G and N. The default value is G.
1474
+ # Possible values are B, G and N.
1323
1475
  #
1324
1476
  # The ``sleep_mode`` parameter is currently unused.
1325
1477
  #
@@ -1339,27 +1491,33 @@ module Tinkerforge
1339
1491
  #
1340
1492
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1341
1493
  def set_wifi2_configuration(port, websocket_port, website_port, phy_mode, sleep_mode, website)
1342
- send_request FUNCTION_SET_WIFI2_CONFIGURATION, [port, websocket_port, website_port, phy_mode, sleep_mode, website], 'S S S C C C', 0, ''
1494
+ check_validity
1495
+
1496
+ send_request FUNCTION_SET_WIFI2_CONFIGURATION, [port, websocket_port, website_port, phy_mode, sleep_mode, website], 'S S S C C C', 8, ''
1343
1497
  end
1344
1498
 
1345
1499
  # Returns the general configuration as set by BrickMaster#set_wifi2_configuration.
1346
1500
  #
1347
1501
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1348
1502
  def get_wifi2_configuration
1349
- send_request FUNCTION_GET_WIFI2_CONFIGURATION, [], '', 9, 'S S S C C C'
1503
+ check_validity
1504
+
1505
+ send_request FUNCTION_GET_WIFI2_CONFIGURATION, [], '', 17, 'S S S C C C'
1350
1506
  end
1351
1507
 
1352
1508
  # Returns the client and access point status of the WIFI Extension 2.0.
1353
1509
  #
1354
1510
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1355
1511
  def get_wifi2_status
1356
- send_request FUNCTION_GET_WIFI2_STATUS, [], '', 57, '? C C4 C4 C4 C6 L L c ? C4 C4 C4 C6 L L C'
1512
+ check_validity
1513
+
1514
+ send_request FUNCTION_GET_WIFI2_STATUS, [], '', 65, '? C C4 C4 C4 C6 L L c ? C4 C4 C4 C6 L L C'
1357
1515
  end
1358
1516
 
1359
1517
  # Sets the client specific configuration of the WIFI Extension 2.0.
1360
1518
  #
1361
1519
  # The ``enable`` parameter enables or disables the client part of the
1362
- # WIFI Extension 2.0. The default value is *true*.
1520
+ # WIFI Extension 2.0.
1363
1521
  #
1364
1522
  # The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point
1365
1523
  # to connect to.
@@ -1386,14 +1544,18 @@ module Tinkerforge
1386
1544
  #
1387
1545
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1388
1546
  def set_wifi2_client_configuration(enable, ssid, ip, subnet_mask, gateway, mac_address, bssid)
1389
- send_request FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, mac_address, bssid], '? Z32 C4 C4 C4 C6 C6', 0, ''
1547
+ check_validity
1548
+
1549
+ send_request FUNCTION_SET_WIFI2_CLIENT_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, mac_address, bssid], '? Z32 C4 C4 C4 C6 C6', 8, ''
1390
1550
  end
1391
1551
 
1392
1552
  # Returns the client configuration as set by BrickMaster#set_wifi2_client_configuration.
1393
1553
  #
1394
1554
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1395
1555
  def get_wifi2_client_configuration
1396
- send_request FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION, [], '', 57, '? Z32 C4 C4 C4 C6 C6'
1556
+ check_validity
1557
+
1558
+ send_request FUNCTION_GET_WIFI2_CLIENT_CONFIGURATION, [], '', 65, '? Z32 C4 C4 C4 C6 C6'
1397
1559
  end
1398
1560
 
1399
1561
  # Sets the client hostname (up to 32 characters) of the WIFI Extension 2.0. The
@@ -1408,14 +1570,18 @@ module Tinkerforge
1408
1570
  #
1409
1571
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1410
1572
  def set_wifi2_client_hostname(hostname)
1411
- send_request FUNCTION_SET_WIFI2_CLIENT_HOSTNAME, [hostname], 'Z32', 0, ''
1573
+ check_validity
1574
+
1575
+ send_request FUNCTION_SET_WIFI2_CLIENT_HOSTNAME, [hostname], 'Z32', 8, ''
1412
1576
  end
1413
1577
 
1414
1578
  # Returns the client hostname as set by BrickMaster#set_wifi2_client_hostname.
1415
1579
  #
1416
1580
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1417
1581
  def get_wifi2_client_hostname
1418
- send_request FUNCTION_GET_WIFI2_CLIENT_HOSTNAME, [], '', 32, 'Z32'
1582
+ check_validity
1583
+
1584
+ send_request FUNCTION_GET_WIFI2_CLIENT_HOSTNAME, [], '', 40, 'Z32'
1419
1585
  end
1420
1586
 
1421
1587
  # Sets the client password (up to 63 chars) for WPA/WPA2 encryption.
@@ -1428,7 +1594,9 @@ module Tinkerforge
1428
1594
  #
1429
1595
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1430
1596
  def set_wifi2_client_password(password)
1431
- send_request FUNCTION_SET_WIFI2_CLIENT_PASSWORD, [password], 'Z64', 0, ''
1597
+ check_validity
1598
+
1599
+ send_request FUNCTION_SET_WIFI2_CLIENT_PASSWORD, [password], 'Z64', 8, ''
1432
1600
  end
1433
1601
 
1434
1602
  # Returns the client password as set by BrickMaster#set_wifi2_client_password.
@@ -1439,13 +1607,15 @@ module Tinkerforge
1439
1607
  #
1440
1608
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1441
1609
  def get_wifi2_client_password
1442
- send_request FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 64, 'Z64'
1610
+ check_validity
1611
+
1612
+ send_request FUNCTION_GET_WIFI2_CLIENT_PASSWORD, [], '', 72, 'Z64'
1443
1613
  end
1444
1614
 
1445
1615
  # Sets the access point specific configuration of the WIFI Extension 2.0.
1446
1616
  #
1447
1617
  # The ``enable`` parameter enables or disables the access point part of the
1448
- # WIFI Extension 2.0. The default value is true.
1618
+ # WIFI Extension 2.0.
1449
1619
  #
1450
1620
  # The ``ssid`` parameter sets the SSID (up to 32 characters) of the access point.
1451
1621
  #
@@ -1455,15 +1625,13 @@ module Tinkerforge
1455
1625
  # The default configuration is DHCP.
1456
1626
  #
1457
1627
  # The ``encryption`` parameter sets the encryption mode to be used. Possible
1458
- # values are Open (no encryption), WEP or WPA/WPA2 PSK. The default value is
1459
- # WPA/WPA2 PSK. Use the BrickMaster#set_wifi2_ap_password function to set the encryption
1628
+ # values are Open (no encryption), WEP or WPA/WPA2 PSK.
1629
+ # Use the BrickMaster#set_wifi2_ap_password function to set the encryption
1460
1630
  # password.
1461
1631
  #
1462
1632
  # The ``hidden`` parameter makes the access point hide or show its SSID.
1463
- # The default value is *false*.
1464
1633
  #
1465
1634
  # The ``channel`` parameter sets the channel (1 to 13) of the access point.
1466
- # The default value is 1.
1467
1635
  #
1468
1636
  # If the ``mac_address`` parameter is set to all zero then the factory MAC
1469
1637
  # address is used. Otherwise this parameter can be used to set a custom MAC
@@ -1477,17 +1645,21 @@ module Tinkerforge
1477
1645
  #
1478
1646
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1479
1647
  def set_wifi2_ap_configuration(enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address)
1480
- send_request FUNCTION_SET_WIFI2_AP_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address], '? Z32 C4 C4 C4 C ? C C6', 0, ''
1648
+ check_validity
1649
+
1650
+ send_request FUNCTION_SET_WIFI2_AP_CONFIGURATION, [enable, ssid, ip, subnet_mask, gateway, encryption, hidden, channel, mac_address], '? Z32 C4 C4 C4 C ? C C6', 8, ''
1481
1651
  end
1482
1652
 
1483
1653
  # Returns the access point configuration as set by BrickMaster#set_wifi2_ap_configuration.
1484
1654
  #
1485
1655
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1486
1656
  def get_wifi2_ap_configuration
1487
- send_request FUNCTION_GET_WIFI2_AP_CONFIGURATION, [], '', 54, '? Z32 C4 C4 C4 C ? C C6'
1657
+ check_validity
1658
+
1659
+ send_request FUNCTION_GET_WIFI2_AP_CONFIGURATION, [], '', 62, '? Z32 C4 C4 C4 C ? C C6'
1488
1660
  end
1489
1661
 
1490
- # Sets the access point password (up to 63 chars) for the configured encryption
1662
+ # Sets the access point password (at least 8 and up to 63 chars) for the configured encryption
1491
1663
  # mode, see BrickMaster#set_wifi2_ap_configuration.
1492
1664
  #
1493
1665
  # To apply configuration changes to the WIFI Extension 2.0 the
@@ -1498,7 +1670,9 @@ module Tinkerforge
1498
1670
  #
1499
1671
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1500
1672
  def set_wifi2_ap_password(password)
1501
- send_request FUNCTION_SET_WIFI2_AP_PASSWORD, [password], 'Z64', 0, ''
1673
+ check_validity
1674
+
1675
+ send_request FUNCTION_SET_WIFI2_AP_PASSWORD, [password], 'Z64', 8, ''
1502
1676
  end
1503
1677
 
1504
1678
  # Returns the access point password as set by BrickMaster#set_wifi2_ap_password.
@@ -1509,7 +1683,9 @@ module Tinkerforge
1509
1683
  #
1510
1684
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1511
1685
  def get_wifi2_ap_password
1512
- send_request FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 64, 'Z64'
1686
+ check_validity
1687
+
1688
+ send_request FUNCTION_GET_WIFI2_AP_PASSWORD, [], '', 72, 'Z64'
1513
1689
  end
1514
1690
 
1515
1691
  # All configuration functions for the WIFI Extension 2.0 do not change the
@@ -1521,35 +1697,45 @@ module Tinkerforge
1521
1697
  #
1522
1698
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1523
1699
  def save_wifi2_configuration
1524
- send_request FUNCTION_SAVE_WIFI2_CONFIGURATION, [], '', 1, 'C'
1700
+ check_validity
1701
+
1702
+ send_request FUNCTION_SAVE_WIFI2_CONFIGURATION, [], '', 9, 'C'
1525
1703
  end
1526
1704
 
1527
- # Returns the current version of the WIFI Extension 2.0 firmware (major, minor, revision).
1705
+ # Returns the current version of the WIFI Extension 2.0 firmware.
1528
1706
  #
1529
1707
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1530
1708
  def get_wifi2_firmware_version
1531
- send_request FUNCTION_GET_WIFI2_FIRMWARE_VERSION, [], '', 3, 'C3'
1709
+ check_validity
1710
+
1711
+ send_request FUNCTION_GET_WIFI2_FIRMWARE_VERSION, [], '', 11, 'C3'
1532
1712
  end
1533
1713
 
1534
1714
  # Turns the green status LED of the WIFI Extension 2.0 on.
1535
1715
  #
1536
1716
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1537
1717
  def enable_wifi2_status_led
1538
- send_request FUNCTION_ENABLE_WIFI2_STATUS_LED, [], '', 0, ''
1718
+ check_validity
1719
+
1720
+ send_request FUNCTION_ENABLE_WIFI2_STATUS_LED, [], '', 8, ''
1539
1721
  end
1540
1722
 
1541
1723
  # Turns the green status LED of the WIFI Extension 2.0 off.
1542
1724
  #
1543
1725
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1544
1726
  def disable_wifi2_status_led
1545
- send_request FUNCTION_DISABLE_WIFI2_STATUS_LED, [], '', 0, ''
1727
+ check_validity
1728
+
1729
+ send_request FUNCTION_DISABLE_WIFI2_STATUS_LED, [], '', 8, ''
1546
1730
  end
1547
1731
 
1548
1732
  # Returns *true* if the green status LED of the WIFI Extension 2.0 is turned on.
1549
1733
  #
1550
1734
  # .. versionadded:: 2.4.0$nbsp;(Firmware)
1551
1735
  def is_wifi2_status_led_enabled
1552
- send_request FUNCTION_IS_WIFI2_STATUS_LED_ENABLED, [], '', 1, '?'
1736
+ check_validity
1737
+
1738
+ send_request FUNCTION_IS_WIFI2_STATUS_LED_ENABLED, [], '', 9, '?'
1553
1739
  end
1554
1740
 
1555
1741
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1557,7 +1743,7 @@ module Tinkerforge
1557
1743
  # Sets the mesh specific configuration of the WIFI Extension 2.0.
1558
1744
  #
1559
1745
  # The ``enable`` parameter enables or disables the mesh part of the
1560
- # WIFI Extension 2.0. The default value is *false*. The mesh part cannot be
1746
+ # WIFI Extension 2.0. The mesh part cannot be
1561
1747
  # enabled together with the client and access-point part.
1562
1748
  #
1563
1749
  # If the ``root_ip`` parameter is set to all zero then ``root_subnet_mask``
@@ -1586,7 +1772,9 @@ module Tinkerforge
1586
1772
  #
1587
1773
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1588
1774
  def set_wifi2_mesh_configuration(enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port)
1589
- send_request FUNCTION_SET_WIFI2_MESH_CONFIGURATION, [enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port], '? C4 C4 C4 C6 C6 Z16 C4 S', 0, ''
1775
+ check_validity
1776
+
1777
+ send_request FUNCTION_SET_WIFI2_MESH_CONFIGURATION, [enable, root_ip, root_subnet_mask, root_gateway, router_bssid, group_id, group_ssid_prefix, gateway_ip, gateway_port], '? C4 C4 C4 C6 C6 Z16 C4 S', 8, ''
1590
1778
  end
1591
1779
 
1592
1780
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1595,7 +1783,9 @@ module Tinkerforge
1595
1783
  #
1596
1784
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1597
1785
  def get_wifi2_mesh_configuration
1598
- send_request FUNCTION_GET_WIFI2_MESH_CONFIGURATION, [], '', 47, '? C4 C4 C4 C6 C6 Z16 C4 S'
1786
+ check_validity
1787
+
1788
+ send_request FUNCTION_GET_WIFI2_MESH_CONFIGURATION, [], '', 55, '? C4 C4 C4 C6 C6 Z16 C4 S'
1599
1789
  end
1600
1790
 
1601
1791
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1615,7 +1805,9 @@ module Tinkerforge
1615
1805
  #
1616
1806
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1617
1807
  def set_wifi2_mesh_router_ssid(ssid)
1618
- send_request FUNCTION_SET_WIFI2_MESH_ROUTER_SSID, [ssid], 'Z32', 0, ''
1808
+ check_validity
1809
+
1810
+ send_request FUNCTION_SET_WIFI2_MESH_ROUTER_SSID, [ssid], 'Z32', 8, ''
1619
1811
  end
1620
1812
 
1621
1813
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1624,7 +1816,9 @@ module Tinkerforge
1624
1816
  #
1625
1817
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1626
1818
  def get_wifi2_mesh_router_ssid
1627
- send_request FUNCTION_GET_WIFI2_MESH_ROUTER_SSID, [], '', 32, 'Z32'
1819
+ check_validity
1820
+
1821
+ send_request FUNCTION_GET_WIFI2_MESH_ROUTER_SSID, [], '', 40, 'Z32'
1628
1822
  end
1629
1823
 
1630
1824
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1640,7 +1834,9 @@ module Tinkerforge
1640
1834
  #
1641
1835
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1642
1836
  def set_wifi2_mesh_router_password(password)
1643
- send_request FUNCTION_SET_WIFI2_MESH_ROUTER_PASSWORD, [password], 'Z64', 0, ''
1837
+ check_validity
1838
+
1839
+ send_request FUNCTION_SET_WIFI2_MESH_ROUTER_PASSWORD, [password], 'Z64', 8, ''
1644
1840
  end
1645
1841
 
1646
1842
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1649,7 +1845,9 @@ module Tinkerforge
1649
1845
  #
1650
1846
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1651
1847
  def get_wifi2_mesh_router_password
1652
- send_request FUNCTION_GET_WIFI2_MESH_ROUTER_PASSWORD, [], '', 64, 'Z64'
1848
+ check_validity
1849
+
1850
+ send_request FUNCTION_GET_WIFI2_MESH_ROUTER_PASSWORD, [], '', 72, 'Z64'
1653
1851
  end
1654
1852
 
1655
1853
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1658,7 +1856,9 @@ module Tinkerforge
1658
1856
  #
1659
1857
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1660
1858
  def get_wifi2_mesh_common_status
1661
- send_request FUNCTION_GET_WIFI2_MESH_COMMON_STATUS, [], '', 13, 'C ? ? S L L'
1859
+ check_validity
1860
+
1861
+ send_request FUNCTION_GET_WIFI2_MESH_COMMON_STATUS, [], '', 21, 'C ? ? S L L'
1662
1862
  end
1663
1863
 
1664
1864
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1667,7 +1867,9 @@ module Tinkerforge
1667
1867
  #
1668
1868
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1669
1869
  def get_wifi2_mesh_client_status
1670
- send_request FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS, [], '', 50, 'Z32 C4 C4 C4 C6'
1870
+ check_validity
1871
+
1872
+ send_request FUNCTION_GET_WIFI2_MESH_CLIENT_STATUS, [], '', 58, 'Z32 C4 C4 C4 C6'
1671
1873
  end
1672
1874
 
1673
1875
  # Requires WIFI Extension 2.0 firmware 2.1.0.
@@ -1676,15 +1878,74 @@ module Tinkerforge
1676
1878
  #
1677
1879
  # .. versionadded:: 2.4.2$nbsp;(Firmware)
1678
1880
  def get_wifi2_mesh_ap_status
1679
- send_request FUNCTION_GET_WIFI2_MESH_AP_STATUS, [], '', 50, 'Z32 C4 C4 C4 C6'
1881
+ check_validity
1882
+
1883
+ send_request FUNCTION_GET_WIFI2_MESH_AP_STATUS, [], '', 58, 'Z32 C4 C4 C4 C6'
1884
+ end
1885
+
1886
+ # This function is for internal use to flash the initial
1887
+ # bootstrapper and bootloader to the Bricklets.
1888
+ #
1889
+ # If you need to flash a boostrapper/bootloader (for exmaple
1890
+ # because you made your own Bricklet from scratch) please
1891
+ # take a look at our open source flash and test tool at
1892
+ # `https://github.com/Tinkerforge/flash-test <https://github.com/Tinkerforge/flash-test>`__
1893
+ #
1894
+ # Don't use this function directly.
1895
+ #
1896
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1897
+ def set_bricklet_xmc_flash_config(config, parameter1, parameter2, data)
1898
+ check_validity
1899
+
1900
+ send_request FUNCTION_SET_BRICKLET_XMC_FLASH_CONFIG, [config, parameter1, parameter2, data], 'L L L C52', 72, 'L C60'
1901
+ end
1902
+
1903
+ # This function is for internal use to flash the initial
1904
+ # bootstrapper and bootloader to the Bricklets.
1905
+ #
1906
+ # If you need to flash a boostrapper/bootloader (for exmaple
1907
+ # because you made your own Bricklet from scratch) please
1908
+ # take a look at our open source flash and test tool at
1909
+ # `https://github.com/Tinkerforge/flash-test <https://github.com/Tinkerforge/flash-test>`__
1910
+ #
1911
+ # Don't use this function directly.
1912
+ #
1913
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1914
+ def set_bricklet_xmc_flash_data(data)
1915
+ check_validity
1916
+
1917
+ send_request FUNCTION_SET_BRICKLET_XMC_FLASH_DATA, [data], 'C64', 12, 'L'
1918
+ end
1919
+
1920
+ # This function is only available in Master Brick hardware version >= 3.0.
1921
+ #
1922
+ # Enables/disables all four Bricklets if set to true/false.
1923
+ #
1924
+ # If you disable the Bricklets the power supply to the Bricklets will be disconnected.
1925
+ # The Bricklets will lose all configurations if disabled.
1926
+ #
1927
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1928
+ def set_bricklets_enabled(bricklets_enabled)
1929
+ check_validity
1930
+
1931
+ send_request FUNCTION_SET_BRICKLETS_ENABLED, [bricklets_enabled], '?', 8, ''
1932
+ end
1933
+
1934
+ # Returns *true* if the Bricklets are enabled, *false* otherwise.
1935
+ #
1936
+ # .. versionadded:: 2.5.0$nbsp;(Firmware)
1937
+ def get_bricklets_enabled
1938
+ check_validity
1939
+
1940
+ send_request FUNCTION_GET_BRICKLETS_ENABLED, [], '', 9, '?'
1680
1941
  end
1681
1942
 
1682
1943
  # The SPITF protocol can be used with a dynamic baudrate. If the dynamic baudrate is
1683
1944
  # enabled, the Brick will try to adapt the baudrate for the communication
1684
1945
  # between Bricks and Bricklets according to the amount of data that is transferred.
1685
1946
  #
1686
- # The baudrate will be increased exponentially if lots of data is send/received and
1687
- # decreased linearly if little data is send/received.
1947
+ # The baudrate will be increased exponentially if lots of data is sent/received and
1948
+ # decreased linearly if little data is sent/received.
1688
1949
  #
1689
1950
  # This lowers the baudrate in applications where little data is transferred (e.g.
1690
1951
  # a weather station) and increases the robustness. If there is lots of data to transfer
@@ -1698,20 +1959,20 @@ module Tinkerforge
1698
1959
  # BrickMaster#set_spitfp_baudrate. If the dynamic baudrate is disabled, the baudrate
1699
1960
  # as set by BrickMaster#set_spitfp_baudrate will be used statically.
1700
1961
  #
1701
- # The minimum dynamic baudrate has a value range of 400000 to 2000000 baud.
1702
- #
1703
- # By default dynamic baudrate is enabled and the minimum dynamic baudrate is 400000.
1704
- #
1705
1962
  # .. versionadded:: 2.4.6$nbsp;(Firmware)
1706
1963
  def set_spitfp_baudrate_config(enable_dynamic_baudrate, minimum_dynamic_baudrate)
1707
- send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 0, ''
1964
+ check_validity
1965
+
1966
+ send_request FUNCTION_SET_SPITFP_BAUDRATE_CONFIG, [enable_dynamic_baudrate, minimum_dynamic_baudrate], '? L', 8, ''
1708
1967
  end
1709
1968
 
1710
1969
  # Returns the baudrate config, see BrickMaster#set_spitfp_baudrate_config.
1711
1970
  #
1712
1971
  # .. versionadded:: 2.4.6$nbsp;(Firmware)
1713
1972
  def get_spitfp_baudrate_config
1714
- send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 5, '? L'
1973
+ check_validity
1974
+
1975
+ send_request FUNCTION_GET_SPITFP_BAUDRATE_CONFIG, [], '', 13, '? L'
1715
1976
  end
1716
1977
 
1717
1978
  # Returns the timeout count for the different communication methods.
@@ -1723,11 +1984,12 @@ module Tinkerforge
1723
1984
  #
1724
1985
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1725
1986
  def get_send_timeout_count(communication_method)
1726
- send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 4, 'L'
1987
+ check_validity
1988
+
1989
+ send_request FUNCTION_GET_SEND_TIMEOUT_COUNT, [communication_method], 'C', 12, 'L'
1727
1990
  end
1728
1991
 
1729
- # Sets the baudrate for a specific Bricklet port ('a' - 'd'). The
1730
- # baudrate can be in the range 400000 to 2000000.
1992
+ # Sets the baudrate for a specific Bricklet port.
1731
1993
  #
1732
1994
  # If you want to increase the throughput of Bricklets you can increase
1733
1995
  # the baudrate. If you get a high error count because of high
@@ -1738,21 +2000,23 @@ module Tinkerforge
1738
2000
  # function corresponds to the maximum baudrate (see BrickMaster#set_spitfp_baudrate_config).
1739
2001
  #
1740
2002
  # Regulatory testing is done with the default baudrate. If CE compatibility
1741
- # or similar is necessary in you applications we recommend to not change
2003
+ # or similar is necessary in your applications we recommend to not change
1742
2004
  # the baudrate.
1743
2005
  #
1744
- # The default baudrate for all ports is 1400000.
1745
- #
1746
2006
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1747
2007
  def set_spitfp_baudrate(bricklet_port, baudrate)
1748
- send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 0, ''
2008
+ check_validity
2009
+
2010
+ send_request FUNCTION_SET_SPITFP_BAUDRATE, [bricklet_port, baudrate], 'k L', 8, ''
1749
2011
  end
1750
2012
 
1751
2013
  # Returns the baudrate for a given Bricklet port, see BrickMaster#set_spitfp_baudrate.
1752
2014
  #
1753
2015
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1754
2016
  def get_spitfp_baudrate(bricklet_port)
1755
- send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 4, 'L'
2017
+ check_validity
2018
+
2019
+ send_request FUNCTION_GET_SPITFP_BAUDRATE, [bricklet_port], 'k', 12, 'L'
1756
2020
  end
1757
2021
 
1758
2022
  # Returns the error count for the communication between Brick and Bricklet.
@@ -1769,7 +2033,9 @@ module Tinkerforge
1769
2033
  #
1770
2034
  # .. versionadded:: 2.4.3$nbsp;(Firmware)
1771
2035
  def get_spitfp_error_count(bricklet_port)
1772
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 16, 'L L L L'
2036
+ check_validity
2037
+
2038
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [bricklet_port], 'k', 24, 'L L L L'
1773
2039
  end
1774
2040
 
1775
2041
  # Enables the status LED.
@@ -1781,7 +2047,9 @@ module Tinkerforge
1781
2047
  #
1782
2048
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
1783
2049
  def enable_status_led
1784
- send_request FUNCTION_ENABLE_STATUS_LED, [], '', 0, ''
2050
+ check_validity
2051
+
2052
+ send_request FUNCTION_ENABLE_STATUS_LED, [], '', 8, ''
1785
2053
  end
1786
2054
 
1787
2055
  # Disables the status LED.
@@ -1793,14 +2061,18 @@ module Tinkerforge
1793
2061
  #
1794
2062
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
1795
2063
  def disable_status_led
1796
- send_request FUNCTION_DISABLE_STATUS_LED, [], '', 0, ''
2064
+ check_validity
2065
+
2066
+ send_request FUNCTION_DISABLE_STATUS_LED, [], '', 8, ''
1797
2067
  end
1798
2068
 
1799
2069
  # Returns *true* if the status LED is enabled, *false* otherwise.
1800
2070
  #
1801
2071
  # .. versionadded:: 2.3.2$nbsp;(Firmware)
1802
2072
  def is_status_led_enabled
1803
- send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 1, '?'
2073
+ check_validity
2074
+
2075
+ send_request FUNCTION_IS_STATUS_LED_ENABLED, [], '', 9, '?'
1804
2076
  end
1805
2077
 
1806
2078
  # Returns the firmware and protocol version and the name of the Bricklet for a
@@ -1809,17 +2081,21 @@ module Tinkerforge
1809
2081
  # This functions sole purpose is to allow automatic flashing of v1.x.y Bricklet
1810
2082
  # plugins.
1811
2083
  def get_protocol1_bricklet_name(port)
1812
- send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 44, 'C C3 Z40'
2084
+ check_validity
2085
+
2086
+ send_request FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, [port], 'k', 52, 'C C3 Z40'
1813
2087
  end
1814
2088
 
1815
- # Returns the temperature in °C/10 as measured inside the microcontroller. The
2089
+ # Returns the temperature as measured inside the microcontroller. The
1816
2090
  # value returned is not the ambient temperature!
1817
2091
  #
1818
2092
  # The temperature is only proportional to the real temperature and it has an
1819
- # accuracy of +-15%. Practically it is only useful as an indicator for
2093
+ # accuracy of ±15%. Practically it is only useful as an indicator for
1820
2094
  # temperature changes.
1821
2095
  def get_chip_temperature
1822
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
2096
+ check_validity
2097
+
2098
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
1823
2099
  end
1824
2100
 
1825
2101
  # Calling this function will reset the Brick. Calling this function
@@ -1829,19 +2105,43 @@ module Tinkerforge
1829
2105
  # calling functions on the existing ones will result in
1830
2106
  # undefined behavior!
1831
2107
  def reset
1832
- send_request FUNCTION_RESET, [], '', 0, ''
2108
+ check_validity
2109
+
2110
+ send_request FUNCTION_RESET, [], '', 8, ''
2111
+ end
2112
+
2113
+ # Writes 32 bytes of firmware to the bricklet attached at the given port.
2114
+ # The bytes are written to the position offset * 32.
2115
+ #
2116
+ # This function is used by Brick Viewer during flashing. It should not be
2117
+ # necessary to call it in a normal user program.
2118
+ def write_bricklet_plugin(port, offset, chunk)
2119
+ check_validity
2120
+
2121
+ send_request FUNCTION_WRITE_BRICKLET_PLUGIN, [port, offset, chunk], 'k C C32', 8, ''
2122
+ end
2123
+
2124
+ # Reads 32 bytes of firmware from the bricklet attached at the given port.
2125
+ # The bytes are read starting at the position offset * 32.
2126
+ #
2127
+ # This function is used by Brick Viewer during flashing. It should not be
2128
+ # necessary to call it in a normal user program.
2129
+ def read_bricklet_plugin(port, offset)
2130
+ check_validity
2131
+
2132
+ send_request FUNCTION_READ_BRICKLET_PLUGIN, [port, offset], 'k C', 40, 'C32'
1833
2133
  end
1834
2134
 
1835
2135
  # Returns the UID, the UID where the Brick is connected to,
1836
2136
  # the position, the hardware and firmware version as well as the
1837
2137
  # device identifier.
1838
2138
  #
1839
- # The position can be '0'-'8' (stack position).
2139
+ # The position is the position in the stack from '0' (bottom) to '8' (top).
1840
2140
  #
1841
2141
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
1842
2142
  # |device_identifier_constant|
1843
2143
  def get_identity
1844
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
2144
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
1845
2145
  end
1846
2146
 
1847
2147
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.