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
|
# Battery-backed real-time clock
|
14
16
|
class BrickletRealTimeClockV2 < Device
|
@@ -75,7 +77,7 @@ module Tinkerforge
|
|
75
77
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
76
78
|
# the IP Connection <tt>ipcon</tt>.
|
77
79
|
def initialize(uid, ipcon)
|
78
|
-
super uid, ipcon
|
80
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
79
81
|
|
80
82
|
@api_version = [2, 0, 0]
|
81
83
|
|
@@ -101,24 +103,13 @@ module Tinkerforge
|
|
101
103
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
102
104
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
103
105
|
|
104
|
-
@callback_formats[CALLBACK_DATE_TIME] = 'S C C C C C C C q'
|
105
|
-
@callback_formats[CALLBACK_ALARM] = 'S C C C C C C C q'
|
106
|
+
@callback_formats[CALLBACK_DATE_TIME] = [25, 'S C C C C C C C q']
|
107
|
+
@callback_formats[CALLBACK_ALARM] = [25, 'S C C C C C C C q']
|
106
108
|
|
109
|
+
@ipcon.add_device self
|
107
110
|
end
|
108
111
|
|
109
|
-
# Sets the current date (including weekday) and the current time
|
110
|
-
# of a second resolution.
|
111
|
-
#
|
112
|
-
# Possible value ranges:
|
113
|
-
#
|
114
|
-
# * Year: 2000 to 2099
|
115
|
-
# * Month: 1 to 12 (January to December)
|
116
|
-
# * Day: 1 to 31
|
117
|
-
# * Hour: 0 to 23
|
118
|
-
# * Minute: 0 to 59
|
119
|
-
# * Second: 0 to 59
|
120
|
-
# * Centisecond: 0 to 99
|
121
|
-
# * Weekday: 1 to 7 (Monday to Sunday)
|
112
|
+
# Sets the current date (including weekday) and the current time.
|
122
113
|
#
|
123
114
|
# If the backup battery is installed then the real-time clock keeps date and
|
124
115
|
# time even if the Bricklet is not powered by a Brick.
|
@@ -127,23 +118,29 @@ module Tinkerforge
|
|
127
118
|
# accordingly. But leap seconds, time zones and daylight saving time are not
|
128
119
|
# handled.
|
129
120
|
def set_date_time(year, month, day, hour, minute, second, centisecond, weekday)
|
130
|
-
|
121
|
+
check_validity
|
122
|
+
|
123
|
+
send_request FUNCTION_SET_DATE_TIME, [year, month, day, hour, minute, second, centisecond, weekday], 'S C C C C C C C', 8, ''
|
131
124
|
end
|
132
125
|
|
133
126
|
# Returns the current date (including weekday) and the current time of the
|
134
|
-
# real-time
|
127
|
+
# real-time.
|
135
128
|
#
|
136
129
|
# The timestamp represents the current date and the the current time of the
|
137
|
-
# real-time clock converted to milliseconds.
|
130
|
+
# real-time clock converted to milliseconds and is an offset to 2000-01-01 00:00:00.0000.
|
138
131
|
def get_date_time
|
139
|
-
|
132
|
+
check_validity
|
133
|
+
|
134
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 25, 'S C C C C C C C q'
|
140
135
|
end
|
141
136
|
|
142
137
|
# Returns the current date and the time of the real-time clock converted to
|
143
138
|
# milliseconds. The timestamp has an effective resolution of hundredths of a
|
144
|
-
# second.
|
139
|
+
# second and is an offset to 2000-01-01 00:00:00.0000.
|
145
140
|
def get_timestamp
|
146
|
-
|
141
|
+
check_validity
|
142
|
+
|
143
|
+
send_request FUNCTION_GET_TIMESTAMP, [], '', 16, 'q'
|
147
144
|
end
|
148
145
|
|
149
146
|
# Sets the offset the real-time clock should compensate for in 2.17 ppm steps
|
@@ -172,23 +169,31 @@ module Tinkerforge
|
|
172
169
|
# The offset is saved in the EEPROM of the Bricklet and only needs to be
|
173
170
|
# configured once.
|
174
171
|
def set_offset(offset)
|
175
|
-
|
172
|
+
check_validity
|
173
|
+
|
174
|
+
send_request FUNCTION_SET_OFFSET, [offset], 'c', 8, ''
|
176
175
|
end
|
177
176
|
|
178
177
|
# Returns the offset as set by BrickletRealTimeClockV2#set_offset.
|
179
178
|
def get_offset
|
180
|
-
|
179
|
+
check_validity
|
180
|
+
|
181
|
+
send_request FUNCTION_GET_OFFSET, [], '', 9, 'c'
|
181
182
|
end
|
182
183
|
|
183
184
|
# Sets the period with which the CALLBACK_DATE_TIME callback is triggered
|
184
185
|
# periodically. A value of 0 turns the callback off.
|
185
186
|
def set_date_time_callback_configuration(period)
|
186
|
-
|
187
|
+
check_validity
|
188
|
+
|
189
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_CONFIGURATION, [period], 'L', 8, ''
|
187
190
|
end
|
188
191
|
|
189
192
|
# Returns the period as set by BrickletRealTimeClockV2#set_date_time_callback_configuration.
|
190
193
|
def get_date_time_callback_configuration
|
191
|
-
|
194
|
+
check_validity
|
195
|
+
|
196
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_CONFIGURATION, [], '', 12, 'L'
|
192
197
|
end
|
193
198
|
|
194
199
|
# Configures a repeatable alarm. The CALLBACK_ALARM callback is triggered if the
|
@@ -216,12 +221,16 @@ module Tinkerforge
|
|
216
221
|
# example, configuring the alarm as (-1, -1, 7, 30, -1, -1, 300) results in an
|
217
222
|
# alarm that triggers every day at 7:30 AM and is then repeated every 5 minutes.
|
218
223
|
def set_alarm(month, day, hour, minute, second, weekday, interval)
|
219
|
-
|
224
|
+
check_validity
|
225
|
+
|
226
|
+
send_request FUNCTION_SET_ALARM, [month, day, hour, minute, second, weekday, interval], 'c c c c c c l', 8, ''
|
220
227
|
end
|
221
228
|
|
222
229
|
# Returns the alarm configuration as set by BrickletRealTimeClockV2#set_alarm.
|
223
230
|
def get_alarm
|
224
|
-
|
231
|
+
check_validity
|
232
|
+
|
233
|
+
send_request FUNCTION_GET_ALARM, [], '', 18, 'c c c c c c l'
|
225
234
|
end
|
226
235
|
|
227
236
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -236,7 +245,9 @@ module Tinkerforge
|
|
236
245
|
# The errors counts are for errors that occur on the Bricklet side. All
|
237
246
|
# Bricks have a similar function that returns the errors on the Brick side.
|
238
247
|
def get_spitfp_error_count
|
239
|
-
|
248
|
+
check_validity
|
249
|
+
|
250
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
240
251
|
end
|
241
252
|
|
242
253
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -249,12 +260,16 @@ module Tinkerforge
|
|
249
260
|
# This function is used by Brick Viewer during flashing. It should not be
|
250
261
|
# necessary to call it in a normal user program.
|
251
262
|
def set_bootloader_mode(mode)
|
252
|
-
|
263
|
+
check_validity
|
264
|
+
|
265
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
253
266
|
end
|
254
267
|
|
255
268
|
# Returns the current bootloader mode, see BrickletRealTimeClockV2#set_bootloader_mode.
|
256
269
|
def get_bootloader_mode
|
257
|
-
|
270
|
+
check_validity
|
271
|
+
|
272
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
258
273
|
end
|
259
274
|
|
260
275
|
# Sets the firmware pointer for BrickletRealTimeClockV2#write_firmware. The pointer has
|
@@ -264,7 +279,9 @@ module Tinkerforge
|
|
264
279
|
# This function is used by Brick Viewer during flashing. It should not be
|
265
280
|
# necessary to call it in a normal user program.
|
266
281
|
def set_write_firmware_pointer(pointer)
|
267
|
-
|
282
|
+
check_validity
|
283
|
+
|
284
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
268
285
|
end
|
269
286
|
|
270
287
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -276,7 +293,9 @@ module Tinkerforge
|
|
276
293
|
# This function is used by Brick Viewer during flashing. It should not be
|
277
294
|
# necessary to call it in a normal user program.
|
278
295
|
def write_firmware(data)
|
279
|
-
|
296
|
+
check_validity
|
297
|
+
|
298
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
280
299
|
end
|
281
300
|
|
282
301
|
# Sets the status LED configuration. By default the LED shows
|
@@ -287,22 +306,28 @@ module Tinkerforge
|
|
287
306
|
#
|
288
307
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
289
308
|
def set_status_led_config(config)
|
290
|
-
|
309
|
+
check_validity
|
310
|
+
|
311
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
291
312
|
end
|
292
313
|
|
293
314
|
# Returns the configuration as set by BrickletRealTimeClockV2#set_status_led_config
|
294
315
|
def get_status_led_config
|
295
|
-
|
316
|
+
check_validity
|
317
|
+
|
318
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
296
319
|
end
|
297
320
|
|
298
|
-
# Returns the temperature
|
321
|
+
# Returns the temperature as measured inside the microcontroller. The
|
299
322
|
# value returned is not the ambient temperature!
|
300
323
|
#
|
301
324
|
# The temperature is only proportional to the real temperature and it has bad
|
302
325
|
# accuracy. Practically it is only useful as an indicator for
|
303
326
|
# temperature changes.
|
304
327
|
def get_chip_temperature
|
305
|
-
|
328
|
+
check_validity
|
329
|
+
|
330
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
306
331
|
end
|
307
332
|
|
308
333
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -312,7 +337,9 @@ module Tinkerforge
|
|
312
337
|
# calling functions on the existing ones will result in
|
313
338
|
# undefined behavior!
|
314
339
|
def reset
|
315
|
-
|
340
|
+
check_validity
|
341
|
+
|
342
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
316
343
|
end
|
317
344
|
|
318
345
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -321,25 +348,31 @@ module Tinkerforge
|
|
321
348
|
#
|
322
349
|
# We recommend that you use Brick Viewer to change the UID.
|
323
350
|
def write_uid(uid)
|
324
|
-
|
351
|
+
check_validity
|
352
|
+
|
353
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
325
354
|
end
|
326
355
|
|
327
356
|
# Returns the current UID as an integer. Encode as
|
328
357
|
# Base58 to get the usual string version.
|
329
358
|
def read_uid
|
330
|
-
|
359
|
+
check_validity
|
360
|
+
|
361
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
331
362
|
end
|
332
363
|
|
333
364
|
# Returns the UID, the UID where the Bricklet is connected to,
|
334
365
|
# the position, the hardware and firmware version as well as the
|
335
366
|
# device identifier.
|
336
367
|
#
|
337
|
-
# The position can be 'a', 'b', 'c' or '
|
368
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
369
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
370
|
+
# position 'z'.
|
338
371
|
#
|
339
372
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
340
373
|
# |device_identifier_constant|
|
341
374
|
def get_identity
|
342
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
375
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
343
376
|
end
|
344
377
|
|
345
378
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Controls remote mains switches
|
14
16
|
class BrickletRemoteSwitch < Device
|
@@ -37,7 +39,7 @@ module Tinkerforge
|
|
37
39
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
38
40
|
# the IP Connection <tt>ipcon</tt>.
|
39
41
|
def initialize(uid, ipcon)
|
40
|
-
super uid, ipcon
|
42
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
41
43
|
|
42
44
|
@api_version = [2, 0, 1]
|
43
45
|
|
@@ -51,108 +53,115 @@ module Tinkerforge
|
|
51
53
|
@response_expected[FUNCTION_SWITCH_SOCKET_C] = RESPONSE_EXPECTED_FALSE
|
52
54
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
53
55
|
|
54
|
-
@callback_formats[CALLBACK_SWITCHING_DONE] = ''
|
56
|
+
@callback_formats[CALLBACK_SWITCHING_DONE] = [8, '']
|
55
57
|
|
58
|
+
@ipcon.add_device self
|
56
59
|
end
|
57
60
|
|
58
61
|
# This function is deprecated, use BrickletRemoteSwitch#switch_socket_a instead.
|
59
62
|
def switch_socket(house_code, receiver_code, switch_to)
|
60
|
-
|
63
|
+
check_validity
|
64
|
+
|
65
|
+
send_request FUNCTION_SWITCH_SOCKET, [house_code, receiver_code, switch_to], 'C C C', 8, ''
|
61
66
|
end
|
62
67
|
|
63
68
|
# Returns the current switching state. If the current state is busy, the
|
64
69
|
# Bricklet is currently sending a code to switch a socket. It will not
|
65
|
-
# accept any
|
70
|
+
# accept any requests to switch sockets until the state changes to ready.
|
66
71
|
#
|
67
72
|
# How long the switching takes is dependent on the number of repeats, see
|
68
73
|
# BrickletRemoteSwitch#set_repeats.
|
69
74
|
def get_switching_state
|
70
|
-
|
75
|
+
check_validity
|
76
|
+
|
77
|
+
send_request FUNCTION_GET_SWITCHING_STATE, [], '', 9, 'C'
|
71
78
|
end
|
72
79
|
|
73
|
-
# Sets the number of times the code is
|
80
|
+
# Sets the number of times the code is sent when one of the switch socket
|
74
81
|
# functions is called. The repeats basically correspond to the amount of time
|
75
82
|
# that a button of the remote is pressed.
|
76
83
|
#
|
77
84
|
# Some dimmers are controlled by the length of a button pressed,
|
78
85
|
# this can be simulated by increasing the repeats.
|
79
|
-
#
|
80
|
-
# The default value is 5.
|
81
86
|
def set_repeats(repeats)
|
82
|
-
|
87
|
+
check_validity
|
88
|
+
|
89
|
+
send_request FUNCTION_SET_REPEATS, [repeats], 'C', 8, ''
|
83
90
|
end
|
84
91
|
|
85
92
|
# Returns the number of repeats as set by BrickletRemoteSwitch#set_repeats.
|
86
93
|
def get_repeats
|
87
|
-
|
94
|
+
check_validity
|
95
|
+
|
96
|
+
send_request FUNCTION_GET_REPEATS, [], '', 9, 'C'
|
88
97
|
end
|
89
98
|
|
90
99
|
# To switch a type A socket you have to give the house code, receiver code and the
|
91
100
|
# state (on or off) you want to switch to.
|
92
101
|
#
|
93
|
-
# The house code and receiver code have a range of 0 to 31 (5bit).
|
94
|
-
#
|
95
102
|
# A detailed description on how you can figure out the house and receiver code
|
96
103
|
# can be found :ref:`here <remote_switch_bricklet_type_a_house_and_receiver_code>`.
|
97
104
|
#
|
98
105
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
99
106
|
def switch_socket_a(house_code, receiver_code, switch_to)
|
100
|
-
|
107
|
+
check_validity
|
108
|
+
|
109
|
+
send_request FUNCTION_SWITCH_SOCKET_A, [house_code, receiver_code, switch_to], 'C C C', 8, ''
|
101
110
|
end
|
102
111
|
|
103
112
|
# To switch a type B socket you have to give the address, unit and the state
|
104
113
|
# (on or off) you want to switch to.
|
105
114
|
#
|
106
|
-
#
|
107
|
-
# of 0 to 15 (4bit). To switch all devices with the same address use 255 for
|
108
|
-
# the unit.
|
115
|
+
# To switch all devices with the same address use 255 for the unit.
|
109
116
|
#
|
110
117
|
# A detailed description on how you can teach a socket the address and unit can
|
111
118
|
# be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.
|
112
119
|
#
|
113
120
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
114
121
|
def switch_socket_b(address, unit, switch_to)
|
115
|
-
|
122
|
+
check_validity
|
123
|
+
|
124
|
+
send_request FUNCTION_SWITCH_SOCKET_B, [address, unit, switch_to], 'L C C', 8, ''
|
116
125
|
end
|
117
126
|
|
118
127
|
# To control a type B dimmer you have to give the address, unit and the
|
119
128
|
# dim value you want to set the dimmer to.
|
120
129
|
#
|
121
|
-
# The address has a range of 0 to 67108863 (26bit), the unit and the dim value
|
122
|
-
# has a range of 0 to 15 (4bit).
|
123
|
-
#
|
124
130
|
# A detailed description on how you can teach a dimmer the address and unit can
|
125
131
|
# be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.
|
126
132
|
#
|
127
133
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
128
134
|
def dim_socket_b(address, unit, dim_value)
|
129
|
-
|
135
|
+
check_validity
|
136
|
+
|
137
|
+
send_request FUNCTION_DIM_SOCKET_B, [address, unit, dim_value], 'L C C', 8, ''
|
130
138
|
end
|
131
139
|
|
132
140
|
# To switch a type C socket you have to give the system code, device code and the
|
133
141
|
# state (on or off) you want to switch to.
|
134
142
|
#
|
135
|
-
# The system code has a range of 'A' to 'P' (4bit) and the device code has a
|
136
|
-
# range of 1 to 16 (4bit).
|
137
|
-
#
|
138
143
|
# A detailed description on how you can figure out the system and device code
|
139
144
|
# can be found :ref:`here <remote_switch_bricklet_type_c_system_and_device_code>`.
|
140
145
|
#
|
141
146
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
142
147
|
def switch_socket_c(system_code, device_code, switch_to)
|
143
|
-
|
148
|
+
check_validity
|
149
|
+
|
150
|
+
send_request FUNCTION_SWITCH_SOCKET_C, [system_code, device_code, switch_to], 'k C C', 8, ''
|
144
151
|
end
|
145
152
|
|
146
153
|
# Returns the UID, the UID where the Bricklet is connected to,
|
147
154
|
# the position, the hardware and firmware version as well as the
|
148
155
|
# device identifier.
|
149
156
|
#
|
150
|
-
# The position can be 'a', 'b', 'c' or '
|
157
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
158
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
159
|
+
# position 'z'.
|
151
160
|
#
|
152
161
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
153
162
|
# |device_identifier_constant|
|
154
163
|
def get_identity
|
155
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
164
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
156
165
|
end
|
157
166
|
|
158
167
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2021-05-06. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
6
6
|
# #
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Controls remote mains switches and receives signals from remotes
|
14
16
|
class BrickletRemoteSwitchV2 < Device
|
@@ -105,7 +107,7 @@ module Tinkerforge
|
|
105
107
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
106
108
|
# the IP Connection <tt>ipcon</tt>.
|
107
109
|
def initialize(uid, ipcon)
|
108
|
-
super uid, ipcon
|
110
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
109
111
|
|
110
112
|
@api_version = [2, 0, 0]
|
111
113
|
|
@@ -134,11 +136,12 @@ module Tinkerforge
|
|
134
136
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
135
137
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
136
138
|
|
137
|
-
@callback_formats[CALLBACK_SWITCHING_DONE] = ''
|
138
|
-
@callback_formats[CALLBACK_REMOTE_STATUS_A] = 'C C C S'
|
139
|
-
@callback_formats[CALLBACK_REMOTE_STATUS_B] = 'L C C C S'
|
140
|
-
@callback_formats[CALLBACK_REMOTE_STATUS_C] = 'k C C S'
|
139
|
+
@callback_formats[CALLBACK_SWITCHING_DONE] = [8, '']
|
140
|
+
@callback_formats[CALLBACK_REMOTE_STATUS_A] = [13, 'C C C S']
|
141
|
+
@callback_formats[CALLBACK_REMOTE_STATUS_B] = [17, 'L C C C S']
|
142
|
+
@callback_formats[CALLBACK_REMOTE_STATUS_C] = [13, 'k C C S']
|
141
143
|
|
144
|
+
@ipcon.add_device self
|
142
145
|
end
|
143
146
|
|
144
147
|
# Returns the current switching state. If the current state is busy, the
|
@@ -148,72 +151,74 @@ module Tinkerforge
|
|
148
151
|
# How long the switching takes is dependent on the number of repeats, see
|
149
152
|
# BrickletRemoteSwitchV2#set_repeats.
|
150
153
|
def get_switching_state
|
151
|
-
|
154
|
+
check_validity
|
155
|
+
|
156
|
+
send_request FUNCTION_GET_SWITCHING_STATE, [], '', 9, 'C'
|
152
157
|
end
|
153
158
|
|
154
|
-
# Sets the number of times the code is
|
159
|
+
# Sets the number of times the code is sent when one of the Switch Socket
|
155
160
|
# functions is called. The repeats basically correspond to the amount of time
|
156
161
|
# that a button of the remote is pressed.
|
157
162
|
#
|
158
163
|
# Some dimmers are controlled by the length of a button pressed,
|
159
164
|
# this can be simulated by increasing the repeats.
|
160
|
-
#
|
161
|
-
# The default value is 5.
|
162
165
|
def set_repeats(repeats)
|
163
|
-
|
166
|
+
check_validity
|
167
|
+
|
168
|
+
send_request FUNCTION_SET_REPEATS, [repeats], 'C', 8, ''
|
164
169
|
end
|
165
170
|
|
166
171
|
# Returns the number of repeats as set by BrickletRemoteSwitchV2#set_repeats.
|
167
172
|
def get_repeats
|
168
|
-
|
173
|
+
check_validity
|
174
|
+
|
175
|
+
send_request FUNCTION_GET_REPEATS, [], '', 9, 'C'
|
169
176
|
end
|
170
177
|
|
171
178
|
# To switch a type A socket you have to give the house code, receiver code and the
|
172
179
|
# state (on or off) you want to switch to.
|
173
180
|
#
|
174
|
-
# The house code and receiver code have a range of 0 to 31 (5bit).
|
175
|
-
#
|
176
181
|
# A detailed description on how you can figure out the house and receiver code
|
177
182
|
# can be found :ref:`here <remote_switch_bricklet_type_a_house_and_receiver_code>`.
|
178
183
|
def switch_socket_a(house_code, receiver_code, switch_to)
|
179
|
-
|
184
|
+
check_validity
|
185
|
+
|
186
|
+
send_request FUNCTION_SWITCH_SOCKET_A, [house_code, receiver_code, switch_to], 'C C C', 8, ''
|
180
187
|
end
|
181
188
|
|
182
189
|
# To switch a type B socket you have to give the address, unit and the state
|
183
190
|
# (on or off) you want to switch to.
|
184
191
|
#
|
185
|
-
#
|
186
|
-
# of 0 to 15 (4bit). To switch all devices with the same address use 255 for
|
187
|
-
# the unit.
|
192
|
+
# To switch all devices with the same address use 255 for the unit.
|
188
193
|
#
|
189
194
|
# A detailed description on how you can teach a socket the address and unit can
|
190
195
|
# be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.
|
191
196
|
def switch_socket_b(address, unit, switch_to)
|
192
|
-
|
197
|
+
check_validity
|
198
|
+
|
199
|
+
send_request FUNCTION_SWITCH_SOCKET_B, [address, unit, switch_to], 'L C C', 8, ''
|
193
200
|
end
|
194
201
|
|
195
202
|
# To control a type B dimmer you have to give the address, unit and the
|
196
203
|
# dim value you want to set the dimmer to.
|
197
204
|
#
|
198
|
-
# The address has a range of 0 to 67108863 (26bit), the unit and the dim value
|
199
|
-
# has a range of 0 to 15 (4bit).
|
200
|
-
#
|
201
205
|
# A detailed description on how you can teach a dimmer the address and unit can
|
202
206
|
# be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.
|
203
207
|
def dim_socket_b(address, unit, dim_value)
|
204
|
-
|
208
|
+
check_validity
|
209
|
+
|
210
|
+
send_request FUNCTION_DIM_SOCKET_B, [address, unit, dim_value], 'L C C', 8, ''
|
205
211
|
end
|
206
212
|
|
207
213
|
# To switch a type C socket you have to give the system code, device code and the
|
208
214
|
# state (on or off) you want to switch to.
|
209
215
|
#
|
210
|
-
# The system code has a range of 'A' to 'P' (4bit) and the device code has a
|
211
|
-
# range of 1 to 16 (4bit).
|
212
|
-
#
|
213
216
|
# A detailed description on how you can figure out the system and device code
|
214
217
|
# can be found :ref:`here <remote_switch_bricklet_type_c_system_and_device_code>`.
|
215
218
|
def switch_socket_c(system_code, device_code, switch_to)
|
216
|
-
|
219
|
+
check_validity
|
220
|
+
|
221
|
+
send_request FUNCTION_SWITCH_SOCKET_C, [system_code, device_code, switch_to], 'k C C', 8, ''
|
217
222
|
end
|
218
223
|
|
219
224
|
# Sets the configuration for **receiving** data from a remote of type A, B or C.
|
@@ -223,15 +228,17 @@ module Tinkerforge
|
|
223
228
|
# is triggered (if enabled).
|
224
229
|
# * Callback Enabled: Enable or disable callback (see CALLBACK_REMOTE_STATUS_A callback,
|
225
230
|
# CALLBACK_REMOTE_STATUS_B callback and CALLBACK_REMOTE_STATUS_C callback).
|
226
|
-
#
|
227
|
-
# Default is ('A', 2, false).
|
228
231
|
def set_remote_configuration(remote_type, minimum_repeats, callback_enabled)
|
229
|
-
|
232
|
+
check_validity
|
233
|
+
|
234
|
+
send_request FUNCTION_SET_REMOTE_CONFIGURATION, [remote_type, minimum_repeats, callback_enabled], 'C S ?', 8, ''
|
230
235
|
end
|
231
236
|
|
232
237
|
# Returns the remote configuration as set by BrickletRemoteSwitchV2#set_remote_configuration
|
233
238
|
def get_remote_configuration
|
234
|
-
|
239
|
+
check_validity
|
240
|
+
|
241
|
+
send_request FUNCTION_GET_REMOTE_CONFIGURATION, [], '', 12, 'C S ?'
|
235
242
|
end
|
236
243
|
|
237
244
|
# Returns the house code, receiver code, switch state (on/off) and number of
|
@@ -245,7 +252,9 @@ module Tinkerforge
|
|
245
252
|
# Use the callback to get this data automatically when a button is pressed,
|
246
253
|
# see BrickletRemoteSwitchV2#set_remote_configuration and CALLBACK_REMOTE_STATUS_A callback.
|
247
254
|
def get_remote_status_a
|
248
|
-
|
255
|
+
check_validity
|
256
|
+
|
257
|
+
send_request FUNCTION_GET_REMOTE_STATUS_A, [], '', 13, 'C C C S'
|
249
258
|
end
|
250
259
|
|
251
260
|
# Returns the address (unique per remote), unit (button number), switch state
|
@@ -260,7 +269,9 @@ module Tinkerforge
|
|
260
269
|
# Use the callback to get this data automatically when a button is pressed,
|
261
270
|
# see BrickletRemoteSwitchV2#set_remote_configuration and CALLBACK_REMOTE_STATUS_B callback.
|
262
271
|
def get_remote_status_b
|
263
|
-
|
272
|
+
check_validity
|
273
|
+
|
274
|
+
send_request FUNCTION_GET_REMOTE_STATUS_B, [], '', 17, 'L C C C S'
|
264
275
|
end
|
265
276
|
|
266
277
|
# Returns the system code, device code, switch state (on/off) and number of repeats for
|
@@ -273,7 +284,9 @@ module Tinkerforge
|
|
273
284
|
# Use the callback to get this data automatically when a button is pressed,
|
274
285
|
# see BrickletRemoteSwitchV2#set_remote_configuration and CALLBACK_REMOTE_STATUS_C callback.
|
275
286
|
def get_remote_status_c
|
276
|
-
|
287
|
+
check_validity
|
288
|
+
|
289
|
+
send_request FUNCTION_GET_REMOTE_STATUS_C, [], '', 13, 'k C C S'
|
277
290
|
end
|
278
291
|
|
279
292
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -288,7 +301,9 @@ module Tinkerforge
|
|
288
301
|
# The errors counts are for errors that occur on the Bricklet side. All
|
289
302
|
# Bricks have a similar function that returns the errors on the Brick side.
|
290
303
|
def get_spitfp_error_count
|
291
|
-
|
304
|
+
check_validity
|
305
|
+
|
306
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
292
307
|
end
|
293
308
|
|
294
309
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -301,12 +316,16 @@ module Tinkerforge
|
|
301
316
|
# This function is used by Brick Viewer during flashing. It should not be
|
302
317
|
# necessary to call it in a normal user program.
|
303
318
|
def set_bootloader_mode(mode)
|
304
|
-
|
319
|
+
check_validity
|
320
|
+
|
321
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
305
322
|
end
|
306
323
|
|
307
324
|
# Returns the current bootloader mode, see BrickletRemoteSwitchV2#set_bootloader_mode.
|
308
325
|
def get_bootloader_mode
|
309
|
-
|
326
|
+
check_validity
|
327
|
+
|
328
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
310
329
|
end
|
311
330
|
|
312
331
|
# Sets the firmware pointer for BrickletRemoteSwitchV2#write_firmware. The pointer has
|
@@ -316,7 +335,9 @@ module Tinkerforge
|
|
316
335
|
# This function is used by Brick Viewer during flashing. It should not be
|
317
336
|
# necessary to call it in a normal user program.
|
318
337
|
def set_write_firmware_pointer(pointer)
|
319
|
-
|
338
|
+
check_validity
|
339
|
+
|
340
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
320
341
|
end
|
321
342
|
|
322
343
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -328,7 +349,9 @@ module Tinkerforge
|
|
328
349
|
# This function is used by Brick Viewer during flashing. It should not be
|
329
350
|
# necessary to call it in a normal user program.
|
330
351
|
def write_firmware(data)
|
331
|
-
|
352
|
+
check_validity
|
353
|
+
|
354
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
332
355
|
end
|
333
356
|
|
334
357
|
# Sets the status LED configuration. By default the LED shows
|
@@ -339,22 +362,28 @@ module Tinkerforge
|
|
339
362
|
#
|
340
363
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
341
364
|
def set_status_led_config(config)
|
342
|
-
|
365
|
+
check_validity
|
366
|
+
|
367
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
343
368
|
end
|
344
369
|
|
345
370
|
# Returns the configuration as set by BrickletRemoteSwitchV2#set_status_led_config
|
346
371
|
def get_status_led_config
|
347
|
-
|
372
|
+
check_validity
|
373
|
+
|
374
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
348
375
|
end
|
349
376
|
|
350
|
-
# Returns the temperature
|
377
|
+
# Returns the temperature as measured inside the microcontroller. The
|
351
378
|
# value returned is not the ambient temperature!
|
352
379
|
#
|
353
380
|
# The temperature is only proportional to the real temperature and it has bad
|
354
381
|
# accuracy. Practically it is only useful as an indicator for
|
355
382
|
# temperature changes.
|
356
383
|
def get_chip_temperature
|
357
|
-
|
384
|
+
check_validity
|
385
|
+
|
386
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
358
387
|
end
|
359
388
|
|
360
389
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -364,7 +393,9 @@ module Tinkerforge
|
|
364
393
|
# calling functions on the existing ones will result in
|
365
394
|
# undefined behavior!
|
366
395
|
def reset
|
367
|
-
|
396
|
+
check_validity
|
397
|
+
|
398
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
368
399
|
end
|
369
400
|
|
370
401
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -373,25 +404,31 @@ module Tinkerforge
|
|
373
404
|
#
|
374
405
|
# We recommend that you use Brick Viewer to change the UID.
|
375
406
|
def write_uid(uid)
|
376
|
-
|
407
|
+
check_validity
|
408
|
+
|
409
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
377
410
|
end
|
378
411
|
|
379
412
|
# Returns the current UID as an integer. Encode as
|
380
413
|
# Base58 to get the usual string version.
|
381
414
|
def read_uid
|
382
|
-
|
415
|
+
check_validity
|
416
|
+
|
417
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
383
418
|
end
|
384
419
|
|
385
420
|
# Returns the UID, the UID where the Bricklet is connected to,
|
386
421
|
# the position, the hardware and firmware version as well as the
|
387
422
|
# device identifier.
|
388
423
|
#
|
389
|
-
# The position can be 'a', 'b', 'c' or '
|
424
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
425
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
426
|
+
# position 'z'.
|
390
427
|
#
|
391
428
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
392
429
|
# |device_identifier_constant|
|
393
430
|
def get_identity
|
394
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
431
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
395
432
|
end
|
396
433
|
|
397
434
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|