tinkerforge 2.1.24 → 2.1.25

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
  # Measures UV light
14
16
  class BrickletUVLight < Device
@@ -49,7 +51,7 @@ module Tinkerforge
49
51
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
50
52
  # the IP Connection <tt>ipcon</tt>.
51
53
  def initialize(uid, ipcon)
52
- super uid, ipcon
54
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
53
55
 
54
56
  @api_version = [2, 0, 0]
55
57
 
@@ -62,13 +64,14 @@ module Tinkerforge
62
64
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
65
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
64
66
 
65
- @callback_formats[CALLBACK_UV_LIGHT] = 'L'
66
- @callback_formats[CALLBACK_UV_LIGHT_REACHED] = 'L'
67
+ @callback_formats[CALLBACK_UV_LIGHT] = [12, 'L']
68
+ @callback_formats[CALLBACK_UV_LIGHT_REACHED] = [12, 'L']
67
69
 
70
+ @ipcon.add_device self
68
71
  end
69
72
 
70
- # Returns the UV light intensity of the sensor, the intensity is given
71
- # in 1/10 mW/m². The sensor has already weighted the intensity with the erythemal
73
+ # Returns the UV light intensity of the sensor.
74
+ # The sensor has already weighted the intensity with the erythemal
72
75
  # action spectrum to get the skin-affecting irradiation.
73
76
  #
74
77
  # To get UV index you just have to divide the value by 250. For example, a UV
@@ -78,7 +81,9 @@ module Tinkerforge
78
81
  # CALLBACK_UV_LIGHT callback and set the period with
79
82
  # BrickletUVLight#set_uv_light_callback_period.
80
83
  def get_uv_light
81
- send_request FUNCTION_GET_UV_LIGHT, [], '', 4, 'L'
84
+ check_validity
85
+
86
+ send_request FUNCTION_GET_UV_LIGHT, [], '', 12, 'L'
82
87
  end
83
88
 
84
89
  # Sets the period with which the CALLBACK_UV_LIGHT callback is triggered
@@ -87,12 +92,16 @@ module Tinkerforge
87
92
  # The CALLBACK_UV_LIGHT callback is only triggered if the intensity has changed since
88
93
  # the last triggering.
89
94
  def set_uv_light_callback_period(period)
90
- send_request FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 0, ''
95
+ check_validity
96
+
97
+ send_request FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 8, ''
91
98
  end
92
99
 
93
100
  # Returns the period as set by BrickletUVLight#set_uv_light_callback_period.
94
101
  def get_uv_light_callback_period
95
- send_request FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 4, 'L'
102
+ check_validity
103
+
104
+ send_request FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 12, 'L'
96
105
  end
97
106
 
98
107
  # Sets the thresholds for the CALLBACK_UV_LIGHT_REACHED callback.
@@ -106,15 +115,17 @@ module Tinkerforge
106
115
  # "'i'", "Callback is triggered when the intensity is *inside* the min and max values"
107
116
  # "'<'", "Callback is triggered when the intensity is smaller than the min value (max is ignored)"
108
117
  # "'>'", "Callback is triggered when the intensity is greater than the min value (max is ignored)"
109
- #
110
- # The default value is ('x', 0, 0).
111
118
  def set_uv_light_callback_threshold(option, min, max)
112
- send_request FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 0, ''
119
+ check_validity
120
+
121
+ send_request FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 8, ''
113
122
  end
114
123
 
115
124
  # Returns the threshold as set by BrickletUVLight#set_uv_light_callback_threshold.
116
125
  def get_uv_light_callback_threshold
117
- send_request FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 9, 'k L L'
126
+ check_validity
127
+
128
+ send_request FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 17, 'k L L'
118
129
  end
119
130
 
120
131
  # Sets the period with which the threshold callbacks
@@ -127,24 +138,31 @@ module Tinkerforge
127
138
  #
128
139
  # keep being reached.
129
140
  def set_debounce_period(debounce)
130
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
141
+ check_validity
142
+
143
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
131
144
  end
132
145
 
133
146
  # Returns the debounce period as set by BrickletUVLight#set_debounce_period.
134
147
  def get_debounce_period
135
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
148
+ check_validity
149
+
150
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
136
151
  end
137
152
 
138
153
  # Returns the UID, the UID where the Bricklet is connected to,
139
154
  # the position, the hardware and firmware version as well as the
140
155
  # device identifier.
