tinkerforge 2.1.22 → 2.1.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +157 -76
  3. data/lib/tinkerforge/brick_hat.rb +115 -32
  4. data/lib/tinkerforge/brick_hat_zero.rb +119 -21
  5. data/lib/tinkerforge/brick_imu.rb +192 -87
  6. data/lib/tinkerforge/brick_imu_v2.rb +220 -119
  7. data/lib/tinkerforge/brick_master.rb +498 -198
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +187 -103
  10. data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
  11. data/lib/tinkerforge/brick_stepper.rb +214 -102
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
  14. data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
  18. data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
  21. data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
  24. data/lib/tinkerforge/bricklet_barometer.rb +108 -58
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
  26. data/lib/tinkerforge/bricklet_can.rb +84 -24
  27. data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
  28. data/lib/tinkerforge/bricklet_co2.rb +36 -25
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
  30. data/lib/tinkerforge/bricklet_color.rb +77 -49
  31. data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
  32. data/lib/tinkerforge/bricklet_compass.rb +397 -0
  33. data/lib/tinkerforge/bricklet_current12.rb +61 -40
  34. data/lib/tinkerforge/bricklet_current25.rb +61 -40
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
  37. data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
  39. data/lib/tinkerforge/bricklet_dmx.rb +92 -48
  40. data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
  46. data/lib/tinkerforge/bricklet_gps.rb +72 -48
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
  50. data/lib/tinkerforge/bricklet_humidity.rb +54 -38
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
  52. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  53. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
  54. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
  55. data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
  62. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  63. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
  65. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
  66. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
  67. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
  68. data/lib/tinkerforge/bricklet_io16.rb +57 -32
  69. data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
  70. data/lib/tinkerforge/bricklet_io4.rb +56 -31
  71. data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
  72. data/lib/tinkerforge/bricklet_isolator.rb +111 -35
  73. data/lib/tinkerforge/bricklet_joystick.rb +63 -42
  74. data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
  75. data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
  76. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
  77. data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
  78. data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
  79. data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
  80. data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
  81. data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
  82. data/lib/tinkerforge/bricklet_line.rb +35 -22
  83. data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
  84. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
  85. data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
  86. data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
  87. data/lib/tinkerforge/bricklet_moisture.rb +43 -30
  88. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  89. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
  90. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
  91. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
  92. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
  93. data/lib/tinkerforge/bricklet_nfc.rb +130 -80
  94. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  95. data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
  96. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
  97. data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
  98. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  99. data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
  100. data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
  101. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
  102. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
  103. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
  104. data/lib/tinkerforge/bricklet_ptc.rb +76 -51
  105. data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
  106. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
  107. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
  108. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  109. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  110. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  111. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  112. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  113. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  114. data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
  115. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
  116. data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
  117. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
  118. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  119. data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
  120. data/lib/tinkerforge/bricklet_rs485.rb +303 -207
  121. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  122. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
  123. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  124. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  125. data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
  126. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
  127. data/lib/tinkerforge/bricklet_temperature.rb +43 -28
  128. data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
  129. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
  130. data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
  131. data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
  132. data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
  133. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
  134. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  135. data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
  136. data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
  137. data/lib/tinkerforge/bricklet_voltage.rb +54 -37
  138. data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
  139. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
  140. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
  141. data/lib/tinkerforge/device_display_names.rb +165 -0
  142. data/lib/tinkerforge/ip_connection.rb +155 -33
  143. data/lib/tinkerforge/version.rb +1 -1
  144. metadata +14 -4
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures 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,12 +96,13 @@ 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
- # Returns the particulate matter concentration in µg/m³, broken down as:
105
+ # Returns the particulate matter concentration, broken down as:
103
106
  #
104
107
  # * PM\ :sub:`1.0`\ ,
105
108
  # * PM\ :sub:`2.5`\ and
@@ -107,8 +110,14 @@ module Tinkerforge
107
110
  #
108
111
  # If the sensor is disabled (see BrickletParticulateMatter#set_enable) then the last known good
109
112
  # values from the sensor are returned.
