tinkerforge 2.1.24 → 2.1.29
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 +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
|
# 4 galvanically isolated digital inputs
|
|
14
16
|
class BrickletIndustrialDigitalIn4 < Device
|
|
@@ -51,7 +53,7 @@ module Tinkerforge
|
|
|
51
53
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
52
54
|
# the IP Connection <tt>ipcon</tt>.
|
|
53
55
|
def initialize(uid, ipcon)
|
|
54
|
-
super uid, ipcon
|
|
56
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
55
57
|
|
|
56
58
|
@api_version = [2, 0, 1]
|
|
57
59
|
|
|
@@ -68,8 +70,9 @@ module Tinkerforge
|
|
|
68
70
|
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
69
71
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
70
72
|
|
|
71
|
-
@callback_formats[CALLBACK_INTERRUPT] = 'S S'
|
|
73
|
+
@callback_formats[CALLBACK_INTERRUPT] = [12, 'S S']
|
|
72
74
|
|
|
75
|
+
@ipcon.add_device self
|
|
73
76
|
end
|
|
74
77
|
|
|
75
78
|
# Returns the input value with a bitmask. The bitmask is 16bit long, *true*
|
|
@@ -85,7 +88,9 @@ module Tinkerforge
|
|
|
85
88
|
# Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3
|
|
86
89
|
# pins 8-11 and element 4 pins 12-15.
|
|
87
90
|
def get_value
|
|
88
|
-
|
|
91
|
+
check_validity
|
|
92
|
+
|
|
93
|
+
send_request FUNCTION_GET_VALUE, [], '', 10, 'S'
|
|
89
94
|
end
|
|
90
95
|
|
|
91
96
|
# Sets a group of Digital In 4 Bricklets that should work together. You can
|
|
@@ -107,19 +112,25 @@ module Tinkerforge
|
|
|
107
112
|
# Changing the group configuration resets all edge counter configurations
|
|
108
113
|
# and values.
|
|
109
114
|
def set_group(group)
|
|
110
|
-
|
|
115
|
+
check_validity
|
|
116
|
+
|
|
117
|
+
send_request FUNCTION_SET_GROUP, [group], 'k4', 8, ''
|
|
111
118
|
end
|
|
112
119
|
|
|
113
120
|
# Returns the group as set by BrickletIndustrialDigitalIn4#set_group
|
|
114
121
|
def get_group
|
|
115
|
-
|
|
122
|
+
check_validity
|
|
123
|
+
|
|
124
|
+
send_request FUNCTION_GET_GROUP, [], '', 12, 'k4'
|
|
116
125
|
end
|
|
117
126
|
|
|
118
127
|
# Returns a bitmask of ports that are available for grouping. For example the
|
|
119
128
|
# value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
|
|
120
129
|
# can be grouped together.
|
|
121
130
|
def get_available_for_group
|
|
122
|
-
|
|
131
|
+
check_validity
|
|
132
|
+
|
|
133
|
+
send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 9, 'C'
|
|
123
134
|
end
|
|
124
135
|
|
|
125
136
|
# Sets the debounce period of the CALLBACK_INTERRUPT callback.
|
|
@@ -128,12 +139,16 @@ module Tinkerforge
|
|
|
128
139
|
# maximal every 100ms. This is necessary if something that bounces is
|
|
129
140
|
# connected to the Digital In 4 Bricklet, such as a button.
|
|
130
141
|
def set_debounce_period(debounce)
|
|
131
|
-
|
|
142
|
+
check_validity
|
|
143
|
+
|
|
144
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
132
145
|
end
|
|
133
146
|
|
|
134
147
|
# Returns the debounce period as set by BrickletIndustrialDigitalIn4#set_debounce_period.
|
|
135
148
|
def get_debounce_period
|
|
136
|
-
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
137
152
|
end
|
|
138
153
|
|
|
139
154
|
# Sets the pins on which an interrupt is activated with a bitmask.
|
|
@@ -147,12 +162,16 @@ module Tinkerforge
|
|
|
147
162
|
#
|
|
148
163
|
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
|
149
164
|
def set_interrupt(interrupt_mask)
|
|
150
|
-
|
|
165
|
+
check_validity
|
|
166
|
+
|
|
167
|
+
send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'S', 8, ''
|
|
151
168
|
end
|
|
152
169
|
|
|
153
170
|
# Returns the interrupt bitmask as set by BrickletIndustrialDigitalIn4#set_interrupt.
|
|
154
171
|
def get_interrupt
|
|
155
|
-
|
|
172
|
+
check_validity
|
|
173
|
+
|
|
174
|
+
send_request FUNCTION_GET_INTERRUPT, [], '', 10, 'S'
|
|
156
175
|
end
|
|
157
176
|
|
|
158
177
|
# Returns the current value of the edge counter for the selected pin. You can
|
|
@@ -165,7 +184,9 @@ module Tinkerforge
|
|
|
165
184
|
#
|
|
166
185
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
167
186
|
def get_edge_count(pin, reset_counter)
|
|
168
|
-
|
|
187
|
+
check_validity
|
|
188
|
+
|
|
189
|
+
send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 12, 'L'
|
|
169
190
|
end
|
|
170
191
|
|
|
171
192
|
# Configures the edge counter for the selected pins. A bitmask of 9 or 0b1001 will
|
|
@@ -187,7 +208,9 @@ module Tinkerforge
|
|
|
187
208
|
#
|
|
188
209
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
189
210
|
def set_edge_count_config(selection_mask, edge_type, debounce)
|
|
190
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'S C C', 8, ''
|
|
191
214
|
end
|
|
192
215
|
|
|
193
216
|
# Returns the edge type and debounce time for the selected pin as set by
|
|
@@ -195,19 +218,23 @@ module Tinkerforge
|
|
|
195
218
|
#
|
|
196
219
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
|
197
220
|
def get_edge_count_config(pin)
|
|
198
|
-
|
|
221
|
+
check_validity
|
|
222
|
+
|
|
223
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 10, 'C C'
|
|
199
224
|
end
|
|
200
225
|
|
|
201
226
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
202
227
|
# the position, the hardware and firmware version as well as the
|
|
203
228
|
# device identifier.
|
|
204
229
|
#
|
|
205
|
-
# The position can be 'a', 'b', 'c' or '
|
|
230
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
231
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
232
|
+
# position 'z'.
|
|
206
233
|
#
|
|
207
234
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
208
235
|
# |device_identifier_constant|
|
|
209
236
|
def get_identity
|
|
210
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
237
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
211
238
|
end
|
|
212
239
|
|
|
213
240
|
# 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
|
# 4 galvanically isolated digital inputs
|
|
14
16
|
class BrickletIndustrialDigitalIn4V2 < Device
|
|
@@ -84,7 +86,7 @@ module Tinkerforge
|
|
|
84
86
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
85
87
|
# the IP Connection <tt>ipcon</tt>.
|
|
86
88
|
def initialize(uid, ipcon)
|
|
87
|
-
super uid, ipcon
|
|
89
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
88
90
|
|
|
89
91
|
@api_version = [2, 0, 0]
|
|
90
92
|
|
|
@@ -111,14 +113,17 @@ module Tinkerforge
|
|
|
111
113
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
112
114
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
113
115
|
|
|
114
|
-
@callback_formats[CALLBACK_VALUE] = 'C ? ?'
|
|
115
|
-
@callback_formats[CALLBACK_ALL_VALUE] = '?4 ?4'
|
|
116
|
+
@callback_formats[CALLBACK_VALUE] = [11, 'C ? ?']
|
|
117
|
+
@callback_formats[CALLBACK_ALL_VALUE] = [10, '?4 ?4']
|
|
116
118
|
|
|
119
|
+
@ipcon.add_device self
|
|
117
120
|
end
|
|
118
121
|
|
|
119
122
|
# Returns the input value as bools, *true* refers to high and *false* refers to low.
|
|
120
123
|
def get_value
|
|
121
|
-
|
|
124
|
+
check_validity
|
|
125
|
+
|
|
126
|
+
send_request FUNCTION_GET_VALUE, [], '', 9, '?4'
|
|
122
127
|
end
|
|
123
128
|
|
|
124
129
|
# This callback can be configured per channel.
|
|
@@ -133,13 +138,17 @@ module Tinkerforge
|
|
|
133
138
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
134
139
|
# independent of the value.
|
|
135
140
|
def set_value_callback_configuration(channel, period, value_has_to_change)
|
|
136
|
-
|
|
141
|
+
check_validity
|
|
142
|
+
|
|
143
|
+
send_request FUNCTION_SET_VALUE_CALLBACK_CONFIGURATION, [channel, period, value_has_to_change], 'C L ?', 8, ''
|
|
137
144
|
end
|
|
138
145
|
|
|
139
146
|
# Returns the callback configuration for the given channel as set by
|
|
140
147
|
# BrickletIndustrialDigitalIn4V2#set_value_callback_configuration.
|
|
141
148
|
def get_value_callback_configuration(channel)
|
|
142
|
-
|
|
149
|
+
check_validity
|
|
150
|
+
|
|
151
|
+
send_request FUNCTION_GET_VALUE_CALLBACK_CONFIGURATION, [channel], 'C', 13, 'L ?'
|
|
143
152
|
end
|
|
144
153
|
|
|
145
154
|
# The period is the period with which the CALLBACK_ALL_VALUE
|
|
@@ -152,13 +161,17 @@ module Tinkerforge
|
|
|
152
161
|
# If it is set to false, the callback is continuously triggered with the period,
|
|
153
162
|
# independent of the value.
|
|
154
163
|
def set_all_value_callback_configuration(period, value_has_to_change)
|
|
155
|
-
|
|
164
|
+
check_validity
|
|
165
|
+
|
|
166
|
+
send_request FUNCTION_SET_ALL_VALUE_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
|
156
167
|
end
|
|
157
168
|
|
|
158
169
|
# Returns the callback configuration as set by
|
|
159
170
|
# BrickletIndustrialDigitalIn4V2#set_all_value_callback_configuration.
|
|
160
171
|
def get_all_value_callback_configuration
|
|
161
|
-
|
|
172
|
+
check_validity
|
|
173
|
+
|
|
174
|
+
send_request FUNCTION_GET_ALL_VALUE_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
|
162
175
|
end
|
|
163
176
|
|
|
164
177
|
# Returns the current value of the edge counter for the selected channel. You can
|
|
@@ -167,7 +180,9 @@ module Tinkerforge
|
|
|
167
180
|
# If you set the reset counter to *true*, the count is set back to 0
|
|
168
181
|
# directly after it is read.
|
|
169
182
|
def get_edge_count(channel, reset_counter)
|
|
170
|
-
|
|
183
|
+
check_validity
|
|
184
|
+
|
|
185
|
+
send_request FUNCTION_GET_EDGE_COUNT, [channel, reset_counter], 'C ?', 12, 'L'
|
|
171
186
|
end
|
|
172
187
|
|
|
173
188
|
# Configures the edge counter for a specific channel.
|
|
@@ -184,13 +199,17 @@ module Tinkerforge
|
|
|
184
199
|
# If you don't know what any of this means, just leave it at default. The
|
|
185
200
|
# default configuration is very likely OK for you.
|
|
186
201
|
def set_edge_count_configuration(channel, edge_type, debounce)
|
|
187
|
-
|
|
202
|
+
check_validity
|
|
203
|
+
|
|
204
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIGURATION, [channel, edge_type, debounce], 'C C C', 8, ''
|
|
188
205
|
end
|
|
189
206
|
|
|
190
207
|
# Returns the edge type and debounce time for the selected channel as set by
|
|
191
208
|
# BrickletIndustrialDigitalIn4V2#set_edge_count_configuration.
|
|
192
209
|
def get_edge_count_configuration(channel)
|
|
193
|
-
|
|
210
|
+
check_validity
|
|
211
|
+
|
|
212
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIGURATION, [channel], 'C', 10, 'C C'
|
|
194
213
|
end
|
|
195
214
|
|
|
196
215
|
# Each channel has a corresponding LED. You can turn the LED off, on or show a
|
|
@@ -199,12 +218,16 @@ module Tinkerforge
|
|
|
199
218
|
#
|
|
200
219
|
# By default all channel LEDs are configured as "Channel Status".
|
|
201
220
|
def set_channel_led_config(channel, config)
|
|
202
|
-
|
|
221
|
+
check_validity
|
|
222
|
+
|
|
223
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
|
|
203
224
|
end
|
|
204
225
|
|
|
205
226
|
# Returns the channel LED configuration as set by BrickletIndustrialDigitalIn4V2#set_channel_led_config
|
|
206
227
|
def get_channel_led_config(channel)
|
|
207
|
-
|
|
228
|
+
check_validity
|
|
229
|
+
|
|
230
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
|
|
208
231
|
end
|
|
209
232
|
|
|
210
233
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -219,7 +242,9 @@ module Tinkerforge
|
|
|
219
242
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
220
243
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
221
244
|
def get_spitfp_error_count
|
|
222
|
-
|
|
245
|
+
check_validity
|
|
246
|
+
|
|
247
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
223
248
|
end
|
|
224
249
|
|
|
225
250
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -232,12 +257,16 @@ module Tinkerforge
|
|
|
232
257
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
233
258
|
# necessary to call it in a normal user program.
|
|
234
259
|
def set_bootloader_mode(mode)
|
|
235
|
-
|
|
260
|
+
check_validity
|
|
261
|
+
|
|
262
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
236
263
|
end
|
|
237
264
|
|
|
238
265
|
# Returns the current bootloader mode, see BrickletIndustrialDigitalIn4V2#set_bootloader_mode.
|
|
239
266
|
def get_bootloader_mode
|
|
240
|
-
|
|
267
|
+
check_validity
|
|
268
|
+
|
|
269
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
241
270
|
end
|
|
242
271
|
|
|
243
272
|
# Sets the firmware pointer for BrickletIndustrialDigitalIn4V2#write_firmware. The pointer has
|
|
@@ -247,7 +276,9 @@ module Tinkerforge
|
|
|
247
276
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
248
277
|
# necessary to call it in a normal user program.
|
|
249
278
|
def set_write_firmware_pointer(pointer)
|
|
250
|
-
|
|
279
|
+
check_validity
|
|
280
|
+
|
|
281
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
251
282
|
end
|
|
252
283
|
|
|
253
284
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -259,7 +290,9 @@ module Tinkerforge
|
|
|
259
290
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
260
291
|
# necessary to call it in a normal user program.
|
|
261
292
|
def write_firmware(data)
|
|
262
|
-
|
|
293
|
+
check_validity
|
|
294
|
+
|
|
295
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
263
296
|
end
|
|
264
297
|
|
|
265
298
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -270,22 +303,28 @@ module Tinkerforge
|
|
|
270
303
|
#
|
|
271
304
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
272
305
|
def set_status_led_config(config)
|
|
273
|
-
|
|
306
|
+
check_validity
|
|
307
|
+
|
|
308
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
274
309
|
end
|
|
275
310
|
|
|
276
311
|
# Returns the configuration as set by BrickletIndustrialDigitalIn4V2#set_status_led_config
|
|
277
312
|
def get_status_led_config
|
|
278
|
-
|
|
313
|
+
check_validity
|
|
314
|
+
|
|
315
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
279
316
|
end
|
|
280
317
|
|
|
281
|
-
# Returns the temperature
|
|
318
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
282
319
|
# value returned is not the ambient temperature!
|
|
283
320
|
#
|
|
284
321
|
# The temperature is only proportional to the real temperature and it has bad
|
|
285
322
|
# accuracy. Practically it is only useful as an indicator for
|
|
286
323
|
# temperature changes.
|
|
287
324
|
def get_chip_temperature
|
|
288
|
-
|
|
325
|
+
check_validity
|
|
326
|
+
|
|
327
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
289
328
|
end
|
|
290
329
|
|
|
291
330
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -295,7 +334,9 @@ module Tinkerforge
|
|
|
295
334
|
# calling functions on the existing ones will result in
|
|
296
335
|
# undefined behavior!
|
|
297
336
|
def reset
|
|
298
|
-
|
|
337
|
+
check_validity
|
|
338
|
+
|
|
339
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
299
340
|
end
|
|
300
341
|
|
|
301
342
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -304,25 +345,31 @@ module Tinkerforge
|
|
|
304
345
|
#
|
|
305
346
|
# We recommend that you use Brick Viewer to change the UID.
|
|
306
347
|
def write_uid(uid)
|
|
307
|
-
|
|
348
|
+
check_validity
|
|
349
|
+
|
|
350
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
308
351
|
end
|
|
309
352
|
|
|
310
353
|
# Returns the current UID as an integer. Encode as
|
|
311
354
|
# Base58 to get the usual string version.
|
|
312
355
|
def read_uid
|
|
313
|
-
|
|
356
|
+
check_validity
|
|
357
|
+
|
|
358
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
314
359
|
end
|
|
315
360
|
|
|
316
361
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
317
362
|
# the position, the hardware and firmware version as well as the
|
|
318
363
|
# device identifier.
|
|
319
364
|
#
|
|
320
|
-
# The position can be 'a', 'b', 'c' or '
|
|
365
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
366
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
367
|
+
# position 'z'.
|
|
321
368
|
#
|
|
322
369
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
323
370
|
# |device_identifier_constant|
|
|
324
371
|
def get_identity
|
|
325
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
372
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
326
373
|
end
|
|
327
374
|
|
|
328
375
|
# 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
|
# 4 galvanically isolated digital outputs
|
|
14
16
|
class BrickletIndustrialDigitalOut4 < 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 high
|
|
@@ -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 BrickletIndustrialDigitalOut4#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
|
|
@@ -94,7 +101,9 @@ module Tinkerforge
|
|
|
94
101
|
# of two seconds and pin 0 high. Pin 0 will be high all the time. If now
|
|
95
102
|
# the RS485 connection is lost, then pin 0 will turn low 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 Digital Out 4 Bricklets that should work together. You can
|
|
@@ -122,19 +133,25 @@ module Tinkerforge
|
|
|
122
133
|
# pins on the Digital Out 4 on port B are assigned to 4-7. It is now possible
|
|
123
134
|
# to call BrickletIndustrialDigitalOut4#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 BrickletIndustrialDigitalOut4#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 pins 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>.
|