tinkerforge 2.1.24 → 2.1.29

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 (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  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 +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures air pressure and altitude changes
14
16
  class BrickletBarometerV2 < Device
@@ -96,7 +98,7 @@ module Tinkerforge
96
98
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
97
99
  # the IP Connection <tt>ipcon</tt>.
98
100
  def initialize(uid, ipcon)
99
- super uid, ipcon
101
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
100
102
 
101
103
  @api_version = [2, 0, 0]
102
104
 
@@ -130,10 +132,11 @@ module Tinkerforge
130
132
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
133
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
134
 
133
- @callback_formats[CALLBACK_AIR_PRESSURE] = 'l'
134
- @callback_formats[CALLBACK_ALTITUDE] = 'l'
135
- @callback_formats[CALLBACK_TEMPERATURE] = 'l'
135
+ @callback_formats[CALLBACK_AIR_PRESSURE] = [12, 'l']
136
+ @callback_formats[CALLBACK_ALTITUDE] = [12, 'l']
137
+ @callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
136
138
 
139
+ @ipcon.add_device self
137
140
  end
138
141
 
139
142
  # Returns the measured air pressure.
@@ -143,7 +146,9 @@ module Tinkerforge
143
146
  # CALLBACK_AIR_PRESSURE callback. You can set the callback configuration
144
147
  # with BrickletBarometerV2#set_air_pressure_callback_configuration.
145
148
  def get_air_pressure
146
- send_request FUNCTION_GET_AIR_PRESSURE, [], '', 4, 'l'
149
+ check_validity
150
+
151
+ send_request FUNCTION_GET_AIR_PRESSURE, [], '', 12, 'l'
147
152
  end
148
153
 
149
154
  # The period is the period with which the CALLBACK_AIR_PRESSURE callback is triggered
@@ -172,12 +177,16 @@ module Tinkerforge
172
177
  #
173
178
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
174
179
  def set_air_pressure_callback_configuration(period, value_has_to_change, option, min, max)
175
- send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
180
+ check_validity
181
+
182
+ send_request FUNCTION_SET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
176
183
  end
177
184
 
178
185
  # Returns the callback configuration as set by BrickletBarometerV2#set_air_pressure_callback_configuration.
179
186
  def get_air_pressure_callback_configuration
180
- send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
187
+ check_validity
188
+
189
+ send_request FUNCTION_GET_AIR_PRESSURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
181
190
  end
182
191
 
183
192
  # Returns the relative altitude of the air pressure sensor. The value
@@ -190,7 +199,9 @@ module Tinkerforge
190
199
  # CALLBACK_ALTITUDE callback. You can set the callback configuration
191
200
  # with BrickletBarometerV2#set_altitude_callback_configuration.
192
201
  def get_altitude
193
- send_request FUNCTION_GET_ALTITUDE, [], '', 4, 'l'
202
+ check_validity
203
+
204
+ send_request FUNCTION_GET_ALTITUDE, [], '', 12, 'l'
194
205
  end
195
206
 
196
207
  # The period is the period with which the CALLBACK_ALTITUDE callback is triggered
@@ -219,12 +230,16 @@ module Tinkerforge
219
230
  #
220
231
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
221
232
  def set_altitude_callback_configuration(period, value_has_to_change, option, min, max)
222
- send_request FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
233
+ check_validity
234
+
235
+ send_request FUNCTION_SET_ALTITUDE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
223
236
  end
224
237
 
225
238
  # Returns the callback configuration as set by BrickletBarometerV2#set_altitude_callback_configuration.
226
239
  def get_altitude_callback_configuration
227
- send_request FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
240
+ check_validity
241
+
242
+ send_request FUNCTION_GET_ALTITUDE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
228
243
  end
229
244
 
230
245
  # Returns the temperature of the air pressure sensor.
@@ -239,7 +254,9 @@ module Tinkerforge
239
254
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
240
255
  # with BrickletBarometerV2#set_temperature_callback_configuration.
241
256
  def get_temperature
242
- send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
257
+ check_validity
258
+
259
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
243
260
  end
244
261
 
245
262
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -268,12 +285,16 @@ module Tinkerforge
268
285
  #
269
286
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
270
287
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
271
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 0, ''
288
+ check_validity
289
+
290
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k l l', 8, ''
272
291
  end
273
292
 
274
293
  # Returns the callback configuration as set by BrickletBarometerV2#set_temperature_callback_configuration.
275
294
  def get_temperature_callback_configuration
276
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 14, 'L ? k l l'
295
+ check_validity
296
+
297
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 22, 'L ? k l l'
277
298
  end
278
299
 
279
300
  # Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
@@ -285,13 +306,17 @@ module Tinkerforge
285
306
  # If you want to do long term measurements the longest moving average will give
286
307
  # the cleanest results.
287
308
  def set_moving_average_configuration(moving_average_length_air_pressure, moving_average_length_temperature)
288
- send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_air_pressure, moving_average_length_temperature], 'S S', 0, ''
309
+ check_validity
310
+
311
+ send_request FUNCTION_SET_MOVING_AVERAGE_CONFIGURATION, [moving_average_length_air_pressure, moving_average_length_temperature], 'S S', 8, ''
289
312
  end
