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
  # RGB LED Matrix with 8x8 pixel
14
16
  class BrickletRGBLEDMatrix < Device
@@ -62,7 +64,7 @@ module Tinkerforge
62
64
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
63
65
  # the IP Connection <tt>ipcon</tt>.
64
66
  def initialize(uid, ipcon)
65
- super uid, ipcon
67
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
66
68
 
67
69
  @api_version = [2, 0, 0]
68
70
 
@@ -89,41 +91,54 @@ module Tinkerforge
89
91
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
90
92
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
91
93
 
92
- @callback_formats[CALLBACK_FRAME_STARTED] = 'L'
94
+ @callback_formats[CALLBACK_FRAME_STARTED] = [12, 'L']
93
95
 
96
+ @ipcon.add_device self
94
97
  end
95
98
 
96
99
  # Sets the 64 red LED values of the matrix.
97
100
  def set_red(red)
98
- send_request FUNCTION_SET_RED, [red], 'C64', 0, ''
101
+ check_validity
102
+
103
+ send_request FUNCTION_SET_RED, [red], 'C64', 8, ''
99
104
  end
100
105
 
101
106
  # Returns the red LED values as set by BrickletRGBLEDMatrix#set_red.
102
107
  def get_red
103
- send_request FUNCTION_GET_RED, [], '', 64, 'C64'
108
+ check_validity
109
+
110
+ send_request FUNCTION_GET_RED, [], '', 72, 'C64'
104
111
  end
105
112
 
106
113
  # Sets the 64 green LED values of the matrix.
107
114
  def set_green(green)
108
- send_request FUNCTION_SET_GREEN, [green], 'C64', 0, ''
115
+ check_validity
116
+
117
+ send_request FUNCTION_SET_GREEN, [green], 'C64', 8, ''
109
118
  end
110
119
 
111
120
  # Returns the green LED values as set by BrickletRGBLEDMatrix#set_green.
112
121
  def get_green
113
- send_request FUNCTION_GET_GREEN, [], '', 64, 'C64'
122
+ check_validity
123
+
124
+ send_request FUNCTION_GET_GREEN, [], '', 72, 'C64'
114
125
  end
115
126
 
116
127
  # Sets the 64 blue LED values of the matrix.
117
128
  def set_blue(blue)
118
- send_request FUNCTION_SET_BLUE, [blue], 'C64', 0, ''
129
+ check_validity
130
+
131
+ send_request FUNCTION_SET_BLUE, [blue], 'C64', 8, ''
119
132
  end
120
133
 
121
134
  # Returns the blue LED values as set by BrickletRGBLEDMatrix#set_blue.
122
135
  def get_blue
123
- send_request FUNCTION_GET_BLUE, [], '', 64, 'C64'
136
+ check_validity
137
+
138
+ send_request FUNCTION_GET_BLUE, [], '', 72, 'C64'
124
139
  end
125
140
 
126
- # Sets the frame duration in ms.
141
+ # Sets the frame duration.
127
142
  #
128
143
  # Example: If you want to achieve 20 frames per second, you should
129
144
  # set the frame duration to 50ms (50ms * 20 = 1 second).
@@ -140,15 +155,17 @@ module Tinkerforge
140
155
  # * and so on.
141
156
  #
142
157
  # For frame duration of 0 see BrickletRGBLEDMatrix#draw_frame.
143
- #
144
- # Default value: 0 = off.
145
158
  def set_frame_duration(frame_duration)
146
- send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 0, ''
159
+ check_validity
160
+
161
+ send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 8, ''
147
162
  end
148
163
 
149
- # Returns the frame duration in ms as set by BrickletRGBLEDMatrix#set_frame_duration.
164
+ # Returns the frame duration as set by BrickletRGBLEDMatrix#set_frame_duration.
150
165
  def get_frame_duration
151
- send_request FUNCTION_GET_FRAME_DURATION, [], '', 2, 'S'
166
+ check_validity
167
+
168
+ send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
152
169
  end
153
170
 
154
171
  # If you set the frame duration to 0 (see BrickletRGBLEDMatrix#set_frame_duration), you can use this