141
156
  #
142
- # The position can be 'a', 'b', 'c' or 'd'.
157
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
158
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
159
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
160
+ # position 'z'.
143
161
  #
144
162
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
145
163
  # |device_identifier_constant|
146
164
  def get_identity
147
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
165
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
148
166
  end
149
167
 
150
168
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
  # Measures UV-A, UV-B and UV index
14
16
  class BrickletUVLightV2 < Device
@@ -86,7 +88,7 @@ module Tinkerforge
86
88
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
87
89
  # the IP Connection <tt>ipcon</tt>.
88
90
  def initialize(uid, ipcon)
89
- super uid, ipcon
91
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
90
92
 
91
93
  @api_version = [2, 0, 0]
92
94
 
@@ -114,14 +116,15 @@ module Tinkerforge
114
116
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
117
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
118
 
117
- @callback_formats[CALLBACK_UVA] = 'l'
118
- @callback_formats[CALLBACK_UVB] = 'l'
119
- @callback_formats[CALLBACK_UVI] = 'l'
119
+ @callback_formats[CALLBACK_UVA] = [12, 'l']
120
+ @callback_formats[CALLBACK_UVB] = [12, 'l']
121
+ @callback_formats[CALLBACK_UVI] = [12, 'l']
120
122
 
123
+ @ipcon.add_device self
121
124
  end
122
125
 
123
- # Returns the UVA intensity of the sensor, the intensity is given
124
- # in 1/10 mW/m². The sensor has not weighted the intensity with the erythemal
126
+ # Returns the UVA intensity of the sensor.
127
+ # The sensor has not weighted the intensity with the erythemal
125
128
  # action spectrum to get the skin-affecting irradiation. Therefore, you cannot
126
129
  # just divide the value by 250 to get the UVA index. To get the UV index use
127
130
  # BrickletUVLightV2#get_uvi.
@@ -137,7 +140,9 @@ module Tinkerforge
137
140
  # CALLBACK_UVA callback. You can set the callback configuration
138
141
  # with BrickletUVLightV2#set_uva_callback_configuration.
139
142
  def get_uva
140
- send_request FUNCTION_GET_UVA, [], '', 4, 'l'
143
+ check_validity
144
+
145
+ send_request FUNCTION_GET_UVA, [], '', 12, 'l'
141
146
  end
142
147
 
143
148
  # The period is the period with which the CALLBACK_UVA callback is triggered
@@ -166,16 +171,20 @@ module Tinkerforge
166
171
  #
167
172
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
168
173
  def set_uva_callback_configuration(period, value_has_to_change, option, min, max)
169
- send_request FUNCTION_SET_UVA_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
174
+ check_validity
175
+
176
+ send_request FUNCTION_SET_UVA_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
170
177
  end
171
178
 
172
179
  # Returns the callback configuration as set by BrickletUVLightV2#set_uva_callback_configuration.
173
180
  def get_uva_callback_configuration
174
- send_request FUNCTION_GET_UVA_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_UVA_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
175
184
  end
176
185
 
177
- # Returns the UVB intensity of the sensor, the intensity is given
178
- # in 1/10 mW/m². The sensor has not weighted the intensity with the erythemal
186
+ # Returns the UVB intensity of the sensor.
187
+ # The sensor has not weighted the intensity with the erythemal
179
188
  # action spectrum to get the skin-affecting irradiation. Therefore, you cannot
180
189
  # just divide the value by 250 to get the UVB index. To get the UV index use
181
190
  # BrickletUVLightV2#get_uvi.
@@ -191,7 +200,9 @@ module Tinkerforge
191
200
  # CALLBACK_UVB callback. You can set the callback configuration
192
201
  # with BrickletUVLightV2#set_uvb_callback_configuration.
193
202
  def get_uvb
194
- send_request FUNCTION_GET_UVB, [], '', 4, 'l'
203
+ check_validity
204
+
205
+ send_request FUNCTION_GET_UVB, [], '', 12, 'l'
195
206
  end
196
207
 
197
208
  # The period is the period with which the CALLBACK_UVB callback is triggered
@@ -220,12 +231,16 @@ module Tinkerforge
220
231
  #
221
232
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
222
233
  def set_uvb_callback_configuration(period, value_has_to_change, option, min, max)
223
- send_request FUNCTION_SET_UVB_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_UVB_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
224
237
  end
225
238
 
