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
|
# Three color 296x128 e-paper display
|
14
16
|
class BrickletEPaper296x128 < Device
|
@@ -89,7 +91,7 @@ module Tinkerforge
|
|
89
91
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
90
92
|
# the IP Connection <tt>ipcon</tt>.
|
91
93
|
def initialize(uid, ipcon)
|
92
|
-
super uid, ipcon
|
94
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
93
95
|
|
94
96
|
@api_version = [2, 0, 0]
|
95
97
|
|
@@ -120,8 +122,9 @@ module Tinkerforge
|
|
120
122
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
121
123
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
122
124
|
|
123
|
-
@callback_formats[CALLBACK_DRAW_STATUS] = 'C'
|
125
|
+
@callback_formats[CALLBACK_DRAW_STATUS] = [9, 'C']
|
124
126
|
|
127
|
+
@ipcon.add_device self
|
125
128
|
end
|
126
129
|
|
127
130
|
# Draws the current black/white and red or gray buffer to the e-paper display.
|
@@ -129,7 +132,9 @@ module Tinkerforge
|
|
129
132
|
# The Bricklet does not have any double-buffering. You should not call
|
130
133
|
# this function while writing to the buffer. See BrickletEPaper296x128#get_draw_status.
|
131
134
|
def draw
|
132
|
-
|
135
|
+
check_validity
|
136
|
+
|
137
|
+
send_request FUNCTION_DRAW, [], '', 8, ''
|
133
138
|
end
|
134
139
|
|
135
140
|
# Returns one of three draw statuses:
|
@@ -142,7 +147,9 @@ module Tinkerforge
|
|
142
147
|
# either *idle* or *drawing*. You should not write to the buffer while it is being *copied* to the
|
143
148
|
# display. There is no double-buffering.
|
144
149
|
def get_draw_status
|
145
|
-
|
150
|
+
check_validity
|
151
|
+
|
152
|
+
send_request FUNCTION_GET_DRAW_STATUS, [], '', 9, 'C'
|
146
153
|
end
|
147
154
|
|
148
155
|
# Writes black/white pixels to the specified window into the buffer.
|
@@ -158,7 +165,9 @@ module Tinkerforge
|
|
158
165
|
#
|
159
166
|
# Use BrickletEPaper296x128#write_color to write red or gray pixels.
|
160
167
|
def write_black_white_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
|
161
|
-
|
168
|
+
check_validity
|
169
|
+
|
170
|
+
send_request FUNCTION_WRITE_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 8, ''
|
162
171
|
end
|
163
172
|
|
164
173
|
# Returns the current content of the black/white pixel buffer for the specified window.
|
@@ -170,7 +179,9 @@ module Tinkerforge
|
|
170
179
|
# It is possible that the data was not drawn to the display yet and after a restart of
|
171
180
|
# the Bricklet the buffer will be reset to black, while the display retains its content.
|
172
181
|
def read_black_white_low_level(x_start, y_start, x_end, y_end)
|
173
|
-
|
182
|
+
check_validity
|
183
|
+
|
184
|
+
send_request FUNCTION_READ_BLACK_WHITE_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 70, 'S S ?464'
|
174
185
|
end
|
175
186
|
|
176
187
|
# The E-Paper 296x128 Bricklet is available with the colors black/white/red and
|
@@ -189,7 +200,9 @@ module Tinkerforge
|
|
189
200
|
#
|
190
201
|
# Use BrickletEPaper296x128#write_black_white to write black/white pixels.
|
191
202
|
def write_color_low_level(x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data)
|
192
|
-
|
203
|
+
check_validity
|
204
|
+
|
205
|
+
send_request FUNCTION_WRITE_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end, pixels_length, pixels_chunk_offset, pixels_chunk_data], 'S C S C S S ?432', 8, ''
|
193
206
|
end
|
194
207
|
|
195
208
|
# Returns the current content of the red or gray pixel buffer for the specified window.
|
@@ -201,7 +214,9 @@ module Tinkerforge
|
|
201
214
|
# It is possible that the data was not drawn to the display yet and after a restart of
|
202
215
|
# the Bricklet the buffer will be reset to black, while the display retains its content.
|
203
216
|
def read_color_low_level(x_start, y_start, x_end, y_end)
|
204
|
-
|
217
|
+
check_validity
|
218
|
+
|
219
|
+
send_request FUNCTION_READ_COLOR_LOW_LEVEL, [x_start, y_start, x_end, y_end], 'S C S C', 70, 'S S ?464'
|
205
220
|
end
|
206
221
|
|
207
222
|
# Fills the complete content of the display with the given color.
|
@@ -209,7 +224,9 @@ module Tinkerforge
|
|
209
224
|
# This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
|
210
225
|
# to the display use BrickletEPaper296x128#draw.
|
211
226
|
def fill_display(color)
|
212
|
-
|
227
|
+
check_validity
|
228
|
+
|
229
|
+
send_request FUNCTION_FILL_DISPLAY, [color], 'C', 8, ''
|
213
230
|
end
|
214
231
|
|
215
232
|
# Draws a text with up to 50 characters at the pixel position (x, y).
|
@@ -220,7 +237,9 @@ module Tinkerforge
|
|
220
237
|
# This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
|
221
238
|
# to the display use BrickletEPaper296x128#draw.
|
222
239
|
def draw_text(position_x, position_y, font, color, orientation, text)
|
223
|
-
|
240
|
+
check_validity
|
241
|
+
|
242
|
+
send_request FUNCTION_DRAW_TEXT, [position_x, position_y, font, color, orientation, text], 'S C C C C Z50', 8, ''
|
224
243
|
end
|
225
244
|
|
226
245
|
# Draws a line from (x, y)-start to (x, y)-end in the given color.
|
@@ -228,7 +247,9 @@ module Tinkerforge
|
|
228
247
|
# This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
|
229
248
|
# to the display use BrickletEPaper296x128#draw.
|
230
249
|
def draw_line(position_x_start, position_y_start, position_x_end, position_y_end, color)
|
231
|
-
|
250
|
+
check_validity
|
251
|
+
|
252
|
+
send_request FUNCTION_DRAW_LINE, [position_x_start, position_y_start, position_x_end, position_y_end, color], 'S C S C C', 8, ''
|
232
253
|
end
|
233
254
|
|
234
255
|
# Draws a box from (x, y)-start to (x, y)-end in the given color.
|
@@ -239,7 +260,9 @@ module Tinkerforge
|
|
239
260
|
# This function writes the pixels into the black/white/red|gray pixel buffer, to draw the buffer
|
240
261
|
# to the display use BrickletEPaper296x128#draw.
|
241
262
|
def draw_box(position_x_start, position_y_start, position_x_end, position_y_end, fill, color)
|
242
|
-
|
263
|
+
check_validity
|
264
|
+
|
265
|
+
send_request FUNCTION_DRAW_BOX, [position_x_start, position_y_start, position_x_end, position_y_end, fill, color], 'S C S C ? C', 8, ''
|
243
266
|
end
|
244
267
|
|
245
268
|
# .. note::
|
@@ -277,12 +300,16 @@ module Tinkerforge
|
|
277
300
|
# three available colors a few times. This will get rid of the ghosting and after that you can
|
278
301
|
# go back to the delta mode with flicker-free updates.
|
279
302
|
def set_update_mode(update_mode)
|
280
|
-
|
303
|
+
check_validity
|
304
|
+
|
305
|
+
send_request FUNCTION_SET_UPDATE_MODE, [update_mode], 'C', 8, ''
|
281
306
|
end
|
282
307
|
|
283
308
|
# Returns the update mode as set by BrickletEPaper296x128#set_update_mode.
|
284
309
|
def get_update_mode
|
285
|
-
|
310
|
+
check_validity
|
311
|
+
|
312
|
+
send_request FUNCTION_GET_UPDATE_MODE, [], '', 9, 'C'
|
286
313
|
end
|
287
314
|
|
288
315
|
# Sets the type of the display. The e-paper display is available
|
@@ -290,13 +317,17 @@ module Tinkerforge
|
|
290
317
|
# during the flashing and testing phase. The value is saved in
|
291
318
|
# non-volatile memory and will stay after a power cycle.
|
292
319
|
def set_display_type(display_type)
|
293
|
-
|
320
|
+
check_validity
|
321
|
+
|
322
|
+
send_request FUNCTION_SET_DISPLAY_TYPE, [display_type], 'C', 8, ''
|
294
323
|
end
|
295
324
|
|
296
325
|
# Returns the type of the e-paper display. It can either be
|
297
326
|
# black/white/red or black/white/gray.
|
298
327
|
def get_display_type
|
299
|
-
|
328
|
+
check_validity
|
329
|
+
|
330
|
+
send_request FUNCTION_GET_DISPLAY_TYPE, [], '', 9, 'C'
|
300
331
|
end
|
301
332
|
|
302
333
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -311,7 +342,9 @@ module Tinkerforge
|
|
311
342
|
# The errors counts are for errors that occur on the Bricklet side. All
|
312
343
|
# Bricks have a similar function that returns the errors on the Brick side.
|
313
344
|
def get_spitfp_error_count
|
314
|
-
|
345
|
+
check_validity
|
346
|
+
|
347
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
315
348
|
end
|
316
349
|
|
317
350
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -324,12 +357,16 @@ module Tinkerforge
|
|
324
357
|
# This function is used by Brick Viewer during flashing. It should not be
|
325
358
|
# necessary to call it in a normal user program.
|
326
359
|
def set_bootloader_mode(mode)
|
327
|
-
|
360
|
+
check_validity
|
361
|
+
|
362
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
328
363
|
end
|
329
364
|
|
330
365
|
# Returns the current bootloader mode, see BrickletEPaper296x128#set_bootloader_mode.
|
331
366
|
def get_bootloader_mode
|
332
|
-
|
367
|
+
check_validity
|
368
|
+
|
369
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
333
370
|
end
|
334
371
|
|
335
372
|
# Sets the firmware pointer for BrickletEPaper296x128#write_firmware. The pointer has
|
@@ -339,7 +376,9 @@ module Tinkerforge
|
|
339
376
|
# This function is used by Brick Viewer during flashing. It should not be
|
340
377
|
# necessary to call it in a normal user program.
|
341
378
|
def set_write_firmware_pointer(pointer)
|
342
|
-
|
379
|
+
check_validity
|
380
|
+
|
381
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
343
382
|
end
|
344
383
|
|
345
384
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -351,7 +390,9 @@ module Tinkerforge
|
|
351
390
|
# This function is used by Brick Viewer during flashing. It should not be
|
352
391
|
# necessary to call it in a normal user program.
|
353
392
|
def write_firmware(data)
|
354
|
-
|
393
|
+
check_validity
|
394
|
+
|
395
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
355
396
|
end
|
356
397
|
|
357
398
|
# Sets the status LED configuration. By default the LED shows
|
@@ -362,22 +403,28 @@ module Tinkerforge
|
|
362
403
|
#
|
363
404
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
364
405
|
def set_status_led_config(config)
|
365
|
-
|
406
|
+
check_validity
|
407
|
+
|
408
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
366
409
|
end
|
367
410
|
|
368
411
|
# Returns the configuration as set by BrickletEPaper296x128#set_status_led_config
|
369
412
|
def get_status_led_config
|
370
|
-
|
413
|
+
check_validity
|
414
|
+
|
415
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
371
416
|
end
|
372
417
|
|
373
|
-
# Returns the temperature
|
418
|
+
# Returns the temperature as measured inside the microcontroller. The
|
374
419
|
# value returned is not the ambient temperature!
|
375
420
|
#
|
376
421
|
# The temperature is only proportional to the real temperature and it has bad
|
377
422
|
# accuracy. Practically it is only useful as an indicator for
|
378
423
|
# temperature changes.
|
379
424
|
def get_chip_temperature
|
380
|
-
|
425
|
+
check_validity
|
426
|
+
|
427
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
381
428
|
end
|
382
429
|
|
383
430
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -387,7 +434,9 @@ module Tinkerforge
|
|
387
434
|
# calling functions on the existing ones will result in
|
388
435
|
# undefined behavior!
|
389
436
|
def reset
|
390
|
-
|
437
|
+
check_validity
|
438
|
+
|
439
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
391
440
|
end
|
392
441
|
|
393
442
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -396,25 +445,31 @@ module Tinkerforge
|
|
396
445
|
#
|
397
446
|
# We recommend that you use Brick Viewer to change the UID.
|
398
447
|
def write_uid(uid)
|
399
|
-
|
448
|
+
check_validity
|
449
|
+
|
450
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
400
451
|
end
|
401
452
|
|
402
453
|
# Returns the current UID as an integer. Encode as
|
403
454
|
# Base58 to get the usual string version.
|
404
455
|
def read_uid
|
405
|
-
|
456
|
+
check_validity
|
457
|
+
|
458
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
406
459
|
end
|
407
460
|
|
408
461
|
# Returns the UID, the UID where the Bricklet is connected to,
|
409
462
|
# the position, the hardware and firmware version as well as the
|
410
463
|
# device identifier.
|
411
464
|
#
|
412
|
-
# The position can be 'a', 'b', 'c' or '
|
465
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
466
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
467
|
+
# position 'z'.
|
413
468
|
#
|
414
469
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
415
470
|
# |device_identifier_constant|
|
416
471
|
def get_identity
|
417
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
472
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
418
473
|
end
|
419
474
|
|
420
475
|
# Writes black/white pixels to the specified window into the buffer.
|
@@ -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
|
# Measures Voltage, Current, Energy, Real/Apparent/Reactive Power, Power Factor and Frequency
|
14
16
|
class BrickletEnergyMonitor < 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
|
|
@@ -88,8 +90,9 @@ module Tinkerforge
|
|
88
90
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
91
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
90
92
|
|
91
|
-
@callback_formats[CALLBACK_ENERGY_DATA] = 'l l l l l l S S'
|
93
|
+
@callback_formats[CALLBACK_ENERGY_DATA] = [36, 'l l l l l l S S']
|
92
94
|
|
95
|
+
@ipcon.add_device self
|
93
96
|
end
|
94
97
|
|
95
98
|
# Returns all of the measurements that are done by the Energy Monitor Bricklet.
|
@@ -113,12 +116,16 @@ module Tinkerforge
|
|
113
116
|
# to calculate the frequency and it will use an integration time of
|
114
117
|
# 10 zero-crossings of the current waveform.
|
115
118
|
def get_energy_data
|
116
|
-
|
119
|
+
check_validity
|
120
|
+
|
121
|
+
send_request FUNCTION_GET_ENERGY_DATA, [], '', 36, 'l l l l l l S S'
|
117
122
|
end
|
118
123
|
|
119
124
|
# Sets the energy value (see BrickletEnergyMonitor#get_energy_data) back to 0Wh.
|
120
125
|
def reset_energy
|
121
|
-
|
126
|
+
check_validity
|
127
|
+
|
128
|
+
send_request FUNCTION_RESET_ENERGY, [], '', 8, ''
|
122
129
|
end
|
123
130
|
|
124
131
|
# Returns a snapshot of the voltage and current waveform. The values
|
@@ -132,12 +139,16 @@ module Tinkerforge
|
|
132
139
|
# This data is meant to be used for a non-realtime graphical representation of
|
133
140
|
# the voltage and current waveforms.
|
134
141
|
def get_waveform_low_level
|
135
|
-
|
142
|
+
check_validity
|
143
|
+
|
144
|
+
send_request FUNCTION_GET_WAVEFORM_LOW_LEVEL, [], '', 70, 'S s30'
|
136
145
|
end
|
137
146
|
|
138
147
|
# Returns *true* if a voltage/current transformer is connected to the Bricklet.
|
139
148
|
def get_transformer_status
|
140
|
-
|
149
|
+
check_validity
|
150
|
+
|
151
|
+
send_request FUNCTION_GET_TRANSFORMER_STATUS, [], '', 10, '? ?'
|
141
152
|
end
|
142
153
|
|
143
154
|
# Sets the transformer ratio for the voltage and current transformer in 1/100 form.
|
@@ -153,12 +164,16 @@ module Tinkerforge
|
|
153
164
|
#
|
154
165
|
# Set the phase shift to 0. It is for future use and currently not supported by the Bricklet.
|
155
166
|
def set_transformer_calibration(voltage_ratio, current_ratio, phase_shift)
|
156
|
-
|
167
|
+
check_validity
|
168
|
+
|
169
|
+
send_request FUNCTION_SET_TRANSFORMER_CALIBRATION, [voltage_ratio, current_ratio, phase_shift], 'S S s', 8, ''
|
157
170
|
end
|
158
171
|
|
159
172
|
# Returns the transformer calibration as set by BrickletEnergyMonitor#set_transformer_calibration.
|
160
173
|
def get_transformer_calibration
|
161
|
-
|
174
|
+
check_validity
|
175
|
+
|
176
|
+
send_request FUNCTION_GET_TRANSFORMER_CALIBRATION, [], '', 14, 'S S s'
|
162
177
|
end
|
163
178
|
|
164
179
|
# Calling this function will start an offset calibration. The offset calibration will
|
@@ -174,7 +189,9 @@ module Tinkerforge
|
|
174
189
|
#
|
175
190
|
# The calibration is saved in non-volatile memory, you only have to set it once.
|
176
191
|
def calibrate_offset
|
177
|
-
|
192
|
+
check_validity
|
193
|
+
|
194
|
+
send_request FUNCTION_CALIBRATE_OFFSET, [], '', 8, ''
|
178
195
|
end
|
179
196
|
|
180
197
|
# The period is the period with which the CALLBACK_ENERGY_DATA
|
@@ -187,13 +204,17 @@ module Tinkerforge
|
|
187
204
|
# If it is set to false, the callback is continuously triggered with the period,
|
188
205
|
# independent of the value.
|
189
206
|
def set_energy_data_callback_configuration(period, value_has_to_change)
|
190
|
-
|
207
|
+
check_validity
|
208
|
+
|
209
|
+
send_request FUNCTION_SET_ENERGY_DATA_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
191
210
|
end
|
192
211
|
|
193
212
|
# Returns the callback configuration as set by
|
194
213
|
# BrickletEnergyMonitor#set_energy_data_callback_configuration.
|
195
214
|
def get_energy_data_callback_configuration
|
196
|
-
|
215
|
+
check_validity
|
216
|
+
|
217
|
+
send_request FUNCTION_GET_ENERGY_DATA_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
197
218
|
end
|
198
219
|
|
199
220
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -208,7 +229,9 @@ module Tinkerforge
|
|
208
229
|
# The errors counts are for errors that occur on the Bricklet side. All
|
209
230
|
# Bricks have a similar function that returns the errors on the Brick side.
|
210
231
|
def get_spitfp_error_count
|
211
|
-
|
232
|
+
check_validity
|
233
|
+
|
234
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
212
235
|
end
|
213
236
|
|
214
237
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -221,12 +244,16 @@ module Tinkerforge
|
|
221
244
|
# This function is used by Brick Viewer during flashing. It should not be
|
222
245
|
# necessary to call it in a normal user program.
|
223
246
|
def set_bootloader_mode(mode)
|
224
|
-
|
247
|
+
check_validity
|
248
|
+
|
249
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
225
250
|
end
|
226
251
|
|
227
252
|
# Returns the current bootloader mode, see BrickletEnergyMonitor#set_bootloader_mode.
|
228
253
|
def get_bootloader_mode
|
229
|
-
|
254
|
+
check_validity
|
255
|
+
|
256
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
230
257
|
end
|
231
258
|
|
232
259
|
# Sets the firmware pointer for BrickletEnergyMonitor#write_firmware. The pointer has
|
@@ -236,7 +263,9 @@ module Tinkerforge
|
|
236
263
|
# This function is used by Brick Viewer during flashing. It should not be
|
237
264
|
# necessary to call it in a normal user program.
|
238
265
|
def set_write_firmware_pointer(pointer)
|
239
|
-
|
266
|
+
check_validity
|
267
|
+
|
268
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
240
269
|
end
|
241
270
|
|
242
271
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -248,7 +277,9 @@ module Tinkerforge
|
|
248
277
|
# This function is used by Brick Viewer during flashing. It should not be
|
249
278
|
# necessary to call it in a normal user program.
|
250
279
|
def write_firmware(data)
|
251
|
-
|
280
|
+
check_validity
|
281
|
+
|
282
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
252
283
|
end
|
253
284
|
|
254
285
|
# Sets the status LED configuration. By default the LED shows
|
@@ -259,22 +290,28 @@ module Tinkerforge
|
|
259
290
|
#
|
260
291
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
261
292
|
def set_status_led_config(config)
|
262
|
-
|
293
|
+
check_validity
|
294
|
+
|
295
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
263
296
|
end
|
264
297
|
|
265
298
|
# Returns the configuration as set by BrickletEnergyMonitor#set_status_led_config
|
266
299
|
def get_status_led_config
|
267
|
-
|
300
|
+
check_validity
|
301
|
+
|
302
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
268
303
|
end
|
269
304
|
|
270
|
-
# Returns the temperature
|
305
|
+
# Returns the temperature as measured inside the microcontroller. The
|
271
306
|
# value returned is not the ambient temperature!
|
272
307
|
#
|
273
308
|
# The temperature is only proportional to the real temperature and it has bad
|
274
309
|
# accuracy. Practically it is only useful as an indicator for
|
275
310
|
# temperature changes.
|
276
311
|
def get_chip_temperature
|
277
|
-
|
312
|
+
check_validity
|
313
|
+
|
314
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
278
315
|
end
|
279
316
|
|
280
317
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -284,7 +321,9 @@ module Tinkerforge
|
|
284
321
|
# calling functions on the existing ones will result in
|
285
322
|
# undefined behavior!
|
286
323
|
def reset
|
287
|
-
|
324
|
+
check_validity
|
325
|
+
|
326
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
288
327
|
end
|
289
328
|
|
290
329
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -293,25 +332,31 @@ module Tinkerforge
|
|
293
332
|
#
|
294
333
|
# We recommend that you use Brick Viewer to change the UID.
|
295
334
|
def write_uid(uid)
|
296
|
-
|
335
|
+
check_validity
|
336
|
+
|
337
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
297
338
|
end
|
298
339
|
|
299
340
|
# Returns the current UID as an integer. Encode as
|
300
341
|
# Base58 to get the usual string version.
|
301
342
|
def read_uid
|
302
|
-
|
343
|
+
check_validity
|
344
|
+
|
345
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
303
346
|
end
|
304
347
|
|
305
348
|
# Returns the UID, the UID where the Bricklet is connected to,
|
306
349
|
# the position, the hardware and firmware version as well as the
|
307
350
|
# device identifier.
|
308
351
|
#
|
309
|
-
# The position can be 'a', 'b', 'c' or '
|
352
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
353
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
354
|
+
# position 'z'.
|
310
355
|
#
|
311
356
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
312
357
|
# |device_identifier_constant|
|
313
358
|
def get_identity
|
314
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
359
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
315
360
|
end
|
316
361
|
|
317
362
|
# Returns a snapshot of the voltage and current waveform. The values
|