tinkerforge 2.1.24 → 2.1.25
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 +4 -4
- data/lib/tinkerforge/brick_dc.rb +155 -74
- data/lib/tinkerforge/brick_hat.rb +70 -30
- data/lib/tinkerforge/brick_hat_zero.rb +56 -22
- data/lib/tinkerforge/brick_imu.rb +184 -77
- data/lib/tinkerforge/brick_imu_v2.rb +208 -105
- data/lib/tinkerforge/brick_master.rb +484 -182
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +185 -101
- data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
- data/lib/tinkerforge/brick_stepper.rb +210 -98
- data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
- data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
- data/lib/tinkerforge/bricklet_barometer.rb +66 -26
- data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -18
- data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
- data/lib/tinkerforge/bricklet_co2.rb +34 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
- data/lib/tinkerforge/bricklet_color.rb +69 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
- data/lib/tinkerforge/bricklet_compass.rb +78 -30
- data/lib/tinkerforge/bricklet_current12.rb +58 -24
- data/lib/tinkerforge/bricklet_current25.rb +58 -24
- data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_dmx.rb +88 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
- data/lib/tinkerforge/bricklet_gps.rb +64 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_humidity.rb +51 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_io16.rb +55 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
- data/lib/tinkerforge/bricklet_io4.rb +55 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -28
- data/lib/tinkerforge/bricklet_joystick.rb +59 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
- data/lib/tinkerforge/bricklet_line.rb +34 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
- data/lib/tinkerforge/bricklet_moisture.rb +40 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
- data/lib/tinkerforge/bricklet_nfc.rb +123 -58
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
- data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
- data/lib/tinkerforge/bricklet_ptc.rb +74 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_rs232.rb +90 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
- data/lib/tinkerforge/bricklet_rs485.rb +223 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
- data/lib/tinkerforge/bricklet_temperature.rb +40 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
- data/lib/tinkerforge/bricklet_tilt.rb +24 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
- data/lib/tinkerforge/bricklet_voltage.rb +52 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
- data/lib/tinkerforge/device_display_names.rb +163 -0
- data/lib/tinkerforge/ip_connection.rb +151 -32
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
|
@@ -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-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Measures distance up to 40m with laser light
|
|
14
16
|
class BrickletLaserRangeFinderV2 < Device
|
|
@@ -84,7 +86,7 @@ module Tinkerforge
|
|
|
84
86
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
85
87
|
# the IP Connection <tt>ipcon</tt>.
|
|
86
88
|
def initialize(uid, ipcon)
|
|
87
|
-
super uid, ipcon
|
|
89
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
88
90
|
|
|
89
91
|
@api_version = [2, 0, 0]
|
|
90
92
|
|
|
@@ -117,9 +119,10 @@ module Tinkerforge
|
|
|
117
119
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
118
120
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
119
121
|
|
|
120
|
-
@callback_formats[CALLBACK_DISTANCE] = 's'
|
|
121
|
-
@callback_formats[CALLBACK_VELOCITY] = 's'
|
|
122
|
+
@callback_formats[CALLBACK_DISTANCE] = [10, 's']
|
|
123
|
+
@callback_formats[CALLBACK_VELOCITY] = [10, 's']
|
|
122
124
|
|
|
125
|
+
@ipcon.add_device self
|
|
123
126
|
end
|
|
124
127
|
|
|
125
128
|
# Returns the measured distance.
|
|
@@ -131,7 +134,9 @@ module Tinkerforge
|
|
|
131
134
|
# CALLBACK_DISTANCE callback. You can set the callback configuration
|
|
132
135
|
# with BrickletLaserRangeFinderV2#set_distance_callback_configuration.
|
|
133
136
|
def get_distance
|
|
134
|
-
|
|
137
|
+
check_validity
|
|
138
|
+
|
|
139
|
+
send_request FUNCTION_GET_DISTANCE, [], '', 10, 's'
|
|
135
140
|
end
|
|
136
141
|
|
|
137
142
|
# The period is the period with which the CALLBACK_DISTANCE callback is triggered
|
|
@@ -160,12 +165,16 @@ module Tinkerforge
|
|
|
160
165
|
#
|
|
161
166
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
162
167
|
def set_distance_callback_configuration(period, value_has_to_change, option, min, max)
|
|
163
|
-
|
|
168
|
+
check_validity
|
|
169
|
+
|
|
170
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
|
|
164
171
|
end
|
|
165
172
|
|
|
166
173
|
# Returns the callback configuration as set by BrickletLaserRangeFinderV2#set_distance_callback_configuration.
|
|
167
174
|
def get_distance_callback_configuration
|
|
168
|
-
|
|
175
|
+
check_validity
|
|
176
|
+
|
|
177
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
169
178
|
end
|
|
170
179
|
|
|
171
180
|
# Returns the measured velocity. The value has a range of -12800 to 12700
|
|
@@ -180,7 +189,9 @@ module Tinkerforge
|
|
|
180
189
|
# CALLBACK_VELOCITY callback. You can set the callback configuration
|
|
181
190
|
# with BrickletLaserRangeFinderV2#set_velocity_callback_configuration.
|
|
182
191
|
def get_velocity
|
|
183
|
-
|
|
192
|
+
check_validity
|
|
193
|
+
|
|
194
|
+
send_request FUNCTION_GET_VELOCITY, [], '', 10, 's'
|
|
184
195
|
end
|
|
185
196
|
|
|
186
197
|
# The period is the period with which the CALLBACK_VELOCITY callback is triggered
|
|
@@ -209,12 +220,16 @@ module Tinkerforge
|
|
|
209
220
|
#
|
|
210
221
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
211
222
|
def set_velocity_callback_configuration(period, value_has_to_change, option, min, max)
|
|
212
|
-
|
|
223
|
+
check_validity
|
|
224
|
+
|
|
225
|
+
send_request FUNCTION_SET_VELOCITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
|
|
213
226
|
end
|
|
214
227
|
|
|
215
228
|
# Returns the callback configuration as set by BrickletLaserRangeFinderV2#set_velocity_callback_configuration.
|
|
216
229
|
def get_velocity_callback_configuration
|
|
217
|
-
|
|
230
|
+
check_validity
|
|
231
|
+
|
|
232
|
+
send_request FUNCTION_GET_VELOCITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
218
233
|
end
|
|
219
234
|
|
|
220
235
|
# Enables the laser of the LIDAR if set to *true*.
|
|
@@ -222,12 +237,16 @@ module Tinkerforge
|
|
|
222
237
|
# We recommend that you wait 250ms after enabling the laser before
|
|
223
238
|
# the first call of BrickletLaserRangeFinderV2#get_distance to ensure stable measurements.
|
|
224
239
|
def set_enable(enable)
|
|
225
|
-
|
|
240
|
+
check_validity
|
|
241
|
+
|
|
242
|
+
send_request FUNCTION_SET_ENABLE, [enable], '?', 8, ''
|
|
226
243
|
end
|
|
227
244
|
|
|
228
245
|
# Returns the value as set by BrickletLaserRangeFinderV2#set_enable.
|
|
229
246
|
def get_enable
|
|
230
|
-
|
|
247
|
+
check_validity
|
|
248
|
+
|
|
249
|
+
send_request FUNCTION_GET_ENABLE, [], '', 9, '?'
|
|
231
250
|
end
|
|
232
251
|
|
|
233
252
|
# The **Acquisition Count** defines the number of times the Laser Range Finder Bricklet
|
|
@@ -247,7 +266,7 @@ module Tinkerforge
|
|
|
247
266
|
# the distance to something with a very high reflection (e.g. mirror). Set this to 0 to
|
|
248
267
|
# use the default algorithm. The other allowed values are 1-255.
|
|
249
268
|
#
|
|
250
|
-
# Set the **Measurement Frequency**
|
|
269
|
+
# Set the **Measurement Frequency** to force a fixed measurement rate. If set to 0,
|
|
251
270
|
# the Laser Range Finder Bricklet will use the optimal frequency according to the other
|
|
252
271
|
# configurations and the actual measured distance. Since the rate is not fixed in this case,
|
|
253
272
|
# the velocity measurement is not stable. For a stable velocity measurement you should
|
|
@@ -258,12 +277,16 @@ module Tinkerforge
|
|
|
258
277
|
# The default values for Acquisition Count, Enable Quick Termination, Threshold Value and
|
|
259
278
|
# Measurement Frequency are 128, false, 0 and 0.
|
|
260
279
|
def set_configuration(acquisition_count, enable_quick_termination, threshold_value, measurement_frequency)
|
|
261
|
-
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_SET_CONFIGURATION, [acquisition_count, enable_quick_termination, threshold_value, measurement_frequency], 'C ? C S', 8, ''
|
|
262
283
|
end
|
|
263
284
|
|
|
264
285
|
# Returns the configuration as set by BrickletLaserRangeFinderV2#set_configuration.
|
|
265
286
|
def get_configuration
|
|
266
|
-
|
|
287
|
+
check_validity
|
|
288
|
+
|
|
289
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 13, 'C ? C S'
|
|
267
290
|
end
|
|
268
291
|
|
|
269
292
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
|
@@ -272,12 +295,16 @@ module Tinkerforge
|
|
|
272
295
|
# Setting the length to 0 will turn the averaging completely off. With less
|
|
273
296
|
# averaging, there is more noise on the data.
|
|
274
297
|
def set_moving_average(distance_average_length, velocity_average_length)
|
|
275
|
-
|
|
298
|
+
check_validity
|
|
299
|
+
|
|
300
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [distance_average_length, velocity_average_length], 'C C', 8, ''
|
|
276
301
|
end
|
|
277
302
|
|
|
278
303
|
# Returns the length moving average as set by BrickletLaserRangeFinderV2#set_moving_average.
|
|
279
304
|
def get_moving_average
|
|
280
|
-
|
|
305
|
+
check_validity
|
|
306
|
+
|
|
307
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 10, 'C C'
|
|
281
308
|
end
|
|
282
309
|
|
|
283
310
|
# The offset is added to the measured distance.
|
|
@@ -290,23 +317,31 @@ module Tinkerforge
|
|
|
290
317
|
# Calculate the offset by measuring the distance to a known distance
|
|
291
318
|
# and set it again.
|
|
292
319
|
def set_offset_calibration(offset)
|
|
293
|
-
|
|
320
|
+
check_validity
|
|
321
|
+
|
|
322
|
+
send_request FUNCTION_SET_OFFSET_CALIBRATION, [offset], 's', 8, ''
|
|
294
323
|
end
|
|
295
324
|
|
|
296
325
|
# Returns the offset value as set by BrickletLaserRangeFinderV2#set_offset_calibration.
|
|
297
326
|
def get_offset_calibration
|
|
298
|
-
|
|
327
|
+
check_validity
|
|
328
|
+
|
|
329
|
+
send_request FUNCTION_GET_OFFSET_CALIBRATION, [], '', 10, 's'
|
|
299
330
|
end
|
|
300
331
|
|
|
301
332
|
# Configures the distance LED to be either turned off, turned on, blink in
|
|
302
333
|
# heartbeat mode or show the distance (brighter = object is nearer).
|
|
303
334
|
def set_distance_led_config(config)
|
|
304
|
-
|
|
335
|
+
check_validity
|
|
336
|
+
|
|
337
|
+
send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 8, ''
|
|
305
338
|
end
|
|
306
339
|
|
|
307
340
|
# Returns the LED configuration as set by BrickletLaserRangeFinderV2#set_distance_led_config
|
|
308
341
|
def get_distance_led_config
|
|
309
|
-
|
|
342
|
+
check_validity
|
|
343
|
+
|
|
344
|
+
send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 9, 'C'
|
|
310
345
|
end
|
|
311
346
|
|
|
312
347
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -321,7 +356,9 @@ module Tinkerforge
|
|
|
321
356
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
322
357
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
323
358
|
def get_spitfp_error_count
|
|
324
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
325
362
|
end
|
|
326
363
|
|
|
327
364
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -334,12 +371,16 @@ module Tinkerforge
|
|
|
334
371
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
335
372
|
# necessary to call it in a normal user program.
|
|
336
373
|
def set_bootloader_mode(mode)
|
|
337
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
338
377
|
end
|
|
339
378
|
|
|
340
379
|
# Returns the current bootloader mode, see BrickletLaserRangeFinderV2#set_bootloader_mode.
|
|
341
380
|
def get_bootloader_mode
|
|
342
|
-
|
|
381
|
+
check_validity
|
|
382
|
+
|
|
383
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
343
384
|
end
|
|
344
385
|
|
|
345
386
|
# Sets the firmware pointer for BrickletLaserRangeFinderV2#write_firmware. The pointer has
|
|
@@ -349,7 +390,9 @@ module Tinkerforge
|
|
|
349
390
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
350
391
|
# necessary to call it in a normal user program.
|
|
351
392
|
def set_write_firmware_pointer(pointer)
|
|
352
|
-
|
|
393
|
+
check_validity
|
|
394
|
+
|
|
395
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
353
396
|
end
|
|
354
397
|
|
|
355
398
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -361,7 +404,9 @@ module Tinkerforge
|
|
|
361
404
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
362
405
|
# necessary to call it in a normal user program.
|
|
363
406
|
def write_firmware(data)
|
|
364
|
-
|
|
407
|
+
check_validity
|
|
408
|
+
|
|
409
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
365
410
|
end
|
|
366
411
|
|
|
367
412
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -372,22 +417,28 @@ module Tinkerforge
|
|
|
372
417
|
#
|
|
373
418
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
374
419
|
def set_status_led_config(config)
|
|
375
|
-
|
|
420
|
+
check_validity
|
|
421
|
+
|
|
422
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
376
423
|
end
|
|
377
424
|
|
|
378
425
|
# Returns the configuration as set by BrickletLaserRangeFinderV2#set_status_led_config
|
|
379
426
|
def get_status_led_config
|
|
380
|
-
|
|
427
|
+
check_validity
|
|
428
|
+
|
|
429
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
381
430
|
end
|
|
382
431
|
|
|
383
|
-
# Returns the temperature
|
|
432
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
384
433
|
# value returned is not the ambient temperature!
|
|
385
434
|
#
|
|
386
435
|
# The temperature is only proportional to the real temperature and it has bad
|
|
387
436
|
# accuracy. Practically it is only useful as an indicator for
|
|
388
437
|
# temperature changes.
|
|
389
438
|
def get_chip_temperature
|
|
390
|
-
|
|
439
|
+
check_validity
|
|
440
|
+
|
|
441
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
391
442
|
end
|
|
392
443
|
|
|
393
444
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -397,7 +448,9 @@ module Tinkerforge
|
|
|
397
448
|
# calling functions on the existing ones will result in
|
|
398
449
|
# undefined behavior!
|
|
399
450
|
def reset
|
|
400
|
-
|
|
451
|
+
check_validity
|
|
452
|
+
|
|
453
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
401
454
|
end
|
|
402
455
|
|
|
403
456
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -406,25 +459,32 @@ module Tinkerforge
|
|
|
406
459
|
#
|
|
407
460
|
# We recommend that you use Brick Viewer to change the UID.
|
|
408
461
|
def write_uid(uid)
|
|
409
|
-
|
|
462
|
+
check_validity
|
|
463
|
+
|
|
464
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
410
465
|
end
|
|
411
466
|
|
|
412
467
|
# Returns the current UID as an integer. Encode as
|
|
413
468
|
# Base58 to get the usual string version.
|
|
414
469
|
def read_uid
|
|
415
|
-
|
|
470
|
+
check_validity
|
|
471
|
+
|
|
472
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
416
473
|
end
|
|
417
474
|
|
|
418
475
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
419
476
|
# the position, the hardware and firmware version as well as the
|
|
420
477
|
# device identifier.
|
|
421
478
|
#
|
|
422
|
-
# The position can be 'a', 'b', 'c' or '
|
|
479
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
480
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
481
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
482
|
+
# position 'z'.
|
|
423
483
|
#
|
|
424
484
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
425
485
|
# |device_identifier_constant|
|
|
426
486
|
def get_identity
|
|
427
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
487
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
428
488
|
end
|
|
429
489
|
|
|
430
490
|
# 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
|
|
3
|
+
# This file was automatically generated on 2020-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
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
|
# 7.1cm (2.8") display with 128x64 pixel and touch screen
|
|
14
16
|
class BrickletLCD128x64 < Device
|
|
@@ -153,7 +155,7 @@ module Tinkerforge
|
|
|
153
155
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
154
156
|
# the IP Connection <tt>ipcon</tt>.
|
|
155
157
|
def initialize(uid, ipcon)
|
|
156
|
-
super uid, ipcon
|
|
158
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
157
159
|
|
|
158
160
|
@api_version = [2, 0, 1]
|
|
159
161
|
|
|
@@ -217,12 +219,13 @@ module Tinkerforge
|
|
|
217
219
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
218
220
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
219
221
|
|
|
220
|
-
@callback_formats[CALLBACK_TOUCH_POSITION] = 'S S S L'
|
|
221
|
-
@callback_formats[CALLBACK_TOUCH_GESTURE] = 'C L S S S S S L'
|
|
222
|
-
@callback_formats[CALLBACK_GUI_BUTTON_PRESSED] = 'C ?'
|
|
223
|
-
@callback_formats[CALLBACK_GUI_SLIDER_VALUE] = 'C C'
|
|
224
|
-
@callback_formats[CALLBACK_GUI_TAB_SELECTED] = 'c'
|
|
222
|
+
@callback_formats[CALLBACK_TOUCH_POSITION] = [18, 'S S S L']
|
|
223
|
+
@callback_formats[CALLBACK_TOUCH_GESTURE] = [27, 'C L S S S S S L']
|
|
224
|
+
@callback_formats[CALLBACK_GUI_BUTTON_PRESSED] = [10, 'C ?']
|
|
225
|
+
@callback_formats[CALLBACK_GUI_SLIDER_VALUE] = [10, 'C C']
|
|
226
|
+
@callback_formats[CALLBACK_GUI_TAB_SELECTED] = [9, 'c']
|
|
225
227
|
|
|
228
|
+
@ipcon.add_device self
|
|
226
229
|
end
|
|
227
230
|
|
|
228
231
|
# Writes pixels to the specified window.
|
|
@@ -242,7 +245,9 @@ module Tinkerforge
|
|
|
242
245
|
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
243
246
|
# function.
|
|
244
247
|
def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
|
|
245
|
-
|
|
248
|
+
check_validity
|
|
249
|
+
|
|
250
|
+
send_request FUNCTION_WRITE_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'C C C C S S ?448', 8, ''
|
|
246
251
|
end
|
|
247
252
|
|
|
248
253
|
# Reads pixels from the specified window.
|
|
@@ -259,7 +264,9 @@ module Tinkerforge
|
|
|
259
264
|
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
260
265
|
# function.
|
|
261
266
|
def read_pixels_low_level(x_start, y_start, x_end, y_end)
|
|
262
|
-
|
|
267
|
+
check_validity
|
|
268
|
+
|
|
269
|
+
send_request FUNCTION_READ_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'C C C C', 72, 'S S ?480'
|
|
263
270
|
end
|
|
264
271
|
|
|
265
272
|
# Clears the complete content of the display.
|
|
@@ -274,7 +281,9 @@ module Tinkerforge
|
|
|
274
281
|
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
275
282
|
# function.
|
|
276
283
|
def clear_display
|
|
277
|
-
|
|
284
|
+
check_validity
|
|
285
|
+
|
|
286
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
278
287
|
end
|
|
279
288
|
|
|
280
289
|
# Sets the configuration of the display.
|
|
@@ -284,12 +293,16 @@ module Tinkerforge
|
|
|
284
293
|
# changes are written into an internal buffer and only shown on the display after
|
|
285
294
|
# a call of BrickletLCD128x64#draw_buffered_frame.
|
|
286
295
|
def set_display_configuration(contrast, backlight, invert, automatic_draw)
|
|
287
|
-
|
|
296
|
+
check_validity
|
|
297
|
+
|
|
298
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, backlight, invert, automatic_draw], 'C C ? ?', 8, ''
|
|
288
299
|
end
|
|
289
300
|
|
|
290
301
|
# Returns the configuration as set by BrickletLCD128x64#set_display_configuration.
|
|
291
302
|
def get_display_configuration
|
|
292
|
-
|
|
303
|
+
check_validity
|
|
304
|
+
|
|
305
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 12, 'C C ? ?'
|
|
293
306
|
end
|
|
294
307
|
|
|
295
308
|
# Writes text to a specific line with a specific position.
|
|
@@ -316,7 +329,9 @@ module Tinkerforge
|
|
|
316
329
|
# in the LCD 20x4 Bricklet. You can draw text at a specific pixel position
|
|
317
330
|
# and with different font sizes with the BrickletLCD128x64#draw_text function.
|
|
318
331
|
def write_line(line, position, text)
|
|
319
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, ''
|
|
320
335
|
end
|
|
321
336
|
|
|
322
337
|
# Draws the currently buffered frame. Normally each call of BrickletLCD128x64#write_pixels and
|
|
@@ -329,7 +344,9 @@ module Tinkerforge
|
|
|
329
344
|
# instead of only the changed parts. Normally it should not be necessary to set this to
|
|
330
345
|
# *true*. It may only become necessary in case of stuck pixels because of errors.
|
|
331
346
|
def draw_buffered_frame(force_complete_redraw)
|
|
332
|
-
|
|
347
|
+
check_validity
|
|
348
|
+
|
|
349
|
+
send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, ''
|
|
333
350
|
end
|
|
334
351
|
|
|
335
352
|
# Returns the last valid touch position:
|
|
@@ -337,9 +354,11 @@ module Tinkerforge
|
|
|
337
354
|
# * Pressure: Amount of pressure applied by the user
|
|
338
355
|
# * X: Touch position on x-axis
|
|
339
356
|
# * Y: Touch position on y-axis
|
|
340
|
-
# * Age: Age of touch press
|
|
357
|
+
# * Age: Age of touch press (how long ago it was)
|
|
341
358
|
def get_touch_position
|
|
342
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_GET_TOUCH_POSITION, [], '', 18, 'S S S L'
|
|
343
362
|
end
|
|
344
363
|
|
|
345
364
|
# The period is the period with which the CALLBACK_TOUCH_POSITION callback
|
|
@@ -352,13 +371,17 @@ module Tinkerforge
|
|
|
352
371
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
353
372
|
# independent of the value.
|
|
354
373
|
def set_touch_position_callback_configuration(period, value_has_to_change)
|
|
355
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_SET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
356
377
|
end
|
|
357
378
|
|
|
358
379
|
# Returns the callback configuration as set by
|
|
359
380
|
# BrickletLCD128x64#set_touch_position_callback_configuration.
|
|
360
381
|
def get_touch_position_callback_configuration
|
|
361
|
-
|
|
382
|
+
check_validity
|
|
383
|
+
|
|
384
|
+
send_request FUNCTION_GET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
362
385
|
end
|
|
363
386
|
|
|
364
387
|
# Returns one of four touch gestures that can be automatically detected by the Bricklet.
|
|
@@ -371,7 +394,9 @@ module Tinkerforge
|
|
|
371
394
|
#
|
|
372
395
|
# The age parameter corresponds to the age of gesture (how long ago it was).
|
|
373
396
|
def get_touch_gesture
|
|
374
|
-
|
|
397
|
+
check_validity
|
|
398
|
+
|
|
399
|
+
send_request FUNCTION_GET_TOUCH_GESTURE, [], '', 27, 'C L S S S S S L'
|
|
375
400
|
end
|
|
376
401
|
|
|
377
402
|
# The period is the period with which the CALLBACK_TOUCH_GESTURE callback
|
|
@@ -384,20 +409,26 @@ module Tinkerforge
|
|
|
384
409
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
385
410
|
# independent of the value.
|
|
386
411
|
def set_touch_gesture_callback_configuration(period, value_has_to_change)
|
|
387
|
-
|
|
412
|
+
check_validity
|
|
413
|
+
|
|
414
|
+
send_request FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
388
415
|
end
|
|
389
416
|
|
|
390
417
|
# Returns the callback configuration as set by
|
|
391
418
|
# BrickletLCD128x64#set_touch_gesture_callback_configuration.
|
|
392
419
|
def get_touch_gesture_callback_configuration
|
|
393
|
-
|
|
420
|
+
check_validity
|
|
421
|
+
|
|
422
|
+
send_request FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
394
423
|
end
|
|
395
424
|
|
|
396
425
|
# Draws a white or black line from (x, y)-start to (x, y)-end.
|
|
397
426
|
#
|
|
398
427
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
399
428
|
def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
|
|
400
|
-
|
|
429
|
+
check_validity
|
|
430
|
+
|
|
431
|
+
send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'C C C C ?', 8, ''
|
|
401
432
|
end
|
|
402
433
|
|
|
403
434
|
# Draws a white or black box from (x, y)-start to (x, y)-end.
|
|
@@ -407,7 +438,9 @@ module Tinkerforge
|
|
|
407
438
|
#
|
|
408
439
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
409
440
|
def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
|
|
410
|
-
|
|
441
|
+
check_validity
|
|
442
|
+
|
|
443
|
+
send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'C C C C ? ?', 8, ''
|
|
411
444
|
end
|
|
412
445
|
|
|
413
446
|
# Draws a text at the pixel position (x, y).
|
|
@@ -416,7 +449,9 @@ module Tinkerforge
|
|
|
416
449
|
#
|
|
417
450
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
418
451
|
def draw_text(position_x, position_y, font, color, text)
|
|
419
|
-
|
|
452
|
+
check_validity
|
|
453
|
+
|
|
454
|
+
send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, text], 'C C C ? Z22', 8, ''
|
|
420
455
|
end
|
|
421
456
|
|
|
422
457
|
# Draws a clickable button at position (x, y) with the given text.
|
|
@@ -441,7 +476,9 @@ module Tinkerforge
|
|
|
441
476
|
#
|
|
442
477
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
443
478
|
def set_gui_button(index, position_x, position_y, width, height, text)
|
|
444
|
-
|
|
479
|
+
check_validity
|
|
480
|
+
|
|
481
|
+
send_request FUNCTION_SET_GUI_BUTTON, [index, position_x, position_y, width, height, text], 'C C C C C Z16', 8, ''
|
|
445
482
|
end
|
|
446
483
|
|
|
447
484
|
# Returns the button properties for a given `Index` as set by BrickletLCD128x64#set_gui_button.
|
|
@@ -451,7 +488,9 @@ module Tinkerforge
|
|
|
451
488
|
#
|
|
452
489
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
453
490
|
def get_gui_button(index)
|
|
454
|
-
|
|
491
|
+
check_validity
|
|
492
|
+
|
|
493
|
+
send_request FUNCTION_GET_GUI_BUTTON, [index], 'C', 29, '? C C C C Z16'
|
|
455
494
|
end
|
|
456
495
|
|
|
457
496
|
# Removes the button with the given index.
|
|
@@ -460,7 +499,9 @@ module Tinkerforge
|
|
|
460
499
|
#
|
|
461
500
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
462
501
|
def remove_gui_button(index)
|
|
463
|
-
|
|
502
|
+
check_validity
|
|
503
|
+
|
|
504
|
+
send_request FUNCTION_REMOVE_GUI_BUTTON, [index], 'C', 8, ''
|
|
464
505
|
end
|
|
465
506
|
|
|
466
507
|
# The period is the period with which the CALLBACK_GUI_BUTTON_PRESSED callback
|
|
@@ -475,7 +516,9 @@ module Tinkerforge
|
|
|
475
516
|
#
|
|
476
517
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
477
518
|
def set_gui_button_pressed_callback_configuration(period, value_has_to_change)
|
|
478
|
-
|
|
519
|
+
check_validity
|
|
520
|
+
|
|
521
|
+
send_request FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
479
522
|
end
|
|
480
523
|
|
|
481
524
|
# Returns the callback configuration as set by
|
|
@@ -483,7 +526,9 @@ module Tinkerforge
|
|
|
483
526
|
#
|
|
484
527
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
485
528
|
def get_gui_button_pressed_callback_configuration
|
|
486
|
-
|
|
529
|
+
check_validity
|
|
530
|
+
|
|
531
|
+
send_request FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
487
532
|
end
|
|
488
533
|
|
|
489
534
|
# Returns the state of the button for the given index.
|
|
@@ -492,7 +537,9 @@ module Tinkerforge
|
|
|
492
537
|
#
|
|
493
538
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
494
539
|
def get_gui_button_pressed(index)
|
|
495
|
-
|
|
540
|
+
check_validity
|
|
541
|
+
|
|
542
|
+
send_request FUNCTION_GET_GUI_BUTTON_PRESSED, [index], 'C', 9, '?'
|
|
496
543
|
end
|
|
497
544
|
|
|
498
545
|
# Draws a slider at position (x, y) with the given length.
|
|
@@ -521,7 +568,9 @@ module Tinkerforge
|
|
|
521
568
|
#
|
|
522
569
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
523
570
|
def set_gui_slider(index, position_x, position_y, length, direction, value)
|
|
524
|
-
|
|
571
|
+
check_validity
|
|
572
|
+
|
|
573
|
+
send_request FUNCTION_SET_GUI_SLIDER, [index, position_x, position_y, length, direction, value], 'C C C C C C', 8, ''
|
|
525
574
|
end
|
|
526
575
|
|
|
527
576
|
# Returns the slider properties for a given `Index` as set by BrickletLCD128x64#set_gui_slider.
|
|
@@ -531,7 +580,9 @@ module Tinkerforge
|
|
|
531
580
|
#
|
|
532
581
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
533
582
|
def get_gui_slider(index)
|
|
534
|
-
|
|
583
|
+
check_validity
|
|
584
|
+
|
|
585
|
+
send_request FUNCTION_GET_GUI_SLIDER, [index], 'C', 14, '? C C C C C'
|
|
535
586
|
end
|
|
536
587
|
|
|
537
588
|
# Removes the slider with the given index.
|
|
@@ -540,7 +591,9 @@ module Tinkerforge
|
|
|
540
591
|
#
|
|
541
592
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
542
593
|
def remove_gui_slider(index)
|
|
543
|
-
|
|
594
|
+
check_validity
|
|
595
|
+
|
|
596
|
+
send_request FUNCTION_REMOVE_GUI_SLIDER, [index], 'C', 8, ''
|
|
544
597
|
end
|
|
545
598
|
|
|
546
599
|
# The period is the period with which the CALLBACK_GUI_SLIDER_VALUE callback
|
|
@@ -555,7 +608,9 @@ module Tinkerforge
|
|
|
555
608
|
#
|
|
556
609
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
557
610
|
def set_gui_slider_value_callback_configuration(period, value_has_to_change)
|
|
558
|
-
|
|
611
|
+
check_validity
|
|
612
|
+
|
|
613
|
+
send_request FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
559
614
|
end
|
|
560
615
|
|
|
561
616
|
# Returns the callback configuration as set by
|
|
@@ -563,14 +618,18 @@ module Tinkerforge
|
|
|
563
618
|
#
|
|
564
619
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
565
620
|
def get_gui_slider_value_callback_configuration
|
|
566
|
-
|
|
621
|
+
check_validity
|
|
622
|
+
|
|
623
|
+
send_request FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
567
624
|
end
|
|
568
625
|
|
|
569
626
|
# Returns the current slider value for the given index.
|
|
570
627
|
#
|
|
571
628
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
572
629
|
def get_gui_slider_value(index)
|
|
573
|
-
|
|
630
|
+
check_validity
|
|
631
|
+
|
|
632
|
+
send_request FUNCTION_GET_GUI_SLIDER_VALUE, [index], 'C', 9, 'C'
|
|
574
633
|
end
|
|
575
634
|
|
|
576
635
|
# Sets the general configuration for tabs. You can configure the tabs to only
|
|
@@ -581,14 +640,18 @@ module Tinkerforge
|
|
|
581
640
|
#
|
|
582
641
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
583
642
|
def set_gui_tab_configuration(change_tab_config, clear_gui)
|
|
584
|
-
|
|
643
|
+
check_validity
|
|
644
|
+
|
|
645
|
+
send_request FUNCTION_SET_GUI_TAB_CONFIGURATION, [change_tab_config, clear_gui], 'C ?', 8, ''
|
|
585
646
|
end
|
|
586
647
|
|
|
587
648
|
# Returns the tab configuration as set by BrickletLCD128x64#set_gui_tab_configuration.
|
|
588
649
|
#
|
|
589
650
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
590
651
|
def get_gui_tab_configuration
|
|
591
|
-
|
|
652
|
+
check_validity
|
|
653
|
+
|
|
654
|
+
send_request FUNCTION_GET_GUI_TAB_CONFIGURATION, [], '', 10, 'C ?'
|
|
592
655
|
end
|
|
593
656
|
|
|
594
657
|
# Adds a text-tab with the given index.
|
|
@@ -599,7 +662,9 @@ module Tinkerforge
|
|
|
599
662
|
#
|
|
600
663
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
601
664
|
def set_gui_tab_text(index, text)
|
|
602
|
-
|
|
665
|
+
check_validity
|
|
666
|
+
|
|
667
|
+
send_request FUNCTION_SET_GUI_TAB_TEXT, [index, text], 'C Z5', 8, ''
|
|
603
668
|
end
|
|
604
669
|
|
|
605
670
|
# Returns the text for a given index as set by BrickletLCD128x64#set_gui_tab_text.
|
|
@@ -609,7 +674,9 @@ module Tinkerforge
|
|
|
609
674
|
#
|
|
610
675
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
611
676
|
def get_gui_tab_text(index)
|
|
612
|
-
|
|
677
|
+
check_validity
|
|
678
|
+
|
|
679
|
+
send_request FUNCTION_GET_GUI_TAB_TEXT, [index], 'C', 14, '? Z5'
|
|
613
680
|
end
|
|
614
681
|
|
|
615
682
|
# Adds a icon-tab with the given index. The icon can have a width of 28 pixels
|
|
@@ -621,7 +688,9 @@ module Tinkerforge
|
|
|
621
688
|
#
|
|
622
689
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
623
690
|
def set_gui_tab_icon(index, icon)
|
|
624
|
-
|
|
691
|
+
check_validity
|
|
692
|
+
|
|
693
|
+
send_request FUNCTION_SET_GUI_TAB_ICON, [index, icon], 'C ?168', 8, ''
|
|
625
694
|
end
|
|
626
695
|
|
|
627
696
|
# Returns the icon for a given index as set by BrickletLCD128x64#set_gui_tab_icon.
|
|
@@ -631,7 +700,9 @@ module Tinkerforge
|
|
|
631
700
|
#
|
|
632
701
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
633
702
|
def get_gui_tab_icon(index)
|
|
634
|
-
|
|
703
|
+
check_validity
|
|
704
|
+
|
|
705
|
+
send_request FUNCTION_GET_GUI_TAB_ICON, [index], 'C', 30, '? ?168'
|
|
635
706
|
end
|
|
636
707
|
|
|
637
708
|
# Removes the tab with the given index.
|
|
@@ -640,14 +711,18 @@ module Tinkerforge
|
|
|
640
711
|
#
|
|
641
712
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
642
713
|
def remove_gui_tab(index)
|
|
643
|
-
|
|
714
|
+
check_validity
|
|
715
|
+
|
|
716
|
+
send_request FUNCTION_REMOVE_GUI_TAB, [index], 'C', 8, ''
|
|
644
717
|
end
|
|
645
718
|
|
|
646
719
|
# Sets the tab with the given index as selected (drawn as selected on the display).
|
|
647
720
|
#
|
|
648
721
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
649
722
|
def set_gui_tab_selected(index)
|
|
650
|
-
|
|
723
|
+
check_validity
|
|
724
|
+
|
|
725
|
+
send_request FUNCTION_SET_GUI_TAB_SELECTED, [index], 'C', 8, ''
|
|
651
726
|
end
|
|
652
727
|
|
|
653
728
|
# The period is the period with which the CALLBACK_GUI_TAB_SELECTED callback
|
|
@@ -662,7 +737,9 @@ module Tinkerforge
|
|
|
662
737
|
#
|
|
663
738
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
664
739
|
def set_gui_tab_selected_callback_configuration(period, value_has_to_change)
|
|
665
|
-
|
|
740
|
+
check_validity
|
|
741
|
+
|
|
742
|
+
send_request FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
666
743
|
end
|
|
667
744
|
|
|
668
745
|
# Returns the callback configuration as set by
|
|
@@ -670,7 +747,9 @@ module Tinkerforge
|
|
|
670
747
|
#
|
|
671
748
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
672
749
|
def get_gui_tab_selected_callback_configuration
|
|
673
|
-
|
|
750
|
+
check_validity
|
|
751
|
+
|
|
752
|
+
send_request FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
674
753
|
end
|
|
675
754
|
|
|
676
755
|
# Returns the index of the currently selected tab.
|
|
@@ -678,7 +757,9 @@ module Tinkerforge
|
|
|
678
757
|
#
|
|
679
758
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
680
759
|
def get_gui_tab_selected
|
|
681
|
-
|
|
760
|
+
check_validity
|
|
761
|
+
|
|
762
|
+
send_request FUNCTION_GET_GUI_TAB_SELECTED, [], '', 9, 'c'
|
|
682
763
|
end
|
|
683
764
|
|
|
684
765
|
# Sets the configuration for up to four graphs.
|
|
@@ -701,7 +782,9 @@ module Tinkerforge
|
|
|
701
782
|
#
|
|
702
783
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
703
784
|
def set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y)
|
|
704
|
-
|
|
785
|
+
check_validity
|
|
786
|
+
|
|
787
|
+
send_request FUNCTION_SET_GUI_GRAPH_CONFIGURATION, [index, graph_type, position_x, position_y, width, height, text_x, text_y], 'C C C C C C Z4 Z4', 8, ''
|
|
705
788
|
end
|
|
706
789
|
|
|
707
790
|
# Returns the graph properties for a given `Index` as set by BrickletLCD128x64#set_gui_graph_configuration.
|
|
@@ -711,7 +794,9 @@ module Tinkerforge
|
|
|
711
794
|
#
|
|
712
795
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
713
796
|
def get_gui_graph_configuration(index)
|
|
714
|
-
|
|
797
|
+
check_validity
|
|
798
|
+
|
|
799
|
+
send_request FUNCTION_GET_GUI_GRAPH_CONFIGURATION, [index], 'C', 22, '? C C C C C Z4 Z4'
|
|
715
800
|
end
|
|
716
801
|
|
|
717
802
|
# Sets the data for a graph with the given index. You have to configure the graph with
|
|
@@ -729,14 +814,18 @@ module Tinkerforge
|
|
|
729
814
|
#
|
|
730
815
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
731
816
|
def set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data)
|
|
732
|
-
|
|
817
|
+
check_validity
|
|
818
|
+
|
|
819
|
+
send_request FUNCTION_SET_GUI_GRAPH_DATA_LOW_LEVEL, [index, data_length, data_chunk_offset, data_chunk_data], 'C S S C59', 8, ''
|
|
733
820
|
end
|
|
734
821
|
|
|
735
822
|
# Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
|
|
736
823
|
#
|
|
737
824
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
738
825
|
def get_gui_graph_data_low_level(index)
|
|
739
|
-
|
|
826
|
+
check_validity
|
|
827
|
+
|
|
828
|
+
send_request FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL, [index], 'C', 71, 'S S C59'
|
|
740
829
|
end
|
|
741
830
|
|
|
742
831
|
# Removes the graph with the given index.
|
|
@@ -745,14 +834,18 @@ module Tinkerforge
|
|
|
745
834
|
#
|
|
746
835
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
747
836
|
def remove_gui_graph(index)
|
|
748
|
-
|
|
837
|
+
check_validity
|
|
838
|
+
|
|
839
|
+
send_request FUNCTION_REMOVE_GUI_GRAPH, [index], 'C', 8, ''
|
|
749
840
|
end
|
|
750
841
|
|
|
751
842
|
# Removes all GUI elements (buttons, slider, graphs, tabs).
|
|
752
843
|
#
|
|
753
844
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
754
845
|
def remove_all_gui
|
|
755
|
-
|
|
846
|
+
check_validity
|
|
847
|
+
|
|
848
|
+
send_request FUNCTION_REMOVE_ALL_GUI, [], '', 8, ''
|
|
756
849
|
end
|
|
757
850
|
|
|
758
851
|
# Sets the touch LED configuration. By default the LED is on if the
|
|
@@ -764,14 +857,18 @@ module Tinkerforge
|
|
|
764
857
|
#
|
|
765
858
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
766
859
|
def set_touch_led_config(config)
|
|
767
|
-
|
|
860
|
+
check_validity
|
|
861
|
+
|
|
862
|
+
send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 8, ''
|
|
768
863
|
end
|
|
769
864
|
|
|
770
865
|
# Returns the configuration as set by BrickletLCD128x64#set_touch_led_config
|
|
771
866
|
#
|
|
772
867
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
773
868
|
def get_touch_led_config
|
|
774
|
-
|
|
869
|
+
check_validity
|
|
870
|
+
|
|
871
|
+
send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 9, 'C'
|
|
775
872
|
end
|
|
776
873
|
|
|
777
874
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -786,7 +883,9 @@ module Tinkerforge
|
|
|
786
883
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
787
884
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
788
885
|
def get_spitfp_error_count
|
|
789
|
-
|
|
886
|
+
check_validity
|
|
887
|
+
|
|
888
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
790
889
|
end
|
|
791
890
|
|
|
792
891
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -799,12 +898,16 @@ module Tinkerforge
|
|
|
799
898
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
800
899
|
# necessary to call it in a normal user program.
|
|
801
900
|
def set_bootloader_mode(mode)
|
|
802
|
-
|
|
901
|
+
check_validity
|
|
902
|
+
|
|
903
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
803
904
|
end
|
|
804
905
|
|
|
805
906
|
# Returns the current bootloader mode, see BrickletLCD128x64#set_bootloader_mode.
|
|
806
907
|
def get_bootloader_mode
|
|
807
|
-
|
|
908
|
+
check_validity
|
|
909
|
+
|
|
910
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
808
911
|
end
|
|
809
912
|
|
|
810
913
|
# Sets the firmware pointer for BrickletLCD128x64#write_firmware. The pointer has
|
|
@@ -814,7 +917,9 @@ module Tinkerforge
|
|
|
814
917
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
815
918
|
# necessary to call it in a normal user program.
|
|
816
919
|
def set_write_firmware_pointer(pointer)
|
|
817
|
-
|
|
920
|
+
check_validity
|
|
921
|
+
|
|
922
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
818
923
|
end
|
|
819
924
|
|
|
820
925
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -826,7 +931,9 @@ module Tinkerforge
|
|
|
826
931
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
827
932
|
# necessary to call it in a normal user program.
|
|
828
933
|
def write_firmware(data)
|
|
829
|
-
|
|
934
|
+
check_validity
|
|
935
|
+
|
|
936
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
830
937
|
end
|
|
831
938
|
|
|
832
939
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -837,22 +944,28 @@ module Tinkerforge
|
|
|
837
944
|
#
|
|
838
945
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
839
946
|
def set_status_led_config(config)
|
|
840
|
-
|
|
947
|
+
check_validity
|
|
948
|
+
|
|
949
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
841
950
|
end
|
|
842
951
|
|
|
843
952
|
# Returns the configuration as set by BrickletLCD128x64#set_status_led_config
|
|
844
953
|
def get_status_led_config
|
|
845
|
-
|
|
954
|
+
check_validity
|
|
955
|
+
|
|
956
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
846
957
|
end
|
|
847
958
|
|
|
848
|
-
# Returns the temperature
|
|
959
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
849
960
|
# value returned is not the ambient temperature!
|
|
850
961
|
#
|
|
851
962
|
# The temperature is only proportional to the real temperature and it has bad
|
|
852
963
|
# accuracy. Practically it is only useful as an indicator for
|
|
853
964
|
# temperature changes.
|
|
854
965
|
def get_chip_temperature
|
|
855
|
-
|
|
966
|
+
check_validity
|
|
967
|
+
|
|
968
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
856
969
|
end
|
|
857
970
|
|
|
858
971
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -862,7 +975,9 @@ module Tinkerforge
|
|
|
862
975
|
# calling functions on the existing ones will result in
|
|
863
976
|
# undefined behavior!
|
|
864
977
|
def reset
|
|
865
|
-
|
|
978
|
+
check_validity
|
|
979
|
+
|
|
980
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
866
981
|
end
|
|
867
982
|
|
|
868
983
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -871,25 +986,32 @@ module Tinkerforge
|
|
|
871
986
|
#
|
|
872
987
|
# We recommend that you use Brick Viewer to change the UID.
|
|
873
988
|
def write_uid(uid)
|
|
874
|
-
|
|
989
|
+
check_validity
|
|
990
|
+
|
|
991
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
875
992
|
end
|
|
876
993
|
|
|
877
994
|
# Returns the current UID as an integer. Encode as
|
|
878
995
|
# Base58 to get the usual string version.
|
|
879
996
|
def read_uid
|
|
880
|
-
|
|
997
|
+
check_validity
|
|
998
|
+
|
|
999
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
881
1000
|
end
|
|
882
1001
|
|
|
883
1002
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
884
1003
|
# the position, the hardware and firmware version as well as the
|
|
885
1004
|
# device identifier.
|
|
886
1005
|
#
|
|
887
|
-
# The position can be 'a', 'b', 'c' or '
|
|
1006
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
1007
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
1008
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
1009
|
+
# position 'z'.
|
|
888
1010
|
#
|
|
889
1011
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
890
1012
|
# |device_identifier_constant|
|
|
891
1013
|
def get_identity
|
|
892
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
1014
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
893
1015
|
end
|
|
894
1016
|
|
|
895
1017
|
# Writes pixels to the specified window.
|