tinkerforge 2.1.24 → 2.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tinkerforge/brick_dc.rb +155 -74
  3. data/lib/tinkerforge/brick_hat.rb +70 -30
  4. data/lib/tinkerforge/brick_hat_zero.rb +56 -22
  5. data/lib/tinkerforge/brick_imu.rb +184 -77
  6. data/lib/tinkerforge/brick_imu_v2.rb +208 -105
  7. data/lib/tinkerforge/brick_master.rb +484 -182
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +185 -101
  10. data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
  11. data/lib/tinkerforge/brick_stepper.rb +210 -98
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
  18. data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +66 -26
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -18
  27. data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +34 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
  30. data/lib/tinkerforge/bricklet_color.rb +69 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +78 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +58 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +58 -24
  35. data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
  36. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
  37. data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
  38. data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
  39. data/lib/tinkerforge/bricklet_dmx.rb +88 -34
  40. data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
  41. data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
  42. data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
  43. data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
  44. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
  45. data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
  46. data/lib/tinkerforge/bricklet_gps.rb +64 -26
  47. data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
  48. data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
  49. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
  50. data/lib/tinkerforge/bricklet_humidity.rb +51 -21
  51. data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
  52. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
  53. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
  54. data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
  55. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
  56. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
  57. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
  58. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
  59. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
  60. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
  61. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
  62. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
  64. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
  65. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
  66. data/lib/tinkerforge/bricklet_io16.rb +55 -21
  67. data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
  68. data/lib/tinkerforge/bricklet_io4.rb +55 -23
  69. data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
  70. data/lib/tinkerforge/bricklet_isolator.rb +72 -28
  71. data/lib/tinkerforge/bricklet_joystick.rb +59 -25
  72. data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
  73. data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
  74. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
  75. data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
  76. data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
  77. data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
  78. data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
  79. data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
  80. data/lib/tinkerforge/bricklet_line.rb +34 -14
  81. data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
  82. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
  83. data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
  84. data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
  85. data/lib/tinkerforge/bricklet_moisture.rb +40 -16
  86. data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
  87. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
  88. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
  89. data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
  90. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
  91. data/lib/tinkerforge/bricklet_nfc.rb +123 -58
  92. data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
  93. data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
  94. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
  95. data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
  96. data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
  97. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
  98. data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
  99. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
  100. data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
  101. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
  102. data/lib/tinkerforge/bricklet_ptc.rb +74 -42
  103. data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
  104. data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
  105. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
  106. data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
  107. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
  108. data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
  109. data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
  110. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
  111. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
  112. data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
  113. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
  114. data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
  115. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
  116. data/lib/tinkerforge/bricklet_rs232.rb +90 -28
  117. data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
  118. data/lib/tinkerforge/bricklet_rs485.rb +223 -95
  119. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
  120. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
  121. data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
  122. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
  123. data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
  124. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
  125. data/lib/tinkerforge/bricklet_temperature.rb +40 -16
  126. data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
  127. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
  128. data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
  129. data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
  130. data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
  131. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
  132. data/lib/tinkerforge/bricklet_tilt.rb +24 -10
  133. data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
  134. data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
  135. data/lib/tinkerforge/bricklet_voltage.rb +52 -28
  136. data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
  137. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
  138. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
  139. data/lib/tinkerforge/device_display_names.rb +163 -0
  140. data/lib/tinkerforge/ip_connection.rb +151 -32
  141. data/lib/tinkerforge/version.rb +1 -1
  142. metadata +3 -2
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Communicates with CAN bus devices
14
16
  class BrickletCANV2 < Device
@@ -18,6 +20,30 @@ module Tinkerforge
18
20
  # See CALLBACK_FRAME_READ
19
21
  CALLBACK_FRAME_READ_LOW_LEVEL = 16
20
22
 
