tinkerforge 2.1.24 → 2.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures Particulate Matter concentration (PM1.0, PM2.5 and PM10)
14
16
  class BrickletParticulateMatter < Device
@@ -68,7 +70,7 @@ module Tinkerforge
68
70
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
69
71
  # the IP Connection <tt>ipcon</tt>.
70
72
  def initialize(uid, ipcon)
71
- super uid, ipcon
73
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
72
74
 
73
75
  @api_version = [2, 0, 0]
74
76
 
@@ -94,9 +96,10 @@ module Tinkerforge
94
96
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
95
97
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
96
98
 
97
- @callback_formats[CALLBACK_PM_CONCENTRATION] = 'S S S'
98
- @callback_formats[CALLBACK_PM_COUNT] = 'S S S S S S'
99
+ @callback_formats[CALLBACK_PM_CONCENTRATION] = [14, 'S S S']
100
+ @callback_formats[CALLBACK_PM_COUNT] = [20, 'S S S S S S']
99
101
 
102
+ @ipcon.add_device self
100
103
  end
101
104
 
102
105
  # Returns the particulate matter concentration, broken down as:
@@ -112,7 +115,9 @@ module Tinkerforge
112
115
  # CALLBACK_PM_CONCENTRATION callback. You can set the callback configuration
113
116
  # with BrickletParticulateMatter#set_pm_concentration_callback_configuration.
114
117
  def get_pm_concentration
115
- send_request FUNCTION_GET_PM_CONCENTRATION, [], '', 6, 'S S S'
118
+ check_validity
119
+
120
+ send_request FUNCTION_GET_PM_CONCENTRATION, [], '', 14, 'S S S'
116
121
  end
117
122
 
118
123
  # Returns the number of particulates in 100 ml of air, broken down by their
@@ -132,11 +137,12 @@ module Tinkerforge
132
137
  # CALLBACK_PM_COUNT callback. You can set the callback configuration
133
138
  # with BrickletParticulateMatter#set_pm_count_callback_configuration.
134
139
  def get_pm_count
135
- send_request FUNCTION_GET_PM_COUNT, [], '', 12, 'S S S S S S'
140
+ check_validity
141
+
142
+ send_request FUNCTION_GET_PM_COUNT, [], '', 20, 'S S S S S S'
136
143
  end
137
144
 
138
- # Enables/Disables the fan and the laser diode of the sensors. The sensor is
139
- # enabled by default.
145
+ # Enables/Disables the fan and the laser diode of the sensors.
140
146
  #
141
147
  # The sensor takes about 30 seconds after it is enabled to settle and produce stable
142
148
  # values.
@@ -145,12 +151,16 @@ module Tinkerforge
145
151
  # an interval with a long idle time (e.g. hourly) you should turn the
146
152
  # laser diode off between the measurements.
147
153
  def set_enable(enable)
148
- send_request FUNCTION_SET_ENABLE, [enable], '?', 0, ''
154
+ check_validity
155
+
156
+ send_request FUNCTION_SET_ENABLE, [enable], '?', 8, ''
149
157
  end
150
158
 
151
159
  # Returns the state of the sensor as set by BrickletParticulateMatter#set_enable.
152
160
  def get_enable
153
- send_request FUNCTION_GET_ENABLE, [], '', 1, '?'
161
+ check_validity
162
+
163
+ send_request FUNCTION_GET_ENABLE, [], '', 9, '?'
154
164
  end
155
165
 
156
166
  # Returns information about the sensor:
@@ -160,7 +170,9 @@ module Tinkerforge
160
170
  # * the number of framing and checksum errors that occurred in the communication
161
171
  # with the sensor.
162
172
  def get_sensor_info
163
- send_request FUNCTION_GET_SENSOR_INFO, [], '', 4, 'C C C C'
173
+ check_validity
174
+
175
+ send_request FUNCTION_GET_SENSOR_INFO, [], '', 12, 'C C C C'
164
176
  end
165
177
 
166
178
  # The period is the period with which the CALLBACK_PM_CONCENTRATION
@@ -173,13 +185,17 @@ module Tinkerforge
173
185
  # If it is set to false, the callback is continuously triggered with the period,
174
186
  # independent of the value.
175
187
  def set_pm_concentration_callback_configuration(period, value_has_to_change)
176
- send_request FUNCTION_SET_PM_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
188
+ check_validity
189
+
190
+ send_request FUNCTION_SET_PM_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
177
191
  end