@@ -165,12 +182,16 @@ module Tinkerforge
165
182
  # * Wait for CALLBACK_FRAME_STARTED callback.
166
183
  # * and so on.
167
184
  def draw_frame
168
- send_request FUNCTION_DRAW_FRAME, [], '', 0, ''
185
+ check_validity
186
+
187
+ send_request FUNCTION_DRAW_FRAME, [], '', 8, ''
169
188
  end
170
189
 
171
- # Returns the current supply voltage of the Bricklet. The voltage is given in mV.
190
+ # Returns the current supply voltage of the Bricklet.
172
191
  def get_supply_voltage
173
- send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 2, 'S'
192
+ check_validity
193
+
194
+ send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 10, 'S'
174
195
  end
175
196
 
176
197
  # Returns the error count for the communication between Brick and Bricklet.
@@ -185,7 +206,9 @@ module Tinkerforge
185
206
  # The errors counts are for errors that occur on the Bricklet side. All
186
207
  # Bricks have a similar function that returns the errors on the Brick side.
187
208
  def get_spitfp_error_count
188
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
209
+ check_validity
210
+
211
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
189
212
  end
190
213
 
191
214
  # Sets the bootloader mode and returns the status after the requested
@@ -198,12 +221,16 @@ module Tinkerforge
198
221
  # This function is used by Brick Viewer during flashing. It should not be
199
222
  # necessary to call it in a normal user program.
200
223
  def set_bootloader_mode(mode)
201
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
224
+ check_validity
225
+
226
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
202
227
  end
203
228
 
204
229
  # Returns the current bootloader mode, see BrickletRGBLEDMatrix#set_bootloader_mode.
205
230
  def get_bootloader_mode
206
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
231
+ check_validity
232
+
233
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
207
234
  end
208
235
 
209
236
  # Sets the firmware pointer for BrickletRGBLEDMatrix#write_firmware. The pointer has
@@ -213,7 +240,9 @@ module Tinkerforge
213
240
  # This function is used by Brick Viewer during flashing. It should not be
214
241
  # necessary to call it in a normal user program.
215
242
  def set_write_firmware_pointer(pointer)
216
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
243
+ check_validity
244
+
245
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
217
246
  end
218
247
 
219
248
  # Writes 64 Bytes of firmware at the position as written by
@@ -225,7 +254,9 @@ module Tinkerforge
225
254
  # This function is used by Brick Viewer during flashing. It should not be
226
255
  # necessary to call it in a normal user program.
227
256
  def write_firmware(data)
228
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
257
+ check_validity
258
+
259
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
229
260
  end
230
261
 
231
262
  # Sets the status LED configuration. By default the LED shows
@@ -236,22 +267,28 @@ module Tinkerforge
236
267
  #
237
268
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
238
269
  def set_status_led_config(config)
239
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
270
+ check_validity
271
+
272
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
240
273
  end
241
274
 
242
275
  # Returns the configuration as set by BrickletRGBLEDMatrix#set_status_led_config
243
276
  def get_status_led_config
244
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
277
+ check_validity
278
+
279
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
245
280
  end
246
281
 
247
- # Returns the temperature in °C as measured inside the microcontroller. The
282
+ # Returns the temperature as measured inside the microcontroller. The
248
283
  # value returned is not the ambient temperature!
249
284
  #
250
285
  # The temperature is only proportional to the real temperature and it has bad
251
286
  # accuracy. Practically it is only useful as an indicator for
252
287
  # temperature changes.
253
288
  def get_chip_temperature
254
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
289
+ check_validity
290
+
291
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
255
292
  end
256
293
 
257
294
  # Calling this function will reset the Bricklet. All configurations
@@ -261,7 +298,9 @@ module Tinkerforge
261
298
  # calling functions on the existing ones will result in
262
299
  # undefined behavior!
263
300
  def reset
264
- send_request FUNCTION_RESET, [], '', 0, ''
301
+ check_validity
302
+
303
+ send_request FUNCTION_RESET, [], '', 8, ''
265
304
  end