113
+ #
114
+ # If you want to get the values periodically, it is recommended to use the
115
+ # CALLBACK_PM_CONCENTRATION callback. You can set the callback configuration
116
+ # with BrickletParticulateMatter#set_pm_concentration_callback_configuration.
110
117
  def get_pm_concentration
111
- 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'
112
121
  end
113
122
 
114
123
  # Returns the number of particulates in 100 ml of air, broken down by their
@@ -123,12 +132,17 @@ module Tinkerforge
123
132
  #
124
133
  # If the sensor is disabled (see BrickletParticulateMatter#set_enable) then the last known good
125
134
  # value from the sensor is returned.
135
+ #
136
+ # If you want to get the values periodically, it is recommended to use the
137
+ # CALLBACK_PM_COUNT callback. You can set the callback configuration
138
+ # with BrickletParticulateMatter#set_pm_count_callback_configuration.
126
139
  def get_pm_count
127
- 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'
128
143
  end
129
144
 
130
- # Enables/Disables the fan and the laser diode of the sensors. The sensor is
131
- # enabled by default.
145
+ # Enables/Disables the fan and the laser diode of the sensors.
132
146
  #
133
147
  # The sensor takes about 30 seconds after it is enabled to settle and produce stable
134
148
  # values.
@@ -137,12 +151,16 @@ module Tinkerforge
137
151
  # an interval with a long idle time (e.g. hourly) you should turn the
138
152
  # laser diode off between the measurements.
139
153
  def set_enable(enable)
140
- send_request FUNCTION_SET_ENABLE, [enable], '?', 0, ''
154
+ check_validity
155
+
156
+ send_request FUNCTION_SET_ENABLE, [enable], '?', 8, ''
141
157
  end
142
158
 
143
159
  # Returns the state of the sensor as set by BrickletParticulateMatter#set_enable.
144
160
  def get_enable
145
- send_request FUNCTION_GET_ENABLE, [], '', 1, '?'
161
+ check_validity
162
+
163
+ send_request FUNCTION_GET_ENABLE, [], '', 9, '?'
146
164
  end
147
165
 
148
166
  # Returns information about the sensor:
@@ -152,10 +170,12 @@ module Tinkerforge
152
170
  # * the number of framing and checksum errors that occurred in the communication
153
171
  # with the sensor.
154
172
  def get_sensor_info
155
- 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'
156
176
  end
157
177
 
158
- # The period in ms is the period with which the CALLBACK_PM_CONCENTRATION
178
+ # The period is the period with which the CALLBACK_PM_CONCENTRATION
159
179
  # callback is triggered periodically. A value of 0 turns the callback off.
160
180
  #
161
181
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -164,19 +184,21 @@ module Tinkerforge
164
184
  #
165
185
  # If it is set to false, the callback is continuously triggered with the period,
166
186
  # independent of the value.
167
- #
168
- # The default value is (0, false).
169
187
  def set_pm_concentration_callback_configuration(period, value_has_to_change)
170
- 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, ''
171
191
  end
172
192
 
173
193
  # Returns the callback configuration as set by
174
194
  # BrickletParticulateMatter#set_pm_concentration_callback_configuration.
175
195
  def get_pm_concentration_callback_configuration
176
- 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 ?'
177
199
  end
178
200
 
179
- # The period in ms is the period with which the CALLBACK_PM_COUNT callback
201
+ # The period is the period with which the CALLBACK_PM_COUNT callback
180
202
  # is triggered periodically. A value of 0 turns the callback off.
181
203
  #
182
204
  # If the `value has to change`-parameter is set to true, the callback is only
@@ -185,16 +207,18 @@ module Tinkerforge
185
207
  #
186
208
  # If it is set to false, the callback is continuously triggered with the period,
187
209
  # independent of the value.
188
- #
189
- # The default value is (0, false).
190
210
  def set_pm_count_callback_configuration(period, value_has_to_change)
191
- 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, ''
192
214
  end
193
215
 
194
216
  # Returns the callback configuration as set by
195
217
  # BrickletParticulateMatter#set_pm_count_callback_configuration.
196
218
  def get_pm_count_callback_configuration
197
- 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 ?'
198
222
  end
199
223
 
200
224
  # Returns the error count for the communication between Brick and Bricklet.