290
313
 
291
314
  # Returns the moving average configuration as set by
292
315
  # BrickletBarometerV2#set_moving_average_configuration.
293
316
  def get_moving_average_configuration
294
- send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 4, 'S S'
317
+ check_validity
318
+
319
+ send_request FUNCTION_GET_MOVING_AVERAGE_CONFIGURATION, [], '', 12, 'S S'
295
320
  end
296
321
 
297
322
  # Sets the reference air pressure for the altitude calculation.
@@ -304,12 +329,16 @@ module Tinkerforge
304
329
  # `QFE <https://en.wikipedia.org/wiki/Mean_sea_level_pressure#Mean_sea_level_pressure>`__
305
330
  # used in aviation.
306
331
  def set_reference_air_pressure(air_pressure)
307
- send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 0, ''
332
+ check_validity
333
+
334
+ send_request FUNCTION_SET_REFERENCE_AIR_PRESSURE, [air_pressure], 'l', 8, ''
308
335
  end
309
336
 
310
337
  # Returns the reference air pressure as set by BrickletBarometerV2#set_reference_air_pressure.
311
338
  def get_reference_air_pressure
312
- send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 4, 'l'
339
+ check_validity
340
+
341
+ send_request FUNCTION_GET_REFERENCE_AIR_PRESSURE, [], '', 12, 'l'
313
342
  end
314
343
 
315
344
  # Sets the one point calibration (OPC) values for the air pressure measurement.
@@ -327,13 +356,17 @@ module Tinkerforge
327
356
  # The calibration is saved in the EEPROM of the Bricklet and only needs to be
328
357
  # configured once.
329
358
  def set_calibration(measured_air_pressure, actual_air_pressure)
330
- send_request FUNCTION_SET_CALIBRATION, [measured_air_pressure, actual_air_pressure], 'l l', 0, ''
359
+ check_validity
360
+
361
+ send_request FUNCTION_SET_CALIBRATION, [measured_air_pressure, actual_air_pressure], 'l l', 8, ''
331
362
  end
332
363
 
333
364
  # Returns the air pressure one point calibration values as set by
334
365
  # BrickletBarometerV2#set_calibration.
335
366
  def get_calibration
336
- send_request FUNCTION_GET_CALIBRATION, [], '', 8, 'l l'
367
+ check_validity
368
+
369
+ send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l l'
337
370
  end
338
371
 
339
372
  # Configures the data rate and air pressure low pass filter. The low pass filter
