tinkerforge 2.1.24 → 2.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +69 -31
- data/lib/tinkerforge/brick_hat_zero.rb +55 -23
- data/lib/tinkerforge/brick_imu.rb +185 -78
- data/lib/tinkerforge/brick_imu_v2.rb +209 -106
- data/lib/tinkerforge/brick_master.rb +491 -183
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
- data/lib/tinkerforge/brick_stepper.rb +211 -99
- data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
- data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
- data/lib/tinkerforge/bricklet_barometer.rb +100 -27
- data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -19
- data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
- data/lib/tinkerforge/bricklet_co2.rb +33 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
- data/lib/tinkerforge/bricklet_color.rb +68 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
- data/lib/tinkerforge/bricklet_compass.rb +77 -30
- data/lib/tinkerforge/bricklet_current12.rb +57 -24
- data/lib/tinkerforge/bricklet_current25.rb +57 -24
- data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
- data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_dmx.rb +87 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
- data/lib/tinkerforge/bricklet_gps.rb +63 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_humidity.rb +50 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
- data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_io16.rb +54 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
- data/lib/tinkerforge/bricklet_io4.rb +54 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -29
- data/lib/tinkerforge/bricklet_joystick.rb +58 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
- data/lib/tinkerforge/bricklet_line.rb +33 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_moisture.rb +39 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
- data/lib/tinkerforge/bricklet_nfc.rb +126 -62
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
- data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
- data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
- data/lib/tinkerforge/bricklet_ptc.rb +73 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
- 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 +38 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
- data/lib/tinkerforge/bricklet_rs485.rb +222 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
- data/lib/tinkerforge/bricklet_temperature.rb +39 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
- data/lib/tinkerforge/bricklet_voltage.rb +51 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
- data/lib/tinkerforge/device_display_names.rb +170 -0
- data/lib/tinkerforge/ip_connection.rb +153 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +11 -3
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
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,23 @@ 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
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
185
|
+
# position 'z'.
|
160
186
|
#
|
161
187
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
162
188
|
# |device_identifier_constant|
|
163
189
|
def get_identity
|
164
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
190
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
165
191
|
end
|
166
192
|
|
167
193
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
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,32 @@ 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
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
247
|
+
# position 'z'.
|
214
248
|
#
|
215
249
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
216
250
|
# |device_identifier_constant|
|
217
251
|
def get_identity
|
218
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
252
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
219
253
|
end
|
220
254
|
|
221
255
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
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,32 @@ 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
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
394
|
+
# position 'z'.
|
358
395
|
#
|
359
396
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
360
397
|
# |device_identifier_constant|
|
361
398
|
def get_identity
|
362
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
399
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
363
400
|
end
|
364
401
|
|
365
402
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|