tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
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
  # Reads temperatures from Pt100 und Pt1000 sensors
14
16
  class BrickletPTC < Device
@@ -90,7 +92,7 @@ module Tinkerforge
90
92
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
91
93
  # the IP Connection <tt>ipcon</tt>.
92
94
  def initialize(uid, ipcon)
93
- super uid, ipcon
95
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
94
96
 
95
97
  @api_version = [2, 0, 1]
96
98
 
@@ -115,23 +117,24 @@ module Tinkerforge
115
117
  @response_expected[FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
116
118
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
117
119
 
118
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
119
- @callback_formats[CALLBACK_TEMPERATURE_REACHED] = 'l'
120
- @callback_formats[CALLBACK_RESISTANCE] = 'l'
121
- @callback_formats[CALLBACK_RESISTANCE_REACHED] = 'l'
122
- @callback_formats[CALLBACK_SENSOR_CONNECTED] = '?'
120
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
121
+ @callback_formats[CALLBACK_TEMPERATURE_REACHED] = [12, 'l']
122
+ @callback_formats[CALLBACK_RESISTANCE] = [12, 'l']
123
+ @callback_formats[CALLBACK_RESISTANCE_REACHED] = [12, 'l']
124
+ @callback_formats[CALLBACK_SENSOR_CONNECTED] = [9, '?']
123
125
 
126
+ @ipcon.add_device self
124
127
  end
125
128
 
126
- # Returns the temperature of connected sensor. The value
127
- # has a range of -246 to 849 °C and is given in °C/100,
128
- # e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
129
+ # Returns the temperature of connected sensor.
129
130
  #
130
131
  # If you want to get the temperature periodically, it is recommended
131
132
  # to use the CALLBACK_TEMPERATURE callback and set the period with
132
133
  # BrickletPTC#set_temperature_callback_period.
133
134
  def get_temperature
134
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
135
+ check_validity
136
+
137
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
135
138
  end
136
139
 
137
140
  # Returns the value as measured by the MAX31865 precision delta-sigma ADC.
@@ -145,7 +148,9 @@ module Tinkerforge
145
148
  # to use the CALLBACK_RESISTANCE callback and set the period with
146
149
  # BrickletPTC#set_resistance_callback_period.
147
150
  def get_resistance
148
- send_request FUNCTION_GET_RESISTANCE, [], '', 4, 'l'
151
+ check_validity
152
+
153
+ send_request FUNCTION_GET_RESISTANCE, [], '', 12, 'l'
149
154
  end
150
155
 
151
156
  # Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -154,12 +159,16 @@ module Tinkerforge
154
159
  # The CALLBACK_TEMPERATURE callback is only triggered if the temperature has
155
160
  # changed since the last triggering.
156
161
  def set_temperature_callback_period(period)
157
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
162
+ check_validity
163
+
164
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
158
165
  end
159
166
 
160
167
  # Returns the period as set by BrickletPTC#set_temperature_callback_period.
161
168
  def get_temperature_callback_period
162
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
169
+ check_validity
170
+
171
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
163
172
  end
164
173
 
165
174
  # Sets the period with which the CALLBACK_RESISTANCE callback is triggered
@@ -168,12 +177,16 @@ module Tinkerforge
168
177
  # The CALLBACK_RESISTANCE callback is only triggered if the resistance has changed
169
178
  # since the last triggering.
170
179
  def set_resistance_callback_period(period)
171
- send_request FUNCTION_SET_RESISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_RESISTANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
172
183
  end
173
184
 
174
185
  # Returns the period as set by BrickletPTC#set_resistance_callback_period.
175
186
  def get_resistance_callback_period
176
- send_request FUNCTION_GET_RESISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_RESISTANCE_CALLBACK_PERIOD, [], '', 12, 'L'
177
190
  end
178
191
 
179
192
  # Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
@@ -187,15 +200,17 @@ module Tinkerforge
187
200
  # "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
188
201
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
189
202
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
190
- #
191
- # The default value is ('x', 0, 0).
192
203
  def set_temperature_callback_threshold(option, min, max)
193
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
204
+ check_validity
205
+
206
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
194
207
  end
195
208
 
196
209
  # Returns the threshold as set by BrickletPTC#set_temperature_callback_threshold.
197
210
  def get_temperature_callback_threshold
198
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
211
+ check_validity
212
+
213
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
199
214
  end
200
215
 
201
216
  # Sets the thresholds for the CALLBACK_RESISTANCE_REACHED callback.
@@ -209,15 +224,17 @@ module Tinkerforge
209
224
  # "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
210
225
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
211
226
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
212
- #
213
- # The default value is ('x', 0, 0).
214
227
  def set_resistance_callback_threshold(option, min, max)
215
- send_request FUNCTION_SET_RESISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
228
+ check_validity
229
+
230
+ send_request FUNCTION_SET_RESISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
216
231
  end
217
232
 
218
233
  # Returns the threshold as set by BrickletPTC#set_resistance_callback_threshold.
219
234
  def get_resistance_callback_threshold
220
- send_request FUNCTION_GET_RESISTANCE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
235
+ check_validity
236
+
237
+ send_request FUNCTION_GET_RESISTANCE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
221
238
  end
222
239
 
223
240
  # Sets the period with which the threshold callback
@@ -232,28 +249,34 @@ module Tinkerforge
232
249
  #
233
250
  # keeps being reached.
234
251
  def set_debounce_period(debounce)
235
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
252
+ check_validity
253
+
254
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
236
255
  end
237
256
 
238
257
  # Returns the debounce period as set by BrickletPTC#set_debounce_period.
239
258
  def get_debounce_period
240
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
259
+ check_validity
260
+
261
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
241
262
  end
242
263
 
243
264
  # Sets the noise rejection filter to either 50Hz (0) or 60Hz (1).
244
265
  # Noise from 50Hz or 60Hz power sources (including
245
266
  # harmonics of the AC power's fundamental frequency) is
246
267
  # attenuated by 82dB.
247
- #
248
- # Default value is 0 = 50Hz.
249
268
  def set_noise_rejection_filter(filter)
250
- send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 0, ''
269
+ check_validity
270
+
271
+ send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 8, ''
251
272
  end
252
273
 
253
274
  # Returns the noise rejection filter option as set by
254
275
  # BrickletPTC#set_noise_rejection_filter
255
276
  def get_noise_rejection_filter
256
- send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 1, 'C'
277
+ check_validity
278
+
279
+ send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 9, 'C'
257
280
  end
258
281
 
259
282
  # Returns *true* if the sensor is connected correctly.
@@ -262,50 +285,59 @@ module Tinkerforge
262
285
  # returns *false*, there is either no Pt100 or Pt1000 sensor connected,
263
286
  # the sensor is connected incorrectly or the sensor itself is faulty.
264
287
  def is_sensor_connected
265
- send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 1, '?'
288
+ check_validity
289
+
290
+ send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 9, '?'
266
291
  end
267
292
 
268
293
  # Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which
269
294
  # correspond to 2-, 3- and 4-wire sensors. The value has to match the jumper
270
295
  # configuration on the Bricklet.
271
- #
272
- # The default value is 2 = 2-wire.
273
296
  def set_wire_mode(mode)
274
- send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 0, ''
297
+ check_validity
298
+
299
+ send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 8, ''
275
300
  end
276
301
 
277
302
  # Returns the wire mode as set by BrickletPTC#set_wire_mode
278
303
  def get_wire_mode
279
- send_request FUNCTION_GET_WIRE_MODE, [], '', 1, 'C'
304
+ check_validity
305
+
306
+ send_request FUNCTION_GET_WIRE_MODE, [], '', 9, 'C'
280
307
  end
281
308
 
282
309
  # If you enable this callback, the CALLBACK_SENSOR_CONNECTED callback is triggered
283
310
  # every time a Pt sensor is connected/disconnected.
284
311
  #
285
- # By default this callback is disabled.
286
- #
287
312
  # .. versionadded:: 2.0.2$nbsp;(Plugin)
288
313
  def set_sensor_connected_callback_configuration(enabled)
289
- send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
314
+ check_validity
315
+
316
+ send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
290
317
  end
291
318
 
292
319
  # Returns the configuration as set by BrickletPTC#set_sensor_connected_callback_configuration.
293
320
  #
294
321
  # .. versionadded:: 2.0.2$nbsp;(Plugin)
295
322
  def get_sensor_connected_callback_configuration
296
- send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 1, '?'
323
+ check_validity
324
+
325
+ send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 9, '?'
297
326
  end
298
327
 
299
328
  # Returns the UID, the UID where the Bricklet is connected to,
300
329
  # the position, the hardware and firmware version as well as the
301
330
  # device identifier.
302
331
  #
303
- # The position can be 'a', 'b', 'c' or 'd'.
332
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
333
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
334
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
335
+ # position 'z'.
304
336
  #
305
337
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
306
338
  # |device_identifier_constant|
307
339
  def get_identity
308
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
340
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
309
341
  end
310
342
 
311
343
  # 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
  # Reads temperatures from Pt100 und Pt1000 sensors
14
16
  class BrickletPTCV2 < Device
@@ -90,7 +92,7 @@ module Tinkerforge
90
92
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
91
93
  # the IP Connection <tt>ipcon</tt>.
92
94
  def initialize(uid, ipcon)
93
- super uid, ipcon
95
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
94
96
 
95
97
  @api_version = [2, 0, 0]
96
98
 
@@ -122,22 +124,23 @@ module Tinkerforge
122
124
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
123
125
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
126
 
125
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
126
- @callback_formats[CALLBACK_RESISTANCE] = 'l'
127
- @callback_formats[CALLBACK_SENSOR_CONNECTED] = '?'
127
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
128
+ @callback_formats[CALLBACK_RESISTANCE] = [12, 'l']
129
+ @callback_formats[CALLBACK_SENSOR_CONNECTED] = [9, '?']
128
130
 
131
+ @ipcon.add_device self
129
132
  end
130
133
 
131
- # Returns the temperature of the connected sensor. The value
132
- # has a range of -246 to 849 °C and is given in °C/100,
133
- # e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
134
+ # Returns the temperature of the connected sensor.
134
135
  #
135
136
  #
136
137
  # If you want to get the value periodically, it is recommended to use the
137
138
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
138
139
  # with BrickletPTCV2#set_temperature_callback_configuration.
139
140
  def get_temperature
140
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
141
+ check_validity
142
+
143
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
141
144
  end
142
145
 
143
146
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -166,12 +169,16 @@ module Tinkerforge
166
169
  #
167
170
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
168
171
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
169
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
172
+ check_validity
173
+
174
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
170
175
  end
171
176
 
172
177
  # Returns the callback configuration as set by BrickletPTCV2#set_temperature_callback_configuration.
173
178
  def get_temperature_callback_configuration
174
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
179
+ check_validity
180
+
181
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
175
182
  end
176
183
 
177
184
  # Returns the value as measured by the MAX31865 precision delta-sigma ADC.
@@ -186,7 +193,9 @@ module Tinkerforge
186
193
  # CALLBACK_RESISTANCE callback. You can set the callback configuration
187
194
  # with BrickletPTCV2#set_resistance_callback_configuration.
188
195
  def get_resistance
189
- send_request FUNCTION_GET_RESISTANCE, [], '', 4, 'l'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_RESISTANCE, [], '', 12, 'l'
190
199
  end
191
200
 
192
201
  # The period is the period with which the CALLBACK_RESISTANCE callback is triggered
@@ -215,28 +224,34 @@ module Tinkerforge
215
224
  #
216
225
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
217
226
  def set_resistance_callback_configuration(period, value_has_to_change, option, min, max)
218
- send_request FUNCTION_SET_RESISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
227
+ check_validity
228
+
229
+ send_request FUNCTION_SET_RESISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
219
230
  end
220
231
 
221
232
  # Returns the callback configuration as set by BrickletPTCV2#set_resistance_callback_configuration.
222
233
  def get_resistance_callback_configuration
223
- send_request FUNCTION_GET_RESISTANCE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
234
+ check_validity
235
+
236
+ send_request FUNCTION_GET_RESISTANCE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
224
237
  end
225
238
 
226
239
  # Sets the noise rejection filter to either 50Hz (0) or 60Hz (1).
227
240
  # Noise from 50Hz or 60Hz power sources (including
228
241
  # harmonics of the AC power's fundamental frequency) is
229
242
  # attenuated by 82dB.
230
- #
231
- # Default value is 0 = 50Hz.
232
243
  def set_noise_rejection_filter(filter)
233
- send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 0, ''
244
+ check_validity
245
+
246
+ send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 8, ''
234
247
  end
235
248
 
236
249
  # Returns the noise rejection filter option as set by
237
250
  # BrickletPTCV2#set_noise_rejection_filter
238
251
  def get_noise_rejection_filter
239
- send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 1, 'C'
252
+ check_validity
253
+
254
+ send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 9, 'C'
240
255
  end
241
256
 
242
257
  # Returns *true* if the sensor is connected correctly.
@@ -249,21 +264,25 @@ module Tinkerforge
249
264
  # CALLBACK_SENSOR_CONNECTED callback. You can set the callback configuration
250
265
  # with BrickletPTCV2#set_sensor_connected_callback_configuration.
251
266
  def is_sensor_connected
252
- send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 1, '?'
267
+ check_validity
268
+
269
+ send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 9, '?'
253
270
  end
254
271
 
255
272
  # Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which
256
273
  # correspond to 2-, 3- and 4-wire sensors. The value has to match the jumper
257
274
  # configuration on the Bricklet.
258
- #
259
- # The default value is 2 = 2-wire.
260
275
  def set_wire_mode(mode)
261
- send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 0, ''
276
+ check_validity
277
+
278
+ send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 8, ''
262
279
  end
263
280
 
264
281
  # Returns the wire mode as set by BrickletPTCV2#set_wire_mode
265
282
  def get_wire_mode
266
- send_request FUNCTION_GET_WIRE_MODE, [], '', 1, 'C'
283
+ check_validity
284
+
285
+ send_request FUNCTION_GET_WIRE_MODE, [], '', 9, 'C'
267
286
  end
268
287
 
269
288
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -272,34 +291,37 @@ module Tinkerforge
272
291
  # Setting the length to 1 will turn the averaging off. With less
273
292
  # averaging, there is more noise on the data.
274
293
  #
275
- # The range for the averaging is 1-1000.
276
- #
277
294
  # New data is gathered every 20ms. With a moving average of length 1000 the resulting
278
295
  # averaging window has a length of 20s. If you want to do long term measurements the longest
279
296
  # moving average will give the cleanest results.
280
297
  #
281
- # The default value is 1 for resistance and 40 for temperature. The default values match
282
- # the non-changeable averaging settings of the old PTC Bricklet 1.0
298
+ # The default values match the non-changeable averaging settings of the old PTC Bricklet 1.0
283
299
  def set_moving_average_configuration(moving_average_length_resistance, moving_average_length_temperature)
284
- send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_resistance, moving_average_length_temperature], 'S S', 0, ''
300
+ check_validity
301
+
302
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_resistance, moving_average_length_temperature], 'S S', 8, ''
285
303
  end
