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
|
# Reads and writes NFC and RFID tags
|
14
16
|
class BrickletNFCRFID < Device
|
@@ -52,7 +54,7 @@ module Tinkerforge
|
|
52
54
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
53
55
|
# the IP Connection <tt>ipcon</tt>.
|
54
56
|
def initialize(uid, ipcon)
|
55
|
-
super uid, ipcon
|
57
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
56
58
|
|
57
59
|
@api_version = [2, 0, 0]
|
58
60
|
|
@@ -65,8 +67,9 @@ module Tinkerforge
|
|
65
67
|
@response_expected[FUNCTION_GET_PAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
66
68
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
67
69
|
|
68
|
-
@callback_formats[CALLBACK_STATE_CHANGED] = 'C ?'
|
70
|
+
@callback_formats[CALLBACK_STATE_CHANGED] = [10, 'C ?']
|
69
71
|
|
72
|
+
@ipcon.add_device self
|
70
73
|
end
|
71
74
|
|
72
75
|
# To read or write a tag that is in proximity of the NFC/RFID Bricklet you
|
@@ -98,7 +101,9 @@ module Tinkerforge
|
|
98
101
|
# In case of any *Error* state the selection is lost and you have to
|
99
102
|
# start again by calling BrickletNFCRFID#request_tag_id.
|
100
103
|
def request_tag_id(tag_type)
|
101
|
-
|
104
|
+
check_validity
|
105
|
+
|
106
|
+
send_request FUNCTION_REQUEST_TAG_ID, [tag_type], 'C', 8, ''
|
102
107
|
end
|
103
108
|
|
104
109
|
# Returns the tag type, tag ID and the length of the tag ID
|
@@ -113,7 +118,9 @@ module Tinkerforge
|
|
113
118
|
# CALLBACK_STATE_CHANGED callback)
|
114
119
|
# 3. Call BrickletNFCRFID#get_tag_id
|
115
120
|
def get_tag_id
|
116
|
-
|
121
|
+
check_validity
|
122
|
+
|
123
|
+
send_request FUNCTION_GET_TAG_ID, [], '', 17, 'C C C7'
|
117
124
|
end
|
118
125
|
|
119
126
|
# Returns the current state of the NFC/RFID Bricklet.
|
@@ -131,7 +138,9 @@ module Tinkerforge
|
|
131
138
|
#
|
132
139
|
# The same approach is used analogously for the other API functions.
|
133
140
|
def get_state
|
134
|
-
|
141
|
+
check_validity
|
142
|
+
|
143
|
+
send_request FUNCTION_GET_STATE, [], '', 10, 'C ?'
|
135
144
|
end
|
136
145
|
|
137
146
|
# Mifare Classic tags use authentication. If you want to read from or write to
|
@@ -153,7 +162,9 @@ module Tinkerforge
|
|
153
162
|
# BrickletNFCRFID#get_state or CALLBACK_STATE_CHANGED callback)
|
154
163
|
# 6. Call BrickletNFCRFID#request_page or BrickletNFCRFID#write_page to read/write page
|
155
164
|
def authenticate_mifare_classic_page(page, key_number, key)
|
156
|
-
|
165
|
+
check_validity
|
166
|
+
|
167
|
+
send_request FUNCTION_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 8, ''
|
157
168
|
end
|
158
169
|
|
159
170
|
# Writes 16 bytes starting from the given page. How many pages are written
|
@@ -177,7 +188,9 @@ module Tinkerforge
|
|
177
188
|
# If you use a Mifare Classic tag you have to authenticate a page before you
|
178
189
|
# can write to it. See BrickletNFCRFID#authenticate_mifare_classic_page.
|
179
190
|
def write_page(page, data)
|
180
|
-
|
191
|
+
check_validity
|
192
|
+
|
193
|
+
send_request FUNCTION_WRITE_PAGE, [page, data], 'S C16', 8, ''
|
181
194
|
end
|
182
195
|
|
183
196
|
# Reads 16 bytes starting from the given page and stores them into a buffer.
|
@@ -204,25 +217,31 @@ module Tinkerforge
|
|
204
217
|
# If you use a Mifare Classic tag you have to authenticate a page before you
|
205
218
|
# can read it. See BrickletNFCRFID#authenticate_mifare_classic_page.
|
206
219
|
def request_page(page)
|
207
|
-
|
220
|
+
check_validity
|
221
|
+
|
222
|
+
send_request FUNCTION_REQUEST_PAGE, [page], 'S', 8, ''
|
208
223
|
end
|
209
224
|
|
210
225
|
# Returns 16 bytes of data from an internal buffer. To fill the buffer
|
211
226
|
# with specific pages you have to call BrickletNFCRFID#request_page beforehand.
|
212
227
|
def get_page
|
213
|
-
|
228
|
+
check_validity
|
229
|
+
|
230
|
+
send_request FUNCTION_GET_PAGE, [], '', 24, 'C16'
|
214
231
|
end
|
215
232
|
|
216
233
|
# Returns the UID, the UID where the Bricklet is connected to,
|
217
234
|
# the position, the hardware and firmware version as well as the
|
218
235
|
# device identifier.
|
219
236
|
#
|
220
|
-
# The position can be 'a', 'b', 'c' or '
|
237
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
238
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
239
|
+
# position 'z'.
|
221
240
|
#
|
222
241
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
223
242
|
# |device_identifier_constant|
|
224
243
|
def get_identity
|
225
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
244
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
226
245
|
end
|
227
246
|
|
228
247
|
# 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
|
# 3.3cm (1.3") OLED display with 128x64 pixels
|
14
16
|
class BrickletOLED128x64 < Device
|
@@ -27,7 +29,7 @@ module Tinkerforge
|
|
27
29
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
28
30
|
# the IP Connection <tt>ipcon</tt>.
|
29
31
|
def initialize(uid, ipcon)
|
30
|
-
super uid, ipcon
|
32
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
31
33
|
|
32
34
|
@api_version = [2, 0, 0]
|
33
35
|
|
@@ -40,6 +42,7 @@ module Tinkerforge
|
|
40
42
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
41
43
|
|
42
44
|
|
45
|
+
@ipcon.add_device self
|
43
46
|
end
|
44
47
|
|
45
48
|
# Appends 64 byte of data to the window as set by BrickletOLED128x64#new_window.
|
@@ -63,18 +66,24 @@ module Tinkerforge
|
|
63
66
|
# and the next two the second row and so on. To fill the whole display
|
64
67
|
# you need to call BrickletOLED128x64#write 16 times.
|
65
68
|
def write(data)
|
66
|
-
|
69
|
+
check_validity
|
70
|
+
|
71
|
+
send_request FUNCTION_WRITE, [data], 'C64', 8, ''
|
67
72
|
end
|
68
73
|
|
69
74
|
# Sets the window in which you can write with BrickletOLED128x64#write. One row
|
70
75
|
# has a height of 8 pixels.
|
71
76
|
def new_window(column_from, column_to, row_from, row_to)
|
72
|
-
|
77
|
+
check_validity
|
78
|
+
|
79
|
+
send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 8, ''
|
73
80
|
end
|
74
81
|
|
75
82
|
# Clears the current content of the window as set by BrickletOLED128x64#new_window.
|
76
83
|
def clear_display
|
77
|
-
|
84
|
+
check_validity
|
85
|
+
|
86
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
78
87
|
end
|
79
88
|
|
80
89
|
# Sets the configuration of the display.
|
@@ -82,12 +91,16 @@ module Tinkerforge
|
|
82
91
|
# You can set a contrast value from 0 to 255 and you can invert the color
|
83
92
|
# (black/white) of the display.
|
84
93
|
def set_display_configuration(contrast, invert)
|
85
|
-
|
94
|
+
check_validity
|
95
|
+
|
96
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 8, ''
|
86
97
|
end
|
87
98
|
|
88
99
|
# Returns the configuration as set by BrickletOLED128x64#set_display_configuration.
|
89
100
|
def get_display_configuration
|
90
|
-
|
101
|
+
check_validity
|
102
|
+
|
103
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 10, 'C ?'
|
91
104
|
end
|
92
105
|
|
93
106
|
# Writes text to a specific line with a specific position.
|
@@ -102,19 +115,23 @@ module Tinkerforge
|
|
102
115
|
# The display uses a special 5x7 pixel charset. You can view the characters
|
103
116
|
# of the charset in Brick Viewer.
|
104
117
|
def write_line(line, position, text)
|
105
|
-
|
118
|
+
check_validity
|
119
|
+
|
120
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z26', 8, ''
|
106
121
|
end
|
107
122
|
|
108
123
|
# Returns the UID, the UID where the Bricklet is connected to,
|
109
124
|
# the position, the hardware and firmware version as well as the
|
110
125
|
# device identifier.
|
111
126
|
#
|
112
|
-
# The position can be 'a', 'b', 'c' or '
|
127
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
128
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
129
|
+
# position 'z'.
|
113
130
|
#
|
114
131
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
115
132
|
# |device_identifier_constant|
|
116
133
|
def get_identity
|
117
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
134
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
118
135
|
end
|
119
136
|
|
120
137
|
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 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
|
# 3.3cm (1.3") OLED display with 128x64 pixels
|
14
16
|
class BrickletOLED128x64V2 < Device
|
@@ -54,7 +56,7 @@ module Tinkerforge
|
|
54
56
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
55
57
|
# the IP Connection <tt>ipcon</tt>.
|
56
58
|
def initialize(uid, ipcon)
|
57
|
-
super uid, ipcon
|
59
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
58
60
|
|
59
61
|
@api_version = [2, 0, 0]
|
60
62
|
|
@@ -79,6 +81,7 @@ module Tinkerforge
|
|
79
81
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
80
82
|
|
81
83
|
|
84
|
+
@ipcon.add_device self
|
82
85
|
end
|
83
86
|
|
84
87
|
# Writes pixels to the specified window.
|
@@ -98,7 +101,9 @@ module Tinkerforge
|
|
98
101
|
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
99
102
|
# function.
|
100
103
|
def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
|
101
|
-
|
104
|
+
check_validity
|
105
|
+
|
106
|
+
send_request FUNCTION_WRITE_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'C C C C S S ?448', 8, ''
|
102
107
|
end
|
103
108
|
|
104
109
|
# Reads pixels from the specified window.
|
@@ -115,7 +120,9 @@ module Tinkerforge
|
|
115
120
|
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
116
121
|
# function.
|
117
122
|
def read_pixels_low_level(x_start, y_start, x_end, y_end)
|
118
|
-
|
123
|
+
check_validity
|
124
|
+
|
125
|
+
send_request FUNCTION_READ_PIXELS_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'C C C C', 72, 'S S ?480'
|
119
126
|
end
|
120
127
|
|
121
128
|
# Clears the complete content of the display.
|
@@ -130,7 +137,9 @@ module Tinkerforge
|
|
130
137
|
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
131
138
|
# function.
|
132
139
|
def clear_display
|
133
|
-
|
140
|
+
check_validity
|
141
|
+
|
142
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
134
143
|
end
|
135
144
|
|
136
145
|
# Sets the configuration of the display.
|
@@ -143,12 +152,16 @@ module Tinkerforge
|
|
143
152
|
# changes are written into an internal buffer and only shown on the display after
|
144
153
|
# a call of BrickletOLED128x64V2#draw_buffered_frame.
|
145
154
|
def set_display_configuration(contrast, invert, automatic_draw)
|
146
|
-
|
155
|
+
check_validity
|
156
|
+
|
157
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert, automatic_draw], 'C ? ?', 8, ''
|
147
158
|
end
|
148
159
|
|
149
160
|
# Returns the configuration as set by BrickletOLED128x64V2#set_display_configuration.
|
150
161
|
def get_display_configuration
|
151
|
-
|
162
|
+
check_validity
|
163
|
+
|
164
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 11, 'C ? ?'
|
152
165
|
end
|
153
166
|
|
154
167
|
# Writes text to a specific line with a specific position.
|
@@ -172,7 +185,9 @@ module Tinkerforge
|
|
172
185
|
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
173
186
|
# function.
|
174
187
|
def write_line(line, position, text)
|
175
|
-
|
188
|
+
check_validity
|
189
|
+
|
190
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, ''
|
176
191
|
end
|
177
192
|
|
178
193
|
# Draws the currently buffered frame. Normally each call of BrickletOLED128x64V2#write_pixels and
|
@@ -185,7 +200,9 @@ module Tinkerforge
|
|
185
200
|
# instead of only the changed parts. Normally it should not be necessary to set this to
|
186
201
|
# *true*. It may only become necessary in case of stuck pixels because of errors.
|
187
202
|
def draw_buffered_frame(force_complete_redraw)
|
188
|
-
|
203
|
+
check_validity
|
204
|
+
|
205
|
+
send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, ''
|
189
206
|
end
|
190
207
|
|
191
208
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -200,7 +217,9 @@ module Tinkerforge
|
|
200
217
|
# The errors counts are for errors that occur on the Bricklet side. All
|
201
218
|
# Bricks have a similar function that returns the errors on the Brick side.
|
202
219
|
def get_spitfp_error_count
|
203
|
-
|
220
|
+
check_validity
|
221
|
+
|
222
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
204
223
|
end
|
205
224
|
|
206
225
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -213,12 +232,16 @@ module Tinkerforge
|
|
213
232
|
# This function is used by Brick Viewer during flashing. It should not be
|
214
233
|
# necessary to call it in a normal user program.
|
215
234
|
def set_bootloader_mode(mode)
|
216
|
-
|
235
|
+
check_validity
|
236
|
+
|
237
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
217
238
|
end
|
218
239
|
|
219
240
|
# Returns the current bootloader mode, see BrickletOLED128x64V2#set_bootloader_mode.
|
220
241
|
def get_bootloader_mode
|
221
|
-
|
242
|
+
check_validity
|
243
|
+
|
244
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
222
245
|
end
|
223
246
|
|
224
247
|
# Sets the firmware pointer for BrickletOLED128x64V2#write_firmware. The pointer has
|
@@ -228,7 +251,9 @@ module Tinkerforge
|
|
228
251
|
# This function is used by Brick Viewer during flashing. It should not be
|
229
252
|
# necessary to call it in a normal user program.
|
230
253
|
def set_write_firmware_pointer(pointer)
|
231
|
-
|
254
|
+
check_validity
|
255
|
+
|
256
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
232
257
|
end
|
233
258
|
|
234
259
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -240,7 +265,9 @@ module Tinkerforge
|
|
240
265
|
# This function is used by Brick Viewer during flashing. It should not be
|
241
266
|
# necessary to call it in a normal user program.
|
242
267
|
def write_firmware(data)
|
243
|
-
|
268
|
+
check_validity
|
269
|
+
|
270
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
244
271
|
end
|
245
272
|
|
246
273
|
# Sets the status LED configuration. By default the LED shows
|
@@ -251,22 +278,28 @@ module Tinkerforge
|
|
251
278
|
#
|
252
279
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
253
280
|
def set_status_led_config(config)
|
254
|
-
|
281
|
+
check_validity
|
282
|
+
|
283
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
255
284
|
end
|
256
285
|
|
257
286
|
# Returns the configuration as set by BrickletOLED128x64V2#set_status_led_config
|
258
287
|
def get_status_led_config
|
259
|
-
|
288
|
+
check_validity
|
289
|
+
|
290
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
260
291
|
end
|
261
292
|
|
262
|
-
# Returns the temperature
|
293
|
+
# Returns the temperature as measured inside the microcontroller. The
|
263
294
|
# value returned is not the ambient temperature!
|
264
295
|
#
|
265
296
|
# The temperature is only proportional to the real temperature and it has bad
|
266
297
|
# accuracy. Practically it is only useful as an indicator for
|
267
298
|
# temperature changes.
|
268
299
|
def get_chip_temperature
|
269
|
-
|
300
|
+
check_validity
|
301
|
+
|
302
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
270
303
|
end
|
271
304
|
|
272
305
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -276,7 +309,9 @@ module Tinkerforge
|
|
276
309
|
# calling functions on the existing ones will result in
|
277
310
|
# undefined behavior!
|
278
311
|
def reset
|
279
|
-
|
312
|
+
check_validity
|
313
|
+
|
314
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
280
315
|
end
|
281
316
|
|
282
317
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -285,25 +320,31 @@ module Tinkerforge
|
|
285
320
|
#
|
286
321
|
# We recommend that you use Brick Viewer to change the UID.
|
287
322
|
def write_uid(uid)
|
288
|
-
|
323
|
+
check_validity
|
324
|
+
|
325
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
289
326
|
end
|
290
327
|
|
291
328
|
# Returns the current UID as an integer. Encode as
|
292
329
|
# Base58 to get the usual string version.
|
293
330
|
def read_uid
|
294
|
-
|
331
|
+
check_validity
|
332
|
+
|
333
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
295
334
|
end
|
296
335
|
|
297
336
|
# Returns the UID, the UID where the Bricklet is connected to,
|
298
337
|
# the position, the hardware and firmware version as well as the
|
299
338
|
# device identifier.
|
300
339
|
#
|
301
|
-
# The position can be 'a', 'b', 'c' or '
|
340
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
341
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
342
|
+
# position 'z'.
|
302
343
|
#
|
303
344
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
304
345
|
# |device_identifier_constant|
|
305
346
|
def get_identity
|
306
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
347
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
307
348
|
end
|
308
349
|
|
309
350
|
# Writes pixels to the specified window.
|