266
305
 
267
306
  # Writes a new UID into flash. If you want to set a new UID
@@ -270,25 +309,32 @@ module Tinkerforge
270
309
  #
271
310
  # We recommend that you use Brick Viewer to change the UID.
272
311
  def write_uid(uid)
273
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
312
+ check_validity
313
+
314
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
274
315
  end
275
316
 
276
317
  # Returns the current UID as an integer. Encode as
277
318
  # Base58 to get the usual string version.
278
319
  def read_uid
279
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
320
+ check_validity
321
+
322
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
280
323
  end
281
324
 
282
325
  # Returns the UID, the UID where the Bricklet is connected to,
283
326
  # the position, the hardware and firmware version as well as the
284
327
  # device identifier.
285
328
  #
286
- # The position can be 'a', 'b', 'c' or 'd'.
329
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
330
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
331
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
332
+ # position 'z'.
287
333
  #
288
334
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
289
335
  # |device_identifier_constant|
290
336
  def get_identity
291
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
337
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
292
338
  end
293
339
 
294
340
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2020-04-07. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.25 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Controls one RGB LED
14
16
  class BrickletRGBLEDV2 < 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
 
@@ -69,16 +71,21 @@ module Tinkerforge
69
71
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
70
72
 
71
73
 
74
+ @ipcon.add_device self
72
75
  end
73
76
 
74
- # Sets the *r*, *g* and *b* values for the LED. Each value can be between 0 and 255.
77
+ # Sets the *r*, *g* and *b* values for the LED.
75
78
  def set_rgb_value(r, g, b)
76
- send_request FUNCTION_SET_RGB_VALUE, [r, g, b], 'C C C', 0, ''
79
+ check_validity
80
+
81
+ send_request FUNCTION_SET_RGB_VALUE, [r, g, b], 'C C C', 8, ''
77
82
  end
78
83
 
79
84
  # Returns the *r*, *g* and *b* values of the LED as set by BrickletRGBLEDV2#set_rgb_value.
80
85
  def get_rgb_value
81
- send_request FUNCTION_GET_RGB_VALUE, [], '', 3, 'C C C'
86
+ check_validity
87
+
88
+ send_request FUNCTION_GET_RGB_VALUE, [], '', 11, 'C C C'
82
89
  end
83
90
 
84
91
  # Returns the error count for the communication between Brick and Bricklet.
@@ -93,7 +100,9 @@ module Tinkerforge
93
100
  # The errors counts are for errors that occur on the Bricklet side. All
94
101
  # Bricks have a similar function that returns the errors on the Brick side.
95
102
  def get_spitfp_error_count
96
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
103
+ check_validity
104
+
105
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
97
106
  end
98
107
 
99
108
  # Sets the bootloader mode and returns the status after the requested
@@ -106,12 +115,16 @@ module Tinkerforge
106
115
  # This function is used by Brick Viewer during flashing. It should not be
107
116
  # necessary to call it in a normal user program.
108
117
  def set_bootloader_mode(mode)
109
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
118
+ check_validity
119
+
120
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
110
121
  end
111
122
 
112
123
  # Returns the current bootloader mode, see BrickletRGBLEDV2#set_bootloader_mode.
113
124
  def get_bootloader_mode
114
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
125
+ check_validity
126
+
127
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
115
128
  end
116
129
 
117
130
  # Sets the firmware pointer for BrickletRGBLEDV2#write_firmware. The pointer has
@@ -121,7 +134,9 @@ module Tinkerforge
121
134
  # This function is used by Brick Viewer during flashing. It should not be
122
135
  # necessary to call it in a normal user program.
123
136
  def set_write_firmware_pointer(pointer)
124
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
137
+ check_validity
138
+
139
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
125
140
  end
126
141
 
127
142
  # Writes 64 Bytes of firmware at the position as written by
@@ -133,7 +148,9 @@ module Tinkerforge
133
148
  # This function is used by Brick Viewer during flashing. It should not be
134
149
  # necessary to call it in a normal user program.
135
150
  def write_firmware(data)
