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
|
# 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 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
|
# 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,39 +66,45 @@ 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
|
-
#
|
|
72
|
-
# The columns have a range of 0 to 127 and the rows have a range of 0 to 7.
|
|
73
76
|
def new_window(column_from, column_to, row_from, row_to)
|
|
74
|
-
|
|
77
|
+
check_validity
|
|
78
|
+
|
|
79
|
+
send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 8, ''
|
|
75
80
|
end
|
|
76
81
|
|
|
77
82
|
# Clears the current content of the window as set by BrickletOLED128x64#new_window.
|
|
78
83
|
def clear_display
|
|
79
|
-
|
|
84
|
+
check_validity
|
|
85
|
+
|
|
86
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
80
87
|
end
|
|
81
88
|
|
|
82
89
|
# Sets the configuration of the display.
|
|
83
90
|
#
|
|
84
91
|
# You can set a contrast value from 0 to 255 and you can invert the color
|
|
85
92
|
# (black/white) of the display.
|
|
86
|
-
#
|
|
87
|
-
# The default values are contrast 143 and inverting off.
|
|
88
93
|
def set_display_configuration(contrast, invert)
|
|
89
|
-
|
|
94
|
+
check_validity
|
|
95
|
+
|
|
96
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 8, ''
|
|
90
97
|
end
|
|
91
98
|
|
|
92
99
|
# Returns the configuration as set by BrickletOLED128x64#set_display_configuration.
|
|
93
100
|
def get_display_configuration
|
|
94
|
-
|
|
101
|
+
check_validity
|
|
102
|
+
|
|
103
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 10, 'C ?'
|
|
95
104
|
end
|
|
96
105
|
|
|
97
|
-
# Writes text to a specific line
|
|
98
|
-
#
|
|
106
|
+
# Writes text to a specific line with a specific position.
|
|
107
|
+
# The text can have a maximum of 26 characters.
|
|
99
108
|
#
|
|
100
109
|
# For example: (1, 10, "Hello") will write *Hello* in the middle of the
|
|
101
110
|
# second line of the display.
|
|
@@ -106,19 +115,23 @@ module Tinkerforge
|
|
|
106
115
|
# The display uses a special 5x7 pixel charset. You can view the characters
|
|
107
116
|
# of the charset in Brick Viewer.
|
|
108
117
|
def write_line(line, position, text)
|
|
109
|
-
|
|
118
|
+
check_validity
|
|
119
|
+
|
|
120
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z26', 8, ''
|
|
110
121
|
end
|
|
111
122
|
|
|
112
123
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
113
124
|
# the position, the hardware and firmware version as well as the
|
|
114
125
|
# device identifier.
|
|
115
126
|
#
|
|
116
|
-
# 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'.
|
|
117
130
|
#
|
|
118
131
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
119
132
|
# |device_identifier_constant|
|
|
120
133
|
def get_identity
|
|
121
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
134
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
122
135
|
end
|
|
123
136
|
|
|
124
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 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
|
# 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,13 +81,13 @@ 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.
|
|
85
88
|
#
|
|
86
|
-
# The
|
|
87
|
-
#
|
|
88
|
-
# right.
|
|
89
|
+
# The pixels are written into the window line by line top to bottom
|
|
90
|
+
# and each line is written from left to right.
|
|
89
91
|
#
|
|
90
92
|
# If automatic draw is enabled (default) the pixels are directly written to
|
|
91
93
|
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
@@ -99,14 +101,15 @@ module Tinkerforge
|
|
|
99
101
|
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
|
100
102
|
# function.
|
|
101
103
|
def write_pixels_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
|
|
102
|
-
|
|
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, ''
|
|
103
107
|
end
|
|
104
108
|
|
|
105
109
|
# Reads pixels from the specified window.
|
|
106
110
|
#
|
|
107
|
-
# The
|
|
108
|
-
#
|
|
109
|
-
# right.
|
|
111
|
+
# The pixels are read from the window line by line top to bottom
|
|
112
|
+
# and each line is read from left to right.
|
|
110
113
|
#
|
|
111
114
|
# If automatic draw is enabled (default) the pixels that are read are always the
|
|
112
115
|
# same that are shown on the display.
|
|
@@ -117,12 +120,26 @@ module Tinkerforge
|
|
|
117
120
|
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
|
118
121
|
# function.
|
|
119
122
|
def read_pixels_low_level(x_start, y_start, x_end, y_end)
|
|
120
|
-
|
|
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'
|
|
121
126
|
end
|
|
122
127
|
|
|
123
128
|
# Clears the complete content of the display.
|
|
129
|
+
#
|
|
130
|
+
# If automatic draw is enabled (default) the pixels are directly cleared.
|
|
131
|
+
#
|
|
132
|
+
# If automatic draw is disabled the the internal buffer is cleared and
|
|
133
|
+
# the buffer is transferred to the display only after BrickletOLED128x64V2#draw_buffered_frame
|
|
134
|
+
# is called. This can be used to avoid flicker when drawing a complex frame in
|
|
135
|
+
# multiple steps.
|
|
136
|
+
#
|
|
137
|
+
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
|
138
|
+
# function.
|
|
124
139
|
def clear_display
|
|
125
|
-
|
|
140
|
+
check_validity
|
|
141
|
+
|
|
142
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 8, ''
|
|
126
143
|
end
|
|
127
144
|
|
|
128
145
|
# Sets the configuration of the display.
|
|
@@ -134,27 +151,43 @@ module Tinkerforge
|
|
|
134
151
|
# call of BrickletOLED128x64V2#write_pixels or BrickletOLED128x64V2#write_line. If it is set to false, the
|
|
135
152
|
# changes are written into an internal buffer and only shown on the display after
|
|
136
153
|
# a call of BrickletOLED128x64V2#draw_buffered_frame.
|
|
137
|
-
#
|
|
138
|
-
# The default values are contrast 143, inverting off and automatic draw on.
|
|
139
154
|
def set_display_configuration(contrast, invert, automatic_draw)
|
|
140
|
-
|
|
155
|
+
check_validity
|
|
156
|
+
|
|
157
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert, automatic_draw], 'C ? ?', 8, ''
|
|
141
158
|
end
|
|
142
159
|
|
|
143
160
|
# Returns the configuration as set by BrickletOLED128x64V2#set_display_configuration.
|
|
144
161
|
def get_display_configuration
|
|
145
|
-
|
|
162
|
+
check_validity
|
|
163
|
+
|
|
164
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 11, 'C ? ?'
|
|
146
165
|
end
|
|
147
166
|
|
|
148
|
-
# Writes text to a specific line
|
|
149
|
-
#
|
|
167
|
+
# Writes text to a specific line with a specific position.
|
|
168
|
+
# The text can have a maximum of 22 characters.
|
|
150
169
|
#
|
|
151
170
|
# For example: (1, 10, "Hello") will write *Hello* in the middle of the
|
|
152
171
|
# second line of the display.
|
|
153
172
|
#
|
|
154
173
|
# The display uses a special 5x7 pixel charset. You can view the characters
|
|
155
174
|
# of the charset in Brick Viewer.
|
|
175
|
+
#
|
|
176
|
+
# If automatic draw is enabled (default) the text is directly written to
|
|
177
|
+
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
178
|
+
# the rest stays the same.
|
|
179
|
+
#
|
|
180
|
+
# If automatic draw is disabled the text is written to an internal buffer and
|
|
181
|
+
# the buffer is transferred to the display only after BrickletOLED128x64V2#draw_buffered_frame
|
|
182
|
+
# is called. This can be used to avoid flicker when drawing a complex frame in
|
|
183
|
+
# multiple steps.
|
|
184
|
+
#
|
|
185
|
+
# Automatic draw can be configured with the BrickletOLED128x64V2#set_display_configuration
|
|
186
|
+
# function.
|
|
156
187
|
def write_line(line, position, text)
|
|
157
|
-
|
|
188
|
+
check_validity
|
|
189
|
+
|
|
190
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z22', 8, ''
|
|
158
191
|
end
|
|
159
192
|
|
|
160
193
|
# Draws the currently buffered frame. Normally each call of BrickletOLED128x64V2#write_pixels and
|
|
@@ -167,7 +200,9 @@ module Tinkerforge
|
|
|
167
200
|
# instead of only the changed parts. Normally it should not be necessary to set this to
|
|
168
201
|
# *true*. It may only become necessary in case of stuck pixels because of errors.
|
|
169
202
|
def draw_buffered_frame(force_complete_redraw)
|
|
170
|
-
|
|
203
|
+
check_validity
|
|
204
|
+
|
|
205
|
+
send_request FUNCTION_DRAW_BUFFERED_FRAME, [force_complete_redraw], '?', 8, ''
|
|
171
206
|
end
|
|
172
207
|
|
|
173
208
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -182,7 +217,9 @@ module Tinkerforge
|
|
|
182
217
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
183
218
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
184
219
|
def get_spitfp_error_count
|
|
185
|
-
|
|
220
|
+
check_validity
|
|
221
|
+
|
|
222
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
186
223
|
end
|
|
187
224
|
|
|
188
225
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -195,12 +232,16 @@ module Tinkerforge
|
|
|
195
232
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
196
233
|
# necessary to call it in a normal user program.
|
|
197
234
|
def set_bootloader_mode(mode)
|
|
198
|
-
|
|
235
|
+
check_validity
|
|
236
|
+
|
|
237
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
199
238
|
end
|
|
200
239
|
|
|
201
240
|
# Returns the current bootloader mode, see BrickletOLED128x64V2#set_bootloader_mode.
|
|
202
241
|
def get_bootloader_mode
|
|
203
|
-
|
|
242
|
+
check_validity
|
|
243
|
+
|
|
244
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
204
245
|
end
|
|
205
246
|
|
|
206
247
|
# Sets the firmware pointer for BrickletOLED128x64V2#write_firmware. The pointer has
|
|
@@ -210,7 +251,9 @@ module Tinkerforge
|
|
|
210
251
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
211
252
|
# necessary to call it in a normal user program.
|
|
212
253
|
def set_write_firmware_pointer(pointer)
|
|
213
|
-
|
|
254
|
+
check_validity
|
|
255
|
+
|
|
256
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
214
257
|
end
|
|
215
258
|
|
|
216
259
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -222,7 +265,9 @@ module Tinkerforge
|
|
|
222
265
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
223
266
|
# necessary to call it in a normal user program.
|
|
224
267
|
def write_firmware(data)
|
|
225
|
-
|
|
268
|
+
check_validity
|
|
269
|
+
|
|
270
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
226
271
|
end
|
|
227
272
|
|
|
228
273
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -233,22 +278,28 @@ module Tinkerforge
|
|
|
233
278
|
#
|
|
234
279
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
235
280
|
def set_status_led_config(config)
|
|
236
|
-
|
|
281
|
+
check_validity
|
|
282
|
+
|
|
283
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
237
284
|
end
|
|
238
285
|
|
|
239
286
|
# Returns the configuration as set by BrickletOLED128x64V2#set_status_led_config
|
|
240
287
|
def get_status_led_config
|
|
241
|
-
|
|
288
|
+
check_validity
|
|
289
|
+
|
|
290
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
242
291
|
end
|
|
243
292
|
|
|
244
|
-
# Returns the temperature
|
|
293
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
245
294
|
# value returned is not the ambient temperature!
|
|
246
295
|
#
|
|
247
296
|
# The temperature is only proportional to the real temperature and it has bad
|
|
248
297
|
# accuracy. Practically it is only useful as an indicator for
|
|
249
298
|
# temperature changes.
|
|
250
299
|
def get_chip_temperature
|
|
251
|
-
|
|
300
|
+
check_validity
|
|
301
|
+
|
|
302
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
252
303
|
end
|
|
253
304
|
|
|
254
305
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -258,7 +309,9 @@ module Tinkerforge
|
|
|
258
309
|
# calling functions on the existing ones will result in
|
|
259
310
|
# undefined behavior!
|
|
260
311
|
def reset
|
|
261
|
-
|
|
312
|
+
check_validity
|
|
313
|
+
|
|
314
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
262
315
|
end
|
|
263
316
|
|
|
264
317
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -267,32 +320,37 @@ module Tinkerforge
|
|
|
267
320
|
#
|
|
268
321
|
# We recommend that you use Brick Viewer to change the UID.
|
|
269
322
|
def write_uid(uid)
|
|
270
|
-
|
|
323
|
+
check_validity
|
|
324
|
+
|
|
325
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
271
326
|
end
|
|
272
327
|
|
|
273
328
|
# Returns the current UID as an integer. Encode as
|
|
274
329
|
# Base58 to get the usual string version.
|
|
275
330
|
def read_uid
|
|
276
|
-
|
|
331
|
+
check_validity
|
|
332
|
+
|
|
333
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
277
334
|
end
|
|
278
335
|
|
|
279
336
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
280
337
|
# the position, the hardware and firmware version as well as the
|
|
281
338
|
# device identifier.
|
|
282
339
|
#
|
|
283
|
-
# 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'.
|
|
284
343
|
#
|
|
285
344
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
286
345
|
# |device_identifier_constant|
|
|
287
346
|
def get_identity
|
|
288
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
347
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
289
348
|
end
|
|
290
349
|
|
|
291
350
|
# Writes pixels to the specified window.
|
|
292
351
|
#
|
|
293
|
-
# The
|
|
294
|
-
#
|
|
295
|
-
# right.
|
|
352
|
+
# The pixels are written into the window line by line top to bottom
|
|
353
|
+
# and each line is written from left to right.
|
|
296
354
|
#
|
|
297
355
|
# If automatic draw is enabled (default) the pixels are directly written to
|
|
298
356
|
# the screen. Only pixels that have actually changed are updated on the screen,
|
|
@@ -338,9 +396,8 @@ module Tinkerforge
|
|
|
338
396
|
|
|
339
397
|
# Reads pixels from the specified window.
|
|
340
398
|
#
|
|
341
|
-
# The
|
|
342
|
-
#
|
|
343
|
-
# right.
|
|
399
|
+
# The pixels are read from the window line by line top to bottom
|
|
400
|
+
# and each line is read from left to right.
|
|
344
401
|
#
|
|
345
402
|
# If automatic draw is enabled (default) the pixels that are read are always the
|
|
346
403
|
# same that are shown on the display.
|