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
  # 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.
@@ -167,22 +199,24 @@ module Tinkerforge
167
199
  # The write timeout has three different modes that define how a failed frame
168
200
  # transmission should be handled:
169
201
  #
170
- # * One-Shot (< 0): Only one transmission attempt will be made. If the
202
+ # * One-Shot (= -1): Only one transmission attempt will be made. If the
171
203
  # transmission fails then the frame is discarded.
172
204
  # * Infinite (= 0): Infinite transmission attempts will be made. The frame will
173
205
  # never be discarded.
174
206
  # * Milliseconds (> 0): A limited number of transmission attempts will be made.
175
207
  # If the frame could not be transmitted successfully after the configured
176
208
  # number of milliseconds then the frame is discarded.
177
- #
178
- # The default is: 125 kbit/s, normal transceiver mode and infinite write timeout.
179
209
  def set_configuration(baud_rate, transceiver_mode, write_timeout)
180
- 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, ''
181
213
  end
182
214
 
183
215
  # Returns the configuration as set by BrickletCAN#set_configuration.
184
216
  def get_configuration
185
- send_request FUNCTION_GET_CONFIGURATION, [], '', 6, 'C C l'
217
+ check_validity
218
+
219
+ send_request FUNCTION_GET_CONFIGURATION, [], '', 14, 'C C l'
186
220
  end
187
221
 
188
222
  # Set the read filter configuration. This can be used to define which frames
@@ -235,15 +269,17 @@ module Tinkerforge
235
269
  #
236
270
  # To accept identifier 0x123 and identifier 0x456 at the same time, just set
237
271
  # filter 2 to 0x456 and keep mask and filter 1 unchanged.
238
- #
239
- # The default mode is accept-all.
240
272
  def set_read_filter(mode, mask, filter1, filter2)
241
- 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, ''
242
276
  end
243
277
 
244
278
  # Returns the read filter as set by BrickletCAN#set_read_filter.
245
279
  def get_read_filter
246
- 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'
247
283
  end
248
284
 
249
285
  # Returns information about different kinds of errors.
@@ -252,7 +288,7 @@ module Tinkerforge
252
288
  # acknowledgement, form, bit and stuffing errors during CAN bus write and read
253
289
  # operations.
254
290
  #
255
- # 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
256
292
  # and no frames can be transmitted or received anymore. The CAN transceiver will
257
293
  # automatically be activated again after the CAN bus is idle for a while.
258
294
  #
@@ -280,19 +316,43 @@ module Tinkerforge
280
316
  # function. Using the CALLBACK_FRAME_READ callback ensures that the read buffer
281
317
  # can not overflow.
282
318
  def get_error_log
283
- 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, '?'
284
342
  end
285
343
 
286
344
  # Returns the UID, the UID where the Bricklet is connected to,
287
345
  # the position, the hardware and firmware version as well as the
288
346
  # device identifier.
289
347
  #
290
- # 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'.
291
351
  #
292
352
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
293
353
  # |device_identifier_constant|
294
354
  def get_identity
295
- 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'
296
356
  end
297
357
 
298
358
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,34 +1,48 @@
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
  # Communicates with CAN bus devices
14
16
  class BrickletCANV2 < Device
15
17
  DEVICE_IDENTIFIER = 2107 # :nodoc:
16
18
  DEVICE_DISPLAY_NAME = 'CAN Bricklet 2.0' # :nodoc:
17
19
 
20
+ # See CALLBACK_FRAME_READ
21
+ CALLBACK_FRAME_READ_LOW_LEVEL = 16
22
+
18
23
  # This callback is triggered if a data or remote frame was received by the CAN
19
- # transceiver.
20
- #
21
- # The ``identifier`` return value follows the identifier format described for
22
- # BrickletCANV2#write_frame.
23
- #
24
- # For details on the ``data`` return value see BrickletCANV2#read_frame.
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.
25
27
  #
26
28
  # A configurable read filter can be used to define which frames should be
27
29
  # received by the CAN transceiver and put into the read queue (see
28
- # BrickletCANV2#set_queue_configuration).
30
+ # BrickletCANV2#set_read_filter_configuration).
29
31
  #
30
- # To enable this callback, use BrickletCANV2#set_frame_read_callback_configuration.
31
- CALLBACK_FRAME_READ_LOW_LEVEL = 16
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
32
46
 
33
47
  # This callback is triggered if a data or remote frame was received by the CAN
34
48
  # transceiver.
@@ -40,9 +54,12 @@ module Tinkerforge
40
54
  #
41
55
  # A configurable read filter can be used to define which frames should be
42
56
  # received by the CAN transceiver and put into the read queue (see
43
- # BrickletCANV2#set_queue_configuration).
57
+ # BrickletCANV2#set_read_filter_configuration).
44
58
  #