178
192
 
179
193
  # Returns the callback configuration as set by
180
194
  # BrickletParticulateMatter#set_pm_concentration_callback_configuration.
181
195
  def get_pm_concentration_callback_configuration
182
- send_request FUNCTION_GET_PM_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
196
+ check_validity
197
+
198
+ send_request FUNCTION_GET_PM_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
183
199
  end
184
200
 
185
201
  # The period is the period with which the CALLBACK_PM_COUNT callback
@@ -192,13 +208,17 @@ module Tinkerforge
192
208
  # If it is set to false, the callback is continuously triggered with the period,
193
209
  # independent of the value.
194
210
  def set_pm_count_callback_configuration(period, value_has_to_change)
195
- send_request FUNCTION_SET_PM_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 0, ''
211
+ check_validity
212
+
213
+ send_request FUNCTION_SET_PM_COUNT_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
196
214
  end
197
215
 
198
216
  # Returns the callback configuration as set by
199
217
  # BrickletParticulateMatter#set_pm_count_callback_configuration.
200
218
  def get_pm_count_callback_configuration
201
- send_request FUNCTION_GET_PM_COUNT_CALLBACK_CONFIGURATION, [], '', 5, 'L ?'
219
+ check_validity
220
+
221
+ send_request FUNCTION_GET_PM_COUNT_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
202
222
  end
203
223
 
204
224
  # Returns the error count for the communication between Brick and Bricklet.
@@ -213,7 +233,9 @@ module Tinkerforge
213
233
  # The errors counts are for errors that occur on the Bricklet side. All
214
234
  # Bricks have a similar function that returns the errors on the Brick side.
215
235
  def get_spitfp_error_count
216
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
236
+ check_validity
237
+
238
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
217
239
  end
218
240
 
219
241
  # Sets the bootloader mode and returns the status after the requested
@@ -226,12 +248,16 @@ module Tinkerforge
226
248
  # This function is used by Brick Viewer during flashing. It should not be
227
249
  # necessary to call it in a normal user program.
228
250
  def set_bootloader_mode(mode)
229
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
251
+ check_validity
252
+
253
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
230
254
  end
231
255
 
232
256
  # Returns the current bootloader mode, see BrickletParticulateMatter#set_bootloader_mode.
233
257
  def get_bootloader_mode
234
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
258
+ check_validity
259
+
260
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
235
261
  end
236
262
 
237
263
  # Sets the firmware pointer for BrickletParticulateMatter#write_firmware. The pointer has
@@ -241,7 +267,9 @@ module Tinkerforge
241
267
  # This function is used by Brick Viewer during flashing. It should not be
242
268
  # necessary to call it in a normal user program.
243
269
  def set_write_firmware_pointer(pointer)
244
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
270
+ check_validity
271
+
272
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
245
273
  end
246
274
 
247
275
  # Writes 64 Bytes of firmware at the position as written by
@@ -253,7 +281,9 @@ module Tinkerforge
253
281
  # This function is used by Brick Viewer during flashing. It should not be
254
282
  # necessary to call it in a normal user program.
255
283
  def write_firmware(data)
256
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
284
+ check_validity
285
+
286
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
257
287
  end
258
288
 
259
289
  # Sets the status LED configuration. By default the LED shows
@@ -264,22 +294,28 @@ module Tinkerforge
264
294
  #
265
295
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
266
296
  def set_status_led_config(config)
267
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
297
+ check_validity
298
+
299
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
268
300
  end
269
301
 
270
302
  # Returns the configuration as set by BrickletParticulateMatter#set_status_led_config
271
303
  def get_status_led_config
272
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
304
+ check_validity
305
+
306
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
273
307
  end
274
308
 
275
- # Returns the temperature in °C as measured inside the microcontroller. The
309
+ # Returns the temperature as measured inside the microcontroller. The
276
310
  # value returned is not the ambient temperature!
277
311
  #
278
312
  # The temperature is only proportional to the real temperature and it has bad
279
313
  # accuracy. Practically it is only useful as an indicator for
280
314
  # temperature changes.
281
315
  def get_chip_temperature
282
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
316
+ check_validity
317
+
318
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
283
319
  end
284
320
 
285
321
  # Calling this function will reset the Bricklet. All configurations
@@ -289,7 +325,9 @@ module Tinkerforge
289
325
  # calling functions on the existing ones will result in
290
326
  # undefined behavior!
291
327
  def reset
