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
|
# Controls one RGB LED
|
|
14
16
|
class BrickletRGBLED < Device
|
|
@@ -23,7 +25,7 @@ module Tinkerforge
|
|
|
23
25
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
24
26
|
# the IP Connection <tt>ipcon</tt>.
|
|
25
27
|
def initialize(uid, ipcon)
|
|
26
|
-
super uid, ipcon
|
|
28
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
27
29
|
|
|
28
30
|
@api_version = [2, 0, 0]
|
|
29
31
|
|
|
@@ -32,28 +34,35 @@ module Tinkerforge
|
|
|
32
34
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
33
35
|
|
|
34
36
|
|
|
37
|
+
@ipcon.add_device self
|
|
35
38
|
end
|
|
36
39
|
|
|
37
|
-
# Sets the *r*, *g* and *b* values for the LED.
|
|
40
|
+
# Sets the *r*, *g* and *b* values for the LED.
|
|
38
41
|
def set_rgb_value(r, g, b)
|
|
39
|
-
|
|
42
|
+
check_validity
|
|
43
|
+
|
|
44
|
+
send_request FUNCTION_SET_RGB_VALUE, [r, g, b], 'C C C', 8, ''
|
|
40
45
|
end
|
|
41
46
|
|
|
42
47
|
# Returns the *r*, *g* and *b* values of the LED as set by BrickletRGBLED#set_rgb_value.
|
|
43
48
|
def get_rgb_value
|
|
44
|
-
|
|
49
|
+
check_validity
|
|
50
|
+
|
|
51
|
+
send_request FUNCTION_GET_RGB_VALUE, [], '', 11, 'C C C'
|
|
45
52
|
end
|
|
46
53
|
|
|
47
54
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
48
55
|
# the position, the hardware and firmware version as well as the
|
|
49
56
|
# device identifier.
|
|
50
57
|
#
|
|
51
|
-
# The position can be 'a', 'b', 'c' or '
|
|
58
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
59
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
60
|
+
# position 'z'.
|
|
52
61
|
#
|
|
53
62
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
54
63
|
# |device_identifier_constant|
|
|
55
64
|
def get_identity
|
|
56
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
65
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
57
66
|
end
|
|
58
67
|
|
|
59
68
|
end
|
|
@@ -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
|
# Push button with built-in RGB LED
|
|
14
16
|
class BrickletRGBLEDButton < Device
|
|
@@ -60,7 +62,7 @@ module Tinkerforge
|
|
|
60
62
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
61
63
|
# the IP Connection <tt>ipcon</tt>.
|
|
62
64
|
def initialize(uid, ipcon)
|
|
63
|
-
super uid, ipcon
|
|
65
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
64
66
|
|
|
65
67
|
@api_version = [2, 0, 0]
|
|
66
68
|
|
|
@@ -82,43 +84,48 @@ module Tinkerforge
|
|
|
82
84
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
83
85
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
84
86
|
|
|
85
|
-
@callback_formats[CALLBACK_BUTTON_STATE_CHANGED] = 'C'
|
|
87
|
+
@callback_formats[CALLBACK_BUTTON_STATE_CHANGED] = [9, 'C']
|
|
86
88
|
|
|
89
|
+
@ipcon.add_device self
|
|
87
90
|
end
|
|
88
91
|
|
|
89
92
|
# Sets the color of the LED.
|
|
90
|
-
#
|
|
91
|
-
# By default the LED is off (0, 0, 0).
|
|
92
93
|
def set_color(red, green, blue)
|
|
93
|
-
|
|
94
|
+
check_validity
|
|
95
|
+
|
|
96
|
+
send_request FUNCTION_SET_COLOR, [red, green, blue], 'C C C', 8, ''
|
|
94
97
|
end
|
|
95
98
|
|
|
96
99
|
# Returns the LED color as set by BrickletRGBLEDButton#set_color.
|
|
97
100
|
def get_color
|
|
98
|
-
|
|
101
|
+
check_validity
|
|
102
|
+
|
|
103
|
+
send_request FUNCTION_GET_COLOR, [], '', 11, 'C C C'
|
|
99
104
|
end
|
|
100
105
|
|
|
101
106
|
# Returns the current state of the button (either pressed or released).
|
|
102
107
|
def get_button_state
|
|
103
|
-
|
|
108
|
+
check_validity
|
|
109
|
+
|
|
110
|
+
send_request FUNCTION_GET_BUTTON_STATE, [], '', 9, 'C'
|
|
104
111
|
end
|
|
105
112
|
|
|
106
113
|
# Sets a color calibration. Some colors appear brighter then others,
|
|
107
|
-
# so a calibration may be necessary for
|
|
108
|
-
#
|
|
109
|
-
# The values range from 0% to 100%.
|
|
114
|
+
# so a calibration may be necessary for uniform colors.
|
|
110
115
|
#
|
|
111
116
|
# The calibration is saved in flash. You don't need to call this
|
|
112
117
|
# function on every startup.
|
|
113
|
-
#
|
|
114
|
-
# Default value is (100, 100, 55).
|
|
115
118
|
def set_color_calibration(red, green, blue)
|
|
116
|
-
|
|
119
|
+
check_validity
|
|
120
|
+
|
|
121
|
+
send_request FUNCTION_SET_COLOR_CALIBRATION, [red, green, blue], 'C C C', 8, ''
|
|
117
122
|
end
|
|
118
123
|
|
|
119
124
|
# Returns the color calibration as set by BrickletRGBLEDButton#set_color_calibration.
|
|
120
125
|
def get_color_calibration
|
|
121
|
-
|
|
126
|
+
check_validity
|
|
127
|
+
|
|
128
|
+
send_request FUNCTION_GET_COLOR_CALIBRATION, [], '', 11, 'C C C'
|
|
122
129
|
end
|
|
123
130
|
|
|
124
131
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -133,7 +140,9 @@ module Tinkerforge
|
|
|
133
140
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
134
141
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
135
142
|
def get_spitfp_error_count
|
|
136
|
-
|
|
143
|
+
check_validity
|
|
144
|
+
|
|
145
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
137
146
|
end
|
|
138
147
|
|
|
139
148
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -146,12 +155,16 @@ module Tinkerforge
|
|
|
146
155
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
147
156
|
# necessary to call it in a normal user program.
|
|
148
157
|
def set_bootloader_mode(mode)
|
|
149
|
-
|
|
158
|
+
check_validity
|
|
159
|
+
|
|
160
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
150
161
|
end
|
|
151
162
|
|
|
152
163
|
# Returns the current bootloader mode, see BrickletRGBLEDButton#set_bootloader_mode.
|
|
153
164
|
def get_bootloader_mode
|
|
154
|
-
|
|
165
|
+
check_validity
|
|
166
|
+
|
|
167
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
155
168
|
end
|
|
156
169
|
|
|
157
170
|
# Sets the firmware pointer for BrickletRGBLEDButton#write_firmware. The pointer has
|
|
@@ -161,7 +174,9 @@ module Tinkerforge
|
|
|
161
174
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
162
175
|
# necessary to call it in a normal user program.
|
|
163
176
|
def set_write_firmware_pointer(pointer)
|
|
164
|
-
|
|
177
|
+
check_validity
|
|
178
|
+
|
|
179
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
165
180
|
end
|
|
166
181
|
|
|
167
182
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -173,7 +188,9 @@ module Tinkerforge
|
|
|
173
188
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
174
189
|
# necessary to call it in a normal user program.
|
|
175
190
|
def write_firmware(data)
|
|
176
|
-
|
|
191
|
+
check_validity
|
|
192
|
+
|
|
193
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
177
194
|
end
|
|
178
195
|
|
|
179
196
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -184,22 +201,28 @@ module Tinkerforge
|
|
|
184
201
|
#
|
|
185
202
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
186
203
|
def set_status_led_config(config)
|
|
187
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
188
207
|
end
|
|
189
208
|
|
|
190
209
|
# Returns the configuration as set by BrickletRGBLEDButton#set_status_led_config
|
|
191
210
|
def get_status_led_config
|
|
192
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
193
214
|
end
|
|
194
215
|
|
|
195
|
-
# Returns the temperature
|
|
216
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
196
217
|
# value returned is not the ambient temperature!
|
|
197
218
|
#
|
|
198
219
|
# The temperature is only proportional to the real temperature and it has bad
|
|
199
220
|
# accuracy. Practically it is only useful as an indicator for
|
|
200
221
|
# temperature changes.
|
|
201
222
|
def get_chip_temperature
|
|
202
|
-
|
|
223
|
+
check_validity
|
|
224
|
+
|
|
225
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
203
226
|
end
|
|
204
227
|
|
|
205
228
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -209,7 +232,9 @@ module Tinkerforge
|
|
|
209
232
|
# calling functions on the existing ones will result in
|
|
210
233
|
# undefined behavior!
|
|
211
234
|
def reset
|
|
212
|
-
|
|
235
|
+
check_validity
|
|
236
|
+
|
|
237
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
213
238
|
end
|
|
214
239
|
|
|
215
240
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -218,25 +243,31 @@ module Tinkerforge
|
|
|
218
243
|
#
|
|
219
244
|
# We recommend that you use Brick Viewer to change the UID.
|
|
220
245
|
def write_uid(uid)
|
|
221
|
-
|
|
246
|
+
check_validity
|
|
247
|
+
|
|
248
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
222
249
|
end
|
|
223
250
|
|
|
224
251
|
# Returns the current UID as an integer. Encode as
|
|
225
252
|
# Base58 to get the usual string version.
|
|
226
253
|
def read_uid
|
|
227
|
-
|
|
254
|
+
check_validity
|
|
255
|
+
|
|
256
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
228
257
|
end
|
|
229
258
|
|
|
230
259
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
231
260
|
# the position, the hardware and firmware version as well as the
|
|
232
261
|
# device identifier.
|
|
233
262
|
#
|
|
234
|
-
# The position can be 'a', 'b', 'c' or '
|
|
263
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
264
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
265
|
+
# position 'z'.
|
|
235
266
|
#
|
|
236
267
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
237
268
|
# |device_identifier_constant|
|
|
238
269
|
def get_identity
|
|
239
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
270
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
240
271
|
end
|
|
241
272
|
|
|
242
273
|
# 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
|
# RGB LED Matrix with 8x8 pixel
|
|
14
16
|
class BrickletRGBLEDMatrix < Device
|
|
@@ -62,7 +64,7 @@ module Tinkerforge
|
|
|
62
64
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
63
65
|
# the IP Connection <tt>ipcon</tt>.
|
|
64
66
|
def initialize(uid, ipcon)
|
|
65
|
-
super uid, ipcon
|
|
67
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
66
68
|
|
|
67
69
|
@api_version = [2, 0, 0]
|
|
68
70
|
|
|
@@ -89,41 +91,54 @@ module Tinkerforge
|
|
|
89
91
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
90
92
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
91
93
|
|
|
92
|
-
@callback_formats[CALLBACK_FRAME_STARTED] = 'L'
|
|
94
|
+
@callback_formats[CALLBACK_FRAME_STARTED] = [12, 'L']
|
|
93
95
|
|
|
96
|
+
@ipcon.add_device self
|
|
94
97
|
end
|
|
95
98
|
|
|
96
99
|
# Sets the 64 red LED values of the matrix.
|
|
97
100
|
def set_red(red)
|
|
98
|
-
|
|
101
|
+
check_validity
|
|
102
|
+
|
|
103
|
+
send_request FUNCTION_SET_RED, [red], 'C64', 8, ''
|
|
99
104
|
end
|
|
100
105
|
|
|
101
106
|
# Returns the red LED values as set by BrickletRGBLEDMatrix#set_red.
|
|
102
107
|
def get_red
|
|
103
|
-
|
|
108
|
+
check_validity
|
|
109
|
+
|
|
110
|
+
send_request FUNCTION_GET_RED, [], '', 72, 'C64'
|
|
104
111
|
end
|
|
105
112
|
|
|
106
113
|
# Sets the 64 green LED values of the matrix.
|
|
107
114
|
def set_green(green)
|
|
108
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_SET_GREEN, [green], 'C64', 8, ''
|
|
109
118
|
end
|
|
110
119
|
|
|
111
120
|
# Returns the green LED values as set by BrickletRGBLEDMatrix#set_green.
|
|
112
121
|
def get_green
|
|
113
|
-
|
|
122
|
+
check_validity
|
|
123
|
+
|
|
124
|
+
send_request FUNCTION_GET_GREEN, [], '', 72, 'C64'
|
|
114
125
|
end
|
|
115
126
|
|
|
116
127
|
# Sets the 64 blue LED values of the matrix.
|
|
117
128
|
def set_blue(blue)
|
|
118
|
-
|
|
129
|
+
check_validity
|
|
130
|
+
|
|
131
|
+
send_request FUNCTION_SET_BLUE, [blue], 'C64', 8, ''
|
|
119
132
|
end
|
|
120
133
|
|
|
121
134
|
# Returns the blue LED values as set by BrickletRGBLEDMatrix#set_blue.
|
|
122
135
|
def get_blue
|
|
123
|
-
|
|
136
|
+
check_validity
|
|
137
|
+
|
|
138
|
+
send_request FUNCTION_GET_BLUE, [], '', 72, 'C64'
|
|
124
139
|
end
|
|
125
140
|
|
|
126
|
-
# Sets the frame duration
|
|
141
|
+
# Sets the frame duration.
|
|
127
142
|
#
|
|
128
143
|
# Example: If you want to achieve 20 frames per second, you should
|
|
129
144
|
# set the frame duration to 50ms (50ms * 20 = 1 second).
|
|
@@ -140,15 +155,17 @@ module Tinkerforge
|
|
|
140
155
|
# * and so on.
|
|
141
156
|
#
|
|
142
157
|
# For frame duration of 0 see BrickletRGBLEDMatrix#draw_frame.
|
|
143
|
-
#
|
|
144
|
-
# Default value: 0 = off.
|
|
145
158
|
def set_frame_duration(frame_duration)
|
|
146
|
-
|
|
159
|
+
check_validity
|
|
160
|
+
|
|
161
|
+
send_request FUNCTION_SET_FRAME_DURATION, [frame_duration], 'S', 8, ''
|
|
147
162
|
end
|
|
148
163
|
|
|
149
|
-
# Returns the frame duration
|
|
164
|
+
# Returns the frame duration as set by BrickletRGBLEDMatrix#set_frame_duration.
|
|
150
165
|
def get_frame_duration
|
|
151
|
-
|
|
166
|
+
check_validity
|
|
167
|
+
|
|
168
|
+
send_request FUNCTION_GET_FRAME_DURATION, [], '', 10, 'S'
|
|
152
169
|
end
|
|
153
170
|
|
|
154
171
|
# If you set the frame duration to 0 (see BrickletRGBLEDMatrix#set_frame_duration), you can use this
|
|
@@ -165,12 +182,16 @@ module Tinkerforge
|
|
|
165
182
|
# * Wait for CALLBACK_FRAME_STARTED callback.
|
|
166
183
|
# * and so on.
|
|
167
184
|
def draw_frame
|
|
168
|
-
|
|
185
|
+
check_validity
|
|
186
|
+
|
|
187
|
+
send_request FUNCTION_DRAW_FRAME, [], '', 8, ''
|
|
169
188
|
end
|
|
170
189
|
|
|
171
|
-
# Returns the current supply voltage of the Bricklet.
|
|
190
|
+
# Returns the current supply voltage of the Bricklet.
|
|
172
191
|
def get_supply_voltage
|
|
173
|
-
|
|
192
|
+
check_validity
|
|
193
|
+
|
|
194
|
+
send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 10, 'S'
|
|
174
195
|
end
|
|
175
196
|
|
|
176
197
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -185,7 +206,9 @@ module Tinkerforge
|
|
|
185
206
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
186
207
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
187
208
|
def get_spitfp_error_count
|
|
188
|
-
|
|
209
|
+
check_validity
|
|
210
|
+
|
|
211
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
189
212
|
end
|
|
190
213
|
|
|
191
214
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -198,12 +221,16 @@ module Tinkerforge
|
|
|
198
221
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
199
222
|
# necessary to call it in a normal user program.
|
|
200
223
|
def set_bootloader_mode(mode)
|
|
201
|
-
|
|
224
|
+
check_validity
|
|
225
|
+
|
|
226
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
202
227
|
end
|
|
203
228
|
|
|
204
229
|
# Returns the current bootloader mode, see BrickletRGBLEDMatrix#set_bootloader_mode.
|
|
205
230
|
def get_bootloader_mode
|
|
206
|
-
|
|
231
|
+
check_validity
|
|
232
|
+
|
|
233
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
207
234
|
end
|
|
208
235
|
|
|
209
236
|
# Sets the firmware pointer for BrickletRGBLEDMatrix#write_firmware. The pointer has
|
|
@@ -213,7 +240,9 @@ module Tinkerforge
|
|
|
213
240
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
214
241
|
# necessary to call it in a normal user program.
|
|
215
242
|
def set_write_firmware_pointer(pointer)
|
|
216
|
-
|
|
243
|
+
check_validity
|
|
244
|
+
|
|
245
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
217
246
|
end
|
|
218
247
|
|
|
219
248
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -225,7 +254,9 @@ module Tinkerforge
|
|
|
225
254
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
226
255
|
# necessary to call it in a normal user program.
|
|
227
256
|
def write_firmware(data)
|
|
228
|
-
|
|
257
|
+
check_validity
|
|
258
|
+
|
|
259
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
229
260
|
end
|
|
230
261
|
|
|
231
262
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -236,22 +267,28 @@ module Tinkerforge
|
|
|
236
267
|
#
|
|
237
268
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
238
269
|
def set_status_led_config(config)
|
|
239
|
-
|
|
270
|
+
check_validity
|
|
271
|
+
|
|
272
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
240
273
|
end
|
|
241
274
|
|
|
242
275
|
# Returns the configuration as set by BrickletRGBLEDMatrix#set_status_led_config
|
|
243
276
|
def get_status_led_config
|
|
244
|
-
|
|
277
|
+
check_validity
|
|
278
|
+
|
|
279
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
245
280
|
end
|
|
246
281
|
|
|
247
|
-
# Returns the temperature
|
|
282
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
248
283
|
# value returned is not the ambient temperature!
|
|
249
284
|
#
|
|
250
285
|
# The temperature is only proportional to the real temperature and it has bad
|
|
251
286
|
# accuracy. Practically it is only useful as an indicator for
|
|
252
287
|
# temperature changes.
|
|
253
288
|
def get_chip_temperature
|
|
254
|
-
|
|
289
|
+
check_validity
|
|
290
|
+
|
|
291
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
255
292
|
end
|
|
256
293
|
|
|
257
294
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -261,7 +298,9 @@ module Tinkerforge
|
|
|
261
298
|
# calling functions on the existing ones will result in
|
|
262
299
|
# undefined behavior!
|
|
263
300
|
def reset
|
|
264
|
-
|
|
301
|
+
check_validity
|
|
302
|
+
|
|
303
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
265
304
|
end
|
|
266
305
|
|
|
267
306
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -270,25 +309,31 @@ module Tinkerforge
|
|
|
270
309
|
#
|
|
271
310
|
# We recommend that you use Brick Viewer to change the UID.
|
|
272
311
|
def write_uid(uid)
|
|
273
|
-
|
|
312
|
+
check_validity
|
|
313
|
+
|
|
314
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
274
315
|
end
|
|
275
316
|
|
|
276
317
|
# Returns the current UID as an integer. Encode as
|
|
277
318
|
# Base58 to get the usual string version.
|
|
278
319
|
def read_uid
|
|
279
|
-
|
|
320
|
+
check_validity
|
|
321
|
+
|
|
322
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
280
323
|
end
|
|
281
324
|
|
|
282
325
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
283
326
|
# the position, the hardware and firmware version as well as the
|
|
284
327
|
# device identifier.
|
|
285
328
|
#
|
|
286
|
-
# The position can be 'a', 'b', 'c' or '
|
|
329
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
330
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
331
|
+
# position 'z'.
|
|
287
332
|
#
|
|
288
333
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
289
334
|
# |device_identifier_constant|
|
|
290
335
|
def get_identity
|
|
291
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
336
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
292
337
|
end
|
|
293
338
|
|
|
294
339
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|