tinkerforge 2.1.22 → 2.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
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
|
# Controls up to 2048 RGB(W) LEDs
|
|
14
16
|
class BrickletLEDStripV2 < Device
|
|
@@ -104,7 +106,7 @@ module Tinkerforge
|
|
|
104
106
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
105
107
|
# the IP Connection <tt>ipcon</tt>.
|
|
106
108
|
def initialize(uid, ipcon)
|
|
107
|
-
super uid, ipcon
|
|
109
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
108
110
|
|
|
109
111
|
@api_version = [2, 0, 0]
|
|
110
112
|
|
|
@@ -134,12 +136,13 @@ module Tinkerforge
|
|
|
134
136
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
135
137
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
136
138
|
|
|
137
|
-
@callback_formats[CALLBACK_FRAME_STARTED] = 'S'
|
|
139
|
+
@callback_formats[CALLBACK_FRAME_STARTED] = [10, 'S']
|
|
138
140
|
|
|
141
|
+
@ipcon.add_device self
|
|
139
142
|
end
|
|
140
143
|
|
|
141
144
|
# Sets the RGB(W) values for the LEDs starting from *index*.
|
|
142
|
-
# You can set at most 2048 RGB values or 1536 RGBW values.
|
|
145
|
+
# You can set at most 2048 RGB values or 1536 RGBW values (6144 byte each).
|
|
143
146
|
#
|
|
144
147
|
# To make the colors show correctly you need to configure the chip type
|
|
145
148
|
# (see BrickletLEDStripV2#set_chip_type) and a channel mapping (see BrickletLEDStripV2#set_channel_mapping)
|
|
@@ -164,15 +167,25 @@ module Tinkerforge
|
|
|
164
167
|
#
|
|
165
168
|
# This approach ensures that you can change the LED colors with a fixed frame rate.
|
|
166
169
|
def set_led_values_low_level(index, value_length, value_chunk_offset, value_chunk_data)
|
|
167
|
-
|
|
170
|
+
check_validity
|
|
171
|
+
|
|
172
|
+
send_request FUNCTION_SET_LED_VALUES_LOW_LEVEL, [index, value_length, value_chunk_offset, value_chunk_data], 'S S S C58', 8, ''
|
|
168
173
|
end
|
|
169
174
|
|
|
170
|
-
# Returns
|
|
175
|
+
# Returns *length* RGB(W) values starting from the
|
|
176
|
+
# given *index*.
|
|
177
|
+
#
|
|
178
|
+
# If the channel mapping has 3 colors, you will get the data in the sequence
|
|
179
|
+
# RGBRGBRGB... if the channel mapping has 4 colors you will get the data in the
|
|
180
|
+
# sequence RGBWRGBWRGBW...
|
|
181
|
+
# (assuming you start at an index divisible by 3 (RGB) or 4 (RGBW)).
|
|
171
182
|
def get_led_values_low_level(index, length)
|
|
172
|
-
|
|
183
|
+
check_validity
|
|
184
|
+
|
|
185
|
+
send_request FUNCTION_GET_LED_VALUES_LOW_LEVEL, [index, length], 'S S', 72, 'S S C60'
|
|
173
186
|
end
|
|
174
187
|
|
|
175
|
-
# Sets the frame duration
|
|
188
|
+
# Sets the frame duration.
|
|
176
189
|
#
|
|
177
190
|
# Example: If you want to achieve 20 frames per second, you should
|
|
178
191
|
# set the frame duration to 50ms (50ms * 20 = 1 second).
|
|
@@ -181,21 +194,26 @@ module Tinkerforge
|
|
|
181
194
|
#
|
|
182
195
|
# Default value: 100ms (10 frames per second).
|
|
183
196
|
def set_frame_duration(duration)
|
|
184
|
-
|
|
197
|
+
check_validity
|
|
198
|
+
|
|
199
|
+
send_request FUNCTION_SET_FRAME_DURATION, [duration], 'S', 8, ''
|
|
185
200
|
end
|
|
186
201
|
|
|
187
|
-
# Returns the frame duration
|
|
202
|
+
# Returns the frame duration as set by BrickletLEDStripV2#set_frame_duration.
|
|
188
203
|
def get_frame_duration
|
|
189
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
|
|
190
207
|
end
|
|
191
208
|
|
|
192
|
-
# Returns the current supply voltage of the LEDs.
|
|
209
|
+
# Returns the current supply voltage of the LEDs.
|
|
193
210
|
def get_supply_voltage
|
|
194
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 10, 'S'
|
|
195
214
|
end
|
|
196
215
|
|
|
197
|
-
# Sets the frequency of the clock
|
|
198
|
-
# 2000000Hz (2MHz).
|
|
216
|
+
# Sets the frequency of the clock.
|
|
199
217
|
#
|
|
200
218
|
# The Bricklet will choose the nearest achievable frequency, which may
|
|
201
219
|
# be off by a few Hz. You can get the exact frequency that is used by
|
|
@@ -207,15 +225,17 @@ module Tinkerforge
|
|
|
207
225
|
#
|
|
208
226
|
# With a decreasing frequency your maximum frames per second will decrease
|
|
209
227
|
# too.
|
|
210
|
-
#
|
|
211
|
-
# The default value is 1.66MHz.
|
|
212
228
|
def set_clock_frequency(frequency)
|
|
213
|
-
|
|
229
|
+
check_validity
|
|
230
|
+
|
|
231
|
+
send_request FUNCTION_SET_CLOCK_FREQUENCY, [frequency], 'L', 8, ''
|
|
214
232
|
end
|
|
215
233
|
|
|
216
234
|
# Returns the currently used clock frequency as set by BrickletLEDStripV2#set_clock_frequency.
|
|
217
235
|
def get_clock_frequency
|
|
218
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_GET_CLOCK_FREQUENCY, [], '', 12, 'L'
|
|
219
239
|
end
|
|
220
240
|
|
|
221
241
|
# Sets the type of the LED driver chip. We currently support the chips
|
|
@@ -224,17 +244,20 @@ module Tinkerforge
|
|
|
224
244
|
# * WS2811,
|
|
225
245
|
# * WS2812 / SK6812 / NeoPixel RGB,
|
|
226
246
|
# * SK6812RGBW / NeoPixel RGBW (Chip Type = WS2812),
|
|
247
|
+
# * WS2813 / WS2815 (Chip Type = WS2812)
|
|
227
248
|
# * LPD8806 and
|
|
228
249
|
# * APA102 / DotStar.
|
|
229
|
-
#
|
|
230
|
-
# The default value is WS2801 (2801).
|
|
231
250
|
def set_chip_type(chip)
|
|
232
|
-
|
|
251
|
+
check_validity
|
|
252
|
+
|
|
253
|
+
send_request FUNCTION_SET_CHIP_TYPE, [chip], 'S', 8, ''
|
|
233
254
|
end
|
|
234
255
|
|
|
235
256
|
# Returns the currently used chip type as set by BrickletLEDStripV2#set_chip_type.
|
|
236
257
|
def get_chip_type
|
|
237
|
-
|
|
258
|
+
check_validity
|
|
259
|
+
|
|
260
|
+
send_request FUNCTION_GET_CHIP_TYPE, [], '', 10, 'S'
|
|
238
261
|
end
|
|
239
262
|
|
|
240
263
|
# Sets the channel mapping for the connected LEDs.
|
|
@@ -252,28 +275,32 @@ module Tinkerforge
|
|
|
252
275
|
# making them 4-channel chips. Internally the brightness channel is the first
|
|
253
276
|
# channel, therefore one of the Wxyz channel mappings should be used. Then
|
|
254
277
|
# the W channel controls the brightness.
|
|
255
|
-
#
|
|
256
|
-
# The default value is BGR (36).
|
|
257
278
|
def set_channel_mapping(mapping)
|
|
258
|
-
|
|
279
|
+
check_validity
|
|
280
|
+
|
|
281
|
+
send_request FUNCTION_SET_CHANNEL_MAPPING, [mapping], 'C', 8, ''
|
|
259
282
|
end
|
|
260
283
|
|
|
261
284
|
# Returns the currently used channel mapping as set by BrickletLEDStripV2#set_channel_mapping.
|
|
262
285
|
def get_channel_mapping
|
|
263
|
-
|
|
286
|
+
check_validity
|
|
287
|
+
|
|
288
|
+
send_request FUNCTION_GET_CHANNEL_MAPPING, [], '', 9, 'C'
|
|
264
289
|
end
|
|
265
290
|
|
|
266
291
|
# Enables/disables the CALLBACK_FRAME_STARTED callback.
|
|
267
|
-
#
|
|
268
|
-
# By default the callback is enabled.
|
|
269
292
|
def set_frame_started_callback_configuration(enable)
|
|
270
|
-
|
|
293
|
+
check_validity
|
|
294
|
+
|
|
295
|
+
send_request FUNCTION_SET_FRAME_STARTED_CALLBACK_CONFIGURATION, [enable], '?', 8, ''
|
|
271
296
|
end
|
|
272
297
|
|
|
273
298
|
# Returns the configuration as set by
|
|
274
299
|
# BrickletLEDStripV2#set_frame_started_callback_configuration.
|
|
275
300
|
def get_frame_started_callback_configuration
|
|
276
|
-
|
|
301
|
+
check_validity
|
|
302
|
+
|
|
303
|
+
send_request FUNCTION_GET_FRAME_STARTED_CALLBACK_CONFIGURATION, [], '', 9, '?'
|
|
277
304
|
end
|
|
278
305
|
|
|
279
306
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -288,7 +315,9 @@ module Tinkerforge
|
|
|
288
315
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
289
316
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
290
317
|
def get_spitfp_error_count
|
|
291
|
-
|
|
318
|
+
check_validity
|
|
319
|
+
|
|
320
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
292
321
|
end
|
|
293
322
|
|
|
294
323
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -301,12 +330,16 @@ module Tinkerforge
|
|
|
301
330
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
302
331
|
# necessary to call it in a normal user program.
|
|
303
332
|
def set_bootloader_mode(mode)
|
|
304
|
-
|
|
333
|
+
check_validity
|
|
334
|
+
|
|
335
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
305
336
|
end
|
|
306
337
|
|
|
307
338
|
# Returns the current bootloader mode, see BrickletLEDStripV2#set_bootloader_mode.
|
|
308
339
|
def get_bootloader_mode
|
|
309
|
-
|
|
340
|
+
check_validity
|
|
341
|
+
|
|
342
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
310
343
|
end
|
|
311
344
|
|
|
312
345
|
# Sets the firmware pointer for BrickletLEDStripV2#write_firmware. The pointer has
|
|
@@ -316,7 +349,9 @@ module Tinkerforge
|
|
|
316
349
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
317
350
|
# necessary to call it in a normal user program.
|
|
318
351
|
def set_write_firmware_pointer(pointer)
|
|
319
|
-
|
|
352
|
+
check_validity
|
|
353
|
+
|
|
354
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
320
355
|
end
|
|
321
356
|
|
|
322
357
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -328,7 +363,9 @@ module Tinkerforge
|
|
|
328
363
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
329
364
|
# necessary to call it in a normal user program.
|
|
330
365
|
def write_firmware(data)
|
|
331
|
-
|
|
366
|
+
check_validity
|
|
367
|
+
|
|
368
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
332
369
|
end
|
|
333
370
|
|
|
334
371
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -339,22 +376,28 @@ module Tinkerforge
|
|
|
339
376
|
#
|
|
340
377
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
341
378
|
def set_status_led_config(config)
|
|
342
|
-
|
|
379
|
+
check_validity
|
|
380
|
+
|
|
381
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
343
382
|
end
|
|
344
383
|
|
|
345
384
|
# Returns the configuration as set by BrickletLEDStripV2#set_status_led_config
|
|
346
385
|
def get_status_led_config
|
|
347
|
-
|
|
386
|
+
check_validity
|
|
387
|
+
|
|
388
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
348
389
|
end
|
|
349
390
|
|
|
350
|
-
# Returns the temperature
|
|
391
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
351
392
|
# value returned is not the ambient temperature!
|
|
352
393
|
#
|
|
353
394
|
# The temperature is only proportional to the real temperature and it has bad
|
|
354
395
|
# accuracy. Practically it is only useful as an indicator for
|
|
355
396
|
# temperature changes.
|
|
356
397
|
def get_chip_temperature
|
|
357
|
-
|
|
398
|
+
check_validity
|
|
399
|
+
|
|
400
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
358
401
|
end
|
|
359
402
|
|
|
360
403
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -364,7 +407,9 @@ module Tinkerforge
|
|
|
364
407
|
# calling functions on the existing ones will result in
|
|
365
408
|
# undefined behavior!
|
|
366
409
|
def reset
|
|
367
|
-
|
|
410
|
+
check_validity
|
|
411
|
+
|
|
412
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
368
413
|
end
|
|
369
414
|
|
|
370
415
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -373,29 +418,35 @@ module Tinkerforge
|
|
|
373
418
|
#
|
|
374
419
|
# We recommend that you use Brick Viewer to change the UID.
|
|
375
420
|
def write_uid(uid)
|
|
376
|
-
|
|
421
|
+
check_validity
|
|
422
|
+
|
|
423
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
377
424
|
end
|
|
378
425
|
|
|
379
426
|
# Returns the current UID as an integer. Encode as
|
|
380
427
|
# Base58 to get the usual string version.
|
|
381
428
|
def read_uid
|
|
382
|
-
|
|
429
|
+
check_validity
|
|
430
|
+
|
|
431
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
383
432
|
end
|
|
384
433
|
|
|
385
434
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
386
435
|
# the position, the hardware and firmware version as well as the
|
|
387
436
|
# device identifier.
|
|
388
437
|
#
|
|
389
|
-
# The position can be 'a', 'b', 'c' or '
|
|
438
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
439
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
440
|
+
# position 'z'.
|
|
390
441
|
#
|
|
391
442
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
392
443
|
# |device_identifier_constant|
|
|
393
444
|
def get_identity
|
|
394
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
445
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
395
446
|
end
|
|
396
447
|
|
|
397
448
|
# Sets the RGB(W) values for the LEDs starting from *index*.
|
|
398
|
-
# You can set at most 2048 RGB values or 1536 RGBW values.
|
|
449
|
+
# You can set at most 2048 RGB values or 1536 RGBW values (6144 byte each).
|
|
399
450
|
#
|
|
400
451
|
# To make the colors show correctly you need to configure the chip type
|
|
401
452
|
# (see BrickletLEDStripV2#set_chip_type) and a channel mapping (see BrickletLEDStripV2#set_channel_mapping)
|
|
@@ -450,7 +501,13 @@ module Tinkerforge
|
|
|
450
501
|
ret
|
|
451
502
|
end
|
|
452
503
|
|
|
453
|
-
# Returns
|
|
504
|
+
# Returns *length* RGB(W) values starting from the
|
|
505
|
+
# given *index*.
|
|
506
|
+
#
|
|
507
|
+
# If the channel mapping has 3 colors, you will get the data in the sequence
|
|
508
|
+
# RGBRGBRGB... if the channel mapping has 4 colors you will get the data in the
|
|
509
|
+
# sequence RGBWRGBWRGBW...
|
|
510
|
+
# (assuming you start at an index divisible by 3 (RGB) or 4 (RGBW)).
|
|
454
511
|
def get_led_values(index, length)
|
|
455
512
|
value_length = nil # assigned in block
|
|
456
513
|
value_data = nil # assigned in block
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures reflectivity of a surface
|
|
14
16
|
class BrickletLine < 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_REFLECTIVITY] = 'S'
|
|
66
|
-
@callback_formats[CALLBACK_REFLECTIVITY_REACHED] = 'S'
|
|
67
|
+
@callback_formats[CALLBACK_REFLECTIVITY] = [10, 'S']
|
|
68
|
+
@callback_formats[CALLBACK_REFLECTIVITY_REACHED] = [10, 'S']
|
|
67
69
|
|
|
70
|
+
@ipcon.add_device self
|
|
68
71
|
end
|
|
69
72
|
|
|
70
73
|
# Returns the currently measured reflectivity. The reflectivity is
|
|
@@ -77,23 +80,27 @@ module Tinkerforge
|
|
|
77
80
|
# to use the CALLBACK_REFLECTIVITY callback and set the period with
|
|
78
81
|
# BrickletLine#set_reflectivity_callback_period.
|
|
79
82
|
def get_reflectivity
|
|
80
|
-
|
|
83
|
+
check_validity
|
|
84
|
+
|
|
85
|
+
send_request FUNCTION_GET_REFLECTIVITY, [], '', 10, 'S'
|
|
81
86
|
end
|
|
82
87
|
|
|
83
|
-
# Sets the period
|
|
88
|
+
# Sets the period with which the CALLBACK_REFLECTIVITY callback is triggered
|
|
84
89
|
# periodically. A value of 0 turns the callback off.
|
|
85
90
|
#
|
|
86
91
|
# The CALLBACK_REFLECTIVITY callback is only triggered if the reflectivity has
|
|
87
92
|
# changed since the last triggering.
|
|
88
|
-
#
|
|
89
|
-
# The default value is 0.
|
|
90
93
|
def set_reflectivity_callback_period(period)
|
|
91
|
-
|
|
94
|
+
check_validity
|
|
95
|
+
|
|
96
|
+
send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
92
97
|
end
|
|
93
98
|
|
|
94
99
|
# Returns the period as set by BrickletLine#set_reflectivity_callback_period.
|
|
95
100
|
def get_reflectivity_callback_period
|
|
96
|
-
|
|
101
|
+
check_validity
|
|
102
|
+
|
|
103
|
+
send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
97
104
|
end
|
|
98
105
|
|
|
99
106
|
# Sets the thresholds for the CALLBACK_REFLECTIVITY_REACHED callback.
|
|
@@ -107,18 +114,20 @@ module Tinkerforge
|
|
|
107
114
|
# "'i'", "Callback is triggered when the reflectivity is *inside* the min and max values"
|
|
108
115
|
# "'<'", "Callback is triggered when the reflectivity is smaller than the min value (max is ignored)"
|
|
109
116
|
# "'>'", "Callback is triggered when the reflectivity is greater than the min value (max is ignored)"
|
|
110
|
-
#
|
|
111
|
-
# The default value is ('x', 0, 0).
|
|
112
117
|
def set_reflectivity_callback_threshold(option, min, max)
|
|
113
|
-
|
|
118
|
+
check_validity
|
|
119
|
+
|
|
120
|
+
send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
|
114
121
|
end
|
|
115
122
|
|
|
116
123
|
# Returns the threshold as set by BrickletLine#set_reflectivity_callback_threshold.
|
|
117
124
|
def get_reflectivity_callback_threshold
|
|
118
|
-
|
|
125
|
+
check_validity
|
|
126
|
+
|
|
127
|
+
send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
|
119
128
|
end
|
|
120
129
|
|
|
121
|
-
# Sets the period
|
|
130
|
+
# Sets the period with which the threshold callback
|
|
122
131
|
#
|
|
123
132
|
# * CALLBACK_REFLECTIVITY_REACHED
|
|
124
133
|
#
|
|
@@ -127,27 +136,31 @@ module Tinkerforge
|
|
|
127
136
|
# * BrickletLine#set_reflectivity_callback_threshold
|
|
128
137
|
#
|
|
129
138
|
# keeps being reached.
|
|
130
|
-
#
|
|
131
|
-
# The default value is 100.
|
|
132
139
|
def set_debounce_period(debounce)
|
|
133
|
-
|
|
140
|
+
check_validity
|
|
141
|
+
|
|
142
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
134
143
|
end
|
|
135
144
|
|
|
136
145
|
# Returns the debounce period as set by BrickletLine#set_debounce_period.
|
|
137
146
|
def get_debounce_period
|
|
138
|
-
|
|
147
|
+
check_validity
|
|
148
|
+
|
|
149
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
139
150
|
end
|
|
140
151
|
|
|
141
152
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
142
153
|
# the position, the hardware and firmware version as well as the
|
|
143
154
|
# device identifier.
|
|
144
155
|
#
|
|
145
|
-
# The position can be 'a', 'b', 'c' or '
|
|
156
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
157
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
158
|
+
# position 'z'.
|
|
146
159
|
#
|
|
147
160
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
148
161
|
# |device_identifier_constant|
|
|
149
162
|
def get_identity
|
|
150
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
163
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
151
164
|
end
|
|
152
165
|
|
|
153
166
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|