226
239
  # Returns the callback configuration as set by BrickletUVLightV2#set_uvb_callback_configuration.
227
240
  def get_uvb_callback_configuration
228
- send_request FUNCTION_GET_UVB_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_UVB_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
229
244
  end
230
245
 
231
246
  # Returns the UV index of the sensor, the index is given in 1/10.
@@ -241,7 +256,9 @@ module Tinkerforge
241
256
  # CALLBACK_UVI callback. You can set the callback configuration
242
257
  # with BrickletUVLightV2#set_uvi_callback_configuration.
243
258
  def get_uvi
244
- send_request FUNCTION_GET_UVI, [], '', 4, 'l'
259
+ check_validity
260
+
261
+ send_request FUNCTION_GET_UVI, [], '', 12, 'l'
245
262
  end
246
263
 
247
264
  # The period is the period with which the CALLBACK_UVI callback is triggered
@@ -270,12 +287,16 @@ module Tinkerforge
270
287
  #
271
288
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
272
289
  def set_uvi_callback_configuration(period, value_has_to_change, option, min, max)
273
- send_request FUNCTION_SET_UVI_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
290
+ check_validity
291
+
292
+ send_request FUNCTION_SET_UVI_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
274
293
  end
275
294
 
276
295
  # Returns the callback configuration as set by BrickletUVLightV2#set_uvi_callback_configuration.
277
296
  def get_uvi_callback_configuration
278
- send_request FUNCTION_GET_UVI_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
297
+ check_validity
298
+
299
+ send_request FUNCTION_GET_UVI_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
279
300
  end
280
301
 
281
302
  # Sets the configuration of the sensor. The integration time can be configured
@@ -286,15 +307,17 @@ module Tinkerforge
286
307
  # With a longer integration time (especially 800 ms) and a higher UV intensity the
287
308
  # sensor can be saturated. If this happens the UVA/UVB/UVI readings are all -1.
288
309
  # In this case you need to choose a shorter integration time.
289
- #
290
- # Default value: 400 ms.
291
310
  def set_configuration(integration_time)
292
- send_request FUNCTION_SET_CONFIGURATION, [integration_time], 'C', 0, ''
311
+ check_validity
312
+
313
+ send_request FUNCTION_SET_CONFIGURATION, [integration_time], 'C', 8, ''
293
314
  end
294
315
 
295
316
  # Returns the configuration as set by BrickletUVLightV2#set_configuration.
296
317
  def get_configuration
297
- send_request FUNCTION_GET_CONFIGURATION, [], '', 1, 'C'
318
+ check_validity
319
+
320
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 9, 'C'
298
321
  end
299
322
 
300
323
  # Returns the error count for the communication between Brick and Bricklet.
@@ -309,7 +332,9 @@ module Tinkerforge
309
332
  # The errors counts are for errors that occur on the Bricklet side. All
310
333
  # Bricks have a similar function that returns the errors on the Brick side.
311
334
  def get_spitfp_error_count
312
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
335
+ check_validity
336
+
337
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
313
338
  end
314
339
 
315
340
  # Sets the bootloader mode and returns the status after the requested
@@ -322,12 +347,16 @@ module Tinkerforge
322
347
  # This function is used by Brick Viewer during flashing. It should not be
323
348
  # necessary to call it in a normal user program.
324
349
  def set_bootloader_mode(mode)
325
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
350
+ check_validity
351
+
352
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
326
353
  end
327
354
 
328
355
  # Returns the current bootloader mode, see BrickletUVLightV2#set_bootloader_mode.
329
356
  def get_bootloader_mode
330
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
357
+ check_validity
358
+
359
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
331
360
  end
332
361
 
333
362
  # Sets the firmware pointer for BrickletUVLightV2#write_firmware. The pointer has
@@ -337,7 +366,9 @@ module Tinkerforge
337
366
  # This function is used by Brick Viewer during flashing. It should not be
338
367
  # necessary to call it in a normal user program.
339
368
  def set_write_firmware_pointer(pointer)
340
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
369
+ check_validity
370
+
371
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
341
372
  end
342
373
 
343
374
  # Writes 64 Bytes of firmware at the position as written by
@@ -349,7 +380,9 @@ module Tinkerforge
349
380
  # This function is used by Brick Viewer during flashing. It should not be
350
381
  # necessary to call it in a normal user program.
351
382
  def write_firmware(data)
352
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
383
+ check_validity
384
+
385
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
353
386
  end