286
304
 
287
305
  # Returns the moving average configuration as set by BrickletPTCV2#set_moving_average_configuration.
288
306
  def get_moving_average_configuration
289
- send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
307
+ check_validity
308
+
309
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 12, 'S S'
290
310
  end
291
311
 
292
312
  # If you enable this callback, the CALLBACK_SENSOR_CONNECTED callback is triggered
293
313
  # every time a Pt sensor is connected/disconnected.
294
- #
295
- # By default this callback is disabled.
296
314
  def set_sensor_connected_callback_configuration(enabled)
297
- send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
315
+ check_validity
316
+
317
+ send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
298
318
  end
299
319
 
300
320
  # Returns the configuration as set by BrickletPTCV2#set_sensor_connected_callback_configuration.
301
321
  def get_sensor_connected_callback_configuration
302
- send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 1, '?'
322
+ check_validity
323
+
324
+ send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 9, '?'
303
325
  end
304
326
 
305
327
  # Returns the error count for the communication between Brick and Bricklet.
@@ -314,7 +336,9 @@ module Tinkerforge
314
336
  # The errors counts are for errors that occur on the Bricklet side. All
315
337
  # Bricks have a similar function that returns the errors on the Brick side.
316
338
  def get_spitfp_error_count
317
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
339
+ check_validity
340
+
341
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
318
342
  end