@@ -347,12 +380,16 @@ module Tinkerforge
347
380
  # self-heating of the sensor. If the accuracy of the temperature reading is
348
381
  # important to you, we would recommend the 1Hz data rate.
349
382
  def set_sensor_configuration(data_rate, air_pressure_low_pass_filter)
350
- send_request FUNCTION_SET_SENSOR_CONFIGURATION, [data_rate, air_pressure_low_pass_filter], 'C C', 0, ''
383
+ check_validity
384
+
385
+ send_request FUNCTION_SET_SENSOR_CONFIGURATION, [data_rate, air_pressure_low_pass_filter], 'C C', 8, ''
351
386
  end
352
387
 
353
388
  # Returns the sensor configuration as set by BrickletBarometerV2#set_sensor_configuration.
354
389
  def get_sensor_configuration
355
- send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 2, 'C C'
390
+ check_validity
391
+
392
+ send_request FUNCTION_GET_SENSOR_CONFIGURATION, [], '', 10, 'C C'
356
393
  end
357
394
 
358
395
  # Returns the error count for the communication between Brick and Bricklet.
@@ -367,7 +404,9 @@ module Tinkerforge
367
404
  # The errors counts are for errors that occur on the Bricklet side. All
368
405
  # Bricks have a similar function that returns the errors on the Brick side.
369
406
  def get_spitfp_error_count
370
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
407
+ check_validity
408
+
409
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
371
410
  end
372
411
 
373
412
  # Sets the bootloader mode and returns the status after the requested
@@ -380,12 +419,16 @@ module Tinkerforge
380
419
  # This function is used by Brick Viewer during flashing. It should not be
381
420
  # necessary to call it in a normal user program.
382
421
  def set_bootloader_mode(mode)
383
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
422
+ check_validity
423
+
424
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
384
425
  end
385
426
 
386
427
  # Returns the current bootloader mode, see BrickletBarometerV2#set_bootloader_mode.
387
428
  def get_bootloader_mode
388
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
429
+ check_validity
430
+
431
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
389
432
  end
390
433
 
391
434
  # Sets the firmware pointer for BrickletBarometerV2#write_firmware. The pointer has
@@ -395,7 +438,9 @@ module Tinkerforge
395
438
  # This function is used by Brick Viewer during flashing. It should not be
396
439
  # necessary to call it in a normal user program.
397
440
  def set_write_firmware_pointer(pointer)
398
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
441
+ check_validity
442
+
443
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
399
444
  end
400
445
 
401
446
  # Writes 64 Bytes of firmware at the position as written by
@@ -407,7 +452,9 @@ module Tinkerforge
407
452
  # This function is used by Brick Viewer during flashing. It should not be
408
453
  # necessary to call it in a normal user program.
409
454
  def write_firmware(data)
410
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
455
+ check_validity
456
+
457
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
411
458
  end
412
459
 
413
460
  # Sets the status LED configuration. By default the LED shows
@@ -418,22 +465,28 @@ module Tinkerforge
418
465
  #
419
466
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
420
467
  def set_status_led_config(config)
421
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
468
+ check_validity
469
+
470
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
422
471
  end
423
472
 
424
473
  # Returns the configuration as set by BrickletBarometerV2#set_status_led_config
425
474
  def get_status_led_config
426
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
475
+ check_validity
476
+
477
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
427
478
  end
428
479
 
429
- # Returns the temperature in °C as measured inside the microcontroller. The
480
+ # Returns the temperature as measured inside the microcontroller. The
430
481
  # value returned is not the ambient temperature!
431
482
  #
432
483
  # The temperature is only proportional to the real temperature and it has bad
433
484
  # accuracy. Practically it is only useful as an indicator for
434
485
  # temperature changes.
435
486
  def get_chip_temperature
436
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
487
+ check_validity
488
+
489
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
437
490
  end
438
491
 
439
492
  # Calling this function will reset the Bricklet. All configurations