45
59
  # To enable this callback, use BrickletCANV2#set_frame_read_callback_configuration.
60
+ #
61
+ # .. note::
62
+ # If reconstructing the value fails, the callback is triggered with nil for data.
46
63
  CALLBACK_FRAME_READ = -16
47
64
 
48
65
  FUNCTION_WRITE_FRAME_LOW_LEVEL = 1 # :nodoc:
@@ -60,6 +77,10 @@ module Tinkerforge
60
77
  FUNCTION_GET_COMMUNICATION_LED_CONFIG = 13 # :nodoc:
61
78
  FUNCTION_SET_ERROR_LED_CONFIG = 14 # :nodoc:
62
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:
63
84
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
64
85
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
65
86
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -115,9 +136,9 @@ module Tinkerforge
115
136
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
116
137
  # the IP Connection <tt>ipcon</tt>.
117
138
  def initialize(uid, ipcon)
118
- super uid, ipcon
139
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
119
140
 
120
- @api_version = [2, 0, 0]
141
+ @api_version = [2, 0, 1]
121
142
 
122
143
  @response_expected[FUNCTION_WRITE_FRAME_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
123
144
  @response_expected[FUNCTION_READ_FRAME_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -134,6 +155,10 @@ module Tinkerforge
134
155
  @response_expected[FUNCTION_GET_COMMUNICATION_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
135
156
  @response_expected[FUNCTION_SET_ERROR_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
136
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
137
162
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
138
163
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
139
164
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -147,9 +172,12 @@ module Tinkerforge
147
172
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
148
173
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
149
174
 
150
- @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, '']
151
178
 
152
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
153
181
  end
154
182
 
155
183
  # Writes a data or remote frame to the write queue to be transmitted over the
@@ -181,7 +209,9 @@ module Tinkerforge
181
209
  # arbitration or because the CAN transceiver is currently disabled due to a high
182
210
  # write error level (see BrickletCANV2#get_error_log).
183
211
  def write_frame_low_level(frame_type, identifier, data_length, data_data)
184
- 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, '?'
185
215
  end
186
216
 
187
217
  # Tries to read the next data or remote frame from the read queue and returns it.
@@ -207,26 +237,29 @@ module Tinkerforge
207
237
  # BrickletCANV2#set_frame_read_callback_configuration function and the CALLBACK_FRAME_READ
208
238
  # callback.
209
239
  def read_frame_low_level
210
- 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'
211
243
  end
212
244
 
213
245
  # Enables and disables the CALLBACK_FRAME_READ callback.
214
246
  #
215
- # By default the callback is disabled.
247
+ # By default the callback is disabled. Enabling this callback will disable the CALLBACK_FRAME_READABLE callback.
216
248
  def set_frame_read_callback_configuration(enabled)
217
- 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, ''
218
252
  end
219
253
 
220
254
  # Returns *true* if the CALLBACK_FRAME_READ callback is enabled, *false* otherwise.
221
255
  def get_frame_read_callback_configuration
222
- send_request FUNCTION_GET_FRAME_READ_CALLBACK_CONFIGURATION, [], '', 1, '?'
256
+ check_validity
257
+
258
+ send_request FUNCTION_GET_FRAME_READ_CALLBACK_CONFIGURATION, [], '', 9, '?'
223
259
  end
224
260
 
225
261
  # Sets the transceiver configuration for the CAN bus communication.
226
262
  #
227
- # The baud rate can be configured in bit/s between 10 and 1000 kbit/s and the
228
- # sample point can be configured in 1/10 % between 50 and 90 %.
229
- #
230
263
  # The CAN transceiver has three different modes:
231
264
  #
232
265
  # * Normal: Reads from and writes to the CAN bus and performs active bus
@@ -236,15 +269,17 @@ module Tinkerforge
236
269
  # * Read-Only: Only reads from the CAN bus, but does neither active bus error
237
270
  # detection nor acknowledgement. Only the receiving part of the transceiver
238
271
  # is connected to the CAN bus.
239
- #
240
- # The default is: 125 kbit/s, 62.5 % and normal transceiver mode.
241
272
  def set_transceiver_configuration(baud_rate, sample_point, transceiver_mode)
242
- 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, ''
243
276
  end
244
277
 
245
278
  # Returns the configuration as set by BrickletCANV2#set_transceiver_configuration.
246
279
  def get_transceiver_configuration
247
- 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'
248
283
  end
249
284
 
250
285
  # Sets the write and read queue configuration.
@@ -279,7 +314,7 @@ module Tinkerforge
279
314
  #
280
315
  # A valid queue configuration fulfills these conditions::
281
316
  #
282
- # write_buffer_size + read_buffer_size_0 + read_buffer_size_1 + ... + read_buffer_size_31 <= 32
317
+ # write_buffer_size + abs(read_buffer_size_0) + abs(read_buffer_size_1) + ... + abs(read_buffer_size_31) <= 32
283
318
  # write_backlog_size + read_backlog_size <= 768
284
319
  #
285
320
  # The write buffer timeout has three different modes that define how a failed
@@ -294,22 +329,17 @@ module Tinkerforge
294
329
  # number of milliseconds then the frame is discarded.
295
330
  #
296
331
  # The current content of the queues is lost when this function is called.
297
- #
298
- # The default is:
299
- #
300
- # * 8 write buffers,
301
- # * infinite write timeout,
302
- # * 383 write backlog frames,
303
- # * 16 read buffers for data frames,
304
- # * 8 read buffers for remote frames and
305
- # * 383 read backlog frames.
306
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)
307
- 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, ''
308
336
  end
309
337
 
310
338
  # Returns the queue configuration as set by BrickletCANV2#set_queue_configuration.
311
339
  def get_queue_configuration_low_level
312
- 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'
313
343
  end
314
344
 
315
345
  # Set the read filter configuration for the given read buffer index. This can be
@@ -369,12 +399,16 @@ module Tinkerforge
369
399
  #
370
400
  # The default mode is accept-all for all read buffers.
371
401
  def set_read_filter_configuration(buffer_index, filter_mode, filter_mask, filter_identifier)
372
- 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, ''
373
405
  end
374
406
 
375
407
  # Returns the read filter configuration as set by BrickletCANV2#set_read_filter_configuration.
376
408
  def get_read_filter_configuration(buffer_index)
377
- 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'
378
412
  end
379
413
 
380
414
  # Returns information about different kinds of errors.
@@ -410,9 +444,12 @@ module Tinkerforge
410
444
  # The read buffer overflow counter counts the overflows of all configured read
411
445
  # buffers. Which read buffer exactly suffered from an overflow can be figured
412
446
  # out from the read buffer overflow occurrence list
413
- # (``read_buffer_overflow_error_occurred``).
447
+ # (``read_buffer_overflow_error_occurred``). Reading the error log clears the
448
+ # occurence list.
414
449
  def get_error_log_low_level
415
- 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'
416
453
  end
417
454
 
418
455
  # Sets the communication LED configuration. By default the LED shows
@@ -422,12 +459,16 @@ module Tinkerforge
422
459
  #
423
460
  # If the Bricklet is in bootloader mode, the LED is off.
424
461
  def set_communication_led_config(config)
425
- 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, ''
426
465
  end
427
466
 
428
467
  # Returns the configuration as set by BrickletCANV2#set_communication_led_config
429
468
  def get_communication_led_config
430
- send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 1, 'C'
469
+ check_validity
470
+
471
+ send_request FUNCTION_GET_COMMUNICATION_LED_CONFIG, [], '', 9, 'C'
431
472
  end
432
473
 
433
474
  # Sets the error LED configuration.
@@ -444,12 +485,56 @@ module Tinkerforge
444
485
  #
445
486
  # If the Bricklet is in bootloader mode, the LED is off.
446
487
  def set_error_led_config(config)
447
- 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, ''
448
491
  end
449
492
 
450
493
  # Returns the configuration as set by BrickletCANV2#set_error_led_config.
451
494
  def get_error_led_config
452
- 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, '?'
453
538
  end
454
539
 
455
540
  # Returns the error count for the communication between Brick and Bricklet.
@@ -464,7 +549,9 @@ module Tinkerforge
464
549
  # The errors counts are for errors that occur on the Bricklet side. All
465
550
  # Bricks have a similar function that returns the errors on the Brick side.
466
551
  def get_spitfp_error_count
467
- 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'
468
555
  end
469
556
 
470
557
  # Sets the bootloader mode and returns the status after the requested
@@ -477,12 +564,16 @@ module Tinkerforge
477
564
  # This function is used by Brick Viewer during flashing. It should not be
478
565
  # necessary to call it in a normal user program.
479
566
  def set_bootloader_mode(mode)
480
- 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'
481
570
  end
482
571
 
483
572
  # Returns the current bootloader mode, see BrickletCANV2#set_bootloader_mode.
484
573
  def get_bootloader_mode
485
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
574
+ check_validity
575
+
576
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
486
577
  end
487
578
 
488
579
  # Sets the firmware pointer for BrickletCANV2#write_firmware. The pointer has
@@ -492,7 +583,9 @@ module Tinkerforge
492
583
  # This function is used by Brick Viewer during flashing. It should not be
493
584
  # necessary to call it in a normal user program.
494
585
  def set_write_firmware_pointer(pointer)
495
- 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, ''
496
589
  end
497
590
 
498
591
  # Writes 64 Bytes of firmware at the position as written by
@@ -504,7 +597,9 @@ module Tinkerforge
504
597
  # This function is used by Brick Viewer during flashing. It should not be
505
598
  # necessary to call it in a normal user program.
506
599
  def write_firmware(data)
507
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
600
+ check_validity
601
+
602
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
508
603
  end
509
604
 
510
605
  # Sets the status LED configuration. By default the LED shows
@@ -515,22 +610,28 @@ module Tinkerforge
515
610
  #
516
611
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
517
612
  def set_status_led_config(config)
518
- 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, ''
519
616
  end
520
617
 
521
618
  # Returns the configuration as set by BrickletCANV2#set_status_led_config
522
619
  def get_status_led_config
523
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
620
+ check_validity
621
+
622
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
524
623
  end
525
624
 
526
- # Returns the temperature in °C as measured inside the microcontroller. The
625
+ # Returns the temperature as measured inside the microcontroller. The
527
626
  # value returned is not the ambient temperature!
528
627
  #
529
628
  # The temperature is only proportional to the real temperature and it has bad
530
629
  # accuracy. Practically it is only useful as an indicator for
531
630
  # temperature changes.
532
631
  def get_chip_temperature
533
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
632
+ check_validity
633
+
634
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
534
635
  end
535
636
 
536
637
  # Calling this function will reset the Bricklet. All configurations
@@ -540,7 +641,9 @@ module Tinkerforge
540
641
  # calling functions on the existing ones will result in
541
642
  # undefined behavior!
542
643
  def reset
543
- send_request FUNCTION_RESET, [], '', 0, ''
644
+ check_validity
645
+
646
+ send_request FUNCTION_RESET, [], '', 8, ''
544
647
  end
545
648
 
546
649
  # Writes a new UID into flash. If you want to set a new UID
@@ -549,25 +652,31 @@ module Tinkerforge
549
652
  #
550
653
  # We recommend that you use Brick Viewer to change the UID.
551
654
  def write_uid(uid)
552
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
655
+ check_validity
656
+
657
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
553
658
  end
554
659
 
555
660
  # Returns the current UID as an integer. Encode as
556
661
  # Base58 to get the usual string version.
557
662
  def read_uid
558
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
663
+ check_validity
664
+
665
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
559
666
  end
560
667
 
561
668
  # Returns the UID, the UID where the Bricklet is connected to,
562
669
  # the position, the hardware and firmware version as well as the
563
670
  # device identifier.
564
671
  #
565
- # 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
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
674
+ # position 'z'.
566
675
  #
567
676
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
568
677
  # |device_identifier_constant|
569
678
  def get_identity
570
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
679
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
571
680
  end
572
681
 
573
682
  # Writes a data or remote frame to the write queue to be transmitted over the
@@ -674,7 +783,7 @@ module Tinkerforge
674
783
  #
675
784
  # A valid queue configuration fulfills these conditions::
676
785
  #
677
- # write_buffer_size + read_buffer_size_0 + read_buffer_size_1 + ... + read_buffer_size_31 <= 32
786
+ # write_buffer_size + abs(read_buffer_size_0) + abs(read_buffer_size_1) + ... + abs(read_buffer_size_31) <= 32
678
787
  # write_backlog_size + read_backlog_size <= 768
679
788
  #
680
789
  # The write buffer timeout has three different modes that define how a failed
@@ -689,15 +798,6 @@ module Tinkerforge
689
798
  # number of milliseconds then the frame is discarded.
690
799
  #
691
800
  # The current content of the queues is lost when this function is called.
692
- #
693
- # The default is:
694
- #
695
- # * 8 write buffers,
696
- # * infinite write timeout,
697
- # * 383 write backlog frames,
698
- # * 16 read buffers for data frames,
699
- # * 8 read buffers for remote frames and
700
- # * 383 read backlog frames.
701
801
  def set_queue_configuration(write_buffer_size, write_buffer_timeout, write_backlog_size, read_buffer_sizes, read_backlog_size)
702
802
  read_buffer_sizes = read_buffer_sizes.clone # clone so we can potentially extend it
703
803
  read_buffer_sizes_length = read_buffer_sizes.length
@@ -754,7 +854,8 @@ module Tinkerforge
754
854
  # The read buffer overflow counter counts the overflows of all configured read
755
855
  # buffers. Which read buffer exactly suffered from an overflow can be figured
756
856
  # out from the read buffer overflow occurrence list
757
- # (``read_buffer_overflow_error_occurred``).
857
+ # (``read_buffer_overflow_error_occurred``). Reading the error log clears the
858
+ # occurence list.
758
859
  def get_error_log
759
860
  ret = get_error_log_low_level
760
861