319
343
 
320
344
  # Sets the bootloader mode and returns the status after the requested
@@ -327,12 +351,16 @@ module Tinkerforge
327
351
  # This function is used by Brick Viewer during flashing. It should not be
328
352
  # necessary to call it in a normal user program.
329
353
  def set_bootloader_mode(mode)
330
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
354
+ check_validity
355
+
356
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
331
357
  end
332
358
 
333
359
  # Returns the current bootloader mode, see BrickletPTCV2#set_bootloader_mode.
334
360
  def get_bootloader_mode
335
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
361
+ check_validity
362
+
363
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
336
364
  end
337
365
 
338
366
  # Sets the firmware pointer for BrickletPTCV2#write_firmware. The pointer has
@@ -342,7 +370,9 @@ module Tinkerforge
342
370
  # This function is used by Brick Viewer during flashing. It should not be
343
371
  # necessary to call it in a normal user program.
344
372
  def set_write_firmware_pointer(pointer)
345
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
373
+ check_validity
374
+
375
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
346
376
  end
347
377
 
348
378
  # Writes 64 Bytes of firmware at the position as written by
@@ -354,7 +384,9 @@ module Tinkerforge
354
384
  # This function is used by Brick Viewer during flashing. It should not be
355
385
  # necessary to call it in a normal user program.