@@ -443,7 +496,9 @@ module Tinkerforge
443
496
  # calling functions on the existing ones will result in
444
497
  # undefined behavior!
445
498
  def reset
446
- send_request FUNCTION_RESET, [], '', 0, ''
499
+ check_validity
500
+
501
+ send_request FUNCTION_RESET, [], '', 8, ''
447
502
  end
448
503
 
449
504
  # Writes a new UID into flash. If you want to set a new UID
@@ -452,25 +507,31 @@ module Tinkerforge
452
507
  #
453
508
  # We recommend that you use Brick Viewer to change the UID.
454
509
  def write_uid(uid)
455
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
510
+ check_validity
511
+
512
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
456
513
  end
457
514
 
458
515
  # Returns the current UID as an integer. Encode as
459
516
  # Base58 to get the usual string version.
460
517
  def read_uid
461
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
518
+ check_validity
519
+
520
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
462
521
  end
463
522
 
464
523
  # Returns the UID, the UID where the Bricklet is connected to,
465
524
  # the position, the hardware and firmware version as well as the
466
525
  # device identifier.
467
526
  #
468
- # The position can be 'a', 'b', 'c' or 'd'.
527
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
528
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
529
+ # position 'z'.
469
530
  #
470
531
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
471
532
  # |device_identifier_constant|
472
533
  def get_identity
473
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
534
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
474
535
  end
475
536
 
476
537
  # 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 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
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
  # Communicates with CAN bus devices
14
16
  class BrickletCAN < Device
@@ -29,6 +31,20 @@ module Tinkerforge
29
31
  # To enable this callback, use BrickletCAN#enable_frame_read_callback.
30
32
  CALLBACK_FRAME_READ = 11
31
33
 
34
+ # This callback is triggered if a data or remote frame was received by the CAN
35
+ # transceiver. The received frame can be read with BrickletCAN#read_frame.
36
+ # If additional frames are received, but BrickletCAN#read_frame was not called yet, the callback
37
+ # will not trigger again.
38
+ #
39
+ # A configurable read filter can be used to define which frames should be
40
+ # received by the CAN transceiver and put into the read queue (see
41
+ # BrickletCAN#set_read_filter).
42
+ #
43
+ # To enable this callback, use BrickletCAN#set_frame_readable_callback_configuration.
44
+ #
45
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
46
+ CALLBACK_FRAME_READABLE = 14
47
+
32
48
  FUNCTION_WRITE_FRAME = 1 # :nodoc:
33
49
  FUNCTION_READ_FRAME = 2 # :nodoc:
34
50
  FUNCTION_ENABLE_FRAME_READ_CALLBACK = 3 # :nodoc:
@@ -39,6 +55,8 @@ module Tinkerforge
39
55
  FUNCTION_SET_READ_FILTER = 8 # :nodoc:
40
56
  FUNCTION_GET_READ_FILTER = 9 # :nodoc:
41
57
  FUNCTION_GET_ERROR_LOG = 10 # :nodoc:
58
+ FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION = 12 # :nodoc:
59
+ FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION = 13 # :nodoc:
42
60
  FUNCTION_GET_IDENTITY = 255 # :nodoc:
43
61
 
44
62
  FRAME_TYPE_STANDARD_DATA = 0 # :nodoc:
@@ -65,9 +83,9 @@ module Tinkerforge
65
83
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
66
84
  # the IP Connection <tt>ipcon</tt>.
67
85
  def initialize(uid, ipcon)
68
- super uid, ipcon
86
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
69
87
 
70
- @api_version = [2, 0, 0]
88
+ @api_version = [2, 0, 1]
71
89
 
