tinkerforge 2.1.22 → 2.1.27

Sign up to get free protection for your applications and to get access to all the features.
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
  # Measures air pressure and altitude changes
14
16
  class BrickletBarometer < Device
@@ -64,6 +66,8 @@ module Tinkerforge
64
66
  FUNCTION_GET_REFERENCE_AIR_PRESSURE = 19 # :nodoc:
65
67
  FUNCTION_SET_AVERAGING = 20 # :nodoc:
66
68
  FUNCTION_GET_AVERAGING = 21 # :nodoc:
69
+ FUNCTION_SET_I2C_MODE = 22 # :nodoc:
70
+ FUNCTION_GET_I2C_MODE = 23 # :nodoc:
67
71
  FUNCTION_GET_IDENTITY = 255 # :nodoc:
68
72
 
69
73
  THRESHOLD_OPTION_OFF = 'x' # :nodoc:
@@ -71,13 +75,15 @@ module Tinkerforge
71
75
  THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
72
76
  THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
73
77
  THRESHOLD_OPTION_GREATER = '>' # :nodoc:
78
+ I2C_MODE_FAST = 0 # :nodoc:
79
+ I2C_MODE_SLOW = 1 # :nodoc:
74
80
 
75
81
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
76
82
  # the IP Connection <tt>ipcon</tt>.
77
83
  def initialize(uid, ipcon)
78
- super uid, ipcon
84
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
79
85
 
80
- @api_version = [2, 0, 1]
86
+ @api_version = [2, 0, 2]
81
87
 