354
387
 
355
388
  # Sets the status LED configuration. By default the LED shows
@@ -360,22 +393,28 @@ module Tinkerforge
360
393
  #
361
394
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
362
395
  def set_status_led_config(config)
363
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
396
+ check_validity
397
+
398
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
364
399
  end
365
400
 
366
401
  # Returns the configuration as set by BrickletUVLightV2#set_status_led_config
367
402
  def get_status_led_config
368
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
403
+ check_validity
404
+
405
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
369
406
  end
370
407
 
371
- # Returns the temperature in °C as measured inside the microcontroller. The
408
+ # Returns the temperature as measured inside the microcontroller. The
372
409
  # value returned is not the ambient temperature!
373
410
  #
374
411
  # The temperature is only proportional to the real temperature and it has bad
375
412
  # accuracy. Practically it is only useful as an indicator for
376
413
  # temperature changes.
377
414
  def get_chip_temperature
378
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
415
+ check_validity
416
+
417
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
379
418
  end
380
419
 
381
420
  # Calling this function will reset the Bricklet. All configurations
@@ -385,7 +424,9 @@ module Tinkerforge
385
424
  # calling functions on the existing ones will result in
386
425
  # undefined behavior!
387
426
  def reset
388
- send_request FUNCTION_RESET, [], '', 0, ''
427
+ check_validity
428
+
429
+ send_request FUNCTION_RESET, [], '', 8, ''
389
430
  end
390
431
 
391
432
  # Writes a new UID into flash. If you want to set a new UID
@@ -394,25 +435,32 @@ module Tinkerforge
394
435
  #
395
436
  # We recommend that you use Brick Viewer to change the UID.
396
437
  def write_uid(uid)
397
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
438
+ check_validity
439
+
440
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
398
441
  end
399
442
 
400
443
  # Returns the current UID as an integer. Encode as
401
444
  # Base58 to get the usual string version.
402
445
  def read_uid
403
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
446
+ check_validity
447
+
448
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
404
449
  end
405
450
 
406
451
  # Returns the UID, the UID where the Bricklet is connected to,
407
452
  # the position, the hardware and firmware version as well as the
408
453
  # device identifier.
409
454
  #
410
- # The position can be 'a', 'b', 'c' or 'd'.
455
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
456
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
457
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
458
+ # position 'z'.
411
459
  #
412
460
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
413
461
  # |device_identifier_constant|
414
462
  def get_identity
415
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
463
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
416
464
  end
417
465
 
418
466
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
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
  # Measures DC voltage between 0V and 50V
14
16
  class BrickletVoltage < Device
@@ -70,7 +72,7 @@ module Tinkerforge
70
72
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
71
73
  # the IP Connection <tt>ipcon</tt>.
72
74
  def initialize(uid, ipcon)
73
- super uid, ipcon
75
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
74
76
 
75
77
  @api_version = [2, 0, 1]
76
78
 
@@ -88,25 +90,26 @@ module Tinkerforge
88
90
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
 
91
- @callback_formats[CALLBACK_VOLTAGE] = 'S'
92
- @callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
93
- @callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
94
- @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
93
+ @callback_formats[CALLBACK_VOLTAGE] = [10, 'S']
94
+ @callback_formats[CALLBACK_ANALOG_VALUE] = [10, 'S']
95
+ @callback_formats[CALLBACK_VOLTAGE_REACHED] = [10, 'S']
96
+ @callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = [10, 'S']
95
97
 
98
+ @ipcon.add_device self
96
99
  end
97
100
 
98
- # Returns the voltage of the sensor. The value is in mV and
99
- # between 0mV and 50000mV.
101
+ # Returns the voltage of the sensor.
100
102
  #
101
103
  # If you want to get the voltage periodically, it is recommended to use the
102
104
  # CALLBACK_VOLTAGE callback and set the period with
103
105
  # BrickletVoltage#set_voltage_callback_period.
104
106
  def get_voltage
105
- send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
107
+ check_validity
108
+
109
+ send_request FUNCTION_GET_VOLTAGE, [], '', 10, 'S'
106
110
  end
107
111
 
108
112
  # Returns the value as read by a 12-bit analog-to-digital converter.
109
- # The value is between 0 and 4095.
110
113
  #
111
114
  # .. note::
112
115
  # The value returned by BrickletVoltage#get_voltage is averaged over several samples
