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
|
# Two relays to switch AC/DC devices
|
|
14
16
|
class BrickletIndustrialDualRelay < Device
|
|
@@ -16,7 +18,7 @@ module Tinkerforge
|
|
|
16
18
|
DEVICE_DISPLAY_NAME = 'Industrial Dual Relay Bricklet' # :nodoc:
|
|
17
19
|
|
|
18
20
|
# This callback is triggered whenever a monoflop timer reaches 0. The
|
|
19
|
-
#
|
|
21
|
+
# parameters contain the relay and the current state of the relay
|
|
20
22
|
# (the state after the monoflop).
|
|
21
23
|
CALLBACK_MONOFLOP_DONE = 5
|
|
22
24
|
|
|
@@ -57,7 +59,7 @@ module Tinkerforge
|
|
|
57
59
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
58
60
|
# the IP Connection <tt>ipcon</tt>.
|
|
59
61
|
def initialize(uid, ipcon)
|
|
60
|
-
super uid, ipcon
|
|
62
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
61
63
|
|
|
62
64
|
@api_version = [2, 0, 0]
|
|
63
65
|
|
|
@@ -79,8 +81,9 @@ module Tinkerforge
|
|
|
79
81
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
80
82
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
81
83
|
|
|
82
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
|
84
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
|
|
83
85
|
|
|
86
|
+
@ipcon.add_device self
|
|
84
87
|
end
|
|
85
88
|
|
|
86
89
|
# Sets the state of the relays, *true* means on and *false* means off.
|
|
@@ -91,20 +94,22 @@ module Tinkerforge
|
|
|
91
94
|
# can use BrickletIndustrialDualRelay#set_selected_value.
|
|
92
95
|
#
|
|
93
96
|
# All running monoflop timers will be aborted if this function is called.
|
|
94
|
-
#
|
|
95
|
-
# The default value is (*false*, *false*).
|
|
96
97
|
def set_value(channel0, channel1)
|
|
97
|
-
|
|
98
|
+
check_validity
|
|
99
|
+
|
|
100
|
+
send_request FUNCTION_SET_VALUE, [channel0, channel1], '? ?', 8, ''
|
|
98
101
|
end
|
|
99
102
|
|
|
100
103
|
# Returns the state of the relays, *true* means on and *false* means off.
|
|
101
104
|
def get_value
|
|
102
|
-
|
|
105
|
+
check_validity
|
|
106
|
+
|
|
107
|
+
send_request FUNCTION_GET_VALUE, [], '', 10, '? ?'
|
|
103
108
|
end
|
|
104
109
|
|
|
105
110
|
# The first parameter can be 0 or 1 (relay 0 or relay 1). The second parameter
|
|
106
111
|
# is the desired state of the relay (*true* means on and *false* means off).
|
|
107
|
-
# The third parameter indicates the time
|
|
112
|
+
# The third parameter indicates the time that the relay should hold
|
|
108
113
|
# the state.
|
|
109
114
|
#
|
|
110
115
|
# If this function is called with the parameters (1, true, 1500):
|
|
@@ -116,7 +121,9 @@ module Tinkerforge
|
|
|
116
121
|
# of two seconds. The relay will be on all the time. If now the RS485
|
|
117
122
|
# connection is lost, the relay will turn off in at most two seconds.
|
|
118
123
|
def set_monoflop(channel, value, time)
|
|
119
|
-
|
|
124
|
+
check_validity
|
|
125
|
+
|
|
126
|
+
send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
|
|
120
127
|
end
|
|
121
128
|
|
|
122
129
|
# Returns (for the given relay) the current state and the time as set by
|
|
@@ -125,10 +132,12 @@ module Tinkerforge
|
|
|
125
132
|
# If the timer is not running currently, the remaining time will be returned
|
|
126
133
|
# as 0.
|
|
127
134
|
def get_monoflop(channel)
|
|
128
|
-
|
|
135
|
+
check_validity
|
|
136
|
+
|
|
137
|
+
send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
|
|
129
138
|
end
|
|
130
139
|
|
|
131
|
-
# Sets the state of the selected relay
|
|
140
|
+
# Sets the state of the selected relay, *true* means on and *false*
|
|
132
141
|
# means off.
|
|
133
142
|
#
|
|
134
143
|
# A running monoflop timer for the selected relay will be aborted if this function
|
|
@@ -136,7 +145,9 @@ module Tinkerforge
|
|
|
136
145
|
#
|
|
137
146
|
# The other relay remains untouched.
|
|
138
147
|
def set_selected_value(channel, value)
|
|
139
|
-
|
|
148
|
+
check_validity
|
|
149
|
+
|
|
150
|
+
send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
|
|
140
151
|
end
|
|
141
152
|
|
|
142
153
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -151,7 +162,9 @@ module Tinkerforge
|
|
|
151
162
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
152
163
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
153
164
|
def get_spitfp_error_count
|
|
154
|
-
|
|
165
|
+
check_validity
|
|
166
|
+
|
|
167
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
155
168
|
end
|
|
156
169
|
|
|
157
170
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -164,12 +177,16 @@ module Tinkerforge
|
|
|
164
177
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
165
178
|
# necessary to call it in a normal user program.
|
|
166
179
|
def set_bootloader_mode(mode)
|
|
167
|
-
|
|
180
|
+
check_validity
|
|
181
|
+
|
|
182
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
168
183
|
end
|
|
169
184
|
|
|
170
185
|
# Returns the current bootloader mode, see BrickletIndustrialDualRelay#set_bootloader_mode.
|
|
171
186
|
def get_bootloader_mode
|
|
172
|
-
|
|
187
|
+
check_validity
|
|
188
|
+
|
|
189
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
173
190
|
end
|
|
174
191
|
|
|
175
192
|
# Sets the firmware pointer for BrickletIndustrialDualRelay#write_firmware. The pointer has
|
|
@@ -179,7 +196,9 @@ module Tinkerforge
|
|
|
179
196
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
180
197
|
# necessary to call it in a normal user program.
|
|
181
198
|
def set_write_firmware_pointer(pointer)
|
|
182
|
-
|
|
199
|
+
check_validity
|
|
200
|
+
|
|
201
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
183
202
|
end
|
|
184
203
|
|
|
185
204
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -191,7 +210,9 @@ module Tinkerforge
|
|
|
191
210
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
192
211
|
# necessary to call it in a normal user program.
|
|
193
212
|
def write_firmware(data)
|
|
194
|
-
|
|
213
|
+
check_validity
|
|
214
|
+
|
|
215
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
195
216
|
end
|
|
196
217
|
|
|
197
218
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -202,22 +223,28 @@ module Tinkerforge
|
|
|
202
223
|
#
|
|
203
224
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
204
225
|
def set_status_led_config(config)
|
|
205
|
-
|
|
226
|
+
check_validity
|
|
227
|
+
|
|
228
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
206
229
|
end
|
|
207
230
|
|
|
208
231
|
# Returns the configuration as set by BrickletIndustrialDualRelay#set_status_led_config
|
|
209
232
|
def get_status_led_config
|
|
210
|
-
|
|
233
|
+
check_validity
|
|
234
|
+
|
|
235
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
211
236
|
end
|
|
212
237
|
|
|
213
|
-
# Returns the temperature
|
|
238
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
214
239
|
# value returned is not the ambient temperature!
|
|
215
240
|
#
|
|
216
241
|
# The temperature is only proportional to the real temperature and it has bad
|
|
217
242
|
# accuracy. Practically it is only useful as an indicator for
|
|
218
243
|
# temperature changes.
|
|
219
244
|
def get_chip_temperature
|
|
220
|
-
|
|
245
|
+
check_validity
|
|
246
|
+
|
|
247
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
221
248
|
end
|
|
222
249
|
|
|
223
250
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -227,7 +254,9 @@ module Tinkerforge
|
|
|
227
254
|
# calling functions on the existing ones will result in
|
|
228
255
|
# undefined behavior!
|
|
229
256
|
def reset
|
|
230
|
-
|
|
257
|
+
check_validity
|
|
258
|
+
|
|
259
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
231
260
|
end
|
|
232
261
|
|
|
233
262
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -236,25 +265,31 @@ module Tinkerforge
|
|
|
236
265
|
#
|
|
237
266
|
# We recommend that you use Brick Viewer to change the UID.
|
|
238
267
|
def write_uid(uid)
|
|
239
|
-
|
|
268
|
+
check_validity
|
|
269
|
+
|
|
270
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
240
271
|
end
|
|
241
272
|
|
|
242
273
|
# Returns the current UID as an integer. Encode as
|
|
243
274
|
# Base58 to get the usual string version.
|
|
244
275
|
def read_uid
|
|
245
|
-
|
|
276
|
+
check_validity
|
|
277
|
+
|
|
278
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
246
279
|
end
|
|
247
280
|
|
|
248
281
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
249
282
|
# the position, the hardware and firmware version as well as the
|
|
250
283
|
# device identifier.
|
|
251
284
|
#
|
|
252
|
-
# The position can be 'a', 'b', 'c' or '
|
|
285
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
286
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
287
|
+
# position 'z'.
|
|
253
288
|
#
|
|
254
289
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
255
290
|
# |device_identifier_constant|
|
|
256
291
|
def get_identity
|
|
257
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
292
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
258
293
|
end
|
|
259
294
|
|
|
260
295
|
# 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
|
# 4 galvanically isolated solid state relays
|
|
14
16
|
class BrickletIndustrialQuadRelay < Device
|
|
@@ -34,7 +36,7 @@ module Tinkerforge
|
|
|
34
36
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
35
37
|
# the IP Connection <tt>ipcon</tt>.
|
|
36
38
|
def initialize(uid, ipcon)
|
|
37
|
-
super uid, ipcon
|
|
39
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
38
40
|
|
|
39
41
|
@api_version = [2, 0, 0]
|
|
40
42
|
|
|
@@ -48,8 +50,9 @@ module Tinkerforge
|
|
|
48
50
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
|
49
51
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
50
52
|
|
|
51
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'S S'
|
|
53
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [12, 'S S']
|
|
52
54
|
|
|
55
|
+
@ipcon.add_device self
|
|
53
56
|
end
|
|
54
57
|
|
|
55
58
|
# Sets the output value with a bitmask (16bit). A 1 in the bitmask means relay
|
|
@@ -67,12 +70,16 @@ module Tinkerforge
|
|
|
67
70
|
#
|
|
68
71
|
# All running monoflop timers will be aborted if this function is called.
|
|
69
72
|
def set_value(value_mask)
|
|
70
|
-
|
|
73
|
+
check_validity
|
|
74
|
+
|
|
75
|
+
send_request FUNCTION_SET_VALUE, [value_mask], 'S', 8, ''
|
|
71
76
|
end
|
|
72
77
|
|
|
73
78
|
# Returns the bitmask as set by BrickletIndustrialQuadRelay#set_value.
|
|
74
79
|
def get_value
|
|
75
|
-
|
|
80
|
+
check_validity
|
|
81
|
+
|
|
82
|
+
send_request FUNCTION_GET_VALUE, [], '', 10, 'S'
|
|
76
83
|
end
|
|
77
84
|
|
|
78
85
|
# Configures a monoflop of the pins specified by the first parameter
|
|
@@ -81,7 +88,7 @@ module Tinkerforge
|
|
|
81
88
|
# The second parameter is a bitmask with the desired value of the specified
|
|
82
89
|
# pins. A 1 in the bitmask means relay closed and a 0 means relay open.
|
|
83
90
|
#
|
|
84
|
-
# The third parameter indicates the time
|
|
91
|
+
# The third parameter indicates the time that the pins should hold
|
|
85
92
|
# the value.
|
|
86
93
|
#
|
|
87
94
|
# If this function is called with the parameters (9, 1, 1500) or
|
|
@@ -94,7 +101,9 @@ module Tinkerforge
|
|
|
94
101
|
# of two seconds and pin 0 closed. Pin 0 will be closed all the time. If now
|
|
95
102
|
# the RS485 connection is lost, then pin 0 will be opened in at most two seconds.
|
|
96
103
|
def set_monoflop(selection_mask, value_mask, time)
|
|
97
|
-
|
|
104
|
+
check_validity
|
|
105
|
+
|
|
106
|
+
send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'S S L', 8, ''
|
|
98
107
|
end
|
|
99
108
|
|
|
100
109
|
# Returns (for the given pin) the current value and the time as set by
|
|
@@ -103,7 +112,9 @@ module Tinkerforge
|
|
|
103
112
|
# If the timer is not running currently, the remaining time will be returned
|
|
104
113
|
# as 0.
|
|
105
114
|
def get_monoflop(pin)
|
|
106
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 18, 'S L L'
|
|
107
118
|
end
|
|
108
119
|
|
|
109
120
|
# Sets a group of Quad Relay Bricklets that should work together. You can
|
|
@@ -122,19 +133,25 @@ module Tinkerforge
|
|
|
122
133
|
# pins on the Quad Relay on port B are assigned to 4-7. It is now possible
|
|
123
134
|
# to call BrickletIndustrialQuadRelay#set_value and control two Bricklets at the same time.
|
|
124
135
|
def set_group(group)
|
|
125
|
-
|
|
136
|
+
check_validity
|
|
137
|
+
|
|
138
|
+
send_request FUNCTION_SET_GROUP, [group], 'k4', 8, ''
|
|
126
139
|
end
|
|
127
140
|
|
|
128
141
|
# Returns the group as set by BrickletIndustrialQuadRelay#set_group
|
|
129
142
|
def get_group
|
|
130
|
-
|
|
143
|
+
check_validity
|
|
144
|
+
|
|
145
|
+
send_request FUNCTION_GET_GROUP, [], '', 12, 'k4'
|
|
131
146
|
end
|
|
132
147
|
|
|
133
148
|
# Returns a bitmask of ports that are available for grouping. For example the
|
|
134
149
|
# value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
|
|
135
150
|
# can be grouped together.
|
|
136
151
|
def get_available_for_group
|
|
137
|
-
|
|
152
|
+
check_validity
|
|
153
|
+
|
|
154
|
+
send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 9, 'C'
|
|
138
155
|
end
|
|
139
156
|
|
|
140
157
|
# Sets the output value with a bitmask, according to the selection mask.
|
|
@@ -154,19 +171,23 @@ module Tinkerforge
|
|
|
154
171
|
# Running monoflop timers for the selected relays will be aborted if this function
|
|
155
172
|
# is called.
|
|
156
173
|
def set_selected_values(selection_mask, value_mask)
|
|
157
|
-
|
|
174
|
+
check_validity
|
|
175
|
+
|
|
176
|
+
send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'S S', 8, ''
|
|
158
177
|
end
|
|
159
178
|
|
|
160
179
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
161
180
|
# the position, the hardware and firmware version as well as the
|
|
162
181
|
# device identifier.
|
|
163
182
|
#
|
|
164
|
-
# The position can be 'a', 'b', 'c' or '
|
|
183
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
184
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
185
|
+
# position 'z'.
|
|
165
186
|
#
|
|
166
187
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
167
188
|
# |device_identifier_constant|
|
|
168
189
|
def get_identity
|
|
169
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
190
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
170
191
|
end
|
|
171
192
|
|
|
172
193
|
# 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
|
# 4 galvanically isolated solid state relays
|
|
14
16
|
class BrickletIndustrialQuadRelayV2 < Device
|
|
@@ -63,7 +65,7 @@ module Tinkerforge
|
|
|
63
65
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
64
66
|
# the IP Connection <tt>ipcon</tt>.
|
|
65
67
|
def initialize(uid, ipcon)
|
|
66
|
-
super uid, ipcon
|
|
68
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
67
69
|
|
|
68
70
|
@api_version = [2, 0, 0]
|
|
69
71
|
|
|
@@ -87,8 +89,9 @@ module Tinkerforge
|
|
|
87
89
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
88
90
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
89
91
|
|
|
90
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
|
92
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [10, 'C ?']
|
|
91
93
|
|
|
94
|
+
@ipcon.add_device self
|
|
92
95
|
end
|
|
93
96
|
|
|
94
97
|
# Sets the value of all four relays. A value of *true* closes the
|
|
@@ -98,12 +101,16 @@ module Tinkerforge
|
|
|
98
101
|
#
|
|
99
102
|
# All running monoflop timers will be aborted if this function is called.
|
|
100
103
|
def set_value(value)
|
|
101
|
-
|
|
104
|
+
check_validity
|
|
105
|
+
|
|
106
|
+
send_request FUNCTION_SET_VALUE, [value], '?4', 8, ''
|
|
102
107
|
end
|
|
103
108
|
|
|
104
109
|
# Returns the values as set by BrickletIndustrialQuadRelayV2#set_value.
|
|
105
110
|
def get_value
|
|
106
|
-
|
|
111
|
+
check_validity
|
|
112
|
+
|
|
113
|
+
send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
|
|
107
114
|
end
|
|
108
115
|
|
|
109
116
|
# Configures a monoflop of the specified channel.
|
|
@@ -111,7 +118,7 @@ module Tinkerforge
|
|
|
111
118
|
# The second parameter is the desired value of the specified
|
|
112
119
|
# channel. A *true* means relay closed and a *false* means relay open.
|
|
113
120
|
#
|
|
114
|
-
# The third parameter indicates the time
|
|
121
|
+
# The third parameter indicates the time that the channels should hold
|
|
115
122
|
# the value.
|
|
116
123
|
#
|
|
117
124
|
# If this function is called with the parameters (0, 1, 1500) channel 0 will
|
|
@@ -124,7 +131,9 @@ module Tinkerforge
|
|
|
124
131
|
# time. If now the RS485 connection is lost, then channel 0 will be opened in at
|
|
125
132
|
# most two seconds.
|
|
126
133
|
def set_monoflop(channel, value, time)
|
|
127
|
-
|
|
134
|
+
check_validity
|
|
135
|
+
|
|
136
|
+
send_request FUNCTION_SET_MONOFLOP, [channel, value, time], 'C ? L', 8, ''
|
|
128
137
|
end
|
|
129
138
|
|
|
130
139
|
# Returns (for the given channel) the current value and the time as set by
|
|
@@ -133,7 +142,9 @@ module Tinkerforge
|
|
|
133
142
|
# If the timer is not running currently, the remaining time will be returned
|
|
134
143
|
# as 0.
|
|
135
144
|
def get_monoflop(channel)
|
|
136
|
-
|
|
145
|
+
check_validity
|
|
146
|
+
|
|
147
|
+
send_request FUNCTION_GET_MONOFLOP, [channel], 'C', 17, '? L L'
|
|
137
148
|
end
|
|
138
149
|
|
|
139
150
|
# Sets the output value of the specified channel without affecting the other
|
|
@@ -142,21 +153,25 @@ module Tinkerforge
|
|
|
142
153
|
# A running monoflop timer for the specified channel will be aborted if this
|
|
143
154
|
# function is called.
|
|
144
155
|
def set_selected_value(channel, value)
|
|
145
|
-
|
|
156
|
+
check_validity
|
|
157
|
+
|
|
158
|
+
send_request FUNCTION_SET_SELECTED_VALUE, [channel, value], 'C ?', 8, ''
|
|
146
159
|
end
|
|
147
160
|
|
|
148
161
|
# Each channel has a corresponding LED. You can turn the LED off, on or show a
|
|
149
162
|
# heartbeat. You can also set the LED to "Channel Status". In this mode the
|
|
150
163
|
# LED is on if the channel is high and off otherwise.
|
|
151
|
-
#
|
|
152
|
-
# By default all channel LEDs are configured as "Channel Status".
|
|
153
164
|
def set_channel_led_config(channel, config)
|
|
154
|
-
|
|
165
|
+
check_validity
|
|
166
|
+
|
|
167
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
|
|
155
168
|
end
|
|
156
169
|
|
|
157
170
|
# Returns the channel LED configuration as set by BrickletIndustrialQuadRelayV2#set_channel_led_config
|
|
158
171
|
def get_channel_led_config(channel)
|
|
159
|
-
|
|
172
|
+
check_validity
|
|
173
|
+
|
|
174
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
|
|
160
175
|
end
|
|
161
176
|
|
|
162
177
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -171,7 +186,9 @@ module Tinkerforge
|
|
|
171
186
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
172
187
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
173
188
|
def get_spitfp_error_count
|
|
174
|
-
|
|
189
|
+
check_validity
|
|
190
|
+
|
|
191
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
175
192
|
end
|
|
176
193
|
|
|
177
194
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -184,12 +201,16 @@ module Tinkerforge
|
|
|
184
201
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
185
202
|
# necessary to call it in a normal user program.
|
|
186
203
|
def set_bootloader_mode(mode)
|
|
187
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
188
207
|
end
|
|
189
208
|
|
|
190
209
|
# Returns the current bootloader mode, see BrickletIndustrialQuadRelayV2#set_bootloader_mode.
|
|
191
210
|
def get_bootloader_mode
|
|
192
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
193
214
|
end
|
|
194
215
|
|
|
195
216
|
# Sets the firmware pointer for BrickletIndustrialQuadRelayV2#write_firmware. The pointer has
|
|
@@ -199,7 +220,9 @@ module Tinkerforge
|
|
|
199
220
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
200
221
|
# necessary to call it in a normal user program.
|
|
201
222
|
def set_write_firmware_pointer(pointer)
|
|
202
|
-
|
|
223
|
+
check_validity
|
|
224
|
+
|
|
225
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
203
226
|
end
|
|
204
227
|
|
|
205
228
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -211,7 +234,9 @@ module Tinkerforge
|
|
|
211
234
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
212
235
|
# necessary to call it in a normal user program.
|
|
213
236
|
def write_firmware(data)
|
|
214
|
-
|
|
237
|
+
check_validity
|
|
238
|
+
|
|
239
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
215
240
|
end
|
|
216
241
|
|
|
217
242
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -222,22 +247,28 @@ module Tinkerforge
|
|
|
222
247
|
#
|
|
223
248
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
224
249
|
def set_status_led_config(config)
|
|
225
|
-
|
|
250
|
+
check_validity
|
|
251
|
+
|
|
252
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
226
253
|
end
|
|
227
254
|
|
|
228
255
|
# Returns the configuration as set by BrickletIndustrialQuadRelayV2#set_status_led_config
|
|
229
256
|
def get_status_led_config
|
|
230
|
-
|
|
257
|
+
check_validity
|
|
258
|
+
|
|
259
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
231
260
|
end
|
|
232
261
|
|
|
233
|
-
# Returns the temperature
|
|
262
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
234
263
|
# value returned is not the ambient temperature!
|
|
235
264
|
#
|
|
236
265
|
# The temperature is only proportional to the real temperature and it has bad
|
|
237
266
|
# accuracy. Practically it is only useful as an indicator for
|
|
238
267
|
# temperature changes.
|
|
239
268
|
def get_chip_temperature
|
|
240
|
-
|
|
269
|
+
check_validity
|
|
270
|
+
|
|
271
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
241
272
|
end
|
|
242
273
|
|
|
243
274
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -247,7 +278,9 @@ module Tinkerforge
|
|
|
247
278
|
# calling functions on the existing ones will result in
|
|
248
279
|
# undefined behavior!
|
|
249
280
|
def reset
|
|
250
|
-
|
|
281
|
+
check_validity
|
|
282
|
+
|
|
283
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
251
284
|
end
|
|
252
285
|
|
|
253
286
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -256,25 +289,31 @@ module Tinkerforge
|
|
|
256
289
|
#
|
|
257
290
|
# We recommend that you use Brick Viewer to change the UID.
|
|
258
291
|
def write_uid(uid)
|
|
259
|
-
|
|
292
|
+
check_validity
|
|
293
|
+
|
|
294
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
260
295
|
end
|
|
261
296
|
|
|
262
297
|
# Returns the current UID as an integer. Encode as
|
|
263
298
|
# Base58 to get the usual string version.
|
|
264
299
|
def read_uid
|
|
265
|
-
|
|
300
|
+
check_validity
|
|
301
|
+
|
|
302
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
266
303
|
end
|
|
267
304
|
|
|
268
305
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
269
306
|
# the position, the hardware and firmware version as well as the
|
|
270
307
|
# device identifier.
|
|
271
308
|
#
|
|
272
|
-
# The position can be 'a', 'b', 'c' or '
|
|
309
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
310
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
311
|
+
# position 'z'.
|
|
273
312
|
#
|
|
274
313
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
275
314
|
# |device_identifier_constant|
|
|
276
315
|
def get_identity
|
|
277
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
316
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
278
317
|
end
|
|
279
318
|
|
|
280
319
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|