@@ -209,7 +233,9 @@ module Tinkerforge
209
233
  # The errors counts are for errors that occur on the Bricklet side. All
210
234
  # Bricks have a similar function that returns the errors on the Brick side.
211
235
  def get_spitfp_error_count
212
- 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'
213
239
  end
214
240
 
215
241
  # Sets the bootloader mode and returns the status after the requested
@@ -222,12 +248,16 @@ module Tinkerforge
222
248
  # This function is used by Brick Viewer during flashing. It should not be
223
249
  # necessary to call it in a normal user program.
224
250
  def set_bootloader_mode(mode)
225
- 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'
226
254
  end
227
255
 
228
256
  # Returns the current bootloader mode, see BrickletParticulateMatter#set_bootloader_mode.
229
257
  def get_bootloader_mode
230
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
258
+ check_validity
259
+
260
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
231
261
  end
232
262
 
233
263
  # Sets the firmware pointer for BrickletParticulateMatter#write_firmware. The pointer has
@@ -237,7 +267,9 @@ module Tinkerforge
237
267
  # This function is used by Brick Viewer during flashing. It should not be
238
268
  # necessary to call it in a normal user program.
239
269
  def set_write_firmware_pointer(pointer)
240
- 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, ''
241
273
  end
242
274
 
243
275
  # Writes 64 Bytes of firmware at the position as written by
@@ -249,7 +281,9 @@ module Tinkerforge
249
281
  # This function is used by Brick Viewer during flashing. It should not be
250
282
  # necessary to call it in a normal user program.
251
283
  def write_firmware(data)
252
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
284
+ check_validity
285
+
286
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
253
287
  end
254
288
 
255
289
  # Sets the status LED configuration. By default the LED shows
@@ -260,22 +294,28 @@ module Tinkerforge
260
294
  #
261
295
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
262
296
  def set_status_led_config(config)
263
- 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, ''
264
300
  end
265
301
 
266
302
  # Returns the configuration as set by BrickletParticulateMatter#set_status_led_config
267
303
  def get_status_led_config
268
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
304
+ check_validity
305
+
306
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
269
307
  end
270
308
 
271
- # Returns the temperature in °C as measured inside the microcontroller. The
309
+ # Returns the temperature as measured inside the microcontroller. The
272
310
  # value returned is not the ambient temperature!
273
311
  #
274
312
  # The temperature is only proportional to the real temperature and it has bad
275
313
  # accuracy. Practically it is only useful as an indicator for
276
314
  # temperature changes.
277
315
  def get_chip_temperature
278
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
316
+ check_validity
317
+
318
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
279
319
  end
280
320
 
281
321
  # Calling this function will reset the Bricklet. All configurations
@@ -285,7 +325,9 @@ module Tinkerforge
285
325
  # calling functions on the existing ones will result in
286
326
  # undefined behavior!
287
327
  def reset
288
- send_request FUNCTION_RESET, [], '', 0, ''
328
+ check_validity
329
+
330
+ send_request FUNCTION_RESET, [], '', 8, ''
289
331
  end
290
332
 
291
333
  # Writes a new UID into flash. If you want to set a new UID
@@ -294,25 +336,31 @@ module Tinkerforge
294
336
  #
295
337
  # We recommend that you use Brick Viewer to change the UID.
296
338
  def write_uid(uid)
297
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
339
+ check_validity
340
+
341
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
298
342
  end
299
343
 
300
344
  # Returns the current UID as an integer. Encode as
301
345
  # Base58 to get the usual string version.
302
346
  def read_uid
303
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
347
+ check_validity
348
+
349
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
304
350
  end
305
351
 
306
352
  # Returns the UID, the UID where the Bricklet is connected to,
307
353
  # the position, the hardware and firmware version as well as the
308
354
  # device identifier.
309
355
  #
310
- # 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
358
+ # position 'z'.
311
359
  #
312
360
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
313
361
  # |device_identifier_constant|
314
362
  def get_identity
315
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
363
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
316
364
  end
317
365
 
318
366
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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,15 +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
- # Beeps with the duration in ms. For example: If you set a value of 1000,
47
- # the piezo buzzer will beep for one second.
49
+ # Beeps for the given duration.
48
50
  def beep(duration)
