tinkerforge 2.1.23 → 2.1.24

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 (141) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +2 -2
  3. data/lib/tinkerforge/brick_hat.rb +45 -4
  4. data/lib/tinkerforge/brick_hat_zero.rb +69 -3
  5. data/lib/tinkerforge/brick_imu.rb +8 -10
  6. data/lib/tinkerforge/brick_imu_v2.rb +12 -14
  7. data/lib/tinkerforge/brick_master.rb +6 -14
  8. data/lib/tinkerforge/brick_red.rb +2 -2
  9. data/lib/tinkerforge/brick_servo.rb +2 -2
  10. data/lib/tinkerforge/brick_silent_stepper.rb +3 -3
  11. data/lib/tinkerforge/brick_stepper.rb +3 -3
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +7 -16
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +18 -24
  14. data/lib/tinkerforge/bricklet_air_quality.rb +13 -23
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +14 -27
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +4 -8
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +3 -5
  18. data/lib/tinkerforge/bricklet_analog_in.rb +6 -22
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +6 -22
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +4 -9
  21. data/lib/tinkerforge/bricklet_analog_out.rb +5 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +4 -4
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +4 -4
  24. data/lib/tinkerforge/bricklet_barometer.rb +10 -33
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +13 -32
  26. data/lib/tinkerforge/bricklet_can.rb +3 -7
  27. data/lib/tinkerforge/bricklet_can_v2.rb +8 -40
  28. data/lib/tinkerforge/bricklet_co2.rb +5 -13
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +24 -24
  30. data/lib/tinkerforge/bricklet_color.rb +9 -22
  31. data/lib/tinkerforge/bricklet_color_v2.rb +7 -16
  32. data/lib/tinkerforge/bricklet_compass.rb +6 -12
  33. data/lib/tinkerforge/bricklet_current12.rb +6 -18
  34. data/lib/tinkerforge/bricklet_current25.rb +6 -18
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +6 -17
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +5 -16
  37. data/lib/tinkerforge/bricklet_distance_us.rb +6 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +4 -10
  39. data/lib/tinkerforge/bricklet_dmx.rb +7 -16
  40. data/lib/tinkerforge/bricklet_dual_button.rb +2 -4
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +3 -7
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +3 -5
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +6 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +30 -33
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +11 -15
  46. data/lib/tinkerforge/bricklet_gps.rb +11 -24
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +10 -28
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +3 -7
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +8 -19
  50. data/lib/tinkerforge/bricklet_humidity.rb +6 -19
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +6 -20
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +6 -6
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +6 -13
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +4 -22
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +9 -9
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +5 -13
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +3 -3
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +5 -8
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +6 -15
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +4 -16
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +5 -13
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +4 -11
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +5 -7
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +3 -3
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +3 -5
  66. data/lib/tinkerforge/bricklet_io16.rb +5 -13
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +6 -16
  68. data/lib/tinkerforge/bricklet_io4.rb +4 -10
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +16 -23
  70. data/lib/tinkerforge/bricklet_isolator.rb +44 -11
  71. data/lib/tinkerforge/bricklet_joystick.rb +7 -19
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +6 -11
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +8 -29
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +6 -17
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +30 -63
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +7 -9
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +4 -8
  78. data/lib/tinkerforge/bricklet_led_strip.rb +12 -27
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +17 -4
  80. data/lib/tinkerforge/bricklet_line.rb +4 -10
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +5 -16
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +3 -5
  83. data/lib/tinkerforge/bricklet_load_cell.rb +6 -19
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +4 -13
  85. data/lib/tinkerforge/bricklet_moisture.rb +6 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +3 -7
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +3 -7
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +2 -6
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +3 -13
  91. data/lib/tinkerforge/bricklet_nfc.rb +6 -20
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +2 -2
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +4 -8
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +12 -18
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +4 -8
  96. data/lib/tinkerforge/bricklet_one_wire.rb +2 -2
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +16 -16
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +13 -9
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +3 -6
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +3 -11
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +8 -18
  102. data/lib/tinkerforge/bricklet_ptc.rb +5 -11
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +4 -8
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +3 -5
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +3 -5
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +2 -2
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +2 -2
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +2 -2
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +2 -2
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +2 -2
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +4 -8
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +3 -5
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +5 -11
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +3 -5
  116. data/lib/tinkerforge/bricklet_rs232.rb +2 -2
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +6 -5
  118. data/lib/tinkerforge/bricklet_rs485.rb +30 -71
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +3 -3
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +2 -2
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +4 -8
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +8 -12
  125. data/lib/tinkerforge/bricklet_temperature.rb +6 -14
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +7 -26
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +6 -19
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +4 -8
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +16 -26
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +4 -8
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +3 -5
  132. data/lib/tinkerforge/bricklet_tilt.rb +2 -2
  133. data/lib/tinkerforge/bricklet_uv_light.rb +4 -8
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +5 -11
  135. data/lib/tinkerforge/bricklet_voltage.rb +5 -11
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +6 -14
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +5 -11
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +4 -8
  139. data/lib/tinkerforge/ip_connection.rb +3 -0
  140. data/lib/tinkerforge/version.rb +1 -1
  141. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd64988900a2ab596ea927820dc04695bc91f1b194cbf6cb35e85ec89014f26c
