tinkerforge 2.1.23 → 2.1.28

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 (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +109 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +191 -86
  6. data/lib/tinkerforge/brick_imu_v2.rb +219 -118
  7. data/lib/tinkerforge/brick_master.rb +495 -195
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
  11. data/lib/tinkerforge/brick_stepper.rb +212 -100
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
  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 +75 -47
  31. data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
  32. data/lib/tinkerforge/bricklet_compass.rb +81 -40
  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 +68 -33
  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 +81 -40
  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 +99 -51
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -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 +76 -39
  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 +75 -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_performance_dc.rb +676 -0
  102. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  103. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  104. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  105. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  106. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  107. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  108. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  109. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  110. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  111. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  112. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  113. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  114. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  115. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  116. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  117. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  118. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -26
  119. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  120. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  121. data/lib/tinkerforge/bricklet_rs485.rb +250 -164
  122. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  123. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  124. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  125. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  126. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  127. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  128. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  129. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  130. data/lib/tinkerforge/bricklet_temperature_ir.rb +61 -47
  131. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
  132. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  133. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  134. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  135. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  136. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  137. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  138. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  139. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  140. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  141. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +92 -77
  142. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
  143. data/lib/tinkerforge/device_display_names.rb +167 -0
  144. data/lib/tinkerforge/ip_connection.rb +156 -33
  145. data/lib/tinkerforge/version.rb +1 -1
  146. metadata +8 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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 Sound Pressure Level in dB(A/B/C/D/Z)
14
16
  class BrickletSoundPressureLevel < Device
@@ -21,16 +23,16 @@ module Tinkerforge
21
23
  # The parameter is the same as BrickletSoundPressureLevel#get_decibel.
22
24
  CALLBACK_DECIBEL = 4
23
25
 
24
- # This callback is triggered periodically according to the configuration set by
25
- # BrickletSoundPressureLevel#set_spectrum_callback_configuration.
26
- #
27
- # The parameter is the same as BrickletSoundPressureLevel#get_spectrum.
26
+ # See CALLBACK_SPECTRUM
28
27
  CALLBACK_SPECTRUM_LOW_LEVEL = 8
29
28
 
30
29
  # This callback is triggered periodically according to the configuration set by
31
30
  # BrickletSoundPressureLevel#set_spectrum_callback_configuration.
32
31
  #
33
32
  # The parameter is the same as BrickletSoundPressureLevel#get_spectrum.
33
+ #
34
+ # .. note::
35
+ # If reconstructing the value fails, the callback is triggered with nil for spectrum.
34
36
  CALLBACK_SPECTRUM = -8
35
37
 
36
38
  FUNCTION_GET_DECIBEL = 1 # :nodoc:
@@ -88,7 +90,7 @@ module Tinkerforge
88
90
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
89
91
  # the IP Connection <tt>ipcon</tt>.
90
92
  def initialize(uid, ipcon)
91
- super uid, ipcon
93
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
92
94
 
93
95
  @api_version = [2, 0, 0]
94
96
 
@@ -113,14 +115,14 @@ module Tinkerforge
113
115
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
116
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
115
117
 
116
- @callback_formats[CALLBACK_DECIBEL] = 'S'
117
- @callback_formats[CALLBACK_SPECTRUM_LOW_LEVEL] = 'S S S30'
118
+ @callback_formats[CALLBACK_DECIBEL] = [10, 'S']
119
+ @callback_formats[CALLBACK_SPECTRUM_LOW_LEVEL] = [72, 'S S S30']
118
120
 
119
121
  @high_level_callbacks[CALLBACK_SPECTRUM] = [['stream_length', 'stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => false}, nil]
122
+ @ipcon.add_device self
120
123
  end
121
124
 
122
- # Returns the measured sound pressure in decibels. The values are given in
123
- # dB/10 (tenths dB).
125
+ # Returns the measured sound pressure in decibels.
124
126
  #
125
127
  # The Bricklet supports the weighting standards dB(A), dB(B), dB(C), dB(D),
126
128
  # dB(Z) and ITU-R 468. You can configure the weighting with BrickletSoundPressureLevel#set_configuration.
@@ -132,10 +134,12 @@ module Tinkerforge
132
134
  # CALLBACK_DECIBEL callback. You can set the callback configuration
133
135
  # with BrickletSoundPressureLevel#set_decibel_callback_configuration.
134
136
  def get_decibel
135
- send_request FUNCTION_GET_DECIBEL, [], '', 2, 'S'
137
+ check_validity
138
+
139
+ send_request FUNCTION_GET_DECIBEL, [], '', 10, 'S'
136
140
  end
137
141
 
138
- # The period in ms is the period with which the CALLBACK_DECIBEL callback is triggered
142
+ # The period is the period with which the CALLBACK_DECIBEL callback is triggered
139
143
  # periodically. A value of 0 turns the callback off.
140
144
  #
141
145
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -160,15 +164,17 @@ module Tinkerforge
160
164
  # "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
161
165
  #
162
166
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
163
- #
164
- # The default value is (0, false, 'x', 0, 0).
165
167
  def set_decibel_callback_configuration(period, value_has_to_change, option, min, max)
166
- send_request FUNCTION_SET_DECIBEL_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_DECIBEL_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
167
171
  end
168
172
 
169
173
  # Returns the callback configuration as set by BrickletSoundPressureLevel#set_decibel_callback_configuration.
170
174
  def get_decibel_callback_configuration
171
- send_request FUNCTION_GET_DECIBEL_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k S S'
175
+ check_validity
176
+
177
+ send_request FUNCTION_GET_DECIBEL_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
172
178
  end
173
179
 
174
180
  # Returns the frequency spectrum. The length of the spectrum is between
@@ -190,24 +196,28 @@ module Tinkerforge
190
196
  # spectrum you have to apply the formula f(x) = 20*log10(max(1, x/sqrt(2)))
191
197
  # on each value.
192
198
  def get_spectrum_low_level
193
- send_request FUNCTION_GET_SPECTRUM_LOW_LEVEL, [], '', 64, 'S S S30'
199
+ check_validity
200
+
201
+ send_request FUNCTION_GET_SPECTRUM_LOW_LEVEL, [], '', 72, 'S S S30'
194
202
  end
195
203
 
196
- # The period in ms is the period with which the CALLBACK_SPECTRUM callback is
204
+ # The period is the period with which the CALLBACK_SPECTRUM callback is
197
205
  # triggered periodically. A value of 0 turns the callback off.
198
206
  #
199
207
  # Every new measured spectrum will be send at most once. Set the period to 1 to
200
208
  # make sure that you get every spectrum.
201
- #
202
- # The default value is 0.
203
209
  def set_spectrum_callback_configuration(period)
204
- send_request FUNCTION_SET_SPECTRUM_CALLBACK_CONFIGURATION, [period], 'L', 0, ''
210
+ check_validity
211
+
212
+ send_request FUNCTION_SET_SPECTRUM_CALLBACK_CONFIGURATION, [period], 'L', 8, ''
205
213
  end
206
214
 
207
215
  # Returns the callback configuration as set by
208
216
  # BrickletSoundPressureLevel#get_spectrum_callback_configuration.
209
217
  def get_spectrum_callback_configuration
210
- send_request FUNCTION_GET_SPECTRUM_CALLBACK_CONFIGURATION, [], '', 4, 'L'
218
+ check_validity
219
+
220
+ send_request FUNCTION_GET_SPECTRUM_CALLBACK_CONFIGURATION, [], '', 12, 'L'
211
221
  end
212
222
 
213
223
  # Sets the Sound Pressure Level Bricklet configuration.
@@ -231,15 +241,17 @@ module Tinkerforge
231
241
  # often used to measure volumes at concerts etc. dB(Z) has a
232
242
  # flat response, no weighting is applied. ITU-R 468 is an ITU
233
243
  # weighting standard mostly used in the UK and Europe.
234
- #
235
- # The defaults are FFT size 1024 and weighting standard dB(A).
236
244
  def set_configuration(fft_size, weighting)
237
- send_request FUNCTION_SET_CONFIGURATION, [fft_size, weighting], 'C C', 0, ''
245
+ check_validity
246
+
247
+ send_request FUNCTION_SET_CONFIGURATION, [fft_size, weighting], 'C C', 8, ''
238
248
  end
239
249
 
240
250
  # Returns the configuration as set by BrickletSoundPressureLevel#set_configuration.
241
251
  def get_configuration
242
- send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
252
+ check_validity
253
+
254
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 10, 'C C'
243
255
  end
244
256
 
245
257
  # Returns the error count for the communication between Brick and Bricklet.
@@ -254,7 +266,9 @@ module Tinkerforge
254
266
  # The errors counts are for errors that occur on the Bricklet side. All
255
267
  # Bricks have a similar function that returns the errors on the Brick side.
256
268
  def get_spitfp_error_count
257
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
269
+ check_validity
270
+
271
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
258
272
  end
259
273
 
260
274
  # Sets the bootloader mode and returns the status after the requested
@@ -267,12 +281,16 @@ module Tinkerforge
267
281
  # This function is used by Brick Viewer during flashing. It should not be
268
282
  # necessary to call it in a normal user program.
269
283
  def set_bootloader_mode(mode)
270
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
284
+ check_validity
285
+
286
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
271
287
  end
272
288
 
273
289
  # Returns the current bootloader mode, see BrickletSoundPressureLevel#set_bootloader_mode.
274
290
  def get_bootloader_mode
275
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
291
+ check_validity
292
+
293
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
276
294
  end
277
295
 
278
296
  # Sets the firmware pointer for BrickletSoundPressureLevel#write_firmware. The pointer has
@@ -282,7 +300,9 @@ module Tinkerforge
282
300
  # This function is used by Brick Viewer during flashing. It should not be
283
301
  # necessary to call it in a normal user program.
284
302
  def set_write_firmware_pointer(pointer)
285
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
303
+ check_validity
304
+
305
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
286
306
  end
287
307
 
288
308
  # Writes 64 Bytes of firmware at the position as written by
@@ -294,7 +314,9 @@ module Tinkerforge
294
314
  # This function is used by Brick Viewer during flashing. It should not be
295
315
  # necessary to call it in a normal user program.
296
316
  def write_firmware(data)
297
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
317
+ check_validity
318
+
319
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
298
320
  end
299
321
 
300
322
  # Sets the status LED configuration. By default the LED shows
@@ -305,22 +327,28 @@ module Tinkerforge
305
327
  #
306
328
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
307
329
  def set_status_led_config(config)
308
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
330
+ check_validity
331
+
332
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
309
333
  end
310
334
 
311
335
  # Returns the configuration as set by BrickletSoundPressureLevel#set_status_led_config
312
336
  def get_status_led_config
313
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
337
+ check_validity
338
+
339
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
314
340
  end
315
341
 
316
- # Returns the temperature in °C as measured inside the microcontroller. The
342
+ # Returns the temperature as measured inside the microcontroller. The
317
343
  # value returned is not the ambient temperature!
318
344
  #
319
345
  # The temperature is only proportional to the real temperature and it has bad
320
346
  # accuracy. Practically it is only useful as an indicator for
321
347
  # temperature changes.
322
348
  def get_chip_temperature
323
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
349
+ check_validity
350
+
351
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
324
352
  end
325
353
 
326
354
  # Calling this function will reset the Bricklet. All configurations
@@ -330,7 +358,9 @@ module Tinkerforge
330
358
  # calling functions on the existing ones will result in
331
359
  # undefined behavior!
332
360
  def reset
333
- send_request FUNCTION_RESET, [], '', 0, ''
361
+ check_validity
362
+
363
+ send_request FUNCTION_RESET, [], '', 8, ''
334
364
  end
335
365
 
336
366
  # Writes a new UID into flash. If you want to set a new UID
@@ -339,25 +369,31 @@ module Tinkerforge
339
369
  #
340
370
  # We recommend that you use Brick Viewer to change the UID.
341
371
  def write_uid(uid)
342
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
372
+ check_validity
373
+
374
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
343
375
  end
344
376
 
345
377
  # Returns the current UID as an integer. Encode as
346
378
  # Base58 to get the usual string version.
347
379
  def read_uid
348
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
380
+ check_validity
381
+
382
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
349
383
  end
350
384
 
351
385
  # Returns the UID, the UID where the Bricklet is connected to,
352
386
  # the position, the hardware and firmware version as well as the
353
387
  # device identifier.
354
388
  #
355
- # The position can be 'a', 'b', 'c' or 'd'.
389
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
390
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
391
+ # position 'z'.
356
392
  #
357
393
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
358
394
  # |device_identifier_constant|
359
395
  def get_identity
360
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
396
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
361
397
  end
362
398
 
363
399
  # Returns the frequency spectrum. The length of the spectrum is between
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-08-23. #
3
+ # This file was automatically generated on 2021-01-15. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.23 #
5
+ # Ruby Bindings Version 2.1.28 #
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 ambient temperature with 0.5°C accuracy
14
16
  class BrickletTemperature < Device
@@ -53,7 +55,7 @@ module Tinkerforge
53
55
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
54
56
  # the IP Connection <tt>ipcon</tt>.
55
57
  def initialize(uid, ipcon)
56
- super uid, ipcon
58
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
57
59
 
58
60
  @api_version = [2, 0, 1]
59
61
 
@@ -68,36 +70,39 @@ module Tinkerforge
68
70
  @response_expected[FUNCTION_GET_I2C_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
69
71
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
72
 
71
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
72
- @callback_formats[CALLBACK_TEMPERATURE_REACHED] = 's'
73
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
74
+ @callback_formats[CALLBACK_TEMPERATURE_REACHED] = [10, 's']
73
75
 
76
+ @ipcon.add_device self
74
77
  end
75
78
 
76
- # Returns the temperature of the sensor. The value
77
- # has a range of -2500 to 8500 and is given in °C/100,
78
- # e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
79
+ # Returns the temperature of the sensor.
79
80
  #
80
81
  # If you want to get the temperature periodically, it is recommended
81
82
  # to use the CALLBACK_TEMPERATURE callback and set the period with
82
83
  # BrickletTemperature#set_temperature_callback_period.
83
84
  def get_temperature
84
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
85
+ check_validity
86
+
87
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
85
88
  end
86
89
 
87
- # Sets the period in ms with which the CALLBACK_TEMPERATURE callback is triggered
90
+ # Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
88
91
  # periodically. A value of 0 turns the callback off.
89
92
  #
90
93
  # The CALLBACK_TEMPERATURE callback is only triggered if the temperature has changed
91
94
  # since the last triggering.
92
- #
93
- # The default value is 0.
94
95
  def set_temperature_callback_period(period)
95
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
96
+ check_validity
97
+
98
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
96
99
  end
97
100
 
98
101
  # Returns the period as set by BrickletTemperature#set_temperature_callback_period.
99
102
  def get_temperature_callback_period
100
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
103
+ check_validity
104
+
105
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
101
106
  end
102
107
 
103
108
  # Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
@@ -111,18 +116,20 @@ module Tinkerforge
111
116
  # "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
112
117
  # "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
113
118
  # "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
114
- #
115
- # The default value is ('x', 0, 0).
116
119
  def set_temperature_callback_threshold(option, min, max)
117
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
120
+ check_validity
121
+
122
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 8, ''
118
123
  end
119
124
 
120
125
  # Returns the threshold as set by BrickletTemperature#set_temperature_callback_threshold.
121
126
  def get_temperature_callback_threshold
122
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
127
+ check_validity
128
+
129
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 13, 'k s s'
123
130
  end
124
131
 
125
- # Sets the period in ms with which the threshold callback
132
+ # Sets the period with which the threshold callback
126
133
  #
127
134
  # * CALLBACK_TEMPERATURE_REACHED
128
135
  #
@@ -131,20 +138,22 @@ module Tinkerforge
131
138
  # * BrickletTemperature#set_temperature_callback_threshold
132
139
  #
133
140
  # keeps being reached.
134
- #
135
- # The default value is 100.
136
141
  def set_debounce_period(debounce)
137
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
142
+ check_validity
143
+
144
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
138
145
  end
139
146
 
140
147
  # Returns the debounce period as set by BrickletTemperature#set_debounce_period.
141
148
  def get_debounce_period
142
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
143
152
  end
144
153
 
145
154
  # Sets the I2C mode. Possible modes are:
146
155
  #
147
- # * 0: Fast (400kHz, default)
156
+ # * 0: Fast (400kHz)
148
157
  # * 1: Slow (100kHz)
149
158
  #
150
159
  # If you have problems with obvious outliers in the
@@ -156,26 +165,32 @@ module Tinkerforge
156
165
  #
157
166
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
158
167
  def set_i2c_mode(mode)
159
- send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 0, ''
168
+ check_validity
169
+
170
+ send_request FUNCTION_SET_I2C_MODE, [mode], 'C', 8, ''
160
171
  end
161
172
 
162
173
  # Returns the I2C mode as set by BrickletTemperature#set_i2c_mode.
163
174
  #
164
175
  # .. versionadded:: 2.0.1$nbsp;(Plugin)
165
176
  def get_i2c_mode
166
- send_request FUNCTION_GET_I2C_MODE, [], '', 1, 'C'
177
+ check_validity
178
+
179
+ send_request FUNCTION_GET_I2C_MODE, [], '', 9, 'C'
167
180
  end
168
181
 
169
182
  # Returns the UID, the UID where the Bricklet is connected to,
170
183
  # the position, the hardware and firmware version as well as the
171
184
  # device identifier.
172
185
  #
173
- # The position can be 'a', 'b', 'c' or 'd'.
186
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
187
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
188
+ # position 'z'.
174
189
  #
175
190
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
176
191
  # |device_identifier_constant|
177
192
  def get_identity
178
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
193
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
179
194
  end
180
195
 
181
196
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.