@@ -118,7 +121,9 @@ module Tinkerforge
118
121
  # CALLBACK_ANALOG_VALUE callback and set the period with
119
122
  # BrickletVoltage#set_analog_value_callback_period.
120
123
  def get_analog_value
121
- send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
124
+ check_validity
125
+
126
+ send_request FUNCTION_GET_ANALOG_VALUE, [], '', 10, 'S'
122
127
  end
123
128
 
124
129
  # Sets the period with which the CALLBACK_VOLTAGE callback is triggered
@@ -127,12 +132,16 @@ module Tinkerforge
127
132
  # The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since
128
133
  # the last triggering.
129
134
  def set_voltage_callback_period(period)
130
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
135
+ check_validity
136
+
137
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 8, ''
131
138
  end
132
139
 
133
140
  # Returns the period as set by BrickletVoltage#set_voltage_callback_period.
134
141
  def get_voltage_callback_period
135
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
142
+ check_validity
143
+
144
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 12, 'L'
136
145
  end
137
146
 
138
147
  # Sets the period with which the CALLBACK_ANALOG_VALUE callback is triggered
@@ -141,12 +150,16 @@ module Tinkerforge
141
150
  # The CALLBACK_ANALOG_VALUE callback is only triggered if the analog value has
142
151
  # changed since the last triggering.
143
152
  def set_analog_value_callback_period(period)
144
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
153
+ check_validity
154
+
155
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 8, ''
145
156
  end
146
157
 
147
158
  # Returns the period as set by BrickletVoltage#set_analog_value_callback_period.
148
159
  def get_analog_value_callback_period
149
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
160
+ check_validity
161
+
162
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 12, 'L'
150
163
  end
151
164
 
152
165
  # Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
@@ -160,15 +173,17 @@ module Tinkerforge
160
173
  # "'i'", "Callback is triggered when the voltage is *inside* the min and max values"
161
174
  # "'<'", "Callback is triggered when the voltage is smaller than the min value (max is ignored)"
162
175
  # "'>'", "Callback is triggered when the voltage is greater than the min value (max is ignored)"
163
- #
164
- # The default value is ('x', 0, 0).
165
176
  def set_voltage_callback_threshold(option, min, max)
166
- send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
177
+ check_validity
178
+
179
+ send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
167
180
  end
168
181
 
169
182
  # Returns the threshold as set by BrickletVoltage#set_voltage_callback_threshold.
170
183
  def get_voltage_callback_threshold
171
- send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
184
+ check_validity
185
+
186
+ send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
172
187
  end
173
188
 
174
189
  # Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
@@ -182,15 +197,17 @@ module Tinkerforge
182
197
  # "'i'", "Callback is triggered when the analog value is *inside* the min and max values"
183
198
  # "'<'", "Callback is triggered when the analog value is smaller than the min value (max is ignored)"
184
199
  # "'>'", "Callback is triggered when the analog value is greater than the min value (max is ignored)"
185
- #
186
- # The default value is ('x', 0, 0).
187
200
  def set_analog_value_callback_threshold(option, min, max)
188
- send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
201
+ check_validity
202
+
203
+ send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
189
204
  end
190
205
 
191
206
  # Returns the threshold as set by BrickletVoltage#set_analog_value_callback_threshold.
192
207
  def get_analog_value_callback_threshold
193
- send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
208
+ check_validity
209
+
210
+ send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
194
211
  end
195
212
 
196
213
  # Sets the period with which the threshold callbacks
@@ -205,24 +222,31 @@ module Tinkerforge
205
222
  #
206
223
  # keep being reached.
207
224
  def set_debounce_period(debounce)
208
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
225
+ check_validity
226
+
227
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
209
228
  end
210
229
 
211
230
  # Returns the debounce period as set by BrickletVoltage#set_debounce_period.
212
231
  def get_debounce_period
213
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
232
+ check_validity
233
+
234
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
214
235
  end
215
236
 
216
237
  # Returns the UID, the UID where the Bricklet is connected to,
217
238
  # the position, the hardware and firmware version as well as the
218
239
  # device identifier.
219
240
  #
220
- # The position can be 'a', 'b', 'c' or 'd'.
241
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
242
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
243
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
244
+ # position 'z'.
221
245
  #
222
246
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
223
247
  # |device_identifier_constant|
224
248
  def get_identity
225
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
249
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
226
250
  end
227
251
 
228
252
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.