tinkerforge 2.1.22 → 2.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# 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,48 +294,54 @@ 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
|
-
# The Bricklet comes with a per-sensor factory-calibrated offset value,
|
|
313
|
+
# The Bricklet comes with a per-sensor factory-calibrated offset value,
|
|
296
314
|
# you should not have to call this function.
|
|
297
315
|
#
|
|
298
316
|
# If you want to re-calibrate the offset you first have to set it to 0.
|
|
299
|
-
# Calculate the offset by measuring the distance to a known distance
|
|
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 2020-11-02. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# 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,37 +264,48 @@ 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.
|
|
273
|
+
#
|
|
274
|
+
# If automatic draw is enabled (default) the pixels are directly cleared.
|
|
275
|
+
#
|
|
276
|
+
# If automatic draw is disabled the the internal buffer is cleared and
|
|
277
|
+
# the buffer is transferred to the display only after BrickletLCD128x64#draw_buffered_frame
|
|
278
|
+
# is called. This can be used to avoid flicker when drawing a complex frame in
|
|
279
|
+
# multiple steps.
|
|
280
|
+
#
|
|
281
|
+
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
282
|
+
# function.
|
|
268
283
|
def clear_display
|
|
269
|
-
|
|
284
|
+
check_validity
|
|
285
|
+
|
|
286
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
270
287
|
end
|
|
271
288
|
|
|
272
289
|
# Sets the configuration of the display.
|
|
273
290
|
#
|
|
274
|
-
# You can set a contrast value from 0 to 63, a backlight intensity value
|
|
275
|
-
# from 0 to 100 and you can invert the color (white/black) of the display.
|
|
276
|
-
#
|
|
277
291
|
# If automatic draw is set to *true*, the display is automatically updated with every
|
|
278
292
|
# call of BrickletLCD128x64#write_pixels and BrickletLCD128x64#write_line. If it is set to false, the
|
|
279
293
|
# changes are written into an internal buffer and only shown on the display after
|
|
280
294
|
# a call of BrickletLCD128x64#draw_buffered_frame.
|
|
281
|
-
#
|
|
282
|
-
# The default values are contrast 14, backlight intensity 100, inverting off
|
|
283
|
-
# and automatic draw on.
|
|
284
295
|
def set_display_configuration(contrast, backlight, invert, automatic_draw)
|
|
285
|
-
|
|
296
|
+
check_validity
|
|
297
|
+
|
|
298
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, backlight, invert, automatic_draw], 'C C ? ?', 8, ''
|
|
286
299
|
end
|
|
287
300
|
|
|
288
301
|
# Returns the configuration as set by BrickletLCD128x64#set_display_configuration.
|
|
289
302
|
def get_display_configuration
|
|
290
|
-
|
|
303
|
+
check_validity
|
|
304
|
+
|
|
305
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 12, 'C C ? ?'
|
|
291
306
|
end
|
|
292
307
|
|
|
293
|
-
# Writes text to a specific line
|
|
294
|
-
# (0 to 21). The text can have a maximum of 22 characters.
|
|
308
|
+
# Writes text to a specific line with a specific position.
|
|
295
309
|
#
|
|
296
310
|
# For example: (1, 10, "Hello") will write *Hello* in the middle of the
|
|
297
311
|
# second line of the display.
|
|
@@ -299,11 +313,25 @@ module Tinkerforge
|
|
|
299
313
|
# The display uses a special 5x7 pixel charset. You can view the characters
|
|
300
314
|
# of the charset in Brick Viewer.
|
|
301
315
|
#
|
|
316
|
+
# If automatic draw is enabled (default) the text is directly written to
|
|
317
|
+
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
318
|
+
# the rest stays the same.
|
|
319
|
+
#
|
|
320
|
+
# If automatic draw is disabled the text is written to an internal buffer and
|
|
321
|
+
# the buffer is transferred to the display only after BrickletLCD128x64#draw_buffered_frame
|
|
322
|
+
# is called. This can be used to avoid flicker when drawing a complex frame in
|
|
323
|
+
# multiple steps.
|
|
324
|
+
#
|
|
325
|
+
# Automatic draw can be configured with the BrickletLCD128x64#set_display_configuration
|
|
326
|
+
# function.
|
|
327
|
+
#
|
|
302
328
|
# This function is a 1:1 replacement for the function with the same name
|
|
303
329
|
# in the LCD 20x4 Bricklet. You can draw text at a specific pixel position
|
|
304
330
|
# and with different font sizes with the BrickletLCD128x64#draw_text function.
|
|
305
331
|
def write_line(line, position, text)
|
|
306
|
-
|
|
332
|
+
check_validity
|
|
333
|
+
|
|
334
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, ''
|
|
307
335
|
end
|
|
308
336
|
|
|
309
337
|
# Draws the currently buffered frame. Normally each call of BrickletLCD128x64#write_pixels and
|
|
@@ -316,20 +344,24 @@ module Tinkerforge
|
|
|
316
344
|
# instead of only the changed parts. Normally it should not be necessary to set this to
|
|
317
345
|
# *true*. It may only become necessary in case of stuck pixels because of errors.
|
|
318
346
|
def draw_buffered_frame(force_complete_redraw)
|
|
319
|
-
|
|
347
|
+
check_validity
|
|
348
|
+
|
|
349
|
+
send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, ''
|
|
320
350
|
end
|
|
321
351
|
|
|
322
352
|
# Returns the last valid touch position:
|
|
323
353
|
#
|
|
324
|
-
# * Pressure: Amount of pressure applied by the user
|
|
325
|
-
# * X: Touch position on x-axis
|
|
326
|
-
# * Y: Touch position on y-axis
|
|
327
|
-
# * 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)
|
|
328
358
|
def get_touch_position
|
|
329
|
-
|
|
359
|
+
check_validity
|
|
360
|
+
|
|
361
|
+
send_request FUNCTION_GET_TOUCH_POSITION, [], '', 18, 'S S S L'
|
|
330
362
|
end
|
|
331
363
|
|
|
332
|
-
# The period
|
|
364
|
+
# The period is the period with which the CALLBACK_TOUCH_POSITION callback
|
|
333
365
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
334
366
|
#
|
|
335
367
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -338,16 +370,18 @@ module Tinkerforge
|
|
|
338
370
|
#
|
|
339
371
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
340
372
|
# independent of the value.
|
|
341
|
-
#
|
|
342
|
-
# The default value is (0, false).
|
|
343
373
|
def set_touch_position_callback_configuration(period, value_has_to_change)
|
|
344
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_SET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
345
377
|
end
|
|
346
378
|
|
|
347
379
|
# Returns the callback configuration as set by
|
|
348
380
|
# BrickletLCD128x64#set_touch_position_callback_configuration.
|
|
349
381
|
def get_touch_position_callback_configuration
|
|
350
|
-
|
|
382
|
+
check_validity
|
|
383
|
+
|
|
384
|
+
send_request FUNCTION_GET_TOUCH_POSITION_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
351
385
|
end
|
|
352
386
|
|
|
353
387
|
# Returns one of four touch gestures that can be automatically detected by the Bricklet.
|
|
@@ -358,12 +392,14 @@ module Tinkerforge
|
|
|
358
392
|
# provided. You can use this vector do determine a more exact location of the gesture (e.g.
|
|
359
393
|
# the swipe from top to bottom was on the left or right part of the screen).
|
|
360
394
|
#
|
|
361
|
-
# The age parameter corresponds to the age of gesture
|
|
395
|
+
# The age parameter corresponds to the age of gesture (how long ago it was).
|
|
362
396
|
def get_touch_gesture
|
|
363
|
-
|
|
397
|
+
check_validity
|
|
398
|
+
|
|
399
|
+
send_request FUNCTION_GET_TOUCH_GESTURE, [], '', 27, 'C L S S S S S L'
|
|
364
400
|
end
|
|
365
401
|
|
|
366
|
-
# The period
|
|
402
|
+
# The period is the period with which the CALLBACK_TOUCH_GESTURE callback
|
|
367
403
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
368
404
|
#
|
|
369
405
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -372,55 +408,55 @@ module Tinkerforge
|
|
|
372
408
|
#
|
|
373
409
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
374
410
|
# independent of the value.
|
|
375
|
-
#
|
|
376
|
-
# The default value is (0, false).
|
|
377
411
|
def set_touch_gesture_callback_configuration(period, value_has_to_change)
|
|
378
|
-
|
|
412
|
+
check_validity
|
|
413
|
+
|
|
414
|
+
send_request FUNCTION_SET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
379
415
|
end
|
|
380
416
|
|
|
381
417
|
# Returns the callback configuration as set by
|
|
382
418
|
# BrickletLCD128x64#set_touch_gesture_callback_configuration.
|
|
383
419
|
def get_touch_gesture_callback_configuration
|
|
384
|
-
|
|
420
|
+
check_validity
|
|
421
|
+
|
|
422
|
+
send_request FUNCTION_GET_TOUCH_GESTURE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
385
423
|
end
|
|
386
424
|
|
|
387
425
|
# Draws a white or black line from (x, y)-start to (x, y)-end.
|
|
388
|
-
# The x values have to be within the range of 0 to 127 and the y
|
|
389
|
-
# values have t be within the range of 0 to 63.
|
|
390
426
|
#
|
|
391
427
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
392
428
|
def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
|
|
393
|
-
|
|
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, ''
|
|
394
432
|
end
|
|
395
433
|
|
|
396
434
|
# Draws a white or black box from (x, y)-start to (x, y)-end.
|
|
397
|
-
# The x values have to be within the range of 0 to 127 and the y
|
|
398
|
-
# values have to be within the range of 0 to 63.
|
|
399
435
|
#
|
|
400
436
|
# If you set fill to true, the box will be filled with the
|
|
401
437
|
# color. Otherwise only the outline will be drawn.
|
|
402
438
|
#
|
|
403
439
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
404
440
|
def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
|
|
405
|
-
|
|
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, ''
|
|
406
444
|
end
|
|
407
445
|
|
|
408
|
-
# Draws a text
|
|
409
|
-
#
|
|
410
|
-
# The x values have to be within the range of 0 to 127 and the y
|
|
411
|
-
# values have to be within the range of 0 to 63.
|
|
446
|
+
# Draws a text at the pixel position (x, y).
|
|
412
447
|
#
|
|
413
448
|
# You can use one of 9 different font sizes and draw the text in white or black.
|
|
414
449
|
#
|
|
415
450
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
416
451
|
def draw_text(position_x, position_y, font, color, text)
|
|
417
|
-
|
|
452
|
+
check_validity
|
|
453
|
+
|
|
454
|
+
send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, text], 'C C C ? Z22', 8, ''
|
|
418
455
|
end
|
|
419
456
|
|
|
420
|
-
# Draws a clickable button at position (x, y) with the given text
|
|
421
|
-
# of up to 16 characters.
|
|
457
|
+
# Draws a clickable button at position (x, y) with the given text.
|
|
422
458
|
#
|
|
423
|
-
# You can use up to 12 buttons
|
|
459
|
+
# You can use up to 12 buttons.
|
|
424
460
|
#
|
|
425
461
|
# The x position + width has to be within the range of 1 to 128 and the y
|
|
426
462
|
# position + height has to be within the range of 1 to 64.
|
|
@@ -440,7 +476,9 @@ module Tinkerforge
|
|
|
440
476
|
#
|
|
441
477
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
442
478
|
def set_gui_button(index, position_x, position_y, width, height, text)
|
|
443
|
-
|
|
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, ''
|
|
444
482
|
end
|
|
445
483
|
|
|
446
484
|
# Returns the button properties for a given `Index` as set by BrickletLCD128x64#set_gui_button.
|
|
@@ -450,7 +488,9 @@ module Tinkerforge
|
|
|
450
488
|
#
|
|
451
489
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
452
490
|
def get_gui_button(index)
|
|
453
|
-
|
|
491
|
+
check_validity
|
|
492
|
+
|
|
493
|
+
send_request FUNCTION_GET_GUI_BUTTON, [index], 'C', 29, '? C C C C Z16'
|
|
454
494
|
end
|
|
455
495
|
|
|
456
496
|
# Removes the button with the given index.
|
|
@@ -459,10 +499,12 @@ module Tinkerforge
|
|
|
459
499
|
#
|
|
460
500
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
461
501
|
def remove_gui_button(index)
|
|
462
|
-
|
|
502
|
+
check_validity
|
|
503
|
+
|
|
504
|
+
send_request FUNCTION_REMOVE_GUI_BUTTON, [index], 'C', 8, ''
|
|
463
505
|
end
|
|
464
506
|
|
|
465
|
-
# The period
|
|
507
|
+
# The period is the period with which the CALLBACK_GUI_BUTTON_PRESSED callback
|
|
466
508
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
467
509
|
#
|
|
468
510
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -472,11 +514,11 @@ module Tinkerforge
|
|
|
472
514
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
473
515
|
# independent of the value.
|
|
474
516
|
#
|
|
475
|
-
# The default value is (0, false).
|
|
476
|
-
#
|
|
477
517
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
478
518
|
def set_gui_button_pressed_callback_configuration(period, value_has_to_change)
|
|
479
|
-
|
|
519
|
+
check_validity
|
|
520
|
+
|
|
521
|
+
send_request FUNCTION_SET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
480
522
|
end
|
|
481
523
|
|
|
482
524
|
# Returns the callback configuration as set by
|
|
@@ -484,7 +526,9 @@ module Tinkerforge
|
|
|
484
526
|
#
|
|
485
527
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
486
528
|
def get_gui_button_pressed_callback_configuration
|
|
487
|
-
|
|
529
|
+
check_validity
|
|
530
|
+
|
|
531
|
+
send_request FUNCTION_GET_GUI_BUTTON_PRESSED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
488
532
|
end
|
|
489
533
|
|
|
490
534
|
# Returns the state of the button for the given index.
|
|
@@ -493,12 +537,14 @@ module Tinkerforge
|
|
|
493
537
|
#
|
|
494
538
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
495
539
|
def get_gui_button_pressed(index)
|
|
496
|
-
|
|
540
|
+
check_validity
|
|
541
|
+
|
|
542
|
+
send_request FUNCTION_GET_GUI_BUTTON_PRESSED, [index], 'C', 9, '?'
|
|
497
543
|
end
|
|
498
544
|
|
|
499
545
|
# Draws a slider at position (x, y) with the given length.
|
|
500
546
|
#
|
|
501
|
-
# You can use up to 6 sliders
|
|
547
|
+
# You can use up to 6 sliders.
|
|
502
548
|
#
|
|
503
549
|
# If you use the horizontal direction, the x position + length has to be
|
|
504
550
|
# within the range of 1 to 128 and the y position has to be within
|
|
@@ -522,7 +568,9 @@ module Tinkerforge
|
|
|
522
568
|
#
|
|
523
569
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
524
570
|
def set_gui_slider(index, position_x, position_y, length, direction, value)
|
|
525
|
-
|
|
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, ''
|
|
526
574
|
end
|
|
527
575
|
|
|
528
576
|
# Returns the slider properties for a given `Index` as set by BrickletLCD128x64#set_gui_slider.
|
|
@@ -532,7 +580,9 @@ module Tinkerforge
|
|
|
532
580
|
#
|
|
533
581
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
534
582
|
def get_gui_slider(index)
|
|
535
|
-
|
|
583
|
+
check_validity
|
|
584
|
+
|
|
585
|
+
send_request FUNCTION_GET_GUI_SLIDER, [index], 'C', 14, '? C C C C C'
|
|
536
586
|
end
|
|
537
587
|
|
|
538
588
|
# Removes the slider with the given index.
|
|
@@ -541,10 +591,12 @@ module Tinkerforge
|
|
|
541
591
|
#
|
|
542
592
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
543
593
|
def remove_gui_slider(index)
|
|
544
|
-
|
|
594
|
+
check_validity
|
|
595
|
+
|
|
596
|
+
send_request FUNCTION_REMOVE_GUI_SLIDER, [index], 'C', 8, ''
|
|
545
597
|
end
|
|
546
598
|
|
|
547
|
-
# The period
|
|
599
|
+
# The period is the period with which the CALLBACK_GUI_SLIDER_VALUE callback
|
|
548
600
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
549
601
|
#
|
|
550
602
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -554,11 +606,11 @@ module Tinkerforge
|
|
|
554
606
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
555
607
|
# independent of the value.
|
|
556
608
|
#
|
|
557
|
-
# The default value is (0, false).
|
|
558
|
-
#
|
|
559
609
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
560
610
|
def set_gui_slider_value_callback_configuration(period, value_has_to_change)
|
|
561
|
-
|
|
611
|
+
check_validity
|
|
612
|
+
|
|
613
|
+
send_request FUNCTION_SET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
562
614
|
end
|
|
563
615
|
|
|
564
616
|
# Returns the callback configuration as set by
|
|
@@ -566,14 +618,18 @@ module Tinkerforge
|
|
|
566
618
|
#
|
|
567
619
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
568
620
|
def get_gui_slider_value_callback_configuration
|
|
569
|
-
|
|
621
|
+
check_validity
|
|
622
|
+
|
|
623
|
+
send_request FUNCTION_GET_GUI_SLIDER_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
570
624
|
end
|
|
571
625
|
|
|
572
626
|
# Returns the current slider value for the given index.
|
|
573
627
|
#
|
|
574
628
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
575
629
|
def get_gui_slider_value(index)
|
|
576
|
-
|
|
630
|
+
check_validity
|
|
631
|
+
|
|
632
|
+
send_request FUNCTION_GET_GUI_SLIDER_VALUE, [index], 'C', 9, 'C'
|
|
577
633
|
end
|
|
578
634
|
|
|
579
635
|
# Sets the general configuration for tabs. You can configure the tabs to only
|
|
@@ -582,29 +638,33 @@ module Tinkerforge
|
|
|
582
638
|
# Additionally, if you set `Clear GUI` to true, all of the GUI elements (buttons,
|
|
583
639
|
# slider, graphs) will automatically be removed on every tab change.
|
|
584
640
|
#
|
|
585
|
-
# By default click and swipe as well as automatic GUI clear is enabled.
|
|
586
|
-
#
|
|
587
641
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
588
642
|
def set_gui_tab_configuration(change_tab_config, clear_gui)
|
|
589
|
-
|
|
643
|
+
check_validity
|
|
644
|
+
|
|
645
|
+
send_request FUNCTION_SET_GUI_TAB_CONFIGURATION, [change_tab_config, clear_gui], 'C ?', 8, ''
|
|
590
646
|
end
|
|
591
647
|
|
|
592
648
|
# Returns the tab configuration as set by BrickletLCD128x64#set_gui_tab_configuration.
|
|
593
649
|
#
|
|
594
650
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
595
651
|
def get_gui_tab_configuration
|
|
596
|
-
|
|
652
|
+
check_validity
|
|
653
|
+
|
|
654
|
+
send_request FUNCTION_GET_GUI_TAB_CONFIGURATION, [], '', 10, 'C ?'
|
|
597
655
|
end
|
|
598
656
|
|
|
599
|
-
# Adds a text-tab with the given index.
|
|
657
|
+
# Adds a text-tab with the given index.
|
|
600
658
|
#
|
|
601
|
-
# You can use up to 10 tabs
|
|
659
|
+
# You can use up to 10 tabs.
|
|
602
660
|
#
|
|
603
661
|
# A text-tab with the same index as a icon-tab will overwrite the icon-tab.
|
|
604
662
|
#
|
|
605
663
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
606
664
|
def set_gui_tab_text(index, text)
|
|
607
|
-
|
|
665
|
+
check_validity
|
|
666
|
+
|
|
667
|
+
send_request FUNCTION_SET_GUI_TAB_TEXT, [index, text], 'C Z5', 8, ''
|
|
608
668
|
end
|
|
609
669
|
|
|
610
670
|
# Returns the text for a given index as set by BrickletLCD128x64#set_gui_tab_text.
|
|
@@ -614,19 +674,23 @@ module Tinkerforge
|
|
|
614
674
|
#
|
|
615
675
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
616
676
|
def get_gui_tab_text(index)
|
|
617
|
-
|
|
677
|
+
check_validity
|
|
678
|
+
|
|
679
|
+
send_request FUNCTION_GET_GUI_TAB_TEXT, [index], 'C', 14, '? Z5'
|
|
618
680
|
end
|
|
619
681
|
|
|
620
682
|
# Adds a icon-tab with the given index. The icon can have a width of 28 pixels
|
|
621
683
|
# with a height of 6 pixels. It is drawn line-by-line from left to right.
|
|
622
684
|
#
|
|
623
|
-
# You can use up to 10 tabs
|
|
685
|
+
# You can use up to 10 tabs.
|
|
624
686
|
#
|
|
625
687
|
# A icon-tab with the same index as a text-tab will overwrite the text-tab.
|
|
626
688
|
#
|
|
627
689
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
628
690
|
def set_gui_tab_icon(index, icon)
|
|
629
|
-
|
|
691
|
+
check_validity
|
|
692
|
+
|
|
693
|
+
send_request FUNCTION_SET_GUI_TAB_ICON, [index, icon], 'C ?168', 8, ''
|
|
630
694
|
end
|
|
631
695
|
|
|
632
696
|
# Returns the icon for a given index as set by BrickletLCD128x64#set_gui_tab_icon.
|
|
@@ -636,7 +700,9 @@ module Tinkerforge
|
|
|
636
700
|
#
|
|
637
701
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
638
702
|
def get_gui_tab_icon(index)
|
|
639
|
-
|
|
703
|
+
check_validity
|
|
704
|
+
|
|
705
|
+
send_request FUNCTION_GET_GUI_TAB_ICON, [index], 'C', 30, '? ?168'
|
|
640
706
|
end
|
|
641
707
|
|
|
642
708
|
# Removes the tab with the given index.
|
|
@@ -645,17 +711,21 @@ module Tinkerforge
|
|
|
645
711
|
#
|
|
646
712
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
647
713
|
def remove_gui_tab(index)
|
|
648
|
-
|
|
714
|
+
check_validity
|
|
715
|
+
|
|
716
|
+
send_request FUNCTION_REMOVE_GUI_TAB, [index], 'C', 8, ''
|
|
649
717
|
end
|
|
650
718
|
|
|
651
719
|
# Sets the tab with the given index as selected (drawn as selected on the display).
|
|
652
720
|
#
|
|
653
721
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
654
722
|
def set_gui_tab_selected(index)
|
|
655
|
-
|
|
723
|
+
check_validity
|
|
724
|
+
|
|
725
|
+
send_request FUNCTION_SET_GUI_TAB_SELECTED, [index], 'C', 8, ''
|
|
656
726
|
end
|
|
657
727
|
|
|
658
|
-
# The period
|
|
728
|
+
# The period is the period with which the CALLBACK_GUI_TAB_SELECTED callback
|
|
659
729
|
# is triggered periodically. A value of 0 turns the callback off.
|
|
660
730
|
#
|
|
661
731
|
# If the `value has to change`-parameter is set to true, the callback is only
|
|
@@ -665,11 +735,11 @@ module Tinkerforge
|
|
|
665
735
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
666
736
|
# independent of the value.
|
|
667
737
|
#
|
|
668
|
-
# The default value is (0, false).
|
|
669
|
-
#
|
|
670
738
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
671
739
|
def set_gui_tab_selected_callback_configuration(period, value_has_to_change)
|
|
672
|
-
|
|
740
|
+
check_validity
|
|
741
|
+
|
|
742
|
+
send_request FUNCTION_SET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
673
743
|
end
|
|
674
744
|
|
|
675
745
|
# Returns the callback configuration as set by
|
|
@@ -677,7 +747,9 @@ module Tinkerforge
|
|
|
677
747
|
#
|
|
678
748
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
679
749
|
def get_gui_tab_selected_callback_configuration
|
|
680
|
-
|
|
750
|
+
check_validity
|
|
751
|
+
|
|
752
|
+
send_request FUNCTION_GET_GUI_TAB_SELECTED_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
681
753
|
end
|
|
682
754
|
|
|
683
755
|
# Returns the index of the currently selected tab.
|
|
@@ -685,18 +757,18 @@ module Tinkerforge
|
|
|
685
757
|
#
|
|
686
758
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
687
759
|
def get_gui_tab_selected
|
|
688
|
-
|
|
760
|
+
check_validity
|
|
761
|
+
|
|
762
|
+
send_request FUNCTION_GET_GUI_TAB_SELECTED, [], '', 9, 'c'
|
|
689
763
|
end
|
|
690
764
|
|
|
691
|
-
# Sets the configuration for up to four graphs
|
|
765
|
+
# Sets the configuration for up to four graphs.
|
|
692
766
|
#
|
|
693
767
|
# The graph type can be dot-, line- or bar-graph.
|
|
694
768
|
#
|
|
695
|
-
# The x and y position are pixel positions.
|
|
696
|
-
# the range of (0, 0) to (127, 63). The maximum width is 118 and the
|
|
697
|
-
# maximum height is 63.
|
|
769
|
+
# The x and y position are pixel positions.
|
|
698
770
|
#
|
|
699
|
-
# You can add a text for the x and y axis
|
|
771
|
+
# You can add a text for the x and y axis.
|
|
700
772
|
# The text is drawn at the inside of the graph and it can overwrite some
|
|
701
773
|
# of the graph data. If you need the text outside of the graph you can
|
|
702
774
|
# leave this text here empty and use BrickletLCD128x64#draw_text to draw the caption
|
|
@@ -710,7 +782,9 @@ module Tinkerforge
|
|
|
710
782
|
#
|
|
711
783
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
712
784
|
def set_gui_graph_configuration(index, graph_type, position_x, position_y, width, height, text_x, text_y)
|
|
713
|
-
|
|
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, ''
|
|
714
788
|
end
|
|
715
789
|
|
|
716
790
|
# Returns the graph properties for a given `Index` as set by BrickletLCD128x64#set_gui_graph_configuration.
|
|
@@ -720,7 +794,9 @@ module Tinkerforge
|
|
|
720
794
|
#
|
|
721
795
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
722
796
|
def get_gui_graph_configuration(index)
|
|
723
|
-
|
|
797
|
+
check_validity
|
|
798
|
+
|
|
799
|
+
send_request FUNCTION_GET_GUI_GRAPH_CONFIGURATION, [index], 'C', 22, '? C C C C C Z4 Z4'
|
|
724
800
|
end
|
|
725
801
|
|
|
726
802
|
# Sets the data for a graph with the given index. You have to configure the graph with
|
|
@@ -738,14 +814,18 @@ module Tinkerforge
|
|
|
738
814
|
#
|
|
739
815
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
740
816
|
def set_gui_graph_data_low_level(index, data_length, data_chunk_offset, data_chunk_data)
|
|
741
|
-
|
|
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, ''
|
|
742
820
|
end
|
|
743
821
|
|
|
744
822
|
# Returns the graph data for a given index as set by BrickletLCD128x64#set_gui_graph_data.
|
|
745
823
|
#
|
|
746
824
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
747
825
|
def get_gui_graph_data_low_level(index)
|
|
748
|
-
|
|
826
|
+
check_validity
|
|
827
|
+
|
|
828
|
+
send_request FUNCTION_GET_GUI_GRAPH_DATA_LOW_LEVEL, [index], 'C', 71, 'S S C59'
|
|
749
829
|
end
|
|
750
830
|
|
|
751
831
|
# Removes the graph with the given index.
|
|
@@ -754,14 +834,18 @@ module Tinkerforge
|
|
|
754
834
|
#
|
|
755
835
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
756
836
|
def remove_gui_graph(index)
|
|
757
|
-
|
|
837
|
+
check_validity
|
|
838
|
+
|
|
839
|
+
send_request FUNCTION_REMOVE_GUI_GRAPH, [index], 'C', 8, ''
|
|
758
840
|
end
|
|
759
841
|
|
|
760
842
|
# Removes all GUI elements (buttons, slider, graphs, tabs).
|
|
761
843
|
#
|
|
762
844
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
763
845
|
def remove_all_gui
|
|
764
|
-
|
|
846
|
+
check_validity
|
|
847
|
+
|
|
848
|
+
send_request FUNCTION_REMOVE_ALL_GUI, [], '', 8, ''
|
|
765
849
|
end
|
|
766
850
|
|
|
767
851
|
# Sets the touch LED configuration. By default the LED is on if the
|
|
@@ -773,14 +857,18 @@ module Tinkerforge
|
|
|
773
857
|
#
|
|
774
858
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
775
859
|
def set_touch_led_config(config)
|
|
776
|
-
|
|
860
|
+
check_validity
|
|
861
|
+
|
|
862
|
+
send_request FUNCTION_SET_TOUCH_LED_CONFIG, [config], 'C', 8, ''
|
|
777
863
|
end
|
|
778
864
|
|
|
779
865
|
# Returns the configuration as set by BrickletLCD128x64#set_touch_led_config
|
|
780
866
|
#
|
|
781
867
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
782
868
|
def get_touch_led_config
|
|
783
|
-
|
|
869
|
+
check_validity
|
|
870
|
+
|
|
871
|
+
send_request FUNCTION_GET_TOUCH_LED_CONFIG, [], '', 9, 'C'
|
|
784
872
|
end
|
|
785
873
|
|
|
786
874
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -795,7 +883,9 @@ module Tinkerforge
|
|
|
795
883
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
796
884
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
797
885
|
def get_spitfp_error_count
|
|
798
|
-
|
|
886
|
+
check_validity
|
|
887
|
+
|
|
888
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
799
889
|
end
|
|
800
890
|
|
|
801
891
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -808,12 +898,16 @@ module Tinkerforge
|
|
|
808
898
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
809
899
|
# necessary to call it in a normal user program.
|
|
810
900
|
def set_bootloader_mode(mode)
|
|
811
|
-
|
|
901
|
+
check_validity
|
|
902
|
+
|
|
903
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
812
904
|
end
|
|
813
905
|
|
|
814
906
|
# Returns the current bootloader mode, see BrickletLCD128x64#set_bootloader_mode.
|
|
815
907
|
def get_bootloader_mode
|
|
816
|
-
|
|
908
|
+
check_validity
|
|
909
|
+
|
|
910
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
817
911
|
end
|
|
818
912
|
|
|
819
913
|
# Sets the firmware pointer for BrickletLCD128x64#write_firmware. The pointer has
|
|
@@ -823,7 +917,9 @@ module Tinkerforge
|
|
|
823
917
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
824
918
|
# necessary to call it in a normal user program.
|
|
825
919
|
def set_write_firmware_pointer(pointer)
|
|
826
|
-
|
|
920
|
+
check_validity
|
|
921
|
+
|
|
922
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
827
923
|
end
|
|
828
924
|
|
|
829
925
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -835,7 +931,9 @@ module Tinkerforge
|
|
|
835
931
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
836
932
|
# necessary to call it in a normal user program.
|
|
837
933
|
def write_firmware(data)
|
|
838
|
-
|
|
934
|
+
check_validity
|
|
935
|
+
|
|
936
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
839
937
|
end
|
|
840
938
|
|
|
841
939
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -846,22 +944,28 @@ module Tinkerforge
|
|
|
846
944
|
#
|
|
847
945
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
848
946
|
def set_status_led_config(config)
|
|
849
|
-
|
|
947
|
+
check_validity
|
|
948
|
+
|
|
949
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
850
950
|
end
|
|
851
951
|
|
|
852
952
|
# Returns the configuration as set by BrickletLCD128x64#set_status_led_config
|
|
853
953
|
def get_status_led_config
|
|
854
|
-
|
|
954
|
+
check_validity
|
|
955
|
+
|
|
956
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
855
957
|
end
|
|
856
958
|
|
|
857
|
-
# Returns the temperature
|
|
959
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
858
960
|
# value returned is not the ambient temperature!
|
|
859
961
|
#
|
|
860
962
|
# The temperature is only proportional to the real temperature and it has bad
|
|
861
963
|
# accuracy. Practically it is only useful as an indicator for
|
|
862
964
|
# temperature changes.
|
|
863
965
|
def get_chip_temperature
|
|
864
|
-
|
|
966
|
+
check_validity
|
|
967
|
+
|
|
968
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
865
969
|
end
|
|
866
970
|
|
|
867
971
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -871,7 +975,9 @@ module Tinkerforge
|
|
|
871
975
|
# calling functions on the existing ones will result in
|
|
872
976
|
# undefined behavior!
|
|
873
977
|
def reset
|
|
874
|
-
|
|
978
|
+
check_validity
|
|
979
|
+
|
|
980
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
875
981
|
end
|
|
876
982
|
|
|
877
983
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -880,32 +986,37 @@ module Tinkerforge
|
|
|
880
986
|
#
|
|
881
987
|
# We recommend that you use Brick Viewer to change the UID.
|
|
882
988
|
def write_uid(uid)
|
|
883
|
-
|
|
989
|
+
check_validity
|
|
990
|
+
|
|
991
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
884
992
|
end
|
|
885
993
|
|
|
886
994
|
# Returns the current UID as an integer. Encode as
|
|
887
995
|
# Base58 to get the usual string version.
|
|
888
996
|
def read_uid
|
|
889
|
-
|
|
997
|
+
check_validity
|
|
998
|
+
|
|
999
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
890
1000
|
end
|
|
891
1001
|
|
|
892
1002
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
893
1003
|
# the position, the hardware and firmware version as well as the
|
|
894
1004
|
# device identifier.
|
|
895
1005
|
#
|
|
896
|
-
# 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'.
|
|
897
1009
|
#
|
|
898
1010
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
899
1011
|
# |device_identifier_constant|
|
|
900
1012
|
def get_identity
|
|
901
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
1013
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
902
1014
|
end
|
|
903
1015
|
|
|
904
1016
|
# Writes pixels to the specified window.
|
|
905
1017
|
#
|
|
906
|
-
# The
|
|
907
|
-
#
|
|
908
|
-
# 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.
|
|
909
1020
|
#
|
|
910
1021
|
# If automatic draw is enabled (default) the pixels are directly written to
|
|
911
1022
|
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
@@ -951,9 +1062,8 @@ module Tinkerforge
|
|
|
951
1062
|
|
|
952
1063
|
# Reads pixels from the specified window.
|
|
953
1064
|
#
|
|
954
|
-
# The
|
|
955
|
-
#
|
|
956
|
-
# 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.
|
|
957
1067
|
#
|
|
958
1068
|
# If automatic draw is enabled (default) the pixels that are read are always the
|
|
959
1069
|
# same that are shown on the display.
|