82
88
  @response_expected[FUNCTION_GET_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
83
89
  @response_expected[FUNCTION_GET_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -96,67 +102,76 @@ module Tinkerforge
96
102
  @response_expected[FUNCTION_GET_REFERENCE_AIR_PRESSURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
97
103
  @response_expected[FUNCTION_SET_AVERAGING] = RESPONSE_EXPECTED_FALSE
98
104
  @response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
105
+ @response_expected[FUNCTION_SET_I2C_MODE] = RESPONSE_EXPECTED_FALSE
106
+ @response_expected[FUNCTION_GET_I2C_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
99
107
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
108
 
101
- @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
102
- @callback_formats[CALLBACK_ALTITUDE] = 'l'
103
- @callback_formats[CALLBACK_AIR_PRESSURE_REACHED] = 'l'
104
- @callback_formats[CALLBACK_ALTITUDE_REACHED] = 'l'
109
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
110
+ @callback_formats[CALLBACK_ALTITUDE] = [12, 'l']
111
+ @callback_formats[CALLBACK_AIR_PRESSURE_REACHED] = [12, 'l']
112
+ @callback_formats[CALLBACK_ALTITUDE_REACHED] = [12, 'l']
105
113
 
114
+ @ipcon.add_device self
106
115
  end
107
116
 
108
- # Returns the air pressure of the air pressure sensor. The value
109
- # has a range of 10000 to 1200000 and is given in mbar/1000, i.e. a value
110
- # of 1001092 means that an air pressure of 1001.092 mbar is measured.
117
+ # Returns the air pressure of the air pressure sensor.
111
118
  #
112
119
  # If you want to get the air pressure periodically, it is recommended to use the
113
120
  # CALLBACK_AIR_PRESSURE callback and set the period with
114
121
  # BrickletBarometer#set_air_pressure_callback_period.
115
122
  def get_air_pressure
116
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
123
+ check_validity
124
+
125
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
117
126
  end
118
127
 
119
- # Returns the relative altitude of the air pressure sensor. The value is given in
120
- # cm and is calculated based on the difference between the current air pressure
128
+ # Returns the relative altitude of the air pressure sensor. The value is
129
+ # calculated based on the difference between the current air pressure
121
130
  # and the reference air pressure that can be set with BrickletBarometer#set_reference_air_pressure.
122
131
  #
123
132
  # If you want to get the altitude periodically, it is recommended to use the
124
133
  # CALLBACK_ALTITUDE callback and set the period with
125
134
  # BrickletBarometer#set_altitude_callback_period.
126
135
  def get_altitude
127
- send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
136
+ check_validity
137
+
138
+ send_request FUNCTION_GET_ALTITUDE, [], '', 12, 'l'
128
139
  end
129
140
 
130
- # Sets the period in ms with which the CALLBACK_AIR_PRESSURE callback is triggered
141
+ # Sets the period with which the CALLBACK_AIR_PRESSURE callback is triggered
131
142
  # periodically. A value of 0 turns the callback off.
132
143
  #
133
144
  # The CALLBACK_AIR_PRESSURE callback is only triggered if the air pressure has
134
145
  # changed since the last triggering.
135
- #
136
- # The default value is 0.
137
146
  def set_air_pressure_callback_period(period)
138
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 0, ''
147
+ check_validity
148
+
149
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD, [period], 'L', 8, ''
139
150
  end
140
151
 
141
152
  # Returns the period as set by BrickletBarometer#set_air_pressure_callback_period.
142
153
  def get_air_pressure_callback_period
143
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 4, 'L'
154
+ check_validity
155
+
156
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD, [], '', 12, 'L'
144
157
  end
145
158
 
146
- # Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
159
+ # Sets the period with which the CALLBACK_ALTITUDE callback is triggered
147
160
  # periodically. A value of 0 turns the callback off.
148
161
  #
149
162
  # The CALLBACK_ALTITUDE callback is only triggered if the altitude has changed since
150
163
  # the last triggering.
151
- #
152
- # The default value is 0.
153
164
  def set_altitude_callback_period(period)
154
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
165
+ check_validity
166
+
167
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 8, ''
155
168
  end
156
169
 
157
170
  # Returns the period as set by BrickletBarometer#set_altitude_callback_period.
158
171
  def get_altitude_callback_period
159
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
172
+ check_validity
173
+
174
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 12, 'L'
160
175
  end
161
176
 
162
177
  # Sets the thresholds for the CALLBACK_AIR_PRESSURE_REACHED callback.
@@ -170,15 +185,17 @@ module Tinkerforge
170
185
  # "'i'", "Callback is triggered when the air pressure is *inside* the min and max values"
171
186
  # "'<'", "Callback is triggered when the air pressure is smaller than the min value (max is ignored)"
172
187
  # "'>'", "Callback is triggered when the air pressure is greater than the min value (max is ignored)"
173
- #
174
- # The default value is ('x', 0, 0).
175
188
  def set_air_pressure_callback_threshold(option, min, max)
176
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
189
+ check_validity
190
+
191
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
177
192
  end
178
193
 
179
194
  # Returns the threshold as set by BrickletBarometer#set_air_pressure_callback_threshold.
180
195
  def get_air_pressure_callback_threshold
181
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
182
199
  end
183
200
 
184
201
  # Sets the thresholds for the CALLBACK_ALTITUDE_REACHED callback.
@@ -192,18 +209,20 @@ module Tinkerforge
192
209
  # "'i'", "Callback is triggered when the altitude is *inside* the min and max values"
193
210
  # "'<'", "Callback is triggered when the altitude is smaller than the min value (max is ignored)"
194
211
  # "'>'", "Callback is triggered when the altitude is greater than the min value (max is ignored)"
195
- #
196
- # The default value is ('x', 0, 0).
197
212
  def set_altitude_callback_threshold(option, min, max)
198
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
213
+ check_validity
214
+
215
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
199
216
  end
200
217
 
201
218
  # Returns the threshold as set by BrickletBarometer#set_altitude_callback_threshold.
202
219
  def get_altitude_callback_threshold
203
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
220
+ check_validity
221
+
222
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
204
223
  end
205
224
 
206
- # Sets the period in ms with which the threshold callbacks
225
+ # Sets the period with which the threshold callbacks
207
226
  #
208
227
  # * CALLBACK_AIR_PRESSURE_REACHED,
209
228
  # * CALLBACK_ALTITUDE_REACHED
@@ -214,19 +233,20 @@ module Tinkerforge
214
233
  # * BrickletBarometer#set_altitude_callback_threshold
215
234
  #
216
235
  # keep being reached.
217
- #
218
- # The default value is 100.
219
236
  def set_debounce_period(debounce)
220
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
237
+ check_validity
238
+
239
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
221
240
  end
222
241
 
223
242
  # Returns the debounce period as set by BrickletBarometer#set_debounce_period.
224
243
  def get_debounce_period
225
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
244
+ check_validity
245
+
246
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
226
247
  end
227
248
 
228
- # Sets the reference air pressure in mbar/1000 for the altitude calculation.
229
- # Valid values are between 10000 and 1200000.
249
+ # Sets the reference air pressure for the altitude calculation.
230
250
  # Setting the reference to the current air pressure results in a calculated
231
251
  # altitude of 0cm. Passing 0 is a shortcut for passing the current air pressure as
232
252
  # reference.
@@ -235,26 +255,28 @@ module Tinkerforge
235
255
  # `QNH <https://en.wikipedia.org/wiki/QNH>`__ and
236
256
  # `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
237
257
  # used in aviation.
238
- #
239
- # The default value is 1013.25mbar.
240
258
  def set_reference_air_pressure(air_pressure)
241
- send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
259
+ check_validity
260
+
261
+ send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 8, ''
242
262
  end
243
263
 
244
- # Returns the temperature of the air pressure sensor. The value
245
- # has a range of -4000 to 8500 and is given in °C/100, i.e. a value
246
- # of 2007 means that a temperature of 20.07 °C is measured.
264
+ # Returns the temperature of the air pressure sensor.
247
265
  #
248
266
  # This temperature is used internally for temperature compensation of the air
249
267
  # pressure measurement. It is not as accurate as the temperature measured by the
250
268
  # :ref:`temperature_bricklet` or the :ref:`temperature_ir_bricklet`.
251
269
  def get_chip_temperature
252
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
270
+ check_validity
271
+
272
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
253
273
  end
254
274
 
255
275
  # Returns the reference air pressure as set by BrickletBarometer#set_reference_air_pressure.
256
276
  def get_reference_air_pressure
257
- send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
277
+ check_validity
278
+
279
+ send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 12, 'l'
258
280
  end
259
281
 
260
282
  # Sets the different averaging parameters. It is possible to set
@@ -264,40 +286,68 @@ module Tinkerforge
264
286
  # for the pressure. The moving average is calculated from the normal
265
287
  # averages. There is no moving average for the temperature.
266
288
  #
267
- # The maximum length for the pressure average is 10, for the
268
- # temperature average is 255 and for the moving average is 25.
269
- #
270
289
  # Setting the all three parameters to 0 will turn the averaging
271
290
  # completely off. If the averaging is off, there is lots of noise
272
291
  # on the data, but the data is without delay. Thus we recommend
273
292
  # to turn the averaging off if the Barometer Bricklet data is
274
293
  # to be used for sensor fusion with other sensors.
275
294
  #
276
- # The default values are 10 for the normal averages and 25 for the
277
- # moving average.
278
- #
279
295
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
280
296
  def set_averaging(moving_average_pressure, average_pressure, average_temperature)
281
- send_request FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 0, ''
297
+ check_validity
298
+
299
+ send_request FUNCTION_SET_AVERAGING, [moving_average_pressure, average_pressure, average_temperature], 'C C C', 8, ''
282
300
  end
283
301
 
284
302
  # Returns the averaging configuration as set by BrickletBarometer#set_averaging.
285
303
  #
286
304
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
287
305
  def get_averaging
288
- send_request FUNCTION_GET_AVERAGING, [], '', 3, 'C C C'
306
+ check_validity
307
+
308
+ send_request FUNCTION_GET_AVERAGING, [], '', 11, 'C C C'
309
+ end
310
+
311
+ # Sets the I2C mode. Possible modes are:
312
+ #
313
+ # * 0: Fast (400kHz)
314
+ # * 1: Slow (100kHz)
315
+ #
316
+ # If you have problems with obvious outliers in the
317
+ # Barometer Bricklet measurements, they may be caused by EMI issues.
318
+ # In this case it may be helpful to lower the I2C speed.
319
+ #
320
+ # It is however not recommended to lower the I2C speed in applications where
321
+ # a high throughput needs to be achieved.
322
+ #
323
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
324
+ def set_i2c_mode(mode)
325
+ check_validity
326
+
327
+ send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 8, ''
328
+ end
329
+
330
+ # Returns the I2C mode as set by BrickletBarometer#set_i2c_mode.
331
+ #
332
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
333
+ def get_i2c_mode
334
+ check_validity
335
+
336
+ send_request FUNCTION_GET_I2C_MODE, [], '', 9, 'C'
289
337
  end
290
338
 
291
339
  # Returns the UID, the UID where the Bricklet is connected to,
292
340
  # the position, the hardware and firmware version as well as the
293
341
  # device identifier.
294
342
  #
295
- # The position can be 'a', 'b', 'c' or 'd'.
343
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
344
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
345
+ # position 'z'.
296
346
  #
297
347
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
298
348
  # |device_identifier_constant|
299
349
  def get_identity
300
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
350
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
301
351
  end
302
352
 
303
353
  # 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-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
  # Measures air pressure and altitude changes
14
16
  class BrickletBarometerV2 < Device
@@ -96,7 +98,7 @@ module Tinkerforge
96
98
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
97
99
  # the IP Connection <tt>ipcon</tt>.
98
100
  def initialize(uid, ipcon)
99
- super uid, ipcon
101
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
100
102
 
101
103
  @api_version = [2, 0, 0]
102
104
 
@@ -130,25 +132,26 @@ module Tinkerforge
130
132
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
133
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
134
 
133
- @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
134
- @callback_formats[CALLBACK_ALTITUDE] = 'l'
135
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
135
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
136
+ @callback_formats[CALLBACK_ALTITUDE] = [12, 'l']
137
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
136
138
 
139
+ @ipcon.add_device self
137
140
  end
138
141
 
139
- # Returns the measured air pressure. The value has a range of
140
- # 260000 to 1260000 and is given in mbar/1000, i.e. a value of
141
- # 1001092 means that an air pressure of 1001.092 mbar is measured.
142
+ # Returns the measured air pressure.
142
143
  #
143
144
  #
144
145
  # If you want to get the value periodically, it is recommended to use the
145
146
  # CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
146
147
  # with BrickletBarometerV2#set_air_pressure_callback_configuration.
147
148
  def get_air_pressure
148
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
149
152
  end
150
153
 
151
- # The period in ms is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
154
+ # The period is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
152
155
  # periodically. A value of 0 turns the callback off.
153
156
  #
154
157
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -173,19 +176,21 @@ module Tinkerforge
173
176
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
174
177
  #
175
178
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
176
- #
177
- # The default value is (0, false, 'x', 0, 0).
178
179
  def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
179
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
180
183
  end
181
184
 
182
185
  # Returns the callback configuration as set by BrickletBarometerV2#set_air_pressure_callback_configuration.
183
186
  def get_air_pressure_callback_configuration
184
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
185
190
  end
186
191
 
187
192
  # Returns the relative altitude of the air pressure sensor. The value
188
- # is given in mm and is calculated based on the difference between the
193
+ # is calculated based on the difference between the
189
194
  # current air pressure and the reference air pressure that can be set
190
195
  # with BrickletBarometerV2#set_reference_air_pressure.
191
196
  #
@@ -194,10 +199,12 @@ module Tinkerforge
194
199
  # CALLBACK_ALTITUDE callback. You can set the callback configuration
195
200
  # with BrickletBarometerV2#set_altitude_callback_configuration.
196
201
  def get_altitude
197
- send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
202
+ check_validity
203
+
204
+ send_request FUNCTION_GET_ALTITUDE, [], '', 12, 'l'
198
205
  end
199
206
 
200
- # The period in ms is the period with which the CALLBACK_ALTITUDE callback is triggered
207
+ # The period is the period with which the CALLBACK_ALTITUDE callback is triggered
201
208
  # periodically. A value of 0 turns the callback off.
202
209
  #
203
210
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -222,20 +229,20 @@ module Tinkerforge
222
229
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
223
230
  #
224
231
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
225
- #
226
- # The default value is (0, false, 'x', 0, 0).
227
232
  def set_altitude_callback_configuration(period, value_has_to_change, option, min, max)
228
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
233
+ check_validity
234
+
235
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
229
236
  end
230
237
 
231
238
  # Returns the callback configuration as set by BrickletBarometerV2#set_altitude_callback_configuration.
232
239
  def get_altitude_callback_configuration
233
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
240
+ check_validity
241
+
242
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
234
243
  end
235
244
 
236
- # Returns the temperature of the air pressure sensor. The value
237
- # has a range of -4000 to 8500 and is given in °C/100, i.e. a value
238
- # of 2007 means that a temperature of 20.07 °C is measured.
245
+ # Returns the temperature of the air pressure sensor.
239
246
  #
240
247
  # This temperature is used internally for temperature compensation
241
248
  # of the air pressure measurement. It is not as accurate as the
@@ -247,10 +254,12 @@ module Tinkerforge
247
254
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
248
255
  # with BrickletBarometerV2#set_temperature_callback_configuration.
249
256
  def get_temperature
250
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
257
+ check_validity
258
+
259
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
251
260
  end
252
261
 
253
- # The period in ms is the period with which the CALLBACK_TEMPERATURE callback is triggered
262
+ # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
254
263
  # periodically. A value of 0 turns the callback off.
255
264
  #
256
265
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -275,15 +284,17 @@ module Tinkerforge
275
284
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
276
285
  #
277
286
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
278
- #
279
- # The default value is (0, false, 'x', 0, 0).
280
287
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
281
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
288
+ check_validity
289
+
290
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
282
291
  end
283
292
 
284
293
  # Returns the callback configuration as set by BrickletBarometerV2#set_temperature_callback_configuration.
285
294
  def get_temperature_callback_configuration
286
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
295
+ check_validity
296
+
297
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
287
298
  end
288
299
 
289
300
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -292,24 +303,24 @@ module Tinkerforge
292
303
  # Setting the length to 1 will turn the averaging off. With less
293
304
  # averaging, there is more noise on the data.
294
305
  #
295
- # The range for the averaging is 1-1000.
296
- #
297
306
  # If you want to do long term measurements the longest moving average will give
298
307
  # the cleanest results.
299
- #
300
- # The default value is 100.
301
308
  def set_moving_average_configuration(moving_average_length_air_pressure, moving_average_length_temperature)
302
- send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_air_pressure, moving_average_length_temperature], 'S S', 0, ''
309
+ check_validity
310
+
311
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_air_pressure, moving_average_length_temperature], 'S S', 8, ''
303
312
  end
304
313
 
305
314
  # Returns the moving average configuration as set by
306
315
  # BrickletBarometerV2#set_moving_average_configuration.
307
316
  def get_moving_average_configuration
308
- send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
317
+ check_validity
318
+
319
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 12, 'S S'
309
320
  end
310
321
 
311
- # Sets the reference air pressure in mbar/1000 for the altitude calculation.
312
- # Valid values are between 260000 and 1260000. Setting the reference to the
322
+ # Sets the reference air pressure for the altitude calculation.
323
+ # Setting the reference to the
313
324
  # current air pressure results in a calculated altitude of 0mm. Passing 0 is
314
325
  # a shortcut for passing the current air pressure as reference.
315
326
  #
@@ -317,15 +328,17 @@ module Tinkerforge
317
328
  # `QNH <https://en.wikipedia.org/wiki/QNH>`__ and
318
329
  # `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
319
330
  # used in aviation.
320
- #
321
- # The default value is 1013.25mbar.
322
331
  def set_reference_air_pressure(air_pressure)
323
- send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
332
+ check_validity
333
+
334
+ send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 8, ''
324
335
  end
325
336
 
326
337
  # Returns the reference air pressure as set by BrickletBarometerV2#set_reference_air_pressure.
327
338
  def get_reference_air_pressure
328
- send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
339
+ check_validity
340
+
341
+ send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 12, 'l'
329
342
  end
330
343
 
331
344
  # Sets the one point calibration (OPC) values for the air pressure measurement.
@@ -334,23 +347,26 @@ module Tinkerforge
334
347
  # by setting ``measured air pressure`` and ``actual air pressure`` to 0.
335
348
  #
336
349
  # Then the current air pressure has to be measured using the Bricklet
337
- # (``measured air pressure``) and with and accurate reference barometer
338
- # (``actual air pressure``) at the same time and passed to this function in
339
- # mbar/1000.
350
+ # (``measured air pressure``) and with an accurate reference barometer
351
+ # (``actual air pressure``) at the same time and passed to this function.
340
352
  #
341
353
  # After proper calibration the air pressure measurement can achieve an accuracy
342
- # up to 0.2 mbar.
354
+ # up to 0.2 hPa.
343
355
  #
344
356
  # The calibration is saved in the EEPROM of the Bricklet and only needs to be
345
357
  # configured once.
346
358
  def set_calibration(measured_air_pressure, actual_air_pressure)
347
- send_request FUNCTION_SET_CALIBRATION, [measured_air_pressure, actual_air_pressure], 'l l', 0, ''
359
+ check_validity
360
+
361
+ send_request FUNCTION_SET_CALIBRATION, [measured_air_pressure, actual_air_pressure], 'l l', 8, ''
348
362
  end
349
363
 
350
364
  # Returns the air pressure one point calibration values as set by
351
365
  # BrickletBarometerV2#set_calibration.
352
366
  def get_calibration
353
- send_request FUNCTION_GET_CALIBRATION, [], '', 8, 'l l'
367
+ check_validity
368
+
369
+ send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l l'
354
370
  end
355
371
 
356
372
  # Configures the data rate and air pressure low pass filter. The low pass filter
@@ -363,15 +379,17 @@ module Tinkerforge
363
379
  # A higher data rate will result in a less precise temperature because of
364
380
  # self-heating of the sensor. If the accuracy of the temperature reading is
365
381
  # important to you, we would recommend the 1Hz data rate.
366
- #
367
- # The default values are 50Hz data rate and 1/9th low pass filter.
368
382
  def set_sensor_configuration(data_rate, air_pressure_low_pass_filter)
369
- send_request FUNCTION_SET_SENSOR_CONFIGURATION, [data_rate, air_pressure_low_pass_filter], 'C C', 0, ''
383
+ check_validity
384
+
385
+ send_request FUNCTION_SET_SENSOR_CONFIGURATION, [data_rate, air_pressure_low_pass_filter], 'C C', 8, ''
370
386
  end
371
387
 
372
388
  # Returns the sensor configuration as set by BrickletBarometerV2#set_sensor_configuration.
373
389
  def get_sensor_configuration
374
- send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 2, 'C C'
390
+ check_validity
391
+
392
+ send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 10, 'C C'
375
393
  end
376
394
 
377
395
  # Returns the error count for the communication between Brick and Bricklet.
@@ -386,7 +404,9 @@ module Tinkerforge
386
404
  # The errors counts are for errors that occur on the Bricklet side. All
387
405
  # Bricks have a similar function that returns the errors on the Brick side.
388
406
  def get_spitfp_error_count
389
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
407
+ check_validity
408
+
409
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
390
410
  end
391
411
 
392
412
  # Sets the bootloader mode and returns the status after the requested
@@ -399,12 +419,16 @@ module Tinkerforge
399
419
  # This function is used by Brick Viewer during flashing. It should not be
400
420
  # necessary to call it in a normal user program.
401
421
  def set_bootloader_mode(mode)
402
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
422
+ check_validity
423
+
424
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
403
425
  end
404
426
 
405
427
  # Returns the current bootloader mode, see BrickletBarometerV2#set_bootloader_mode.
406
428
  def get_bootloader_mode
407
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
429
+ check_validity
430
+
431
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
408
432
  end
409
433
 
410
434
  # Sets the firmware pointer for BrickletBarometerV2#write_firmware. The pointer has
@@ -414,7 +438,9 @@ module Tinkerforge
414
438
  # This function is used by Brick Viewer during flashing. It should not be
415
439
  # necessary to call it in a normal user program.
416
440
  def set_write_firmware_pointer(pointer)
417
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
441
+ check_validity
442
+
443
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
418
444
  end
419
445
 
420
446
  # Writes 64 Bytes of firmware at the position as written by
@@ -426,7 +452,9 @@ module Tinkerforge
426
452
  # This function is used by Brick Viewer during flashing. It should not be
427
453
  # necessary to call it in a normal user program.
428
454
  def write_firmware(data)
429
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
455
+ check_validity
456
+
457
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
430
458
  end
431
459
 
432
460
  # Sets the status LED configuration. By default the LED shows
@@ -437,22 +465,28 @@ module Tinkerforge
437
465
  #
438
466
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
439
467
  def set_status_led_config(config)
440
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
468
+ check_validity
469
+
470
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
441
471
  end
442
472
 
443
473
  # Returns the configuration as set by BrickletBarometerV2#set_status_led_config
444
474
  def get_status_led_config
445
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
475
+ check_validity
476
+
477
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
446
478
  end
447
479
 
448
- # Returns the temperature in °C as measured inside the microcontroller. The
480
+ # Returns the temperature as measured inside the microcontroller. The
449
481
  # value returned is not the ambient temperature!
450
482
  #
451
483
  # The temperature is only proportional to the real temperature and it has bad
452
484
  # accuracy. Practically it is only useful as an indicator for
453
485
  # temperature changes.
454
486
  def get_chip_temperature
455
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
487
+ check_validity
488
+
489
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
456
490
  end
457
491
 
458
492
  # Calling this function will reset the Bricklet. All configurations
@@ -462,7 +496,9 @@ module Tinkerforge
462
496
  # calling functions on the existing ones will result in
463
497
  # undefined behavior!
464
498
  def reset
465
- send_request FUNCTION_RESET, [], '', 0, ''
499
+ check_validity
500
+
501
+ send_request FUNCTION_RESET, [], '', 8, ''
466
502
  end
467
503
 
468
504
  # Writes a new UID into flash. If you want to set a new UID
@@ -471,25 +507,31 @@ module Tinkerforge
471
507
  #
472
508
  # We recommend that you use Brick Viewer to change the UID.
473
509
  def write_uid(uid)
474
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
510
+ check_validity
511
+
512
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
475
513
  end
476
514
 
477
515
  # Returns the current UID as an integer. Encode as
478
516
  # Base58 to get the usual string version.
479
517
  def read_uid
480
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
518
+ check_validity
519
+
520
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
481
521
  end
482
522
 
483
523
  # Returns the UID, the UID where the Bricklet is connected to,
484
524
  # the position, the hardware and firmware version as well as the
485
525
  # device identifier.
486
526
  #
487
- # The position can be 'a', 'b', 'c' or 'd'.
527
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
528
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
529
+ # position 'z'.
488
530
  #
489
531
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
490
532
  # |device_identifier_constant|
491
533
  def get_identity
492
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
534
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
493
535
  end
494
536
 
495
537
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.