292
- send_request FUNCTION_RESET, [], '', 0, ''
328
+ check_validity
329
+
330
+ send_request FUNCTION_RESET, [], '', 8, ''
293
331
  end
294
332
 
295
333
  # Writes a new UID into flash. If you want to set a new UID
@@ -298,25 +336,32 @@ module Tinkerforge
298
336
  #
299
337
  # We recommend that you use Brick Viewer to change the UID.
300
338
  def write_uid(uid)
301
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
339
+ check_validity
340
+
341
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
302
342
  end
303
343
 
304
344
  # Returns the current UID as an integer. Encode as
305
345
  # Base58 to get the usual string version.
306
346
  def read_uid
307
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
347
+ check_validity
348
+
349
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
308
350
  end
309
351
 
310
352
  # Returns the UID, the UID where the Bricklet is connected to,
311
353
  # the position, the hardware and firmware version as well as the
312
354
  # device identifier.
313
355
  #
314
- # The position can be 'a', 'b', 'c' or 'd'.
356
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
357
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
358
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
359
+ # position 'z'.
315
360
  #
316
361
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
317
362
  # |device_identifier_constant|
318
363
  def get_identity
319
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
364
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
320
365
  end
321
366
 
322
367
  # 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
  # Creates 1kHz beep
14
16
  class BrickletPiezoBuzzer < Device
@@ -30,7 +32,7 @@ module Tinkerforge
30
32
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
31
33
  # the IP Connection <tt>ipcon</tt>.
32
34
  def initialize(uid, ipcon)
33
- super uid, ipcon
35
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
34
36
 
35
37
  @api_version = [2, 0, 0]
36
38
 
@@ -38,14 +40,17 @@ module Tinkerforge
38
40
  @response_expected[FUNCTION_MORSE_CODE] = RESPONSE_EXPECTED_FALSE
39
41
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
40
42
 
41
- @callback_formats[CALLBACK_BEEP_FINISHED] = ''
42
- @callback_formats[CALLBACK_MORSE_CODE_FINISHED] = ''
43
+ @callback_formats[CALLBACK_BEEP_FINISHED] = [8, '']
44
+ @callback_formats[CALLBACK_MORSE_CODE_FINISHED] = [8, '']
43
45
 
46
+ @ipcon.add_device self
44
47
  end
45
48
 
46
49
  # Beeps for the given duration.
47
50
  def beep(duration)
48
- send_request FUNCTION_BEEP, [duration], 'L', 0, ''
51
+ check_validity
52
+
53
+ send_request FUNCTION_BEEP, [duration], 'L', 8, ''
49
54
  end
50
55
 
51
56
  # Sets morse code that will be played by the piezo buzzer. The morse code
@@ -56,19 +61,24 @@ module Tinkerforge
56
61
  # nine times with the durations "short short short long long long short
57
62
  # short short".
58
63
  def morse_code(morse)
59
- send_request FUNCTION_MORSE_CODE, [morse], 'Z60', 0, ''
64
+ check_validity
65
+
66
+ send_request FUNCTION_MORSE_CODE, [morse], 'Z60', 8, ''
60
67
  end
61
68
 
62
69
  # Returns the UID, the UID where the Bricklet is connected to,
63
70
  # the position, the hardware and firmware version as well as the
64
71
  # device identifier.
65
72
  #
66
- # The position can be 'a', 'b', 'c' or 'd'.
73
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
74
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
75
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
76
+ # position 'z'.
67
77
  #
68
78
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
69
79
  # |device_identifier_constant|
70
80
  def get_identity
71
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
81
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
72
82
  end
73
83
 
74
84
  # 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
  # Creates beep with configurable frequency
14
16
  class BrickletPiezoSpeaker < Device
@@ -33,7 +35,7 @@ module Tinkerforge
33
35
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
34
36
  # the IP Connection <tt>ipcon</tt>.
35
37
  def initialize(uid, ipcon)
36
- super uid, ipcon
38
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
37
39
 
38
40
  @api_version = [2, 0, 0]
39
41
 
