tinkerforge 2.1.23 → 2.1.28
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 +156 -75
- data/lib/tinkerforge/brick_hat.rb +109 -30
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +191 -86
- data/lib/tinkerforge/brick_imu_v2.rb +219 -118
- data/lib/tinkerforge/brick_master.rb +495 -195
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +248 -168
- data/lib/tinkerforge/brick_stepper.rb +212 -100
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +107 -63
- 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 +75 -47
- data/lib/tinkerforge/bricklet_color_v2.rb +91 -47
- data/lib/tinkerforge/bricklet_compass.rb +81 -40
- 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 +68 -33
- 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 +81 -40
- 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 +99 -51
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +219 -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 +76 -39
- 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 +75 -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_performance_dc.rb +676 -0
- 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 +57 -26
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +250 -164
- 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_servo_v2.rb +565 -0
- 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 +61 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +74 -44
- 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 +92 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +81 -36
- data/lib/tinkerforge/device_display_names.rb +167 -0
- data/lib/tinkerforge/ip_connection.rb +156 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +8 -3
|
@@ -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 2021-01-15. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
|
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,13 +119,13 @@ 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
|
-
# Returns the measured distance.
|
|
126
|
-
# and is given in cm.
|
|
128
|
+
# Returns the measured distance.
|
|
127
129
|
#
|
|
128
130
|
# The laser has to be enabled, see BrickletLaserRangeFinderV2#set_enable.
|
|
129
131
|
#
|
|
@@ -132,10 +134,12 @@ module Tinkerforge
|
|
|
132
134
|
# CALLBACK_DISTANCE callback. You can set the callback configuration
|
|
133
135
|
# with BrickletLaserRangeFinderV2#set_distance_callback_configuration.
|
|
134
136
|
def get_distance
|
|
135
|
-
|
|
137
|
+
check_validity
|
|
138
|
+
|
|
139
|
+
send_request FUNCTION_GET_DISTANCE, [], '', 10, 's'
|
|
136
140
|
end
|
|
137
141
|
|
|
138
|
-
# The period
|
|
142
|
+
# The period is the period with which the CALLBACK_DISTANCE callback is triggered
|
|
139
143
|
# periodically. A value of 0 turns the callback off.
|
|
140
144
|
#
|
|
141
145
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -160,15 +164,17 @@ module Tinkerforge
|
|
|
160
164
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
161
165
|
#
|
|
162
166
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
163
|
-
#
|
|
164
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
165
167
|
def set_distance_callback_configuration(period, value_has_to_change, option, min, max)
|
|
166
|
-
|
|
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, ''
|
|
167
171
|
end
|
|
168
172
|
|
|
169
173
|
# Returns the callback configuration as set by BrickletLaserRangeFinderV2#set_distance_callback_configuration.
|
|
170
174
|
def get_distance_callback_configuration
|
|
171
|
-
|
|
175
|
+
check_validity
|
|
176
|
+
|
|
177
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
172
178
|
end
|
|
173
179
|
|
|
174
180
|
# Returns the measured velocity. The value has a range of -12800 to 12700
|
|
@@ -183,10 +189,12 @@ module Tinkerforge
|
|
|
183
189
|
# CALLBACK_VELOCITY callback. You can set the callback configuration
|
|
184
190
|
# with BrickletLaserRangeFinderV2#set_velocity_callback_configuration.
|
|
185
191
|
def get_velocity
|
|
186
|
-
|
|
192
|
+
check_validity
|
|
193
|
+
|
|
194
|
+
send_request FUNCTION_GET_VELOCITY, [], '', 10, 's'
|
|
187
195
|
end
|
|
188
196
|
|
|
189
|
-
# The period
|
|
197
|
+
# The period is the period with which the CALLBACK_VELOCITY callback is triggered
|
|
190
198
|
# periodically. A value of 0 turns the callback off.
|
|
191
199
|
#
|
|
192
200
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -211,15 +219,17 @@ module Tinkerforge
|
|
|
211
219
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
|
212
220
|
#
|
|
213
221
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
|
214
|
-
#
|
|
215
|
-
# The default value is (0, false, 'x', 0, 0).
|
|
216
222
|
def set_velocity_callback_configuration(period, value_has_to_change, option, min, max)
|
|
217
|
-
|
|
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, ''
|
|
218
226
|
end
|
|
219
227
|
|
|
220
228
|
# Returns the callback configuration as set by BrickletLaserRangeFinderV2#set_velocity_callback_configuration.
|
|
221
229
|
def get_velocity_callback_configuration
|
|
222
|
-
|
|
230
|
+
check_validity
|
|
231
|
+
|
|
232
|
+
send_request FUNCTION_GET_VELOCITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
|
223
233
|
end
|
|
224
234
|
|
|
225
235
|
# Enables the laser of the LIDAR if set to *true*.
|
|
@@ -227,12 +237,16 @@ module Tinkerforge
|
|
|
227
237
|
# We recommend that you wait 250ms after enabling the laser before
|
|
228
238
|
# the first call of BrickletLaserRangeFinderV2#get_distance to ensure stable measurements.
|
|
229
239
|
def set_enable(enable)
|
|
230
|
-
|
|
240
|
+
check_validity
|
|
241
|
+
|
|
242
|
+
send_request FUNCTION_SET_ENABLE, [enable], '?', 8, ''
|
|
231
243
|
end
|
|
232
244
|
|
|
233
245
|
# Returns the value as set by BrickletLaserRangeFinderV2#set_enable.
|
|
234
246
|
def get_enable
|
|
235
|
-
|
|
247
|
+
check_validity
|
|
248
|
+
|
|
249
|
+
send_request FUNCTION_GET_ENABLE, [], '', 9, '?'
|
|
236
250
|
end
|
|
237
251
|
|
|
238
252
|
# The **Acquisition Count** defines the number of times the Laser Range Finder Bricklet
|
|
@@ -252,7 +266,7 @@ module Tinkerforge
|
|
|
252
266
|
# the distance to something with a very high reflection (e.g. mirror). Set this to 0 to
|
|
253
267
|
# use the default algorithm. The other allowed values are 1-255.
|
|
254
268
|
#
|
|
255
|
-
# Set the **Measurement Frequency**
|
|
269
|
+
# Set the **Measurement Frequency** to force a fixed measurement rate. If set to 0,
|
|
256
270
|
# the Laser Range Finder Bricklet will use the optimal frequency according to the other
|
|
257
271
|
# configurations and the actual measured distance. Since the rate is not fixed in this case,
|
|
258
272
|
# the velocity measurement is not stable. For a stable velocity measurement you should
|
|
@@ -263,12 +277,16 @@ module Tinkerforge
|
|
|
263
277
|
# The default values for Acquisition Count, Enable Quick Termination, Threshold Value and
|
|
264
278
|
# Measurement Frequency are 128, false, 0 and 0.
|
|
265
279
|
def set_configuration(acquisition_count, enable_quick_termination, threshold_value, measurement_frequency)
|
|
266
|
-
|
|
280
|
+
check_validity
|
|
281
|
+
|
|
282
|
+
send_request FUNCTION_SET_CONFIGURATION, [acquisition_count, enable_quick_termination, threshold_value, measurement_frequency], 'C ? C S', 8, ''
|
|
267
283
|
end
|
|
268
284
|
|
|
269
285
|
# Returns the configuration as set by BrickletLaserRangeFinderV2#set_configuration.
|
|
270
286
|
def get_configuration
|
|
271
|
-
|
|
287
|
+
check_validity
|
|
288
|
+
|
|
289
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 13, 'C ? C S'
|
|
272
290
|
end
|
|
273
291
|
|
|
274
292
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
|
@@ -276,20 +294,20 @@ module Tinkerforge
|
|
|
276
294
|
#
|
|
277
295
|
# Setting the length to 0 will turn the averaging completely off. With less
|
|
278
296
|
# averaging, there is more noise on the data.
|
|
279
|
-
#
|
|
280
|
-
# The range for the averaging is 0-255.
|
|
281
|
-
#
|
|
282
|
-
# The default value is 10.
|
|
283
297
|
def set_moving_average(distance_average_length, velocity_average_length)
|
|
284
|
-
|
|
298
|
+
check_validity
|
|
299
|
+
|
|
300
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [distance_average_length, velocity_average_length], 'C C', 8, ''
|
|
285
301
|
end
|
|
286
302
|
|
|
287
303
|
# Returns the length moving average as set by BrickletLaserRangeFinderV2#set_moving_average.
|
|
288
304
|
def get_moving_average
|
|
289
|
-
|
|
305
|
+
check_validity
|
|
306
|
+
|
|
307
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 10, 'C C'
|
|
290
308
|
end
|
|
291
309
|
|
|
292
|
-
# The offset is
|
|
310
|
+
# The offset is added to the measured distance.
|
|
293
311
|
# It is saved in non-volatile memory, you only have to set it once.
|
|
294
312
|
#
|
|
295
313
|
# The Bricklet comes with a per-sensor factory-calibrated offset value,
|
|
@@ -299,25 +317,31 @@ module Tinkerforge
|
|
|
299
317
|
# Calculate the offset by measuring the distance to a known distance
|
|
300
318
|
# and set it again.
|
|
301
319
|
def set_offset_calibration(offset)
|
|
302
|
-
|
|
320
|
+
check_validity
|
|
321
|
+
|
|
322
|
+
send_request FUNCTION_SET_OFFSET_CALIBRATION, [offset], 's', 8, ''
|
|
303
323
|
end
|
|
304
324
|
|
|
305
325
|
# Returns the offset value as set by BrickletLaserRangeFinderV2#set_offset_calibration.
|
|
306
326
|
def get_offset_calibration
|
|
307
|
-
|
|
327
|
+
check_validity
|
|
328
|
+
|
|
329
|
+
send_request FUNCTION_GET_OFFSET_CALIBRATION, [], '', 10, 's'
|
|
308
330
|
end
|
|
309
331
|
|
|
310
332
|
# Configures the distance LED to be either turned off, turned on, blink in
|
|
311
333
|
# heartbeat mode or show the distance (brighter = object is nearer).
|
|
312
|
-
#
|
|
313
|
-
# The default value is 3 (show distance).
|
|
314
334
|
def set_distance_led_config(config)
|
|
315
|
-
|
|
335
|
+
check_validity
|
|
336
|
+
|
|
337
|
+
send_request FUNCTION_SET_DISTANCE_LED_CONFIG, [config], 'C', 8, ''
|
|
316
338
|
end
|
|
317
339
|
|
|
318
340
|
# Returns the LED configuration as set by BrickletLaserRangeFinderV2#set_distance_led_config
|
|
319
341
|
def get_distance_led_config
|
|
320
|
-
|
|
342
|
+
check_validity
|
|
343
|
+
|
|
344
|
+
send_request FUNCTION_GET_DISTANCE_LED_CONFIG, [], '', 9, 'C'
|
|
321
345
|
end
|
|
322
346
|
|
|
323
347
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -332,7 +356,9 @@ module Tinkerforge
|
|
|
332
356
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
333
357
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
334
358
|
def get_spitfp_error_count
|
|
335
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
336
362
|
end
|
|
337
363
|
|
|
338
364
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -345,12 +371,16 @@ module Tinkerforge
|
|
|
345
371
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
346
372
|
# necessary to call it in a normal user program.
|
|
347
373
|
def set_bootloader_mode(mode)
|
|
348
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
349
377
|
end
|
|
350
378
|
|
|
351
379
|
# Returns the current bootloader mode, see BrickletLaserRangeFinderV2#set_bootloader_mode.
|
|
352
380
|
def get_bootloader_mode
|
|
353
|
-
|
|
381
|
+
check_validity
|
|
382
|
+
|
|
383
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
354
384
|
end
|
|
355
385
|
|
|
356
386
|
# Sets the firmware pointer for BrickletLaserRangeFinderV2#write_firmware. The pointer has
|
|
@@ -360,7 +390,9 @@ module Tinkerforge
|
|
|
360
390
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
361
391
|
# necessary to call it in a normal user program.
|
|
362
392
|
def set_write_firmware_pointer(pointer)
|
|
363
|
-
|
|
393
|
+
check_validity
|
|
394
|
+
|
|
395
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
364
396
|
end
|
|
365
397
|
|
|
366
398
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -372,7 +404,9 @@ module Tinkerforge
|
|
|
372
404
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
373
405
|
# necessary to call it in a normal user program.
|
|
374
406
|
def write_firmware(data)
|
|
375
|
-
|
|
407
|
+
check_validity
|
|
408
|
+
|
|
409
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
376
410
|
end
|
|
377
411
|
|
|
378
412
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -383,22 +417,28 @@ module Tinkerforge
|
|
|
383
417
|
#
|
|
384
418
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
385
419
|
def set_status_led_config(config)
|
|
386
|
-
|
|
420
|
+
check_validity
|
|
421
|
+
|
|
422
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
387
423
|
end
|
|
388
424
|
|
|
389
425
|
# Returns the configuration as set by BrickletLaserRangeFinderV2#set_status_led_config
|
|
390
426
|
def get_status_led_config
|
|
391
|
-
|
|
427
|
+
check_validity
|
|
428
|
+
|
|
429
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
392
430
|
end
|
|
393
431
|
|
|
394
|
-
# Returns the temperature
|
|
432
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
395
433
|
# value returned is not the ambient temperature!
|
|
396
434
|
#
|
|
397
435
|
# The temperature is only proportional to the real temperature and it has bad
|
|
398
436
|
# accuracy. Practically it is only useful as an indicator for
|
|
399
437
|
# temperature changes.
|
|
400
438
|
def get_chip_temperature
|
|
401
|
-
|
|
439
|
+
check_validity
|
|
440
|
+
|
|
441
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
402
442
|
end
|
|
403
443
|
|
|
404
444
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -408,7 +448,9 @@ module Tinkerforge
|
|
|
408
448
|
# calling functions on the existing ones will result in
|
|
409
449
|
# undefined behavior!
|
|
410
450
|
def reset
|
|
411
|
-
|
|
451
|
+
check_validity
|
|
452
|
+
|
|
453
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
412
454
|
end
|
|
413
455
|
|
|
414
456
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -417,25 +459,31 @@ module Tinkerforge
|
|
|
417
459
|
#
|
|
418
460
|
# We recommend that you use Brick Viewer to change the UID.
|
|
419
461
|
def write_uid(uid)
|
|
420
|
-
|
|
462
|
+
check_validity
|
|
463
|
+
|
|
464
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
421
465
|
end
|
|
422
466
|
|
|
423
467
|
# Returns the current UID as an integer. Encode as
|
|
424
468
|
# Base58 to get the usual string version.
|
|
425
469
|
def read_uid
|
|
426
|
-
|
|
470
|
+
check_validity
|
|
471
|
+
|
|
472
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
427
473
|
end
|
|
428
474
|
|
|
429
475
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
430
476
|
# the position, the hardware and firmware version as well as the
|
|
431
477
|
# device identifier.
|
|
432
478
|
#
|
|
433
|
-
# 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
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
481
|
+
# position 'z'.
|
|
434
482
|
#
|
|
435
483
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
436
484
|
# |device_identifier_constant|
|
|
437
485
|
def get_identity
|
|
438
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
486
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
439
487
|
end
|
|
440
488
|
|
|
441
489
|
# 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 2021-01-15. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.28 #
|
|
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,19 +219,19 @@ 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.
|
|
229
232
|
#
|
|
230
|
-
# The
|
|
231
|
-
#
|
|
232
|
-
# right.
|
|
233
|
+
# The pixels are written into the window line by line top to bottom
|
|
234
|
+
# and each line is written from left to right.
|
|
233
235
|
#
|
|
234
236
|
# If automatic draw is enabled (default) the pixels are directly written to
|
|
235
237
|
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
@@ -243,14 +245,15 @@ module Tinkerforge
|
|
|
243
245
|
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
244
246
|
# function.
|
|
245
247
|
def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
|
|
246
|
-
|
|
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, ''
|
|
247
251
|
end
|
|
248
252
|
|
|
249
253
|
# Reads pixels from the specified window.
|
|
250
254
|
#
|
|
251
|
-
# The
|
|
252
|
-
#
|
|
253
|
-
# right.
|
|
255
|
+
# The pixels are read from the window line by line top to bottom
|
|
256
|
+
# and each line is read from left to right.
|
|
254
257
|
#
|
|
255
258
|
# If automatic draw is enabled (default) the pixels that are read are always the
|
|
256
259
|
# same that are shown on the display.
|
|
@@ -261,7 +264,9 @@ module Tinkerforge
|
|
|
261
264
|
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
262
265
|
# function.
|
|
263
266
|
def read_pixels_low_level(x_start, y_start, x_end, y_end)
|
|
264
|
-
|
|
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'
|
|
265
270
|
end
|
|
266
271
|
|
|
267
272
|
# Clears the complete content of the display.
|
|
@@ -276,32 +281,31 @@ module Tinkerforge
|
|
|
276
281
|
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
277
282
|
# function.
|
|
278
283
|
def clear_display
|
|
279
|
-
|
|
284
|
+
check_validity
|
|
285
|
+
|
|
286
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
280
287
|
end
|
|
281
288
|
|
|
282
289
|
# Sets the configuration of the display.
|
|
283
290
|
#
|
|
284
|
-
# You can set a contrast value from 0 to 63, a backlight intensity value
|
|
285
|
-
# from 0 to 100 and you can invert the color (white/black) of the display.
|
|
286
|
-
#
|
|
287
291
|
# If automatic draw is set to *true*, the display is automatically updated with every
|
|
288
292
|
# call of BrickletLCD128x64#write_pixels and BrickletLCD128x64#write_line. If it is set to false, the
|
|
289
293
|
# changes are written into an internal buffer and only shown on the display after
|
|
290
294
|
# a call of BrickletLCD128x64#draw_buffered_frame.
|
|
291
|
-
#
|
|
292
|
-
# The default values are contrast 14, backlight intensity 100, inverting off
|
|
293
|
-
# and automatic draw on.
|
|
294
295
|
def set_display_configuration(contrast, backlight, invert, automatic_draw)
|
|
295
|
-
|
|
296
|
+
check_validity
|
|
297
|
+
|
|
298
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, backlight, invert, automatic_draw], 'C C ? ?', 8, ''
|
|
296
299
|
end
|
|
297
300
|
|
|
298
301
|
# Returns the configuration as set by BrickletLCD128x64#set_display_configuration.
|
|
299
302
|
def get_display_configuration
|
|
300
|
-
|
|
303
|
+
check_validity
|
|
304
|
+
|
|
305
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 12, 'C C ? ?'
|
|
301
306
|
end
|
|
302
307
|
|
|
303
|
-
# Writes text to a specific line
|
|
304
|
-
# (0 to 21). The text can have a maximum of 22 characters.
|
|
308
|
+
# Writes text to a specific line with a specific position.
|
|
305
309
|
#
|
|
306
310
|
# For example: (1, 10, "Hello") will write *Hello* in the middle of the
|
|
307
311
|
# second line of the display.
|
|
@@ -325,7 +329,9 @@ module Tinkerforge
|
|
|
325
329
|
# in the LCD 20x4 Bricklet. You can draw text at a specific pixel position
|
|
326
330
|
# and with different font sizes with the BrickletLCD128x64#draw_text function.
|
|
327
331
|
def write_line(line, position, text)
|
|
328
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, ''
|
|
329
335
|
end
|
|
330
336
|
|
|
331
337
|
# Draws the currently buffered frame. Normally each call of BrickletLCD128x64#write_pixels and
|
|
@@ -338,20 +344,24 @@ module Tinkerforge
|
|
|
338
344
|
# instead of only the changed parts. Normally it should not be necessary to set this to
|
|
339
345
|
# *true*. It may only become necessary in case of stuck pixels because of errors.
|
|
340
346
|
def draw_buffered_frame(force_complete_redraw)
|
|
341
|
-
|
|
347
|
+
check_validity
|
|
348
|
+
|
|
349
|
+
send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, ''
|
|
342
350
|
end
|
|
343
351
|
|
|
344
352
|
# Returns the last valid touch position:
|
|
345
353
|
#
|
|
346
|
-
# * Pressure: Amount of pressure applied by the user
|
|
347
|
-
# * X: Touch position on x-axis
|
|
348
|
-
# * Y: Touch position on y-axis
|
|
349
|
-
# * Age: Age of touch press
|
|
354
|
+
# * Pressure: Amount of pressure applied by the user
|
|
355
|
+
# * X: Touch position on x-axis
|
|
356
|
+
# * Y: Touch position on y-axis
|
|
357
|
+
# * Age: Age of touch press (how long ago it was)
|
|
350
358
|
def get_touch_position
|
|
351
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_GET_TOUCH_POSITION, [], '', 18, 'S S S L'
|
|
352
362
|
end
|
|
353
363
|
|
|
354
|
-
# The period
|
|
364
|
+
# The period is the period with which the CALLBACK_TOUCH_POSITION callback
|
|
355
365
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
356
366
|
#
|
|
357
367
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -360,16 +370,18 @@ module Tinkerforge
|
|
|
360
370
|
#
|
|
361
371
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
362
372
|
# independent of the value.
|
|
363
|
-
#
|
|
364
|
-
# The default value is (0, false).
|
|
365
373
|
def set_touch_position_callback_configuration(period, value_has_to_change)
|
|
366
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_SET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
367
377
|
end
|
|
368
378
|
|
|
369
379
|
# Returns the callback configuration as set by
|
|
370
380
|
# BrickletLCD128x64#set_touch_position_callback_configuration.
|
|
371
381
|
def get_touch_position_callback_configuration
|
|
372
|
-
|
|
382
|
+
check_validity
|
|
383
|
+
|
|
384
|
+
send_request FUNCTION_GET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
373
385
|
end
|
|
374
386
|
|
|
375
387
|
# Returns one of four touch gestures that can be automatically detected by the Bricklet.
|
|
@@ -380,12 +392,14 @@ module Tinkerforge
|
|
|
380
392
|
# provided. You can use this vector do determine a more exact location of the gesture (e.g.
|
|
381
393
|
# the swipe from top to bottom was on the left or right part of the screen).
|
|
382
394
|
#
|
|
383
|
-
# The age parameter corresponds to the age of gesture
|
|
395
|
+
# The age parameter corresponds to the age of gesture (how long ago it was).
|
|
384
396
|
def get_touch_gesture
|
|
385
|
-
|
|
397
|
+
check_validity
|
|
398
|
+
|
|
399
|
+
send_request FUNCTION_GET_TOUCH_GESTURE, [], '', 27, 'C L S S S S S L'
|
|
386
400
|
end
|
|
387
401
|
|
|
388
|
-
# The period
|
|
402
|
+
# The period is the period with which the CALLBACK_TOUCH_GESTURE callback
|
|
389
403
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
390
404
|
#
|
|
391
405
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -394,55 +408,55 @@ module Tinkerforge
|
|
|
394
408
|
#
|
|
395
409
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
396
410
|
# independent of the value.
|
|
397
|
-
#
|
|
398
|
-
# The default value is (0, false).
|
|
399
411
|
def set_touch_gesture_callback_configuration(period, value_has_to_change)
|
|
400
|
-
|
|
412
|
+
check_validity
|
|
413
|
+
|
|
414
|
+
send_request FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
401
415
|
end
|
|
402
416
|
|
|
403
417
|
# Returns the callback configuration as set by
|
|
404
418
|
# BrickletLCD128x64#set_touch_gesture_callback_configuration.
|
|
405
419
|
def get_touch_gesture_callback_configuration
|
|
406
|
-
|
|
420
|
+
check_validity
|
|
421
|
+
|
|
422
|
+
send_request FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
407
423
|
end
|
|
408
424
|
|
|
409
425
|
# Draws a white or black line from (x, y)-start to (x, y)-end.
|
|
410
|
-
# The x values have to be within the range of 0 to 127 and the y
|
|
411
|
-
# values have t be within the range of 0 to 63.
|
|
412
426
|
#
|
|
413
427
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
414
428
|
def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
|
|
415
|
-
|
|
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, ''
|
|
416
432
|
end
|
|
417
433
|
|
|
418
434
|
# Draws a white or black box from (x, y)-start to (x, y)-end.
|
|
419
|
-
# The x values have to be within the range of 0 to 127 and the y
|
|
420
|
-
# values have to be within the range of 0 to 63.
|
|
421
435
|
#
|
|
422
436
|
# If you set fill to true, the box will be filled with the
|
|
423
437
|
# color. Otherwise only the outline will be drawn.
|
|
424
438
|
#
|
|
425
439
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
426
440
|
def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
|
|
427
|
-
|
|
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, ''
|
|
428
444
|
end
|
|
429
445
|
|
|
430
|
-
# Draws a text
|
|
431
|
-
#
|
|
432
|
-
# The x values have to be within the range of 0 to 127 and the y
|
|
433
|
-
# values have to be within the range of 0 to 63.
|
|
446
|
+
# Draws a text at the pixel position (x, y).
|
|
434
447
|
#
|
|
435
448
|
# You can use one of 9 different font sizes and draw the text in white or black.
|
|
436
449
|
#
|
|
437
450
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
438
451
|
def draw_text(position_x, position_y, font, color, text)
|
|
439
|
-
|
|
452
|
+
check_validity
|
|
453
|
+
|
|
454
|
+
send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, text], 'C C C ? Z22', 8, ''
|
|
440
455
|
end
|
|
441
456
|
|
|
442
|
-
# Draws a clickable button at position (x, y) with the given text
|
|
443
|
-
# of up to 16 characters.
|
|
457
|
+
# Draws a clickable button at position (x, y) with the given text.
|
|
444
458
|
#
|
|
445
|
-
# You can use up to 12 buttons
|
|
459
|
+
# You can use up to 12 buttons.
|
|
446
460
|
#
|
|
447
461
|
# The x position + width has to be within the range of 1 to 128 and the y
|
|
448
462
|
# position + height has to be within the range of 1 to 64.
|
|
@@ -462,7 +476,9 @@ module Tinkerforge
|
|
|
462
476
|
#
|
|
463
477
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
464
478
|
def set_gui_button(index, position_x, position_y, width, height, text)
|
|
465
|
-
|
|
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, ''
|
|
466
482
|
end
|
|
467
483
|
|
|
468
484
|
# Returns the button properties for a given `Index` as set by BrickletLCD128x64#set_gui_button.
|
|
@@ -472,7 +488,9 @@ module Tinkerforge
|
|
|
472
488
|
#
|
|
473
489
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
474
490
|
def get_gui_button(index)
|
|
475
|
-
|
|
491
|
+
check_validity
|
|
492
|
+
|
|
493
|
+
send_request FUNCTION_GET_GUI_BUTTON, [index], 'C', 29, '? C C C C Z16'
|
|
476
494
|
end
|
|
477
495
|
|
|
478
496
|
# Removes the button with the given index.
|
|
@@ -481,10 +499,12 @@ module Tinkerforge
|
|
|
481
499
|
#
|
|
482
500
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
483
501
|
def remove_gui_button(index)
|
|
484
|
-
|
|
502
|
+
check_validity
|
|
503
|
+
|
|
504
|
+
send_request FUNCTION_REMOVE_GUI_BUTTON, [index], 'C', 8, ''
|
|
485
505
|
end
|
|
486
506
|
|
|
487
|
-
# The period
|
|
507
|
+
# The period is the period with which the CALLBACK_GUI_BUTTON_PRESSED callback
|
|
488
508
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
489
509
|
#
|
|
490
510
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -494,11 +514,11 @@ module Tinkerforge
|
|
|
494
514
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
495
515
|
# independent of the value.
|
|
496
516
|
#
|
|
497
|
-
# The default value is (0, false).
|
|
498
|
-
#
|
|
499
517
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
500
518
|
def set_gui_button_pressed_callback_configuration(period, value_has_to_change)
|
|
501
|
-
|
|
519
|
+
check_validity
|
|
520
|
+
|
|
521
|
+
send_request FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
502
522
|
end
|
|
503
523
|
|
|
504
524
|
# Returns the callback configuration as set by
|
|
@@ -506,7 +526,9 @@ module Tinkerforge
|
|
|
506
526
|
#
|
|
507
527
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
508
528
|
def get_gui_button_pressed_callback_configuration
|
|
509
|
-
|
|
529
|
+
check_validity
|
|
530
|
+
|
|
531
|
+
send_request FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
510
532
|
end
|
|
511
533
|
|
|
512
534
|
# Returns the state of the button for the given index.
|
|
@@ -515,12 +537,14 @@ module Tinkerforge
|
|
|
515
537
|
#
|
|
516
538
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
517
539
|
def get_gui_button_pressed(index)
|
|
518
|
-
|
|
540
|
+
check_validity
|
|
541
|
+
|
|
542
|
+
send_request FUNCTION_GET_GUI_BUTTON_PRESSED, [index], 'C', 9, '?'
|
|
519
543
|
end
|
|
520
544
|
|
|
521
545
|
# Draws a slider at position (x, y) with the given length.
|
|
522
546
|
#
|
|
523
|
-
# You can use up to 6 sliders
|
|
547
|
+
# You can use up to 6 sliders.
|
|
524
548
|
#
|
|
525
549
|
# If you use the horizontal direction, the x position + length has to be
|
|
526
550
|
# within the range of 1 to 128 and the y position has to be within
|
|
@@ -544,7 +568,9 @@ module Tinkerforge
|
|
|
544
568
|
#
|
|
545
569
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
546
570
|
def set_gui_slider(index, position_x, position_y, length, direction, value)
|
|
547
|
-
|
|
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, ''
|
|
548
574
|
end
|
|
549
575
|
|
|
550
576
|
# Returns the slider properties for a given `Index` as set by BrickletLCD128x64#set_gui_slider.
|
|
@@ -554,7 +580,9 @@ module Tinkerforge
|
|
|
554
580
|
#
|
|
555
581
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
556
582
|
def get_gui_slider(index)
|
|
557
|
-
|
|
583
|
+
check_validity
|
|
584
|
+
|
|
585
|
+
send_request FUNCTION_GET_GUI_SLIDER, [index], 'C', 14, '? C C C C C'
|
|
558
586
|
end
|
|
559
587
|
|
|
560
588
|
# Removes the slider with the given index.
|
|
@@ -563,10 +591,12 @@ module Tinkerforge
|
|
|
563
591
|
#
|
|
564
592
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
565
593
|
def remove_gui_slider(index)
|
|
566
|
-
|
|
594
|
+
check_validity
|
|
595
|
+
|
|
596
|
+
send_request FUNCTION_REMOVE_GUI_SLIDER, [index], 'C', 8, ''
|
|
567
597
|
end
|
|
568
598
|
|
|
569
|
-
# The period
|
|
599
|
+
# The period is the period with which the CALLBACK_GUI_SLIDER_VALUE callback
|
|
570
600
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
571
601
|
#
|
|
572
602
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -576,11 +606,11 @@ module Tinkerforge
|
|
|
576
606
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
577
607
|
# independent of the value.
|
|
578
608
|
#
|
|
579
|
-
# The default value is (0, false).
|
|
580
|
-
#
|
|
581
609
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
582
610
|
def set_gui_slider_value_callback_configuration(period, value_has_to_change)
|
|
583
|
-
|
|
611
|
+
check_validity
|
|
612
|
+
|
|
613
|
+
send_request FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
584
614
|
end
|
|
585
615
|
|
|
586
616
|
# Returns the callback configuration as set by
|
|
@@ -588,14 +618,18 @@ module Tinkerforge
|
|
|
588
618
|
#
|
|
589
619
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
590
620
|
def get_gui_slider_value_callback_configuration
|
|
591
|
-
|
|
621
|
+
check_validity
|
|
622
|
+
|
|
623
|
+
send_request FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
592
624
|
end
|
|
593
625
|
|
|
594
626
|
# Returns the current slider value for the given index.
|
|
595
627
|
#
|
|
596
628
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
597
629
|
def get_gui_slider_value(index)
|
|
598
|
-
|
|
630
|
+
check_validity
|
|
631
|
+
|
|
632
|
+
send_request FUNCTION_GET_GUI_SLIDER_VALUE, [index], 'C', 9, 'C'
|
|
599
633
|
end
|
|
600
634
|
|
|
601
635
|
# Sets the general configuration for tabs. You can configure the tabs to only
|
|
@@ -604,29 +638,33 @@ module Tinkerforge
|
|
|
604
638
|
# Additionally, if you set `Clear GUI` to true, all of the GUI elements (buttons,
|
|
605
639
|
# slider, graphs) will automatically be removed on every tab change.
|
|
606
640
|
#
|
|
607
|
-
# By default click and swipe as well as automatic GUI clear is enabled.
|
|
608
|
-
#
|
|
609
641
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
610
642
|
def set_gui_tab_configuration(change_tab_config, clear_gui)
|
|
611
|
-
|
|
643
|
+
check_validity
|
|
644
|
+
|
|
645
|
+
send_request FUNCTION_SET_GUI_TAB_CONFIGURATION, [change_tab_config, clear_gui], 'C ?', 8, ''
|
|
612
646
|
end
|
|
613
647
|
|
|
614
648
|
# Returns the tab configuration as set by BrickletLCD128x64#set_gui_tab_configuration.
|
|
615
649
|
#
|
|
616
650
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
617
651
|
def get_gui_tab_configuration
|
|
618
|
-
|
|
652
|
+
check_validity
|
|
653
|
+
|
|
654
|
+
send_request FUNCTION_GET_GUI_TAB_CONFIGURATION, [], '', 10, 'C ?'
|
|
619
655
|
end
|
|
620
656
|
|
|
621
|
-
# Adds a text-tab with the given index.
|
|
657
|
+
# Adds a text-tab with the given index.
|
|
622
658
|
#
|
|
623
|
-
# You can use up to 10 tabs
|
|
659
|
+
# You can use up to 10 tabs.
|
|
624
660
|
#
|
|
625
661
|
# A text-tab with the same index as a icon-tab will overwrite the icon-tab.
|
|
626
662
|
#
|
|
627
663
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
628
664
|
def set_gui_tab_text(index, text)
|
|
629
|
-
|
|
665
|
+
check_validity
|
|
666
|
+
|
|
667
|
+
send_request FUNCTION_SET_GUI_TAB_TEXT, [index, text], 'C Z5', 8, ''
|
|
630
668
|
end
|
|
631
669
|
|
|
632
670
|
# Returns the text for a given index as set by BrickletLCD128x64#set_gui_tab_text.
|
|
@@ -636,19 +674,23 @@ module Tinkerforge
|
|
|
636
674
|
#
|
|
637
675
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
638
676
|
def get_gui_tab_text(index)
|
|
639
|
-
|
|
677
|
+
check_validity
|
|
678
|
+
|
|
679
|
+
send_request FUNCTION_GET_GUI_TAB_TEXT, [index], 'C', 14, '? Z5'
|
|
640
680
|
end
|
|
641
681
|
|
|
642
682
|
# Adds a icon-tab with the given index. The icon can have a width of 28 pixels
|
|
643
683
|
# with a height of 6 pixels. It is drawn line-by-line from left to right.
|
|
644
684
|
#
|
|
645
|
-
# You can use up to 10 tabs
|
|
685
|
+
# You can use up to 10 tabs.
|
|
646
686
|
#
|
|
647
687
|
# A icon-tab with the same index as a text-tab will overwrite the text-tab.
|
|
648
688
|
#
|
|
649
689
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
650
690
|
def set_gui_tab_icon(index, icon)
|
|
651
|
-
|
|
691
|
+
check_validity
|
|
692
|
+
|
|
693
|
+
send_request FUNCTION_SET_GUI_TAB_ICON, [index, icon], 'C ?168', 8, ''
|
|
652
694
|
end
|
|
653
695
|
|
|
654
696
|
# Returns the icon for a given index as set by BrickletLCD128x64#set_gui_tab_icon.
|
|
@@ -658,7 +700,9 @@ module Tinkerforge
|
|
|
658
700
|
#
|
|
659
701
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
660
702
|
def get_gui_tab_icon(index)
|
|
661
|
-
|
|
703
|
+
check_validity
|
|
704
|
+
|
|
705
|
+
send_request FUNCTION_GET_GUI_TAB_ICON, [index], 'C', 30, '? ?168'
|
|
662
706
|
end
|
|
663
707
|
|
|
664
708
|
# Removes the tab with the given index.
|
|
@@ -667,17 +711,21 @@ module Tinkerforge
|
|
|
667
711
|
#
|
|
668
712
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
669
713
|
def remove_gui_tab(index)
|
|
670
|
-
|
|
714
|
+
check_validity
|
|
715
|
+
|
|
716
|
+
send_request FUNCTION_REMOVE_GUI_TAB, [index], 'C', 8, ''
|
|
671
717
|
end
|
|
672
718
|
|
|
673
719
|
# Sets the tab with the given index as selected (drawn as selected on the display).
|
|
674
720
|
#
|
|
675
721
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
676
722
|
def set_gui_tab_selected(index)
|
|
677
|
-
|
|
723
|
+
check_validity
|
|
724
|
+
|
|
725
|
+
send_request FUNCTION_SET_GUI_TAB_SELECTED, [index], 'C', 8, ''
|
|
678
726
|
end
|
|
679
727
|
|
|
680
|
-
# The period
|
|
728
|
+
# The period is the period with which the CALLBACK_GUI_TAB_SELECTED callback
|
|
681
729
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
682
730
|
#
|
|
683
731
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -687,11 +735,11 @@ module Tinkerforge
|
|
|
687
735
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
688
736
|
# independent of the value.
|
|
689
737
|
#
|
|
690
|
-
# The default value is (0, false).
|
|
691
|
-
#
|
|
692
738
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
693
739
|
def set_gui_tab_selected_callback_configuration(period, value_has_to_change)
|
|
694
|
-
|
|
740
|
+
check_validity
|
|
741
|
+
|
|
742
|
+
send_request FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
695
743
|
end
|
|
696
744
|
|
|
697
745
|
# Returns the callback configuration as set by
|
|
@@ -699,7 +747,9 @@ module Tinkerforge
|
|
|
699
747
|
#
|
|
700
748
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
701
749
|
def get_gui_tab_selected_callback_configuration
|
|
702
|
-
|
|
750
|
+
check_validity
|
|
751
|
+
|
|
752
|
+
send_request FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
703
753
|
end
|
|
704
754
|
|
|
705
755
|
# Returns the index of the currently selected tab.
|
|
@@ -707,18 +757,18 @@ module Tinkerforge
|
|
|
707
757
|
#
|
|
708
758
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
709
759
|
def get_gui_tab_selected
|
|
710
|
-
|
|
760
|
+
check_validity
|
|
761
|
+
|
|
762
|
+
send_request FUNCTION_GET_GUI_TAB_SELECTED, [], '', 9, 'c'
|
|
711
763
|
end
|
|
712
764
|
|
|
713
|
-
# Sets the configuration for up to four graphs
|
|
765
|
+
# Sets the configuration for up to four graphs.
|
|
714
766
|
#
|
|
715
767
|
# The graph type can be dot-, line- or bar-graph.
|
|
716
768
|
#
|
|
717
|
-
# The x and y position are pixel positions.
|
|
718
|
-
# the range of (0, 0) to (127, 63). The maximum width is 118 and the
|
|
719
|
-
# maximum height is 63.
|
|
769
|
+
# The x and y position are pixel positions.
|
|
720
770
|
#
|
|
721
|
-
# You can add a text for the x and y axis
|
|
771
|
+
# You can add a text for the x and y axis.
|
|
722
772
|
# The text is drawn at the inside of the graph and it can overwrite some
|
|
723
773
|
# of the graph data. If you need the text outside of the graph you can
|
|
724
774
|
# leave this text here empty and use BrickletLCD128x64#draw_text to draw the caption
|
|
@@ -732,7 +782,9 @@ module Tinkerforge
|
|
|
732
782
|
#
|
|
733
783
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
734
784
|
def set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y)
|
|
735
|
-
|
|
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, ''
|
|
736
788
|
end
|
|
737
789
|
|
|
738
790
|
# Returns the graph properties for a given `Index` as set by BrickletLCD128x64#set_gui_graph_configuration.
|
|
@@ -742,7 +794,9 @@ module Tinkerforge
|
|
|
742
794
|
#
|
|
743
795
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
744
796
|
def get_gui_graph_configuration(index)
|
|
745
|
-
|
|
797
|
+
check_validity
|
|
798
|
+
|
|
799
|
+
send_request FUNCTION_GET_GUI_GRAPH_CONFIGURATION, [index], 'C', 22, '? C C C C C Z4 Z4'
|
|
746
800
|
end
|
|
747
801
|
|
|
748
802
|
# Sets the data for a graph with the given index. You have to configure the graph with
|
|
@@ -760,14 +814,18 @@ module Tinkerforge
|
|
|
760
814
|
#
|
|
761
815
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
762
816
|
def set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data)
|
|
763
|
-
|
|
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, ''
|
|
764
820
|
end
|
|
765
821
|
|
|
766
822
|
# Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
|
|
767
823
|
#
|
|
768
824
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
769
825
|
def get_gui_graph_data_low_level(index)
|
|
770
|
-
|
|
826
|
+
check_validity
|
|
827
|
+
|
|
828
|
+
send_request FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL, [index], 'C', 71, 'S S C59'
|
|
771
829
|
end
|
|
772
830
|
|
|
773
831
|
# Removes the graph with the given index.
|
|
@@ -776,14 +834,18 @@ module Tinkerforge
|
|
|
776
834
|
#
|
|
777
835
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
778
836
|
def remove_gui_graph(index)
|
|
779
|
-
|
|
837
|
+
check_validity
|
|
838
|
+
|
|
839
|
+
send_request FUNCTION_REMOVE_GUI_GRAPH, [index], 'C', 8, ''
|
|
780
840
|
end
|
|
781
841
|
|
|
782
842
|
# Removes all GUI elements (buttons, slider, graphs, tabs).
|
|
783
843
|
#
|
|
784
844
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
785
845
|
def remove_all_gui
|
|
786
|
-
|
|
846
|
+
check_validity
|
|
847
|
+
|
|
848
|
+
send_request FUNCTION_REMOVE_ALL_GUI, [], '', 8, ''
|
|
787
849
|
end
|
|
788
850
|
|
|
789
851
|
# Sets the touch LED configuration. By default the LED is on if the
|
|
@@ -795,14 +857,18 @@ module Tinkerforge
|
|
|
795
857
|
#
|
|
796
858
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
797
859
|
def set_touch_led_config(config)
|
|
798
|
-
|
|
860
|
+
check_validity
|
|
861
|
+
|
|
862
|
+
send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 8, ''
|
|
799
863
|
end
|
|
800
864
|
|
|
801
865
|
# Returns the configuration as set by BrickletLCD128x64#set_touch_led_config
|
|
802
866
|
#
|
|
803
867
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
804
868
|
def get_touch_led_config
|
|
805
|
-
|
|
869
|
+
check_validity
|
|
870
|
+
|
|
871
|
+
send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 9, 'C'
|
|
806
872
|
end
|
|
807
873
|
|
|
808
874
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -817,7 +883,9 @@ module Tinkerforge
|
|
|
817
883
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
818
884
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
819
885
|
def get_spitfp_error_count
|
|
820
|
-
|
|
886
|
+
check_validity
|
|
887
|
+
|
|
888
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
821
889
|
end
|
|
822
890
|
|
|
823
891
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -830,12 +898,16 @@ module Tinkerforge
|
|
|
830
898
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
831
899
|
# necessary to call it in a normal user program.
|
|
832
900
|
def set_bootloader_mode(mode)
|
|
833
|
-
|
|
901
|
+
check_validity
|
|
902
|
+
|
|
903
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
834
904
|
end
|
|
835
905
|
|
|
836
906
|
# Returns the current bootloader mode, see BrickletLCD128x64#set_bootloader_mode.
|
|
837
907
|
def get_bootloader_mode
|
|
838
|
-
|
|
908
|
+
check_validity
|
|
909
|
+
|
|
910
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
839
911
|
end
|
|
840
912
|
|
|
841
913
|
# Sets the firmware pointer for BrickletLCD128x64#write_firmware. The pointer has
|
|
@@ -845,7 +917,9 @@ module Tinkerforge
|
|
|
845
917
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
846
918
|
# necessary to call it in a normal user program.
|
|
847
919
|
def set_write_firmware_pointer(pointer)
|
|
848
|
-
|
|
920
|
+
check_validity
|
|
921
|
+
|
|
922
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
849
923
|
end
|
|
850
924
|
|
|
851
925
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -857,7 +931,9 @@ module Tinkerforge
|
|
|
857
931
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
858
932
|
# necessary to call it in a normal user program.
|
|
859
933
|
def write_firmware(data)
|
|
860
|
-
|
|
934
|
+
check_validity
|
|
935
|
+
|
|
936
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
861
937
|
end
|
|
862
938
|
|
|
863
939
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -868,22 +944,28 @@ module Tinkerforge
|
|
|
868
944
|
#
|
|
869
945
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
870
946
|
def set_status_led_config(config)
|
|
871
|
-
|
|
947
|
+
check_validity
|
|
948
|
+
|
|
949
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
872
950
|
end
|
|
873
951
|
|
|
874
952
|
# Returns the configuration as set by BrickletLCD128x64#set_status_led_config
|
|
875
953
|
def get_status_led_config
|
|
876
|
-
|
|
954
|
+
check_validity
|
|
955
|
+
|
|
956
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
877
957
|
end
|
|
878
958
|
|
|
879
|
-
# Returns the temperature
|
|
959
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
880
960
|
# value returned is not the ambient temperature!
|
|
881
961
|
#
|
|
882
962
|
# The temperature is only proportional to the real temperature and it has bad
|
|
883
963
|
# accuracy. Practically it is only useful as an indicator for
|
|
884
964
|
# temperature changes.
|
|
885
965
|
def get_chip_temperature
|
|
886
|
-
|
|
966
|
+
check_validity
|
|
967
|
+
|
|
968
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
887
969
|
end
|
|
888
970
|
|
|
889
971
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -893,7 +975,9 @@ module Tinkerforge
|
|
|
893
975
|
# calling functions on the existing ones will result in
|
|
894
976
|
# undefined behavior!
|
|
895
977
|
def reset
|
|
896
|
-
|
|
978
|
+
check_validity
|
|
979
|
+
|
|
980
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
897
981
|
end
|
|
898
982
|
|
|
899
983
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -902,32 +986,37 @@ module Tinkerforge
|
|
|
902
986
|
#
|
|
903
987
|
# We recommend that you use Brick Viewer to change the UID.
|
|
904
988
|
def write_uid(uid)
|
|
905
|
-
|
|
989
|
+
check_validity
|
|
990
|
+
|
|
991
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
906
992
|
end
|
|
907
993
|
|
|
908
994
|
# Returns the current UID as an integer. Encode as
|
|
909
995
|
# Base58 to get the usual string version.
|
|
910
996
|
def read_uid
|
|
911
|
-
|
|
997
|
+
check_validity
|
|
998
|
+
|
|
999
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
912
1000
|
end
|
|
913
1001
|
|
|
914
1002
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
915
1003
|
# the position, the hardware and firmware version as well as the
|
|
916
1004
|
# device identifier.
|
|
917
1005
|
#
|
|
918
|
-
# 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
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
1008
|
+
# position 'z'.
|
|
919
1009
|
#
|
|
920
1010
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
921
1011
|
# |device_identifier_constant|
|
|
922
1012
|
def get_identity
|
|
923
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
1013
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
924
1014
|
end
|
|
925
1015
|
|
|
926
1016
|
# Writes pixels to the specified window.
|
|
927
1017
|
#
|
|
928
|
-
# The
|
|
929
|
-
#
|
|
930
|
-
# right.
|
|
1018
|
+
# The pixels are written into the window line by line top to bottom
|
|
1019
|
+
# and each line is written from left to right.
|
|
931
1020
|
#
|
|
932
1021
|
# If automatic draw is enabled (default) the pixels are directly written to
|
|
933
1022
|
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
@@ -973,9 +1062,8 @@ module Tinkerforge
|
|
|
973
1062
|
|
|
974
1063
|
# Reads pixels from the specified window.
|
|
975
1064
|
#
|
|
976
|
-
# The
|
|
977
|
-
#
|
|
978
|
-
# right.
|
|
1065
|
+
# The pixels are read from the window line by line top to bottom
|
|
1066
|
+
# and each line is read from left to right.
|
|
979
1067
|
#
|
|
980
1068
|
# If automatic draw is enabled (default) the pixels that are read are always the
|
|
981
1069
|
# same that are shown on the display.
|