23
+ # This callback is triggered if a data or remote frame was received by the CAN
24
+ # transceiver. The received frame can be read with BrickletCANV2#read_frame.
25
+ # If additional frames are received, but BrickletCANV2#read_frame was not called yet, the callback
26
+ # will not trigger again.
27
+ #
28
+ # A configurable read filter can be used to define which frames should be
29
+ # received by the CAN transceiver and put into the read queue (see
30
+ # BrickletCANV2#set_read_filter_configuration).
31
+ #
32
+ # To enable this callback, use BrickletCANV2#set_frame_readable_callback_configuration.
33
+ #
34
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
35
+ CALLBACK_FRAME_READABLE = 19
36
+
37
+ # This callback is triggered if any error occurred while writing, reading or transmitting CAN frames.
38
+ #
39
+ # The callback is only triggered once until BrickletCANV2#get_error_log is called. That function will return
40
+ # details abount the error(s) occurred.
41
+ #
42
+ # To enable this callback, use BrickletCANV2#set_error_occurred_callback_configuration.
43
+ #
44
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
45
+ CALLBACK_ERROR_OCCURRED = 22
46
+
21
47
  # This callback is triggered if a data or remote frame was received by the CAN
22
48
  # transceiver.
23
49
  #
@@ -28,7 +54,7 @@ module Tinkerforge
28
54
  #
29
55
  # A configurable read filter can be used to define which frames should be
30
56
  # received by the CAN transceiver and put into the read queue (see
31
- # BrickletCANV2#set_queue_configuration).
57
+ # BrickletCANV2#set_read_filter_configuration).
32
58
  #
33
59
  # To enable this callback, use BrickletCANV2#set_frame_read_callback_configuration.
34
60
  #
@@ -51,6 +77,10 @@ module Tinkerforge
51
77
  FUNCTION_GET_COMMUNICATION_LED_CONFIG = 13 # :nodoc:
52
78
  FUNCTION_SET_ERROR_LED_CONFIG = 14 # :nodoc:
53
79
  FUNCTION_GET_ERROR_LED_CONFIG = 15 # :nodoc:
80
+ FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION = 17 # :nodoc:
81
+ FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION = 18 # :nodoc:
82
+ FUNCTION_SET_ERROR_OCCURRED_CALLBACK_CONFIGURATION = 20 # :nodoc:
83
+ FUNCTION_GET_ERROR_OCCURRED_CALLBACK_CONFIGURATION = 21 # :nodoc:
54
84
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
55
85
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
56
86
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -106,9 +136,9 @@ module Tinkerforge
106
136
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
107
137
  # the IP Connection <tt>ipcon</tt>.
108
138
  def initialize(uid, ipcon)
109
- super uid, ipcon
139
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
110
140
 
111
- @api_version = [2, 0, 0]
141
+ @api_version = [2, 0, 1]
112
142
 