72
90
  @response_expected[FUNCTION_WRITE_FRAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
73
91
  @response_expected[FUNCTION_READ_FRAME] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -79,10 +97,14 @@ module Tinkerforge
79
97
  @response_expected[FUNCTION_SET_READ_FILTER] = RESPONSE_EXPECTED_FALSE
80
98
  @response_expected[FUNCTION_GET_READ_FILTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
81
99
  @response_expected[FUNCTION_GET_ERROR_LOG] = RESPONSE_EXPECTED_ALWAYS_TRUE
100
+ @response_expected[FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
101
+ @response_expected[FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
82
102
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
83
103
 
84
- @callback_formats[CALLBACK_FRAME_READ] = 'C L C8 C'
104
+ @callback_formats[CALLBACK_FRAME_READ] = [22, 'C L C8 C']
105
+ @callback_formats[CALLBACK_FRAME_READABLE] = [8, '']
85
106
 
107
+ @ipcon.add_device self
86
108
  end
87
109
 
88
110
  # Writes a data or remote frame to the write buffer to be transmitted over the
@@ -107,7 +129,9 @@ module Tinkerforge
107
129
  # arbitration or because the CAN transceiver is currently disabled due to a high
108
130
  # write error level (see BrickletCAN#get_error_log).
109
131
  def write_frame(frame_type, identifier, data, length)
110
- send_request FUNCTION_WRITE_FRAME, [frame_type, identifier, data, length], 'C L C8 C', 1, '?'
132
+ check_validity
133
+
134
+ send_request FUNCTION_WRITE_FRAME, [frame_type, identifier, data, length], 'C L C8 C', 9, '?'
111
135
  end
112
136
 
113
137
  # Tries to read the next data or remote frame from the read buffer and return it.
@@ -128,26 +152,34 @@ module Tinkerforge
128
152
  # Instead of polling with this function, you can also use callbacks. See the
129
153
  # BrickletCAN#enable_frame_read_callback function and the CALLBACK_FRAME_READ callback.
130
154
  def read_frame
131
- send_request FUNCTION_READ_FRAME, [], '', 15, '? C L C8 C'
155
+ check_validity
156
+
157
+ send_request FUNCTION_READ_FRAME, [], '', 23, '? C L C8 C'
132
158
  end
133
159
 
134
160
  # Enables the CALLBACK_FRAME_READ callback.
135
161
  #
136
- # By default the callback is disabled.
162
+ # By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READABLE callback.
137
163
  def enable_frame_read_callback
138
- send_request FUNCTION_ENABLE_FRAME_READ_CALLBACK, [], '', 0, ''
164
+ check_validity
165
+
166
+ send_request FUNCTION_ENABLE_FRAME_READ_CALLBACK, [], '', 8, ''
139
167
  end
140
168
 
141
169
  # Disables the CALLBACK_FRAME_READ callback.
142
170
  #
143
171
  # By default the callback is disabled.
144
172
  def disable_frame_read_callback
145
- send_request FUNCTION_DISABLE_FRAME_READ_CALLBACK, [], '', 0, ''
173
+ check_validity
174
+
175
+ send_request FUNCTION_DISABLE_FRAME_READ_CALLBACK, [], '', 8, ''
146
176
  end
147
177
 
148
178
  # Returns *true* if the CALLBACK_FRAME_READ callback is enabled, *false* otherwise.
149
179
  def is_frame_read_callback_enabled
150
- send_request FUNCTION_IS_FRAME_READ_CALLBACK_ENABLED, [], '', 1, '?'
180
+ check_validity
181
+
182
+ send_request FUNCTION_IS_FRAME_READ_CALLBACK_ENABLED, [], '', 9, '?'
151
183
  end
152
184
 
153
185
  # Sets the configuration for the CAN bus communication.
@@ -175,12 +207,16 @@ module Tinkerforge
175
207
  # If the frame could not be transmitted successfully after the configured
176
208
  # number of milliseconds then the frame is discarded.
177
209
  def set_configuration(baud_rate, transceiver_mode, write_timeout)
178
- send_request FUNCTION_SET_CONFIGURATION, [baud_rate, transceiver_mode, write_timeout], 'C C l', 0, ''
210
+ check_validity
211
+
212
+ send_request FUNCTION_SET_CONFIGURATION, [baud_rate, transceiver_mode, write_timeout], 'C C l', 8, ''
179
213
  end
180
214
 
181
215
  # Returns the configuration as set by BrickletCAN#set_configuration.
182
216
  def get_configuration
183
- send_request FUNCTION_GET_CONFIGURATION, [], '', 6, 'C C l'
217
+ check_validity
218
+
219
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 14, 'C C l'
184
220
  end
185
221
 
186
222
  # Set the read filter configuration. This can be used to define which frames
@@ -234,12 +270,16 @@ module Tinkerforge
234
270
  # To accept identifier 0x123 and identifier 0x456 at the same time, just set
235
271
  # filter 2 to 0x456 and keep mask and filter 1 unchanged.
236
272
  def set_read_filter(mode, mask, filter1, filter2)
237
- send_request FUNCTION_SET_READ_FILTER, [mode, mask, filter1, filter2], 'C L L L', 0, ''
273
+ check_validity
274
+
275
+ send_request FUNCTION_SET_READ_FILTER, [mode, mask, filter1, filter2], 'C L L L', 8, ''
238
276
  end
239
277
 
240
278
  # Returns the read filter as set by BrickletCAN#set_read_filter.
241
279
  def get_read_filter
242
- send_request FUNCTION_GET_READ_FILTER, [], '', 13, 'C L L L'
280
+ check_validity
281
+
282
+ send_request FUNCTION_GET_READ_FILTER, [], '', 21, 'C L L L'
243
283
  end
244
284
 
245
285
  # Returns information about different kinds of errors.
@@ -248,7 +288,7 @@ module Tinkerforge
248
288
  # acknowledgement, form, bit and stuffing errors during CAN bus write and read
249
289
  # operations.
250
290
  #
251
- # When the write error level extends 255 then the CAN transceiver gets disabled
291
+ # When the write error level exceeds 255 then the CAN transceiver gets disabled
252
292
  # and no frames can be transmitted or received anymore. The CAN transceiver will
253
293
  # automatically be activated again after the CAN bus is idle for a while.
254
294
  #
@@ -276,19 +316,43 @@ module Tinkerforge
276
316
  # function. Using the CALLBACK_FRAME_READ callback ensures that the read buffer
277
317
  # can not overflow.
278
318
  def get_error_log
279
- send_request FUNCTION_GET_ERROR_LOG, [], '', 15, 'C C ? L L L'
319
+ check_validity
320
+
321
+ send_request FUNCTION_GET_ERROR_LOG, [], '', 23, 'C C ? L L L'
322
+ end
323
+
324
+ # Enables/disables the CALLBACK_FRAME_READABLE callback.
325
+ #
326
+ # By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READ callback.
327
+ #
328
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
329
+ def set_frame_readable_callback_configuration(enabled)
330
+ check_validity
331
+
332
+ send_request FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
333
+ end
334
+
335
+ # Returns *true* if the CALLBACK_FRAME_READABLE callback is enabled, *false* otherwise.
336
+ #
337
+ # .. versionadded:: 2.0.1$nbsp;(Plugin)
338
+ def get_frame_readable_callback_configuration
339
+ check_validity
340
+
341
+ send_request FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION, [], '', 9, '?'
280
342
  end
281
343
 
282
344
  # Returns the UID, the UID where the Bricklet is connected to,
283
345
  # the position, the hardware and firmware version as well as the
284
346
  # device identifier.
285
347
  #
286
- # The position can be 'a', 'b', 'c' or 'd'.
348
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
349
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
350
+ # position 'z'.
287
351
  #
288
352
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
289
353
  # |device_identifier_constant|
290
354
  def get_identity
291
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
355
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
292
356
  end
293
357
 
294
358
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.