49
- send_request FUNCTION_BEEP, [duration], 'L', 0, ''
51
+ check_validity
52
+
53
+ send_request FUNCTION_BEEP, [duration], 'L', 8, ''
50
54
  end
51
55
 
52
56
  # Sets morse code that will be played by the piezo buzzer. The morse code
@@ -56,22 +60,24 @@ module Tinkerforge
56
60
  # For example: If you set the string "...---...", the piezo buzzer will beep
57
61
  # nine times with the durations "short short short long long long short
58
62
  # short short".
59
- #
60
- # The maximum string size is 60.
61
63
  def morse_code(morse)
62
- send_request FUNCTION_MORSE_CODE, [morse], 'Z60', 0, ''
64
+ check_validity
65
+
66
+ send_request FUNCTION_MORSE_CODE, [morse], 'Z60', 8, ''
63
67
  end
64
68
 
65
69
  # Returns the UID, the UID where the Bricklet is connected to,
66
70
  # the position, the hardware and firmware version as well as the
67
71
  # device identifier.
68
72
  #
69
- # 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
75
+ # position 'z'.
70
76
  #
71
77
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
72
78
  # |device_identifier_constant|
73
79
  def get_identity
74
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
80
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
75
81
  end
76
82
 
77
83
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-05-21. #
3
+ # This file was automatically generated on 2020-11-02. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.22 #
5
+ # Ruby Bindings Version 2.1.27 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 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,40 +44,37 @@ 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
- # Beeps with the given frequency for the duration in ms. For example:
51
- # If you set a duration of 1000, with a frequency value of 2000
52
- # the piezo buzzer will beep for one second with a frequency of
53
- # approximately 2 kHz.
53
+ # Beeps with the given frequency for the given duration.
54
54
  #
55
55
  # .. versionchanged:: 2.0.2$nbsp;(Plugin)
56
56
  # A duration of 0 stops the current beep if any, the frequency parameter is
57
57
  # ignored. A duration of 4294967295 results in an infinite beep.
58
58
  #
59
- # The *frequency* parameter can be set between 585 and 7100.
60
- #
61
59
  # The Piezo Speaker Bricklet can only approximate the frequency, it will play
62
60
  # the best possible match by applying the calibration (see BrickletPiezoSpeaker#calibrate).
63
61
  def beep(duration, frequency)
64
- send_request FUNCTION_BEEP, [duration, frequency], 'L S', 0, ''
62
+ check_validity
63
+
64
+ send_request FUNCTION_BEEP, [duration, frequency], 'L S', 8, ''
65
65
  end
66
66
 
67
67
  # Sets morse code that will be played by the piezo buzzer. The morse code
68
68
  # is given as a string consisting of "." (dot), "-" (minus) and " " (space)
69
69
  # for *dits*, *dahs* and *pauses*. Every other character is ignored.
70
- # The second parameter is the frequency (see BrickletPiezoSpeaker#beep).
71
70
  #
72
71
  # For example: If you set the string "...---...", the piezo buzzer will beep
73
72
  # nine times with the durations "short short short long long long short
74
73
  # short short".
75
- #
76
- # The maximum string size is 60.
77
74
  def morse_code(morse, frequency)
78
- 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, ''
79
78
  end
80
79
 
81
80
  # The Piezo Speaker Bricklet can play 512 different tones. This function
@@ -88,19 +87,23 @@ module Tinkerforge
88
87
  #
89
88
  # Returns *true* after the calibration finishes.
90
89
  def calibrate
91
- send_request FUNCTION_CALIBRATE, [], '', 1, '?'
90
+ check_validity
91
+
92
+ send_request FUNCTION_CALIBRATE, [], '', 9, '?'
92
93
  end
93
94
 
94
95
  # Returns the UID, the UID where the Bricklet is connected to,
95
96
  # the position, the hardware and firmware version as well as the
96
97
  # device identifier.
97
98
  #
98
- # 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
101
+ # position 'z'.
99
102
  #
100
103
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
101
104
  # |device_identifier_constant|
102
105
  def get_identity
103
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
106
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
104
107
  end
105
108
 
106
109
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.