@@ -42,9 +44,10 @@ module Tinkerforge
42
44
  @response_expected[FUNCTION_CALIBRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
43
45
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
44
46
 
45
- @callback_formats[CALLBACK_BEEP_FINISHED] = ''
46
- @callback_formats[CALLBACK_MORSE_CODE_FINISHED] = ''
47
+ @callback_formats[CALLBACK_BEEP_FINISHED] = [8, '']
48
+ @callback_formats[CALLBACK_MORSE_CODE_FINISHED] = [8, '']
47
49
 
50
+ @ipcon.add_device self
48
51
  end
49
52
 
50
53
  # Beeps with the given frequency for the given duration.
@@ -56,7 +59,9 @@ module Tinkerforge
56
59
  # The Piezo Speaker Bricklet can only approximate the frequency, it will play
57
60
  # the best possible match by applying the calibration (see BrickletPiezoSpeaker#calibrate).
58
61
  def beep(duration, frequency)
59
- send_request FUNCTION_BEEP, [duration, frequency], 'L S', 0, ''
62
+ check_validity
63
+
64
+ send_request FUNCTION_BEEP, [duration, frequency], 'L S', 8, ''
60
65
  end
61
66
 
62
67
  # Sets morse code that will be played by the piezo buzzer. The morse code
@@ -67,7 +72,9 @@ module Tinkerforge
67
72
  # nine times with the durations "short short short long long long short
68
73
  # short short".
69
74
  def morse_code(morse, frequency)
70
- send_request FUNCTION_MORSE_CODE, [morse, frequency], 'Z60 S', 0, ''
75
+ check_validity
76
+
77
+ send_request FUNCTION_MORSE_CODE, [morse, frequency], 'Z60 S', 8, ''
71
78
  end
72
79
 
73
80
  # The Piezo Speaker Bricklet can play 512 different tones. This function
@@ -80,19 +87,24 @@ module Tinkerforge
80
87
  #
81
88
  # Returns *true* after the calibration finishes.
82
89
  def calibrate
83
- send_request FUNCTION_CALIBRATE, [], '', 1, '?'
90
+ check_validity
91
+
92
+ send_request FUNCTION_CALIBRATE, [], '', 9, '?'
84
93
  end
85
94
 
86
95
  # Returns the UID, the UID where the Bricklet is connected to,
87
96
  # the position, the hardware and firmware version as well as the
88
97
  # device identifier.
89
98
  #
90
- # The position can be 'a', 'b', 'c' or 'd'.
99
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
100
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
101
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
102
+ # position 'z'.
91
103
  #
92
104
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
93
105
  # |device_identifier_constant|
94
106
  def get_identity
95
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
107
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
96
108
  end
97
109
 
98
110
  # 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
  # Creates beep and alarm with configurable volume and frequency
14
16
  class BrickletPiezoSpeakerV2 < Device
@@ -63,7 +65,7 @@ module Tinkerforge
63
65
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
64
66
  # the IP Connection <tt>ipcon</tt>.
65
67
  def initialize(uid, ipcon)
66
- super uid, ipcon
68
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
67
69
 
68
70
  @api_version = [2, 0, 0]
69
71
 
@@ -86,9 +88,10 @@ module Tinkerforge
86
88
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
87
89
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
88
90
 
89
- @callback_formats[CALLBACK_BEEP_FINISHED] = ''
90
- @callback_formats[CALLBACK_ALARM_FINISHED] = ''
91
+ @callback_formats[CALLBACK_BEEP_FINISHED] = [8, '']
92
+ @callback_formats[CALLBACK_ALARM_FINISHED] = [8, '']
91
93
 
94
+ @ipcon.add_device self
92
95
  end
93
96
 
94
97
  # Beeps with the given frequency and volume for the duration.
@@ -96,7 +99,9 @@ module Tinkerforge
96
99
  # A duration of 0 stops the current beep if any is ongoing.
97
100
  # A duration of 4294967295 results in an infinite beep.
98
101
  def set_beep(frequency, volume, duration)
99
- send_request FUNCTION_SET_BEEP, [frequency, volume, duration], 'S C L', 0, ''
102
+ check_validity
103
+
104
+ send_request FUNCTION_SET_BEEP, [frequency, volume, duration], 'S C L', 8, ''
100
105
  end
101
106
 
102
107
  # Returns the last beep settings as set by BrickletPiezoSpeakerV2#set_beep. If a beep is currently
@@ -105,18 +110,20 @@ module Tinkerforge
105
110
  # If the frequency or volume is updated during a beep (with BrickletPiezoSpeakerV2#update_frequency
106
111
  # or BrickletPiezoSpeakerV2#update_volume) this function returns the updated value.
107
112
  def get_beep
108
- send_request FUNCTION_GET_BEEP, [], '', 11, 'S C L L'
113
+ check_validity
114
+
115
+ send_request FUNCTION_GET_BEEP, [], '', 19, 'S C L L'
109
116
  end
110
117
 
111
118
  # Creates an alarm (a tone that goes back and force between two specified frequencies).
112
119
  #
113
120
  # The following parameters can be set:
114
121
  #
115
- # * Start Frequency: Start frequency of the alarm in Hz.
116
- # * End Frequency: End frequency of the alarm in Hz.
117
- # * Step Size: Size of one step of the sweep between the start/end frequencies in Hz.
118
- # * Step Delay: Delay between two steps (duration of time that one tone is used in a sweep) in ms.
119
- # * Duration: Duration of the alarm in ms.
122
+ # * Start Frequency: Start frequency of the alarm.
123
+ # * End Frequency: End frequency of the alarm.
124
+ # * Step Size: Size of one step of the sweep between the start/end frequencies.
125
+ # * Step Delay: Delay between two steps (duration of time that one tone is used in a sweep).
126
+ # * Duration: Duration of the alarm.
120
127
  #
121
128
  # A duration of 0 stops the current alarm if any is ongoing.
122
129
  # A duration of 4294967295 results in an infinite alarm.
@@ -142,36 +149,42 @@ module Tinkerforge
142
149
  # * Volume = 0
143
150
  # * Duration = 10000
144
151
  #
145
- # The ranges are:
152
+ # The following conditions must be met:
146
153
  #
147
- # * Start Frequency: 50Hz - 14999Hz (has to be smaller than end frequency)
148
- # * End Frequency: 51Hz - 15000Hz (has to be bigger than start frequency)
149
- # * Step Size: 1Hz - 65535Hz (has to be small enough to fit into the frequency range)
150
- # * Step Delay: 1ms - 65535ms (has to be small enough to fit into the duration)
151
- # * Volume: 0 - 10
152
- # * Duration: 0ms - 4294967295ms
154
+ # * Start Frequency: has to be smaller than end frequency
155
+ # * End Frequency: has to be bigger than start frequency
156
+ # * Step Size: has to be small enough to fit into the frequency range
157
+ # * Step Delay: has to be small enough to fit into the duration
153
158
  def set_alarm(start_frequency, end_frequency, step_size, step_delay, volume, duration)
154
- send_request FUNCTION_SET_ALARM, [start_frequency, end_frequency, step_size, step_delay, volume, duration], 'S S S S C L', 0, ''
159
+ check_validity
160
+
161
+ send_request FUNCTION_SET_ALARM, [start_frequency, end_frequency, step_size, step_delay, volume, duration], 'S S S S C L', 8, ''
155
162
  end
156
163
 
157
164
  # Returns the last alarm settings as set by BrickletPiezoSpeakerV2#set_alarm. If an alarm is currently
158
- # running it also returns the remaining duration of the alarm in ms as well as the
159
- # current frequency of the alarm in Hz.
165
+ # running it also returns the remaining duration of the alarm as well as the
166
+ # current frequency of the alarm.
160
167
  #
161
- # If the volume is updated during a beep (with BrickletPiezoSpeakerV2#update_volume)
168
+ # If the volume is updated during an alarm (with BrickletPiezoSpeakerV2#update_volume)
162
169
  # this function returns the updated value.
163
170
  def get_alarm
164
- send_request FUNCTION_GET_ALARM, [], '', 19, 'S S S S C L L S'
171
+ check_validity
172
+
173
+ send_request FUNCTION_GET_ALARM, [], '', 27, 'S S S S C L L S'
165
174
  end
166
175
 
167
- # Updates the volume of an ongoing beep or alarm. The range of the volume is 0 to 10.
176
+ # Updates the volume of an ongoing beep or alarm.
168
177
  def update_volume(volume)
169
- send_request FUNCTION_UPDATE_VOLUME, [volume], 'C', 0, ''
178
+ check_validity
179
+
180
+ send_request FUNCTION_UPDATE_VOLUME, [volume], 'C', 8, ''
170
181
  end
171
182
 
172
- # Updates the frequency of an ongoing beep. The range of the frequency is 50Hz to 15000Hz.
183
+ # Updates the frequency of an ongoing beep.
173
184
  def update_frequency(frequency)
174
- send_request FUNCTION_UPDATE_FREQUENCY, [frequency], 'S', 0, ''
185
+ check_validity
186
+
187
+ send_request FUNCTION_UPDATE_FREQUENCY, [frequency], 'S', 8, ''
175
188
  end
176
189
 
177
190
  # Returns the error count for the communication between Brick and Bricklet.
@@ -186,7 +199,9 @@ module Tinkerforge
186
199
  # The errors counts are for errors that occur on the Bricklet side. All
187
200
  # Bricks have a similar function that returns the errors on the Brick side.
188
201
  def get_spitfp_error_count
189
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
202
+ check_validity
203
+
204
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
190
205
  end
191
206
 
192
207
  # Sets the bootloader mode and returns the status after the requested
@@ -199,12 +214,16 @@ module Tinkerforge
199
214
  # This function is used by Brick Viewer during flashing. It should not be
200
215
  # necessary to call it in a normal user program.
201
216
  def set_bootloader_mode(mode)
202
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
217
+ check_validity
218
+
219
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
203
220
  end
204
221
 
205
222
  # Returns the current bootloader mode, see BrickletPiezoSpeakerV2#set_bootloader_mode.
206
223
  def get_bootloader_mode
207
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
224
+ check_validity
225
+
226
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
208
227
  end
209
228
 
210
229
  # Sets the firmware pointer for BrickletPiezoSpeakerV2#write_firmware. The pointer has
@@ -214,7 +233,9 @@ module Tinkerforge
214
233
  # This function is used by Brick Viewer during flashing. It should not be
215
234
  # necessary to call it in a normal user program.
216
235
  def set_write_firmware_pointer(pointer)
217
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
236
+ check_validity
237
+
238
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
218
239
  end
219
240
 
220
241
  # Writes 64 Bytes of firmware at the position as written by
@@ -226,7 +247,9 @@ module Tinkerforge
226
247
  # This function is used by Brick Viewer during flashing. It should not be
227
248
  # necessary to call it in a normal user program.
228
249
  def write_firmware(data)
229
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
250
+ check_validity
251
+
252
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
230
253
  end
231
254
 
232
255
  # Sets the status LED configuration. By default the LED shows
@@ -237,22 +260,28 @@ module Tinkerforge
237
260
  #
238
261
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
239
262
  def set_status_led_config(config)
240
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
263
+ check_validity
264
+
265
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
241
266
  end
242
267
 
243
268
  # Returns the configuration as set by BrickletPiezoSpeakerV2#set_status_led_config
244
269
  def get_status_led_config
245
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
270
+ check_validity
271
+
272
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
246
273
  end
247
274
 
248
- # Returns the temperature in °C as measured inside the microcontroller. The
275
+ # Returns the temperature as measured inside the microcontroller. The
249
276
  # value returned is not the ambient temperature!
250
277
  #
251
278
  # The temperature is only proportional to the real temperature and it has bad
252
279
  # accuracy. Practically it is only useful as an indicator for
253
280
  # temperature changes.
254
281
  def get_chip_temperature
255
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
282
+ check_validity
283
+
284
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
256
285
  end
257
286
 
258
287
  # Calling this function will reset the Bricklet. All configurations
@@ -262,7 +291,9 @@ module Tinkerforge
262
291
  # calling functions on the existing ones will result in
263
292
  # undefined behavior!
264
293
  def reset
265
- send_request FUNCTION_RESET, [], '', 0, ''
294
+ check_validity
295
+
296
+ send_request FUNCTION_RESET, [], '', 8, ''
266
297
  end
267
298
 
268
299
  # Writes a new UID into flash. If you want to set a new UID
@@ -271,25 +302,32 @@ module Tinkerforge
271
302
  #
272
303
  # We recommend that you use Brick Viewer to change the UID.
273
304
  def write_uid(uid)
274
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
305
+ check_validity
306
+
307
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
275
308
  end
276
309
 
277
310
  # Returns the current UID as an integer. Encode as
278
311
  # Base58 to get the usual string version.
279
312
  def read_uid
280
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
313
+ check_validity
314
+
315
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
281
316
  end
282
317
 
283
318
  # Returns the UID, the UID where the Bricklet is connected to,
284
319
  # the position, the hardware and firmware version as well as the
285
320
  # device identifier.
286
321
  #
287
- # The position can be 'a', 'b', 'c' or 'd'.
322
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
323
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
324
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
325
+ # position 'z'.
288
326
  #
289
327
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
290
328
  # |device_identifier_constant|
291
329
  def get_identity
292
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
330
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
293
331
  end
294
332
 
295
333
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.