136
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
151
+ check_validity
152
+
153
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
137
154
  end
138
155
 
139
156
  # Sets the status LED configuration. By default the LED shows
@@ -144,22 +161,28 @@ module Tinkerforge
144
161
  #
145
162
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
146
163
  def set_status_led_config(config)
147
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
164
+ check_validity
165
+
166
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
148
167
  end
149
168
 
150
169
  # Returns the configuration as set by BrickletRGBLEDV2#set_status_led_config
151
170
  def get_status_led_config
152
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
171
+ check_validity
172
+
173
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
153
174
  end
154
175
 
155
- # Returns the temperature in °C as measured inside the microcontroller. The
176
+ # Returns the temperature as measured inside the microcontroller. The
156
177
  # value returned is not the ambient temperature!
157
178
  #
158
179
  # The temperature is only proportional to the real temperature and it has bad
159
180
  # accuracy. Practically it is only useful as an indicator for
160
181
  # temperature changes.
161
182
  def get_chip_temperature
162
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
183
+ check_validity
184
+
185
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
163
186
  end
164
187
 
165
188
  # Calling this function will reset the Bricklet. All configurations
@@ -169,7 +192,9 @@ module Tinkerforge
169
192
  # calling functions on the existing ones will result in
170
193
  # undefined behavior!
171
194
  def reset
172
- send_request FUNCTION_RESET, [], '', 0, ''
195
+ check_validity
196
+
197
+ send_request FUNCTION_RESET, [], '', 8, ''
173
198
  end
174
199
 
175
200
  # Writes a new UID into flash. If you want to set a new UID
@@ -178,25 +203,32 @@ module Tinkerforge
178
203
  #
179
204
  # We recommend that you use Brick Viewer to change the UID.
180
205
  def write_uid(uid)
181
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
206
+ check_validity
207
+
208
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
182
209
  end
183
210
 
184
211
  # Returns the current UID as an integer. Encode as
185
212
  # Base58 to get the usual string version.
186
213
  def read_uid
187
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
214
+ check_validity
215
+
216
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
188
217
  end
189
218
 
190
219
  # Returns the UID, the UID where the Bricklet is connected to,
191
220
  # the position, the hardware and firmware version as well as the
192
221
  # device identifier.
193
222
  #
194
- # The position can be 'a', 'b', 'c' or 'd'.
223
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
224
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
225
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
226
+ # position 'z'.
195
227
  #
196
228
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
197
229
  # |device_identifier_constant|
198
230
  def get_identity
199
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
231
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
200
232
  end
201
233
 
202
234
  end
@@ -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
  # 360° rotary encoder with push-button
14
16
  class BrickletRotaryEncoder < Device
@@ -56,7 +58,7 @@ module Tinkerforge
56
58
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
57
59
  # the IP Connection <tt>ipcon</tt>.
58
60
  def initialize(uid, ipcon)
59
- super uid, ipcon
61
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
60
62
 
61
63
  @api_version = [2, 0, 0]
62
64
 
@@ -70,11 +72,12 @@ module Tinkerforge
70
72
  @response_expected[FUNCTION_IS_PRESSED] = RESPONSE_EXPECTED_ALWAYS_TRUE
71
73
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
72
74
 
73
- @callback_formats[CALLBACK_COUNT] = 'l'
74
- @callback_formats[CALLBACK_COUNT_REACHED] = 'l'
75
- @callback_formats[CALLBACK_PRESSED] = ''
76
- @callback_formats[CALLBACK_RELEASED] = ''
75
+ @callback_formats[CALLBACK_COUNT] = [12, 'l']
76
+ @callback_formats[CALLBACK_COUNT_REACHED] = [12, 'l']
77
+ @callback_formats[CALLBACK_PRESSED] = [8, '']
78
+ @callback_formats[CALLBACK_RELEASED] = [8, '']
77
79
 
80
+ @ipcon.add_device self
78
81
  end
79
82
 
80
83
  # Returns the current count of the encoder. If you set reset
@@ -86,7 +89,9 @@ module Tinkerforge
86
89
  # Turning the encoder to the left decrements the counter,