113
143
  @response_expected[FUNCTION_WRITE_FRAME_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
114
144
  @response_expected[FUNCTION_READ_FRAME_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -125,6 +155,10 @@ module Tinkerforge
125
155
  @response_expected[FUNCTION_GET_COMMUNICATION_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
126
156
  @response_expected[FUNCTION_SET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
127
157
  @response_expected[FUNCTION_GET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
158
+ @response_expected[FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
159
+ @response_expected[FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
160
+ @response_expected[FUNCTION_SET_ERROR_OCCURRED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_TRUE
161
+ @response_expected[FUNCTION_GET_ERROR_OCCURRED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
128
162
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
129
163
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
130
164
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -138,9 +172,12 @@ module Tinkerforge
138
172
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
139
173
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
140
174
 
141
- @callback_formats[CALLBACK_FRAME_READ_LOW_LEVEL] = 'C L C C15'
175
+ @callback_formats[CALLBACK_FRAME_READ_LOW_LEVEL] = [29, 'C L C C15']
176
+ @callback_formats[CALLBACK_FRAME_READABLE] = [8, '']
177
+ @callback_formats[CALLBACK_ERROR_OCCURRED] = [8, '']
142
178
 
143
179
  @high_level_callbacks[CALLBACK_FRAME_READ] = [[nil, nil, 'stream_length', 'stream_chunk_data'], {'fixed_length' => nil, 'single_chunk' => true}, nil]
180
+ @ipcon.add_device self
144
181
  end
145
182
 
146
183
  # Writes a data or remote frame to the write queue to be transmitted over the
@@ -172,7 +209,9 @@ module Tinkerforge
172
209
  # arbitration or because the CAN transceiver is currently disabled due to a high
173
210
  # write error level (see BrickletCANV2#get_error_log).
174
211
  def write_frame_low_level(frame_type, identifier, data_length, data_data)
175
- send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_type, identifier, data_length, data_data], 'C L C C15', 1, '?'
212
+ check_validity
213
+
214
+ send_request FUNCTION_WRITE_FRAME_LOW_LEVEL, [frame_type, identifier, data_length, data_data], 'C L C C15', 9, '?'
176
215
  end
177
216
 
178
217
  # Tries to read the next data or remote frame from the read queue and returns it.
@@ -198,19 +237,25 @@ module Tinkerforge
198
237
  # BrickletCANV2#set_frame_read_callback_configuration function and the CALLBACK_FRAME_READ
199
238
  # callback.
200
239
  def read_frame_low_level
201
- send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 22, '? C L C C15'
240
+ check_validity
241
+
242
+ send_request FUNCTION_READ_FRAME_LOW_LEVEL, [], '', 30, '? C L C C15'
202
243
  end
203
244
 
204
245
  # Enables and disables the CALLBACK_FRAME_READ callback.
205
246
  #
206
- # By default the callback is disabled.
247
+ # By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READABLE callback.
207
248
  def set_frame_read_callback_configuration(enabled)
208
- send_request FUNCTION_SET_FRAME_READ_CALLBACK_CONFIGURATION, [enabled], '?', 0, ''
249
+ check_validity
250
+
251
+ send_request FUNCTION_SET_FRAME_READ_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
209
252
  end
210
253
 
211
254
  # Returns *true* if the CALLBACK_FRAME_READ callback is enabled, *false* otherwise.
212
255
  def get_frame_read_callback_configuration
213
- send_request FUNCTION_GET_FRAME_READ_CALLBACK_CONFIGURATION, [], '', 1, '?'
256
+ check_validity
257
+
258
+ send_request FUNCTION_GET_FRAME_READ_CALLBACK_CONFIGURATION, [], '', 9, '?'
214
259
  end
215
260
 
216
261
  # Sets the transceiver configuration for the CAN bus communication.
@@ -225,12 +270,16 @@ module Tinkerforge
225
270
  # detection nor acknowledgement. Only the receiving part of the transceiver
226
271
  # is connected to the CAN bus.
227
272
  def set_transceiver_configuration(baud_rate, sample_point, transceiver_mode)
228
- send_request FUNCTION_SET_TRANSCEIVER_CONFIGURATION, [baud_rate, sample_point, transceiver_mode], 'L S C', 0, ''
273
+ check_validity
274
+
275
+ send_request FUNCTION_SET_TRANSCEIVER_CONFIGURATION, [baud_rate, sample_point, transceiver_mode], 'L S C', 8, ''
229
276
  end
230
277
 
231
278
  # Returns the configuration as set by BrickletCANV2#set_transceiver_configuration.
232
279
  def get_transceiver_configuration
233
- send_request FUNCTION_GET_TRANSCEIVER_CONFIGURATION, [], '', 7, 'L S C'
280
+ check_validity
281
+
282
+ send_request FUNCTION_GET_TRANSCEIVER_CONFIGURATION, [], '', 15, 'L S C'
234
283
  end
235
284
 
236
285
  # Sets the write and read queue configuration.
@@ -281,12 +330,16 @@ module Tinkerforge
281
330
  #
282
331
  # The current content of the queues is lost when this function is called.
283
332
  def set_queue_configuration_low_level(write_buffer_size, write_buffer_timeout, write_backlog_size, read_buffer_sizes_length, read_buffer_sizes_data, read_backlog_size)
284
- send_request FUNCTION_SET_QUEUE_CONFIGURATION_LOW_LEVEL, [write_buffer_size, write_buffer_timeout, write_backlog_size, read_buffer_sizes_length, read_buffer_sizes_data, read_backlog_size], 'C l S C c32 S', 0, ''
333
+ check_validity
334
+
335
+ send_request FUNCTION_SET_QUEUE_CONFIGURATION_LOW_LEVEL, [write_buffer_size, write_buffer_timeout, write_backlog_size, read_buffer_sizes_length, read_buffer_sizes_data, read_backlog_size], 'C l S C c32 S', 8, ''
285
336
  end
286
337
 
287
338
  # Returns the queue configuration as set by BrickletCANV2#set_queue_configuration.
288
339
  def get_queue_configuration_low_level
289
- send_request FUNCTION_GET_QUEUE_CONFIGURATION_LOW_LEVEL, [], '', 42, 'C l S C c32 S'
340
+ check_validity
341
+
342
+ send_request FUNCTION_GET_QUEUE_CONFIGURATION_LOW_LEVEL, [], '', 50, 'C l S C c32 S'
290
343
  end
291
344
 
292
345
  # Set the read filter configuration for the given read buffer index. This can be
@@ -346,12 +399,16 @@ module Tinkerforge
346
399
  #
347
400
  # The default mode is accept-all for all read buffers.
348
401
  def set_read_filter_configuration(buffer_index, filter_mode, filter_mask, filter_identifier)
349
- send_request FUNCTION_SET_READ_FILTER_CONFIGURATION, [buffer_index, filter_mode, filter_mask, filter_identifier], 'C C L L', 0, ''
402
+ check_validity
403
+
404
+ send_request FUNCTION_SET_READ_FILTER_CONFIGURATION, [buffer_index, filter_mode, filter_mask, filter_identifier], 'C C L L', 8, ''
350
405
  end
351
406
 
352
407
  # Returns the read filter configuration as set by BrickletCANV2#set_read_filter_configuration.
353
408
  def get_read_filter_configuration(buffer_index)
354
- send_request FUNCTION_GET_READ_FILTER_CONFIGURATION, [buffer_index], 'C', 9, 'C L L'
409
+ check_validity
410
+
411
+ send_request FUNCTION_GET_READ_FILTER_CONFIGURATION, [buffer_index], 'C', 17, 'C L L'
355
412
  end
356
413
 
357
414
  # Returns information about different kinds of errors.
@@ -387,9 +444,12 @@ module Tinkerforge
387
444
  # The read buffer overflow counter counts the overflows of all configured read
388
445
  # buffers. Which read buffer exactly suffered from an overflow can be figured
389
446
  # out from the read buffer overflow occurrence list
390
- # (``read_buffer_overflow_error_occurred``).
447
+ # (``read_buffer_overflow_error_occurred``). Reading the error log clears the
448
+ # occurence list.
391
449
  def get_error_log_low_level
392
- send_request FUNCTION_GET_ERROR_LOG_LOW_LEVEL, [], '', 72, 'C C C L L L L L L L L C ?32 L'
450
+ check_validity
451
+
452
+ send_request FUNCTION_GET_ERROR_LOG_LOW_LEVEL, [], '', 52, 'C C C L L L L L L L L C ?32 L'
393
453
  end
394
454
 
395
455
  # Sets the communication LED configuration. By default the LED shows
@@ -399,12 +459,16 @@ module Tinkerforge
399
459
  #
400
460
  # If the Bricklet is in bootloader mode, the LED is off.
401
461
  def set_communication_led_config(config)
402
- send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 0, ''
462
+ check_validity
463
+
464
+ send_request FUNCTION_SET_COMMUNICATION_LED_CONFIG, [config], 'C', 8, ''
403
465
  end
404
466
 
405
467
  # Returns the configuration as set by BrickletCANV2#set_communication_led_config
406
468
  def get_communication_led_config
407
- send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
469
+ check_validity
470
+
471
+ send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
408
472
  end
409
473
 
410
474
  # Sets the error LED configuration.
@@ -421,12 +485,56 @@ module Tinkerforge
421
485
  #
422
486
  # If the Bricklet is in bootloader mode, the LED is off.
423
487
  def set_error_led_config(config)
424
- send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 0, ''
488
+ check_validity
489
+
490
+ send_request FUNCTION_SET_ERROR_LED_CONFIG, [config], 'C', 8, ''
425
491
  end
426
492
 
427
493
  # Returns the configuration as set by BrickletCANV2#set_error_led_config.
428
494
  def get_error_led_config
429
- send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 1, 'C'
495
+ check_validity
496
+
497
+ send_request FUNCTION_GET_ERROR_LED_CONFIG, [], '', 9, 'C'
498
+ end
499
+
500
+ # Enables and disables the CALLBACK_FRAME_READABLE callback.
501
+ #
502
+ # By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READ callback.
503
+ #
504
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
505
+ def set_frame_readable_callback_configuration(enabled)
506
+ check_validity
507
+
508
+ send_request FUNCTION_SET_FRAME_READABLE_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
509
+ end
510
+
511
+ # Returns *true* if the CALLBACK_FRAME_READABLE callback is enabled, *false* otherwise.
512
+ #
513
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
514
+ def get_frame_readable_callback_configuration
515
+ check_validity
516
+
517
+ send_request FUNCTION_GET_FRAME_READABLE_CALLBACK_CONFIGURATION, [], '', 9, '?'
518
+ end
519
+
520
+ # Enables and disables the CALLBACK_ERROR_OCCURRED callback.
521
+ #
522
+ # By default the callback is disabled.
523
+ #
524
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
525
+ def set_error_occurred_callback_configuration(enabled)
526
+ check_validity
527
+
528
+ send_request FUNCTION_SET_ERROR_OCCURRED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
529
+ end
530
+
531
+ # Returns *true* if the CALLBACK_ERROR_OCCURRED callback is enabled, *false* otherwise.
532
+ #
533
+ # .. versionadded:: 2.0.3$nbsp;(Plugin)
534
+ def get_error_occurred_callback_configuration
535
+ check_validity
536
+
537
+ send_request FUNCTION_GET_ERROR_OCCURRED_CALLBACK_CONFIGURATION, [], '', 9, '?'
430
538
  end
431
539
 
432
540
  # Returns the error count for the communication between Brick and Bricklet.
@@ -441,7 +549,9 @@ module Tinkerforge
441
549
  # The errors counts are for errors that occur on the Bricklet side. All
442
550
  # Bricks have a similar function that returns the errors on the Brick side.
443
551
  def get_spitfp_error_count
444
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
552
+ check_validity
553
+
554
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
445
555
  end
446
556
 
447
557
  # Sets the bootloader mode and returns the status after the requested
@@ -454,12 +564,16 @@ module Tinkerforge
454
564
  # This function is used by Brick Viewer during flashing. It should not be
455
565
  # necessary to call it in a normal user program.
456
566
  def set_bootloader_mode(mode)
457
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
567
+ check_validity
568
+
569
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
458
570
  end
459
571
 
460
572
  # Returns the current bootloader mode, see BrickletCANV2#set_bootloader_mode.
461
573
  def get_bootloader_mode
462
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
574
+ check_validity
575
+
576
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
463
577
  end
464
578
 
465
579
  # Sets the firmware pointer for BrickletCANV2#write_firmware. The pointer has
@@ -469,7 +583,9 @@ module Tinkerforge
469
583
  # This function is used by Brick Viewer during flashing. It should not be
470
584
  # necessary to call it in a normal user program.
471
585
  def set_write_firmware_pointer(pointer)
472
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
586
+ check_validity
587
+
588
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
473
589
  end
474
590
 
475
591
  # Writes 64 Bytes of firmware at the position as written by
@@ -481,7 +597,9 @@ module Tinkerforge
481
597
  # This function is used by Brick Viewer during flashing. It should not be
482
598
  # necessary to call it in a normal user program.
483
599
  def write_firmware(data)
484
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
600
+ check_validity
601
+
602
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
485
603
  end
486
604
 
487
605
  # Sets the status LED configuration. By default the LED shows
@@ -492,22 +610,28 @@ module Tinkerforge
492
610
  #
493
611
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
494
612
  def set_status_led_config(config)
495
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
613
+ check_validity
614
+
615
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
496
616
  end
497
617
 
498
618
  # Returns the configuration as set by BrickletCANV2#set_status_led_config
499
619
  def get_status_led_config
500
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
620
+ check_validity
621
+
622
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
501
623
  end
502
624
 
503
- # Returns the temperature in °C as measured inside the microcontroller. The
625
+ # Returns the temperature as measured inside the microcontroller. The
504
626
  # value returned is not the ambient temperature!
505
627
  #
506
628
  # The temperature is only proportional to the real temperature and it has bad
507
629
  # accuracy. Practically it is only useful as an indicator for
508
630
  # temperature changes.
509
631
  def get_chip_temperature
510
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
632
+ check_validity
633
+
634
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
511
635
  end
512
636
 
513
637
  # Calling this function will reset the Bricklet. All configurations
@@ -517,7 +641,9 @@ module Tinkerforge
517
641
  # calling functions on the existing ones will result in
518
642
  # undefined behavior!
519
643
  def reset
520
- send_request FUNCTION_RESET, [], '', 0, ''
644
+ check_validity
645
+
646
+ send_request FUNCTION_RESET, [], '', 8, ''
521
647
  end
522
648
 
523
649
  # Writes a new UID into flash. If you want to set a new UID
@@ -526,25 +652,32 @@ module Tinkerforge
526
652
  #
527
653
  # We recommend that you use Brick Viewer to change the UID.
528
654
  def write_uid(uid)
529
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
655
+ check_validity
656
+
657
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
530
658
  end
531
659
 
532
660
  # Returns the current UID as an integer. Encode as
533
661
  # Base58 to get the usual string version.
534
662
  def read_uid
535
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
663
+ check_validity
664
+
665
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
536
666
  end
537
667
 
538
668
  # Returns the UID, the UID where the Bricklet is connected to,
539
669
  # the position, the hardware and firmware version as well as the
540
670
  # device identifier.
541
671
  #
542
- # The position can be 'a', 'b', 'c' or 'd'.
672
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
673
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
674
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
675
+ # position 'z'.
543
676
  #
544
677
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
545
678
  # |device_identifier_constant|
546
679
  def get_identity
547
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
680
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
548
681
  end
549
682
 
550
683
  # Writes a data or remote frame to the write queue to be transmitted over the
@@ -722,7 +855,8 @@ module Tinkerforge
722
855
  # The read buffer overflow counter counts the overflows of all configured read
723
856
  # buffers. Which read buffer exactly suffered from an overflow can be figured
724
857
  # out from the read buffer overflow occurrence list
725
- # (``read_buffer_overflow_error_occurred``).
858
+ # (``read_buffer_overflow_error_occurred``). Reading the error log clears the
859
+ # occurence list.
726
860
  def get_error_log
727
861
  ret = get_error_log_low_level
728
862
 
@@ -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 CO2 concentration in ppm
14
16
  class BrickletCO2 < Device
@@ -49,7 +51,7 @@ module Tinkerforge
49
51
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
50
52
  # the IP Connection <tt>ipcon</tt>.
51
53
  def initialize(uid, ipcon)
52
- super uid, ipcon
54
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
53
55
 
54
56
  @api_version = [2, 0, 0]
55
57
 
@@ -62,9 +64,10 @@ module Tinkerforge
62
64
  @response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
63
65
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
64
66
 
65
- @callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
66
- @callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = 'S'
67
+ @callback_formats[CALLBACK_CO2_CONCENTRATION] = [10, 'S']
68
+ @callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = [10, 'S']
67
69
 
70
+ @ipcon.add_device self
68
71
  end
69
72
 
70
73
  # Returns the measured CO2 concentration.
@@ -73,7 +76,9 @@ module Tinkerforge
73
76
  # the CALLBACK_CO2_CONCENTRATION callback and set the period with
74
77
  # BrickletCO2#set_co2_concentration_callback_period.
75
78
  def get_co2_concentration
76
- send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 2, 'S'
79
+ check_validity
80
+
81
+ send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 10, 'S'
77
82
  end
78
83
 
79
84
  # Sets the period with which the CALLBACK_CO2_CONCENTRATION callback is
@@ -82,12 +87,16 @@ module Tinkerforge
82
87
  # The CALLBACK_CO2_CONCENTRATION callback is only triggered if the CO2 concentration
83
88
  # has changed since the last triggering.
84
89
  def set_co2_concentration_callback_period(period)
85
- send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, [period], 'L', 0, ''
90
+ check_validity
91
+
92
+ send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, [period], 'L', 8, ''
86
93
  end
87
94
 
88
95
  # Returns the period as set by BrickletCO2#set_co2_concentration_callback_period.
89
96
  def get_co2_concentration_callback_period
90
- send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD, [], '', 4, 'L'
97
+ check_validity
98
+
99
+ send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD, [], '', 12, 'L'
91
100
  end
92
101
 
93
102
  # Sets the thresholds for the CALLBACK_CO2_CONCENTRATION_REACHED callback.
@@ -102,12 +111,16 @@ module Tinkerforge
102
111
  # "'<'", "Callback is triggered when the CO2 concentration is smaller than the min value (max is ignored)"
103
112
  # "'>'", "Callback is triggered when the CO2 concentration is greater than the min value (max is ignored)"
104
113
  def set_co2_concentration_callback_threshold(option, min, max)
105
- send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
114
+ check_validity
115
+
116
+ send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
106
117
  end
107
118
 
108
119
  # Returns the threshold as set by BrickletCO2#set_co2_concentration_callback_threshold.
109
120
  def get_co2_concentration_callback_threshold
110
- send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
121
+ check_validity
122
+
123
+ send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
111
124
  end
112
125
 
113
126
  # Sets the period with which the threshold callbacks
@@ -120,24 +133,31 @@ module Tinkerforge
120
133
  #
121
134
  # keep being reached.
122
135
  def set_debounce_period(debounce)
123
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
136
+ check_validity
137
+
138
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
124
139
  end
125
140
 
126
141
  # Returns the debounce period as set by BrickletCO2#set_debounce_period.
127
142
  def get_debounce_period
128
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
143
+ check_validity
144
+
145
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
129
146
  end
130
147
 
131
148
  # Returns the UID, the UID where the Bricklet is connected to,
132
149
  # the position, the hardware and firmware version as well as the
133
150
  # device identifier.
134
151
  #
135
- # The position can be 'a', 'b', 'c' or 'd'.
152
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
153
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
154
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
155
+ # position 'z'.
136
156
  #
137
157
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
138
158
  # |device_identifier_constant|
139
159
  def get_identity
140
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
160
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
141
161
  end
142
162
 
143
163
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.