4
- data.tar.gz: 658c988980986bed5dad437fd81d2ad7c39b109cbdc0bdb946b3706d4baf18e3
3
+ metadata.gz: '079f652eea712eed74c2d5cd78a755758a697e3f1f56d494f27d380cedceb20f'
4
+ data.tar.gz: cca1e723fa33b5f5b7359c4b9a369f781a0607656dd8e2099f8df92556232066
5
5
  SHA512:
6
- metadata.gz: 8a5c039bbbecf10223b7e7c47beae80a3123cf0297a2e4c74066ed45495bcebb6d04e468bcbafe50dcc4be43e23b38fcd94dbabb1adad8e5b6f7b06c6c387a79
7
- data.tar.gz: 31d3663aea0a113e769a4bfd49383e7c638944f424ee3a729ebec9aecdac9db3912a1d7d387770d4db9224d8b0c6fe0fa9566592866a5004585368867507df9b
6
+ metadata.gz: 668fbf0aac5f208792cad08bbc3428d7b6d6cc06f11abe636938a6a85c9e140dd722343a3d268e83ffee90b28ec5d55815651d935dfe9ecdd82f012f8c1f23e4
7
+ data.tar.gz: 15f365b69eeda8a8b07d54a2422a08036b1bc4f8d6a40090dd4360c53afe3bee77170cc3d563f6b8d28c6d86fd9395da5c6e2790357dd6c36b17cf3de1749406
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2019-11-25. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.24 #
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 #
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2019-11-25. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.24 #
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 #
@@ -15,11 +15,21 @@ module Tinkerforge
15
15
  DEVICE_IDENTIFIER = 111 # :nodoc:
16
16
  DEVICE_DISPLAY_NAME = 'HAT Brick' # :nodoc:
17
17
 
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickHAT#set_voltages_callback_configuration.
20
+ #
21
+ # The parameters are the same as BrickHAT#get_voltages.
22
+ #
23
+ # .. versionadded:: 2.0.1$nbsp;(Firmware)
24
+ CALLBACK_VOLTAGES = 8
25
+
18
26
  FUNCTION_SET_SLEEP_MODE = 1 # :nodoc:
19
27
  FUNCTION_GET_SLEEP_MODE = 2 # :nodoc:
20
28
  FUNCTION_SET_BRICKLET_POWER = 3 # :nodoc:
21
29
  FUNCTION_GET_BRICKLET_POWER = 4 # :nodoc:
22
30
  FUNCTION_GET_VOLTAGES = 5 # :nodoc:
31
+ FUNCTION_SET_VOLTAGES_CALLBACK_CONFIGURATION = 6 # :nodoc:
32
+ FUNCTION_GET_VOLTAGES_CALLBACK_CONFIGURATION = 7 # :nodoc:
23
33
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
24
34
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
25
35
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -54,13 +64,15 @@ module Tinkerforge
54
64
  def initialize(uid, ipcon)
55
65
  super uid, ipcon
56
66
 
57
- @api_version = [2, 0, 0]
67
+ @api_version = [2, 0, 1]
58
68
 