87
90
  # so a negative count is possible.
88
91
  def get_count(reset)
89
- send_request FUNCTION_GET_COUNT, [reset], '?', 4, 'l'
92
+ check_validity
93
+
94
+ send_request FUNCTION_GET_COUNT, [reset], '?', 12, 'l'
90
95
  end
91
96
 
92
97
  # Sets the period with which the CALLBACK_COUNT callback is triggered
@@ -95,12 +100,16 @@ module Tinkerforge
95
100
  # The CALLBACK_COUNT callback is only triggered if the count has changed since the
96
101
  # last triggering.
97
102
  def set_count_callback_period(period)
98
- send_request FUNCTION_SET_COUNT_CALLBACK_PERIOD, [period], 'L', 0, ''
103
+ check_validity
104
+
105
+ send_request FUNCTION_SET_COUNT_CALLBACK_PERIOD, [period], 'L', 8, ''
99
106
  end
100
107
 
101
108
  # Returns the period as set by BrickletRotaryEncoder#set_count_callback_period.
102
109
  def get_count_callback_period
103
- send_request FUNCTION_GET_COUNT_CALLBACK_PERIOD, [], '', 4, 'L'
110
+ check_validity
111
+
112
+ send_request FUNCTION_GET_COUNT_CALLBACK_PERIOD, [], '', 12, 'L'
104
113
  end
105
114
 
106
115
  # Sets the thresholds for the CALLBACK_COUNT_REACHED callback.
@@ -114,15 +123,17 @@ module Tinkerforge
114
123
  # "'i'", "Callback is triggered when the count is *inside* the min and max values"
115
124
  # "'<'", "Callback is triggered when the count is smaller than the min value (max is ignored)"
116
125
  # "'>'", "Callback is triggered when the count is greater than the min value (max is ignored)"
117
- #
118
- # The default value is ('x', 0, 0).
119
126
  def set_count_callback_threshold(option, min, max)
120
- send_request FUNCTION_SET_COUNT_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
127
+ check_validity
128
+
129
+ send_request FUNCTION_SET_COUNT_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
121
130
  end
122
131
 
123
132
  # Returns the threshold as set by BrickletRotaryEncoder#set_count_callback_threshold.
124
133
  def get_count_callback_threshold
125
- send_request FUNCTION_GET_COUNT_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
134
+ check_validity
135
+
136
+ send_request FUNCTION_GET_COUNT_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
126
137
  end
127
138
 
128
139
  # Sets the period with which the threshold callback
@@ -135,12 +146,16 @@ module Tinkerforge
135
146
  #
136
147
  # keeps being reached.
137
148
  def set_debounce_period(debounce)
138
- send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
149
+ check_validity
150
+
151
+ send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
139
152
  end
140
153
 
141
154
  # Returns the debounce period as set by BrickletRotaryEncoder#set_debounce_period.
142
155
  def get_debounce_period
143
- send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
156
+ check_validity
157
+
158
+ send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
144
159
  end
145
160
 
146
161
  # Returns *true* if the button is pressed and *false* otherwise.
@@ -148,19 +163,24 @@ module Tinkerforge
148
163
  # It is recommended to use the CALLBACK_PRESSED and CALLBACK_RELEASED callbacks
149
164
  # to handle the button.
150
165
  def is_pressed
151
- send_request FUNCTION_IS_PRESSED, [], '', 1, '?'
166
+ check_validity
167
+
168
+ send_request FUNCTION_IS_PRESSED, [], '', 9, '?'
152
169
  end
153
170
 
154
171
  # Returns the UID, the UID where the Bricklet is connected to,
155
172
  # the position, the hardware and firmware version as well as the
156
173
  # device identifier.
157
174
  #
158
- # The position can be 'a', 'b', 'c' or 'd'.
175
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
176
+ # The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
177
+ # connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
178
+ # position 'z'.
159
179
  #
160
180
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
161
181
  # |device_identifier_constant|
162
182
  def get_identity
163
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
183
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
164
184
  end
165
185
 
166
186
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.