356
386
  def write_firmware(data)
357
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
387
+ check_validity
388
+
389
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
358
390
  end
359
391
 
360
392
  # Sets the status LED configuration. By default the LED shows
@@ -365,22 +397,28 @@ module Tinkerforge
365
397
  #
366
398
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
367
399
  def set_status_led_config(config)
368
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
400
+ check_validity
401
+
402
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
369
403
  end
370
404
 
371
405
  # Returns the configuration as set by BrickletPTCV2#set_status_led_config
372
406
  def get_status_led_config
373
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
407
+ check_validity
408
+
409
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
374
410
  end
375
411
 
376
- # Returns the temperature in °C as measured inside the microcontroller. The
412
+ # Returns the temperature as measured inside the microcontroller. The
377
413
  # value returned is not the ambient temperature!
378
414
  #
379
415
  # The temperature is only proportional to the real temperature and it has bad
380
416
  # accuracy. Practically it is only useful as an indicator for
381
417
  # temperature changes.
382
418
  def get_chip_temperature
383
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
419
+ check_validity
420
+
421
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
384
422
  end
385
423
 
386
424
  # Calling this function will reset the Bricklet. All configurations
@@ -390,7 +428,9 @@ module Tinkerforge
390
428
  # calling functions on the existing ones will result in