59
69
  @response_expected[FUNCTION_SET_SLEEP_MODE] = RESPONSE_EXPECTED_FALSE
60
70
  @response_expected[FUNCTION_GET_SLEEP_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
61
71
  @response_expected[FUNCTION_SET_BRICKLET_POWER] = RESPONSE_EXPECTED_FALSE
62
72
  @response_expected[FUNCTION_GET_BRICKLET_POWER] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
73
  @response_expected[FUNCTION_GET_VOLTAGES] = RESPONSE_EXPECTED_ALWAYS_TRUE
74
+ @response_expected[FUNCTION_SET_VOLTAGES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
75
+ @response_expected[FUNCTION_GET_VOLTAGES_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
64
76
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
65
77
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
66
78
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -74,6 +86,7 @@ module Tinkerforge
74
86
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
75
87
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
76
88
 
89
+ @callback_formats[CALLBACK_VOLTAGES] = 'S S'
77
90
 
78
91
  end
79
92
 
@@ -81,7 +94,7 @@ module Tinkerforge
81
94
  #
82
95
  # .. note::
83
96
  # Calling this function will cut the Raspberry Pi's power after Power Off Delay seconds.
84
- # You have to shut down the Operating System yourself, e.g. by calling 'sudo shutdown -h now'.
97
+ # You have to shut down the operating system yourself, e.g. by calling 'sudo shutdown -h now'.
85
98
  #
86
99
  # Parameters:
87
100
  #
@@ -138,6 +151,29 @@ module Tinkerforge
138
151
  send_request FUNCTION_GET_VOLTAGES, [], '', 4, 'S S'
139
152
  end
140
153
 
154
+ # The period is the period with which the CALLBACK_VOLTAGES
155
+ # callback is triggered periodically. A value of 0 turns the callback off.
156
+ #
157
+ # If the `value has to change`-parameter is set to true, the callback is only
158
+ # triggered after the value has changed. If the value didn't change within the
159
+ # period, the callback is triggered immediately on change.
160
+ #
161
+ # If it is set to false, the callback is continuously triggered with the period,
162
+ # independent of the value.
163
+ #
164
+ # .. versionadded:: 2.0.1$nbsp;(Firmware)
165
+ def set_voltages_callback_configuration(period, value_has_to_change)
166
+ send_request FUNCTION_SET_VOLTAGES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
167
+ end
168
+
169
+ # Returns the callback configuration as set by
170
+ # BrickHAT#set_voltages_callback_configuration.
171
+ #
172
+ # .. versionadded:: 2.0.1$nbsp;(Firmware)
173
+ def get_voltages_callback_configuration
174
+ send_request FUNCTION_GET_VOLTAGES_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
175
+ end
176
+
141
177
  # Returns the error count for the communication between Brick and Bricklet.
142
178
  #
143
179
  # The errors are divided into
@@ -256,5 +292,10 @@ module Tinkerforge
256
292
  send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
257
293
  end
258
294
 
295
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
296
+ def register_callback(id, &block)
297
+ callback = block
298
+ @registered_callbacks[id] = callback
299
+ end
259
300
  end
260
301
  end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2019-11-25. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.24 #
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 #
@@ -15,7 +15,17 @@ module Tinkerforge
15
15
  DEVICE_IDENTIFIER = 112 # :nodoc:
16
16
  DEVICE_DISPLAY_NAME = 'HAT Zero Brick' # :nodoc:
17
17
 
18
+ # This callback is triggered periodically according to the configuration set by
19
+ # BrickHATZero#set_usb_voltage_callback_configuration.
20
+ #
21
+ # The parameter is the same as BrickHATZero#get_usb_voltage.
22
+ #
23
+ # .. versionadded:: 2.0.1$nbsp;(Firmware)
24
+ CALLBACK_USB_VOLTAGE = 4
25
+
18
26
  FUNCTION_GET_USB_VOLTAGE = 1 # :nodoc:
27
+ FUNCTION_SET_USB_VOLTAGE_CALLBACK_CONFIGURATION = 2 # :nodoc:
28
+ FUNCTION_GET_USB_VOLTAGE_CALLBACK_CONFIGURATION = 3 # :nodoc:
19
29
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
20
30
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
21
31
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -29,6 +39,11 @@ module Tinkerforge
29
39
  FUNCTION_READ_UID = 249 # :nodoc:
30
40
  FUNCTION_GET_IDENTITY = 255 # :nodoc:
31
41
 
42
+ THRESHOLD_OPTION_OFF = 'x' # :nodoc:
43
+ THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
44
+ THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
45
+ THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
46
+ THRESHOLD_OPTION_GREATER = '>' # :nodoc:
32
47
  BOOTLOADER_MODE_BOOTLOADER = 0 # :nodoc:
33
48
  BOOTLOADER_MODE_FIRMWARE = 1 # :nodoc:
34
49
  BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT = 2 # :nodoc:
@@ -50,9 +65,11 @@ module Tinkerforge
50
65
  def initialize(uid, ipcon)
51
66
  super uid, ipcon
52
67
 
53
- @api_version = [2, 0, 0]
68
+ @api_version = [2, 0, 1]
54
69
 
55
70
  @response_expected[FUNCTION_GET_USB_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
71
+ @response_expected[FUNCTION_SET_USB_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
72
+ @response_expected[FUNCTION_GET_USB_VOLTAGE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
56
73
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
57
74
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
58
75
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -66,14 +83,58 @@ module Tinkerforge
66
83
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
67
84
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
68
85
 
86
+ @callback_formats[CALLBACK_USB_VOLTAGE] = 'S'
69
87
 
70
88
  end
71
89
 
72
90
  # Returns the USB supply voltage of the Raspberry Pi in mV.
91
+ #
92
+ #
93
+ # If you want to get the value periodically, it is recommended to use the
94
+ # CALLBACK_USB_VOLTAGE callback. You can set the callback configuration
95
+ # with BrickHATZero#set_usb_voltage_callback_configuration.
73
96
  def get_usb_voltage
74
97
  send_request FUNCTION_GET_USB_VOLTAGE, [], '', 2, 'S'
75
98
  end
76
99
 
100
+ # The period is the period with which the CALLBACK_USB_VOLTAGE callback is triggered
101
+ # periodically. A value of 0 turns the callback off.
102
+ #
103
+ # If the `value has to change`-parameter is set to true, the callback is only
104
+ # triggered after the value has changed. If the value didn't change
105
+ # within the period, the callback is triggered immediately on change.
106
+ #
107
+ # If it is set to false, the callback is continuously triggered with the period,
108
+ # independent of the value.
109
+ #
110
+ # It is furthermore possible to constrain the callback with thresholds.
111
+ #
112
+ # The `option`-parameter together with min/max sets a threshold for the CALLBACK_USB_VOLTAGE callback.
113
+ #
114
+ # The following options are possible:
115
+ #
116
+ # "Option", "Description"
117
+ #
118
+ # "'x'", "Threshold is turned off"
119
+ # "'o'", "Threshold is triggered when the value is *outside* the min and max values"
120
+ # "'i'", "Threshold is triggered when the value is *inside* or equal to the min and max values"
121
+ # "'<'", "Threshold is triggered when the value is smaller than the min value (max is ignored)"
122
+ # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
123
+ #
124
+ # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
125
+ #
126
+ # .. versionadded:: 2.0.1$nbsp;(Firmware)
127
+ def set_usb_voltage_callback_configuration(period, value_has_to_change, option, min, max)
128
+ send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
129
+ end
130
+
131
+ # Returns the callback configuration as set by BrickHATZero#set_usb_voltage_callback_configuration.
132
+ #
133
+ # .. versionadded:: 2.0.1$nbsp;(Firmware)
134
+ def get_usb_voltage_callback_configuration
135
+ send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
136
+ end
137
+
77
138
  # Returns the error count for the communication between Brick and Bricklet.
78
139
  #
79
140
  # The errors are divided into
@@ -192,5 +253,10 @@ module Tinkerforge
192
253
  send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
193
254
  end
194
255
 
256
+ # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
257
+ def register_callback(id, &block)
258
+ callback = block
259
+ @registered_callbacks[id] = callback
260
+ end
195
261
  end
196
262
  end
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2019-11-25. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.24 #
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 #
@@ -386,10 +386,8 @@ module Tinkerforge
386
386
  send_request FUNCTION_GET_CALIBRATION, [typ], 'C', 20, 's10'
387
387
  end
388
388
 
389
- # Sets the period in ms with which the CALLBACK_ACCELERATION callback is triggered
389
+ # Sets the period with which the CALLBACK_ACCELERATION callback is triggered
390
390
  # periodically. A value of 0 turns the callback off.
391
- #
392
- # The default value is 0.
393
391
  def set_acceleration_period(period)
394
392
  send_request FUNCTION_SET_ACCELERATION_PERIOD, [period], 'L', 0, ''
395
393
  end
@@ -399,7 +397,7 @@ module Tinkerforge
399
397
  send_request FUNCTION_GET_ACCELERATION_PERIOD, [], '', 4, 'L'
400
398
  end
401
399
 
402
- # Sets the period in ms with which the CALLBACK_MAGNETIC_FIELD callback is
400
+ # Sets the period with which the CALLBACK_MAGNETIC_FIELD callback is
403
401
  # triggered periodically. A value of 0 turns the callback off.
404
402
  def set_magnetic_field_period(period)
405
403
  send_request FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 0, ''
@@ -410,7 +408,7 @@ module Tinkerforge
410
408
  send_request FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 4, 'L'
411
409
  end
412
410
 
413
- # Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
411
+ # Sets the period with which the CALLBACK_ANGULAR_VELOCITY callback is
414
412
  # triggered periodically. A value of 0 turns the callback off.
415
413
  def set_angular_velocity_period(period)
416
414
  send_request FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, ''
@@ -421,7 +419,7 @@ module Tinkerforge
421
419
  send_request FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 4, 'L'
422
420
  end
423
421
 
424
- # Sets the period in ms with which the CALLBACK_ALL_DATA callback is triggered
422
+ # Sets the period with which the CALLBACK_ALL_DATA callback is triggered
425
423
  # periodically. A value of 0 turns the callback off.
426
424
  def set_all_data_period(period)
427
425
  send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 0, ''
@@ -432,7 +430,7 @@ module Tinkerforge
432
430
  send_request FUNCTION_GET_ALL_DATA_PERIOD, [], '', 4, 'L'
433
431
  end
434
432
 
435
- # Sets the period in ms with which the CALLBACK_ORIENTATION callback is triggered
433
+ # Sets the period with which the CALLBACK_ORIENTATION callback is triggered
436
434
  # periodically. A value of 0 turns the callback off.
437
435
  def set_orientation_period(period)
438
436
  send_request FUNCTION_SET_ORIENTATION_PERIOD, [period], 'L', 0, ''
@@ -443,7 +441,7 @@ module Tinkerforge
443
441
  send_request FUNCTION_GET_ORIENTATION_PERIOD, [], '', 4, 'L'
444
442
  end
445
443
 
446
- # Sets the period in ms with which the CALLBACK_QUATERNION callback is triggered
444
+ # Sets the period with which the CALLBACK_QUATERNION callback is triggered
447
445
  # periodically. A value of 0 turns the callback off.
448
446
  def set_quaternion_period(period)
449
447
  send_request FUNCTION_SET_QUATERNION_PERIOD, [period], 'L', 0, ''
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2019-11-25. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.24 #
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 #
@@ -315,7 +315,7 @@ module Tinkerforge
315
315
  # Returns the current orientation (w, x, y, z) of the IMU Brick as
316
316
  # `quaternions <https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>`__.
317
317
  #
318
- # You have to divide the returns values by 16383 (14 bit) to get
318
+ # You have to divide the return values by 16383 (14 bit) to get
319
319
  # the usual range of -1.0 to +1.0 for quaternions.
320
320
  #
321
321
  # If you want to get the quaternions periodically, it is recommended
@@ -389,10 +389,8 @@ module Tinkerforge
389
389
  send_request FUNCTION_SAVE_CALIBRATION, [], '', 1, '?'
390
390
  end
391
391
 
392
- # Sets the period in ms with which the CALLBACK_ACCELERATION callback is triggered
392
+ # Sets the period with which the CALLBACK_ACCELERATION callback is triggered
393
393
  # periodically. A value of 0 turns the callback off.
394
- #
395
- # The default value is 0.
396
394
  def set_acceleration_period(period)
397
395
  send_request FUNCTION_SET_ACCELERATION_PERIOD, [period], 'L', 0, ''
398
396
  end
@@ -402,7 +400,7 @@ module Tinkerforge
402
400
  send_request FUNCTION_GET_ACCELERATION_PERIOD, [], '', 4, 'L'
403
401
  end
404
402
 
405
- # Sets the period in ms with which the CALLBACK_MAGNETIC_FIELD callback is triggered
403
+ # Sets the period with which the CALLBACK_MAGNETIC_FIELD callback is triggered
406
404
  # periodically. A value of 0 turns the callback off.
407
405
  def set_magnetic_field_period(period)
408
406
  send_request FUNCTION_SET_MAGNETIC_FIELD_PERIOD, [period], 'L', 0, ''
@@ -413,7 +411,7 @@ module Tinkerforge
413
411
  send_request FUNCTION_GET_MAGNETIC_FIELD_PERIOD, [], '', 4, 'L'
414
412
  end
415
413
 
416
- # Sets the period in ms with which the CALLBACK_ANGULAR_VELOCITY callback is
414
+ # Sets the period with which the CALLBACK_ANGULAR_VELOCITY callback is
417
415
  # triggered periodically. A value of 0 turns the callback off.
418
416
  def set_angular_velocity_period(period)
419
417
  send_request FUNCTION_SET_ANGULAR_VELOCITY_PERIOD, [period], 'L', 0, ''
@@ -424,7 +422,7 @@ module Tinkerforge
424
422
  send_request FUNCTION_GET_ANGULAR_VELOCITY_PERIOD, [], '', 4, 'L'
425
423
  end
426
424
 
427
- # Sets the period in ms with which the CALLBACK_TEMPERATURE callback is triggered
425
+ # Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
428
426
  # periodically. A value of 0 turns the callback off.
429
427
  def set_temperature_period(period)
430
428
  send_request FUNCTION_SET_TEMPERATURE_PERIOD, [period], 'L', 0, ''
@@ -435,7 +433,7 @@ module Tinkerforge
435
433
  send_request FUNCTION_GET_TEMPERATURE_PERIOD, [], '', 4, 'L'
436
434
  end
437
435
 
438
- # Sets the period in ms with which the CALLBACK_ORIENTATION callback is triggered
436
+ # Sets the period with which the CALLBACK_ORIENTATION callback is triggered
439
437
  # periodically. A value of 0 turns the callback off.
440
438
  def set_orientation_period(period)
441
439
  send_request FUNCTION_SET_ORIENTATION_PERIOD, [period], 'L', 0, ''
@@ -446,7 +444,7 @@ module Tinkerforge
446
444
  send_request FUNCTION_GET_ORIENTATION_PERIOD, [], '', 4, 'L'
447
445
  end
448
446
 
449
- # Sets the period in ms with which the CALLBACK_LINEAR_ACCELERATION callback is
447
+ # Sets the period with which the CALLBACK_LINEAR_ACCELERATION callback is
450
448
  # triggered periodically. A value of 0 turns the callback off.
451
449
  def set_linear_acceleration_period(period)
452
450
  send_request FUNCTION_SET_LINEAR_ACCELERATION_PERIOD, [period], 'L', 0, ''
@@ -457,7 +455,7 @@ module Tinkerforge
457
455
  send_request FUNCTION_GET_LINEAR_ACCELERATION_PERIOD, [], '', 4, 'L'
458
456
  end
459
457
 
460
- # Sets the period in ms with which the CALLBACK_GRAVITY_VECTOR callback is triggered
458
+ # Sets the period with which the CALLBACK_GRAVITY_VECTOR callback is triggered
461
459
  # periodically. A value of 0 turns the callback off.
462
460
  def set_gravity_vector_period(period)
463
461
  send_request FUNCTION_SET_GRAVITY_VECTOR_PERIOD, [period], 'L', 0, ''
@@ -468,7 +466,7 @@ module Tinkerforge
468
466
  send_request FUNCTION_GET_GRAVITY_VECTOR_PERIOD, [], '', 4, 'L'
469
467
  end
470
468
 
471
- # Sets the period in ms with which the CALLBACK_QUATERNION callback is triggered
469
+ # Sets the period with which the CALLBACK_QUATERNION callback is triggered
472
470
  # periodically. A value of 0 turns the callback off.
473
471
  def set_quaternion_period(period)
474
472
  send_request FUNCTION_SET_QUATERNION_PERIOD, [period], 'L', 0, ''
@@ -479,7 +477,7 @@ module Tinkerforge
479
477
  send_request FUNCTION_GET_QUATERNION_PERIOD, [], '', 4, 'L'
480
478
  end
481
479
 
482
- # Sets the period in ms with which the CALLBACK_ALL_DATA callback is triggered
480
+ # Sets the period with which the CALLBACK_ALL_DATA callback is triggered
483
481
  # periodically. A value of 0 turns the callback off.
484
482
  def set_all_data_period(period)
485
483
  send_request FUNCTION_SET_ALL_DATA_PERIOD, [period], 'L', 0, ''
@@ -1,8 +1,8 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2019-11-25. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.24 #
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 #
@@ -895,14 +895,12 @@ module Tinkerforge
895
895
  send_request FUNCTION_GET_WIFI_HOSTNAME, [], '', 16, 'Z16'
896
896
  end
897
897
 
898
- # Sets the period in ms with which the CALLBACK_STACK_CURRENT callback is triggered
898
+ # Sets the period with which the CALLBACK_STACK_CURRENT callback is triggered
899
899
  # periodically. A value of 0 turns the callback off.
900
900
  #
901
901
  # The CALLBACK_STACK_CURRENT callback is only triggered if the current has changed
902
902
  # since the last triggering.
903
903
  #
904
- # The default value is 0.
905
- #
906
904
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
907
905
  def set_stack_current_callback_period(period)
908
906
  send_request FUNCTION_SET_STACK_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
@@ -915,14 +913,12 @@ module Tinkerforge
915
913
  send_request FUNCTION_GET_STACK_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
916
914
  end
917
915
 
918
- # Sets the period in ms with which the CALLBACK_STACK_VOLTAGE callback is triggered
916
+ # Sets the period with which the CALLBACK_STACK_VOLTAGE callback is triggered
919
917
  # periodically. A value of 0 turns the callback off.
920
918
  #
921
919
  # The CALLBACK_STACK_VOLTAGE callback is only triggered if the voltage has changed
922
920
  # since the last triggering.
923
921
  #
924
- # The default value is 0.
925
- #
926
922
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
927
923
  def set_stack_voltage_callback_period(period)
928
924
  send_request FUNCTION_SET_STACK_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
@@ -935,14 +931,12 @@ module Tinkerforge
935
931
  send_request FUNCTION_GET_STACK_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
936
932
  end
937
933
 
938
- # Sets the period in ms with which the CALLBACK_USB_VOLTAGE callback is triggered
934
+ # Sets the period with which the CALLBACK_USB_VOLTAGE callback is triggered
939
935
  # periodically. A value of 0 turns the callback off.
940
936
  #
941
937
  # The CALLBACK_USB_VOLTAGE callback is only triggered if the voltage has changed
942
938
  # since the last triggering.
943
939
  #
944
- # The default value is 0.
945
- #
946
940
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
947
941
  def set_usb_voltage_callback_period(period)
948
942
  send_request FUNCTION_SET_USB_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
@@ -1033,7 +1027,7 @@ module Tinkerforge
1033
1027
  send_request FUNCTION_GET_USB_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
1034
1028
  end
1035
1029
 
1036
- # Sets the period in ms with which the threshold callbacks
1030
+ # Sets the period with which the threshold callbacks
1037
1031
  #
1038
1032
  # * CALLBACK_STACK_CURRENT_REACHED,
1039
1033
  # * CALLBACK_STACK_VOLTAGE_REACHED,
@@ -1047,8 +1041,6 @@ module Tinkerforge
1047
1041
  #
1048
1042
  # keep being reached.
1049
1043
  #
1050
- # The default value is 100.
1051
- #
1052
1044
  # .. versionadded:: 2.0.5$nbsp;(Firmware)
1053
1045
  def set_debounce_period(debounce)
1054
1046
  send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''