tinkerforge 2.1.24 → 2.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +155 -74
- data/lib/tinkerforge/brick_hat.rb +70 -30
- data/lib/tinkerforge/brick_hat_zero.rb +56 -22
- data/lib/tinkerforge/brick_imu.rb +184 -77
- data/lib/tinkerforge/brick_imu_v2.rb +208 -105
- data/lib/tinkerforge/brick_master.rb +484 -182
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +185 -101
- data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
- data/lib/tinkerforge/brick_stepper.rb +210 -98
- data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
- data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
- data/lib/tinkerforge/bricklet_barometer.rb +66 -26
- data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -18
- data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
- data/lib/tinkerforge/bricklet_co2.rb +34 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
- data/lib/tinkerforge/bricklet_color.rb +69 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
- data/lib/tinkerforge/bricklet_compass.rb +78 -30
- data/lib/tinkerforge/bricklet_current12.rb +58 -24
- data/lib/tinkerforge/bricklet_current25.rb +58 -24
- data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_dmx.rb +88 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
- data/lib/tinkerforge/bricklet_gps.rb +64 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_humidity.rb +51 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_io16.rb +55 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
- data/lib/tinkerforge/bricklet_io4.rb +55 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -28
- data/lib/tinkerforge/bricklet_joystick.rb +59 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
- data/lib/tinkerforge/bricklet_line.rb +34 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
- data/lib/tinkerforge/bricklet_moisture.rb +40 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
- data/lib/tinkerforge/bricklet_nfc.rb +123 -58
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
- data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
- data/lib/tinkerforge/bricklet_ptc.rb +74 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_rs232.rb +90 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
- data/lib/tinkerforge/bricklet_rs485.rb +223 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
- data/lib/tinkerforge/bricklet_temperature.rb +40 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
- data/lib/tinkerforge/bricklet_tilt.rb +24 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
- data/lib/tinkerforge/bricklet_voltage.rb +52 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
- data/lib/tinkerforge/device_display_names.rb +163 -0
- data/lib/tinkerforge/ip_connection.rb +151 -32
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# 16x2 character alphanumeric display with blue backlight
|
|
14
16
|
class BrickletLCD16x2 < Device
|
|
@@ -39,7 +41,7 @@ module Tinkerforge
|
|
|
39
41
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
40
42
|
# the IP Connection <tt>ipcon</tt>.
|
|
41
43
|
def initialize(uid, ipcon)
|
|
42
|
-
super uid, ipcon
|
|
44
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
43
45
|
|
|
44
46
|
@api_version = [2, 0, 1]
|
|
45
47
|
|
|
@@ -55,9 +57,10 @@ module Tinkerforge
|
|
|
55
57
|
@response_expected[FUNCTION_GET_CUSTOM_CHARACTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
56
58
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
57
59
|
|
|
58
|
-
@callback_formats[CALLBACK_BUTTON_PRESSED] = 'C'
|
|
59
|
-
@callback_formats[CALLBACK_BUTTON_RELEASED] = 'C'
|
|
60
|
+
@callback_formats[CALLBACK_BUTTON_PRESSED] = [9, 'C']
|
|
61
|
+
@callback_formats[CALLBACK_BUTTON_RELEASED] = [9, 'C']
|
|
60
62
|
|
|
63
|
+
@ipcon.add_device self
|
|
61
64
|
end
|
|
62
65
|
|
|
63
66
|
# Writes text to a specific line with a specific position.
|
|
@@ -72,27 +75,37 @@ module Tinkerforge
|
|
|
72
75
|
# for details. The Unicode example above shows how to specify non-ASCII characters
|
|
73
76
|
# and how to translate from Unicode to the LCD charset.
|
|
74
77
|
def write_line(line, position, text)
|
|
75
|
-
|
|
78
|
+
check_validity
|
|
79
|
+
|
|
80
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z16', 8, ''
|
|
76
81
|
end
|
|
77
82
|
|
|
78
83
|
# Deletes all characters from the display.
|
|
79
84
|
def clear_display
|
|
80
|
-
|
|
85
|
+
check_validity
|
|
86
|
+
|
|
87
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
81
88
|
end
|
|
82
89
|
|
|
83
90
|
# Turns the backlight on.
|
|
84
91
|
def backlight_on
|
|
85
|
-
|
|
92
|
+
check_validity
|
|
93
|
+
|
|
94
|
+
send_request FUNCTION_BACKLIGHT_ON, [], '', 8, ''
|
|
86
95
|
end
|
|
87
96
|
|
|
88
97
|
# Turns the backlight off.
|
|
89
98
|
def backlight_off
|
|
90
|
-
|
|
99
|
+
check_validity
|
|
100
|
+
|
|
101
|
+
send_request FUNCTION_BACKLIGHT_OFF, [], '', 8, ''
|
|
91
102
|
end
|
|
92
103
|
|
|
93
104
|
# Returns *true* if the backlight is on and *false* otherwise.
|
|
94
105
|
def is_backlight_on
|
|
95
|
-
|
|
106
|
+
check_validity
|
|
107
|
+
|
|
108
|
+
send_request FUNCTION_IS_BACKLIGHT_ON, [], '', 9, '?'
|
|
96
109
|
end
|
|
97
110
|
|
|
98
111
|
# Configures if the cursor (shown as "_") should be visible and if it
|
|
@@ -100,12 +113,16 @@ module Tinkerforge
|
|
|
100
113
|
# is one character behind the the last text written with
|
|
101
114
|
# BrickletLCD16x2#write_line.
|
|
102
115
|
def set_config(cursor, blinking)
|
|
103
|
-
|
|
116
|
+
check_validity
|
|
117
|
+
|
|
118
|
+
send_request FUNCTION_SET_CONFIG, [cursor, blinking], '? ?', 8, ''
|
|
104
119
|
end
|
|
105
120
|
|
|
106
121
|
# Returns the configuration as set by BrickletLCD16x2#set_config.
|
|
107
122
|
def get_config
|
|
108
|
-
|
|
123
|
+
check_validity
|
|
124
|
+
|
|
125
|
+
send_request FUNCTION_GET_CONFIG, [], '', 10, '? ?'
|
|
109
126
|
end
|
|
110
127
|
|
|
111
128
|
# Returns *true* if the button is pressed.
|
|
@@ -113,7 +130,9 @@ module Tinkerforge
|
|
|
113
130
|
# If you want to react on button presses and releases it is recommended to use the
|
|
114
131
|
# CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
|
|
115
132
|
def is_button_pressed(button)
|
|
116
|
-
|
|
133
|
+
check_validity
|
|
134
|
+
|
|
135
|
+
send_request FUNCTION_IS_BUTTON_PRESSED, [button], 'C', 9, '?'
|
|
117
136
|
end
|
|
118
137
|
|
|
119
138
|
# The LCD 16x2 Bricklet can store up to 8 custom characters. The characters
|
|
@@ -131,7 +150,8 @@ module Tinkerforge
|
|
|
131
150
|
# * ``character[7] = 0b00000000`` (decimal value 0)
|
|
132
151
|
#
|
|
133
152
|
# The characters can later be written with BrickletLCD16x2#write_line by using the
|
|
134
|
-
# characters with the byte representation 8 to 15
|
|
153
|
+
# characters with the byte representation 8 ("\\x08" or "\\u0008") to 15
|
|
154
|
+
# ("\\x0F" or "\\u000F").
|
|
135
155
|
#
|
|
136
156
|
# You can play around with the custom characters in Brick Viewer since
|
|
137
157
|
# version 2.0.1.
|
|
@@ -141,7 +161,9 @@ module Tinkerforge
|
|
|
141
161
|
#
|
|
142
162
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
143
163
|
def set_custom_character(index, character)
|
|
144
|
-
|
|
164
|
+
check_validity
|
|
165
|
+
|
|
166
|
+
send_request FUNCTION_SET_CUSTOM_CHARACTER, [index, character], 'C C8', 8, ''
|
|
145
167
|
end
|
|
146
168
|
|
|
147
169
|
# Returns the custom character for a given index, as set with
|
|
@@ -149,19 +171,24 @@ module Tinkerforge
|
|
|
149
171
|
#
|
|
150
172
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
151
173
|
def get_custom_character(index)
|
|
152
|
-
|
|
174
|
+
check_validity
|
|
175
|
+
|
|
176
|
+
send_request FUNCTION_GET_CUSTOM_CHARACTER, [index], 'C', 16, 'C8'
|
|
153
177
|
end
|
|
154
178
|
|
|
155
179
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
156
180
|
# the position, the hardware and firmware version as well as the
|
|
157
181
|
# device identifier.
|
|
158
182
|
#
|
|
159
|
-
# The position can be 'a', 'b', 'c' or '
|
|
183
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
184
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
185
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
186
|
+
# position 'z'.
|
|
160
187
|
#
|
|
161
188
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
162
189
|
# |device_identifier_constant|
|
|
163
190
|
def get_identity
|
|
164
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
191
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
165
192
|
end
|
|
166
193
|
|
|
167
194
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# 20x4 character alphanumeric display with blue backlight
|
|
14
16
|
class BrickletLCD20x4 < Device
|
|
@@ -43,7 +45,7 @@ module Tinkerforge
|
|
|
43
45
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
44
46
|
# the IP Connection <tt>ipcon</tt>.
|
|
45
47
|
def initialize(uid, ipcon)
|
|
46
|
-
super uid, ipcon
|
|
48
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
47
49
|
|
|
48
50
|
@api_version = [2, 0, 2]
|
|
49
51
|
|
|
@@ -63,9 +65,10 @@ module Tinkerforge
|
|
|
63
65
|
@response_expected[FUNCTION_GET_DEFAULT_TEXT_COUNTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
64
66
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
65
67
|
|
|
66
|
-
@callback_formats[CALLBACK_BUTTON_PRESSED] = 'C'
|
|
67
|
-
@callback_formats[CALLBACK_BUTTON_RELEASED] = 'C'
|
|
68
|
+
@callback_formats[CALLBACK_BUTTON_PRESSED] = [9, 'C']
|
|
69
|
+
@callback_formats[CALLBACK_BUTTON_RELEASED] = [9, 'C']
|
|
68
70
|
|
|
71
|
+
@ipcon.add_device self
|
|
69
72
|
end
|
|
70
73
|
|
|
71
74
|
# Writes text to a specific line with a specific position.
|
|
@@ -80,27 +83,37 @@ module Tinkerforge
|
|
|
80
83
|
# for details. The Unicode example above shows how to specify non-ASCII characters
|
|
81
84
|
# and how to translate from Unicode to the LCD charset.
|
|
82
85
|
def write_line(line, position, text)
|
|
83
|
-
|
|
86
|
+
check_validity
|
|
87
|
+
|
|
88
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z20', 8, ''
|
|
84
89
|
end
|
|
85
90
|
|
|
86
91
|
# Deletes all characters from the display.
|
|
87
92
|
def clear_display
|
|
88
|
-
|
|
93
|
+
check_validity
|
|
94
|
+
|
|
95
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
89
96
|
end
|
|
90
97
|
|
|
91
98
|
# Turns the backlight on.
|
|
92
99
|
def backlight_on
|
|
93
|
-
|
|
100
|
+
check_validity
|
|
101
|
+
|
|
102
|
+
send_request FUNCTION_BACKLIGHT_ON, [], '', 8, ''
|
|
94
103
|
end
|
|
95
104
|
|
|
96
105
|
# Turns the backlight off.
|
|
97
106
|
def backlight_off
|
|
98
|
-
|
|
107
|
+
check_validity
|
|
108
|
+
|
|
109
|
+
send_request FUNCTION_BACKLIGHT_OFF, [], '', 8, ''
|
|
99
110
|
end
|
|
100
111
|
|
|
101
112
|
# Returns *true* if the backlight is on and *false* otherwise.
|
|
102
113
|
def is_backlight_on
|
|
103
|
-
|
|
114
|
+
check_validity
|
|
115
|
+
|
|
116
|
+
send_request FUNCTION_IS_BACKLIGHT_ON, [], '', 9, '?'
|
|
104
117
|
end
|
|
105
118
|
|
|
106
119
|
# Configures if the cursor (shown as "_") should be visible and if it
|
|
@@ -108,12 +121,16 @@ module Tinkerforge
|
|
|
108
121
|
# is one character behind the the last text written with
|
|
109
122
|
# BrickletLCD20x4#write_line.
|
|
110
123
|
def set_config(cursor, blinking)
|
|
111
|
-
|
|
124
|
+
check_validity
|
|
125
|
+
|
|
126
|
+
send_request FUNCTION_SET_CONFIG, [cursor, blinking], '? ?', 8, ''
|
|
112
127
|
end
|
|
113
128
|
|
|
114
129
|
# Returns the configuration as set by BrickletLCD20x4#set_config.
|
|
115
130
|
def get_config
|
|
116
|
-
|
|
131
|
+
check_validity
|
|
132
|
+
|
|
133
|
+
send_request FUNCTION_GET_CONFIG, [], '', 10, '? ?'
|
|
117
134
|
end
|
|
118
135
|
|
|
119
136
|
# Returns *true* if the button (0 to 2 or 0 to 3 since hardware version 1.2)
|
|
@@ -122,7 +139,9 @@ module Tinkerforge
|
|
|
122
139
|
# If you want to react on button presses and releases it is recommended to use
|
|
123
140
|
# the CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
|
|
124
141
|
def is_button_pressed(button)
|
|
125
|
-
|
|
142
|
+
check_validity
|
|
143
|
+
|
|
144
|
+
send_request FUNCTION_IS_BUTTON_PRESSED, [button], 'C', 9, '?'
|
|
126
145
|
end
|
|
127
146
|
|
|
128
147
|
# The LCD 20x4 Bricklet can store up to 8 custom characters. The characters
|
|
@@ -140,7 +159,8 @@ module Tinkerforge
|
|
|
140
159
|
# * ``character[7] = 0b00000000`` (decimal value 0)
|
|
141
160
|
#
|
|
142
161
|
# The characters can later be written with BrickletLCD20x4#write_line by using the
|
|
143
|
-
# characters with the byte representation 8 ("
|
|
162
|
+
# characters with the byte representation 8 ("\\x08" or "\\u0008") to 15
|
|
163
|
+
# ("\\x0F" or "\\u000F").
|
|
144
164
|
#
|
|
145
165
|
# You can play around with the custom characters in Brick Viewer version
|
|
146
166
|
# since 2.0.1.
|
|
@@ -150,7 +170,9 @@ module Tinkerforge
|
|
|
150
170
|
#
|
|
151
171
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
152
172
|
def set_custom_character(index, character)
|
|
153
|
-
|
|
173
|
+
check_validity
|
|
174
|
+
|
|
175
|
+
send_request FUNCTION_SET_CUSTOM_CHARACTER, [index, character], 'C C8', 8, ''
|
|
154
176
|
end
|
|
155
177
|
|
|
156
178
|
# Returns the custom character for a given index, as set with
|
|
@@ -158,7 +180,9 @@ module Tinkerforge
|
|
|
158
180
|
#
|
|
159
181
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
160
182
|
def get_custom_character(index)
|
|
161
|
-
|
|
183
|
+
check_validity
|
|
184
|
+
|
|
185
|
+
send_request FUNCTION_GET_CUSTOM_CHARACTER, [index], 'C', 16, 'C8'
|
|
162
186
|
end
|
|
163
187
|
|
|
164
188
|
# Sets the default text for lines 0-3. The max number of characters
|
|
@@ -169,7 +193,9 @@ module Tinkerforge
|
|
|
169
193
|
#
|
|
170
194
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
171
195
|
def set_default_text(line, text)
|
|
172
|
-
|
|
196
|
+
check_validity
|
|
197
|
+
|
|
198
|
+
send_request FUNCTION_SET_DEFAULT_TEXT, [line, text], 'C Z20', 8, ''
|
|
173
199
|
end
|
|
174
200
|
|
|
175
201
|
# Returns the default text for a given line (0-3) as set by
|
|
@@ -177,10 +203,12 @@ module Tinkerforge
|
|
|
177
203
|
#
|
|
178
204
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
179
205
|
def get_default_text(line)
|
|
180
|
-
|
|
206
|
+
check_validity
|
|
207
|
+
|
|
208
|
+
send_request FUNCTION_GET_DEFAULT_TEXT, [line], 'C', 28, 'Z20'
|
|
181
209
|
end
|
|
182
210
|
|
|
183
|
-
# Sets the default text counter
|
|
211
|
+
# Sets the default text counter. This counter is decremented each
|
|
184
212
|
# ms by the LCD firmware. If the counter reaches 0, the default text
|
|
185
213
|
# (see BrickletLCD20x4#set_default_text) is shown on the LCD.
|
|
186
214
|
#
|
|
@@ -196,26 +224,33 @@ module Tinkerforge
|
|
|
196
224
|
#
|
|
197
225
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
198
226
|
def set_default_text_counter(counter)
|
|
199
|
-
|
|
227
|
+
check_validity
|
|
228
|
+
|
|
229
|
+
send_request FUNCTION_SET_DEFAULT_TEXT_COUNTER, [counter], 'l', 8, ''
|
|
200
230
|
end
|
|
201
231
|
|
|
202
232
|
# Returns the current value of the default text counter.
|
|
203
233
|
#
|
|
204
234
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
205
235
|
def get_default_text_counter
|
|
206
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_GET_DEFAULT_TEXT_COUNTER, [], '', 12, 'l'
|
|
207
239
|
end
|
|
208
240
|
|
|
209
241
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
210
242
|
# the position, the hardware and firmware version as well as the
|
|
211
243
|
# device identifier.
|
|
212
244
|
#
|
|
213
|
-
# The position can be 'a', 'b', 'c' or '
|
|
245
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
246
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
247
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
248
|
+
# position 'z'.
|
|
214
249
|
#
|
|
215
250
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
216
251
|
# |device_identifier_constant|
|
|
217
252
|
def get_identity
|
|
218
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
253
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
219
254
|
end
|
|
220
255
|
|
|
221
256
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2020-04-07. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
|
10
10
|
#############################################################
|
|
11
11
|
|
|
12
|
+
require_relative './ip_connection'
|
|
13
|
+
|
|
12
14
|
module Tinkerforge
|
|
13
15
|
# Controls up to 320 RGB LEDs
|
|
14
16
|
class BrickletLEDStrip < Device
|
|
@@ -81,7 +83,7 @@ module Tinkerforge
|
|
|
81
83
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
82
84
|
# the IP Connection <tt>ipcon</tt>.
|
|
83
85
|
def initialize(uid, ipcon)
|
|
84
|
-
super uid, ipcon
|
|
86
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
85
87
|
|
|
86
88
|
@api_version = [2, 0, 3]
|
|
87
89
|
|
|
@@ -103,8 +105,9 @@ module Tinkerforge
|
|
|
103
105
|
@response_expected[FUNCTION_IS_FRAME_RENDERED_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
104
106
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
105
107
|
|
|
106
|
-
@callback_formats[CALLBACK_FRAME_RENDERED] = 'S'
|
|
108
|
+
@callback_formats[CALLBACK_FRAME_RENDERED] = [10, 'S']
|
|
107
109
|
|
|
110
|
+
@ipcon.add_device self
|
|
108
111
|
end
|
|
109
112
|
|
|
110
113
|
# Sets *length* RGB values for the LEDs starting from *index*.
|
|
@@ -146,7 +149,9 @@ module Tinkerforge
|
|
|
146
149
|
# information. A call of BrickletLEDStrip#set_rgb_values with index + length above the
|
|
147
150
|
# bounds is ignored completely.
|
|
148
151
|
def set_rgb_values(index, length, r, g, b)
|
|
149
|
-
|
|
152
|
+
check_validity
|
|
153
|
+
|
|
154
|
+
send_request FUNCTION_SET_RGB_VALUES, [index, length, r, g, b], 'S C C16 C16 C16', 8, ''
|
|
150
155
|
end
|
|
151
156
|
|
|
152
157
|
# Returns *length* R, G and B values starting from the
|
|
@@ -154,7 +159,9 @@ module Tinkerforge
|
|
|
154
159
|
#
|
|
155
160
|
# The values are the last values that were set by BrickletLEDStrip#set_rgb_values.
|
|
156
161
|
def get_rgb_values(index, length)
|
|
157
|
-
|
|
162
|
+
check_validity
|
|
163
|
+
|
|
164
|
+
send_request FUNCTION_GET_RGB_VALUES, [index, length], 'S C', 56, 'C16 C16 C16'
|
|
158
165
|
end
|
|
159
166
|
|
|
160
167
|
# Sets the frame duration.
|
|
@@ -164,17 +171,23 @@ module Tinkerforge
|
|
|
164
171
|
#
|
|
165
172
|
# For an explanation of the general approach see BrickletLEDStrip#set_rgb_values.
|
|
166
173
|
def set_frame_duration(duration)
|
|
167
|
-
|
|
174
|
+
check_validity
|
|
175
|
+
|
|
176
|
+
send_request FUNCTION_SET_FRAME_DURATION, [duration], 'S', 8, ''
|
|
168
177
|
end
|
|
169
178
|
|
|
170
179
|
# Returns the frame duration as set by BrickletLEDStrip#set_frame_duration.
|
|
171
180
|
def get_frame_duration
|
|
172
|
-
|
|
181
|
+
check_validity
|
|
182
|
+
|
|
183
|
+
send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
|
|
173
184
|
end
|
|
174
185
|
|
|
175
186
|
# Returns the current supply voltage of the LEDs.
|
|
176
187
|
def get_supply_voltage
|
|
177
|
-
|
|
188
|
+
check_validity
|
|
189
|
+
|
|
190
|
+
send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 10, 'S'
|
|
178
191
|
end
|
|
179
192
|
|
|
180
193
|
# Sets the frequency of the clock.
|
|
@@ -195,14 +208,18 @@ module Tinkerforge
|
|
|
195
208
|
#
|
|
196
209
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
197
210
|
def set_clock_frequency(frequency)
|
|
198
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_SET_CLOCK_FREQUENCY, [frequency], 'L', 8, ''
|
|
199
214
|
end
|
|
200
215
|
|
|
201
216
|
# Returns the currently used clock frequency as set by BrickletLEDStrip#set_clock_frequency.
|
|
202
217
|
#
|
|
203
218
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
204
219
|
def get_clock_frequency
|
|
205
|
-
|
|
220
|
+
check_validity
|
|
221
|
+
|
|
222
|
+
send_request FUNCTION_GET_CLOCK_FREQUENCY, [], '', 12, 'L'
|
|
206
223
|
end
|
|
207
224
|
|
|
208
225
|
# Sets the type of the LED driver chip. We currently support the chips
|
|
@@ -216,14 +233,18 @@ module Tinkerforge
|
|
|
216
233
|
#
|
|
217
234
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
218
235
|
def set_chip_type(chip)
|
|
219
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_SET_CHIP_TYPE, [chip], 'S', 8, ''
|
|
220
239
|
end
|
|
221
240
|
|
|
222
241
|
# Returns the currently used chip type as set by BrickletLEDStrip#set_chip_type.
|
|
223
242
|
#
|
|
224
243
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
225
244
|
def get_chip_type
|
|
226
|
-
|
|
245
|
+
check_validity
|
|
246
|
+
|
|
247
|
+
send_request FUNCTION_GET_CHIP_TYPE, [], '', 10, 'S'
|
|
227
248
|
end
|
|
228
249
|
|
|
229
250
|
# Sets *length* RGBW values for the LEDs starting from *index*.
|
|
@@ -281,7 +302,9 @@ module Tinkerforge
|
|
|
281
302
|
#
|
|
282
303
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
283
304
|
def set_rgbw_values(index, length, r, g, b, w)
|
|
284
|
-
|
|
305
|
+
check_validity
|
|
306
|
+
|
|
307
|
+
send_request FUNCTION_SET_RGBW_VALUES, [index, length, r, g, b, w], 'S C C12 C12 C12 C12', 8, ''
|
|
285
308
|
end
|
|
286
309
|
|
|
287
310
|
# Returns *length* RGBW values starting from the given *index*.
|
|
@@ -290,7 +313,9 @@ module Tinkerforge
|
|
|
290
313
|
#
|
|
291
314
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
292
315
|
def get_rgbw_values(index, length)
|
|
293
|
-
|
|
316
|
+
check_validity
|
|
317
|
+
|
|
318
|
+
send_request FUNCTION_GET_RGBW_VALUES, [index, length], 'S C', 56, 'C12 C12 C12 C12'
|
|
294
319
|
end
|
|
295
320
|
|
|
296
321
|
# Sets the channel mapping for the connected LEDs.
|
|
@@ -315,14 +340,18 @@ module Tinkerforge
|
|
|
315
340
|
#
|
|
316
341
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
317
342
|
def set_channel_mapping(mapping)
|
|
318
|
-
|
|
343
|
+
check_validity
|
|
344
|
+
|
|
345
|
+
send_request FUNCTION_SET_CHANNEL_MAPPING, [mapping], 'C', 8, ''
|
|
319
346
|
end
|
|
320
347
|
|
|
321
348
|
# Returns the currently used channel mapping as set by BrickletLEDStrip#set_channel_mapping.
|
|
322
349
|
#
|
|
323
350
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
324
351
|
def get_channel_mapping
|
|
325
|
-
|
|
352
|
+
check_validity
|
|
353
|
+
|
|
354
|
+
send_request FUNCTION_GET_CHANNEL_MAPPING, [], '', 9, 'C'
|
|
326
355
|
end
|
|
327
356
|
|
|
328
357
|
# Enables the CALLBACK_FRAME_RENDERED callback.
|
|
@@ -331,7 +360,9 @@ module Tinkerforge
|
|
|
331
360
|
#
|
|
332
361
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
333
362
|
def enable_frame_rendered_callback
|
|
334
|
-
|
|
363
|
+
check_validity
|
|
364
|
+
|
|
365
|
+
send_request FUNCTION_ENABLE_FRAME_RENDERED_CALLBACK, [], '', 8, ''
|
|
335
366
|
end
|
|
336
367
|
|
|
337
368
|
# Disables the CALLBACK_FRAME_RENDERED callback.
|
|
@@ -340,26 +371,33 @@ module Tinkerforge
|
|
|
340
371
|
#
|
|
341
372
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
342
373
|
def disable_frame_rendered_callback
|
|
343
|
-
|
|
374
|
+
check_validity
|
|
375
|
+
|
|
376
|
+
send_request FUNCTION_DISABLE_FRAME_RENDERED_CALLBACK, [], '', 8, ''
|
|
344
377
|
end
|
|
345
378
|
|
|
346
379
|
# Returns *true* if the CALLBACK_FRAME_RENDERED callback is enabled, *false* otherwise.
|
|
347
380
|
#
|
|
348
381
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
|
349
382
|
def is_frame_rendered_callback_enabled
|
|
350
|
-
|
|
383
|
+
check_validity
|
|
384
|
+
|
|
385
|
+
send_request FUNCTION_IS_FRAME_RENDERED_CALLBACK_ENABLED, [], '', 9, '?'
|
|
351
386
|
end
|
|
352
387
|
|
|
353
388
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
354
389
|
# the position, the hardware and firmware version as well as the
|
|
355
390
|
# device identifier.
|
|
356
391
|
#
|
|
357
|
-
# The position can be 'a', 'b', 'c' or '
|
|
392
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
393
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
|
394
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
|
395
|
+
# position 'z'.
|
|
358
396
|
#
|
|
359
397
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
360
398
|
# |device_identifier_constant|
|
|
361
399
|
def get_identity
|
|
362
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
400
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
363
401
|
end
|
|
364
402
|
|
|
365
403
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|