391
429
  # undefined behavior!
392
430
  def reset
393
- send_request FUNCTION_RESET, [], '', 0, ''
431
+ check_validity
432
+
433
+ send_request FUNCTION_RESET, [], '', 8, ''
394
434
  end
395
435
 
396
436
  # Writes a new UID into flash. If you want to set a new UID
@@ -399,25 +439,32 @@ module Tinkerforge
399
439
  #
400
440
  # We recommend that you use Brick Viewer to change the UID.
401
441
  def write_uid(uid)
402
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
442
+ check_validity
443
+
444
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
403
445
  end
404
446
 
405
447
  # Returns the current UID as an integer. Encode as
406
448
  # Base58 to get the usual string version.
407
449
  def read_uid
408
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
450
+ check_validity
451
+
452
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
409
453
  end
410
454
 
411
455
  # Returns the UID, the UID where the Bricklet is connected to,
412
456
  # the position, the hardware and firmware version as well as the
413
457
  # device identifier.
414
458
  #
415
- # The position can be 'a', 'b', 'c' or 'd'.
459
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
460
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
461
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
462
+ # position 'z'.
416
463
  #
417
464
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
418
465
  # |device_identifier_constant|
419
466
  def get_identity
420
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
467
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
421
468
  end
422
469
 
423
470
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.