tinkerforge 2.1.24 → 2.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tinkerforge/brick_dc.rb +155 -74
- data/lib/tinkerforge/brick_hat.rb +70 -30
- data/lib/tinkerforge/brick_hat_zero.rb +56 -22
- data/lib/tinkerforge/brick_imu.rb +184 -77
- data/lib/tinkerforge/brick_imu_v2.rb +208 -105
- data/lib/tinkerforge/brick_master.rb +484 -182
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +185 -101
- data/lib/tinkerforge/brick_silent_stepper.rb +246 -166
- data/lib/tinkerforge/brick_stepper.rb +210 -98
- data/lib/tinkerforge/bricklet_accelerometer.rb +58 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +105 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +117 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +51 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +40 -22
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -25
- data/lib/tinkerforge/bricklet_analog_in.rb +63 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +67 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +23 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +20 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +54 -20
- data/lib/tinkerforge/bricklet_barometer.rb +66 -26
- data/lib/tinkerforge/bricklet_barometer_v2.rb +99 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -18
- data/lib/tinkerforge/bricklet_can_v2.rb +172 -38
- data/lib/tinkerforge/bricklet_co2.rb +34 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -37
- data/lib/tinkerforge/bricklet_color.rb +69 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +87 -33
- data/lib/tinkerforge/bricklet_compass.rb +78 -30
- data/lib/tinkerforge/bricklet_current12.rb +58 -24
- data/lib/tinkerforge/bricklet_current25.rb +58 -24
- data/lib/tinkerforge/bricklet_distance_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +40 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_dmx.rb +88 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +24 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +40 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +88 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +73 -27
- data/lib/tinkerforge/bricklet_gps.rb +64 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +117 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_humidity.rb +51 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +83 -31
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +38 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +81 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +101 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +45 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +77 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +73 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +40 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -29
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +49 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +82 -30
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +61 -23
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -25
- data/lib/tinkerforge/bricklet_io16.rb +55 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +90 -34
- data/lib/tinkerforge/bricklet_io4.rb +55 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -28
- data/lib/tinkerforge/bricklet_joystick.rb +59 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +68 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +82 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +96 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +192 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +45 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +58 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +60 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +91 -46
- data/lib/tinkerforge/bricklet_line.rb +34 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +51 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +61 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +80 -30
- data/lib/tinkerforge/bricklet_moisture.rb +40 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +22 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -24
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +31 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +76 -28
- data/lib/tinkerforge/bricklet_nfc.rb +123 -58
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +33 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +29 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +66 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +29 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +66 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -27
- data/lib/tinkerforge/bricklet_particulate_matter.rb +75 -30
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +80 -42
- data/lib/tinkerforge/bricklet_ptc.rb +74 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +95 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -44
- data/lib/tinkerforge/bricklet_remote_switch.rb +39 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +87 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +18 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +62 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +79 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +52 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +39 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +53 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +57 -23
- data/lib/tinkerforge/bricklet_rs232.rb +90 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +118 -44
- data/lib/tinkerforge/bricklet_rs485.rb +223 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +25 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -35
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +25 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +59 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +35 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +72 -31
- data/lib/tinkerforge/bricklet_temperature.rb +40 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +57 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +71 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +61 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +105 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +45 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -27
- data/lib/tinkerforge/bricklet_tilt.rb +24 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +36 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +85 -37
- data/lib/tinkerforge/bricklet_voltage.rb +52 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +91 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +90 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +80 -30
- data/lib/tinkerforge/device_display_names.rb +163 -0
- data/lib/tinkerforge/ip_connection.rb +151 -32
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -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-04-07. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
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
|
@@ -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,24 @@ 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
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
185
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
186
|
+
# position 'z'.
|
165
187
|
#
|
166
188
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
167
189
|
# |device_identifier_constant|
|
168
190
|
def get_identity
|
169
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
191
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
170
192
|
end
|
171
193
|
|
172
194
|
# 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-04-07. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
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.
|
@@ -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,19 +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
164
|
def set_channel_led_config(channel, config)
|
152
|
-
|
165
|
+
check_validity
|
166
|
+
|
167
|
+
send_request FUNCTION_SET_CHANNEL_LED_CONFIG, [channel, config], 'C C', 8, ''
|
153
168
|
end
|
154
169
|
|
155
170
|
# Returns the channel LED configuration as set by BrickletIndustrialQuadRelayV2#set_channel_led_config
|
156
171
|
def get_channel_led_config(channel)
|
157
|
-
|
172
|
+
check_validity
|
173
|
+
|
174
|
+
send_request FUNCTION_GET_CHANNEL_LED_CONFIG, [channel], 'C', 9, 'C'
|
158
175
|
end
|
159
176
|
|
160
177
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -169,7 +186,9 @@ module Tinkerforge
|
|
169
186
|
# The errors counts are for errors that occur on the Bricklet side. All
|
170
187
|
# Bricks have a similar function that returns the errors on the Brick side.
|
171
188
|
def get_spitfp_error_count
|
172
|
-
|
189
|
+
check_validity
|
190
|
+
|
191
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
173
192
|
end
|
174
193
|
|
175
194
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -182,12 +201,16 @@ module Tinkerforge
|
|
182
201
|
# This function is used by Brick Viewer during flashing. It should not be
|
183
202
|
# necessary to call it in a normal user program.
|
184
203
|
def set_bootloader_mode(mode)
|
185
|
-
|
204
|
+
check_validity
|
205
|
+
|
206
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
186
207
|
end
|
187
208
|
|
188
209
|
# Returns the current bootloader mode, see BrickletIndustrialQuadRelayV2#set_bootloader_mode.
|
189
210
|
def get_bootloader_mode
|
190
|
-
|
211
|
+
check_validity
|
212
|
+
|
213
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
191
214
|
end
|
192
215
|
|
193
216
|
# Sets the firmware pointer for BrickletIndustrialQuadRelayV2#write_firmware. The pointer has
|
@@ -197,7 +220,9 @@ module Tinkerforge
|
|
197
220
|
# This function is used by Brick Viewer during flashing. It should not be
|
198
221
|
# necessary to call it in a normal user program.
|
199
222
|
def set_write_firmware_pointer(pointer)
|
200
|
-
|
223
|
+
check_validity
|
224
|
+
|
225
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
201
226
|
end
|
202
227
|
|
203
228
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -209,7 +234,9 @@ module Tinkerforge
|
|
209
234
|
# This function is used by Brick Viewer during flashing. It should not be
|
210
235
|
# necessary to call it in a normal user program.
|
211
236
|
def write_firmware(data)
|
212
|
-
|
237
|
+
check_validity
|
238
|
+
|
239
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
213
240
|
end
|
214
241
|
|
215
242
|
# Sets the status LED configuration. By default the LED shows
|
@@ -220,22 +247,28 @@ module Tinkerforge
|
|
220
247
|
#
|
221
248
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
222
249
|
def set_status_led_config(config)
|
223
|
-
|
250
|
+
check_validity
|
251
|
+
|
252
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
224
253
|
end
|
225
254
|
|
226
255
|
# Returns the configuration as set by BrickletIndustrialQuadRelayV2#set_status_led_config
|
227
256
|
def get_status_led_config
|
228
|
-
|
257
|
+
check_validity
|
258
|
+
|
259
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
229
260
|
end
|
230
261
|
|
231
|
-
# Returns the temperature
|
262
|
+
# Returns the temperature as measured inside the microcontroller. The
|
232
263
|
# value returned is not the ambient temperature!
|
233
264
|
#
|
234
265
|
# The temperature is only proportional to the real temperature and it has bad
|
235
266
|
# accuracy. Practically it is only useful as an indicator for
|
236
267
|
# temperature changes.
|
237
268
|
def get_chip_temperature
|
238
|
-
|
269
|
+
check_validity
|
270
|
+
|
271
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
239
272
|
end
|
240
273
|
|
241
274
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -245,7 +278,9 @@ module Tinkerforge
|
|
245
278
|
# calling functions on the existing ones will result in
|
246
279
|
# undefined behavior!
|
247
280
|
def reset
|
248
|
-
|
281
|
+
check_validity
|
282
|
+
|
283
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
249
284
|
end
|
250
285
|
|
251
286
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -254,25 +289,32 @@ module Tinkerforge
|
|
254
289
|
#
|
255
290
|
# We recommend that you use Brick Viewer to change the UID.
|
256
291
|
def write_uid(uid)
|
257
|
-
|
292
|
+
check_validity
|
293
|
+
|
294
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
258
295
|
end
|
259
296
|
|
260
297
|
# Returns the current UID as an integer. Encode as
|
261
298
|
# Base58 to get the usual string version.
|
262
299
|
def read_uid
|
263
|
-
|
300
|
+
check_validity
|
301
|
+
|
302
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
264
303
|
end
|
265
304
|
|
266
305
|
# Returns the UID, the UID where the Bricklet is connected to,
|
267
306
|
# the position, the hardware and firmware version as well as the
|
268
307
|
# device identifier.
|
269
308
|
#
|
270
|
-
# 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
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
311
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
312
|
+
# position 'z'.
|
271
313
|
#
|
272
314
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
273
315
|
# |device_identifier_constant|
|
274
316
|
def get_identity
|
275
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
317
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
276
318
|
end
|
277
319
|
|
278
320
|
# 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-04-07. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.25 #
|
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
|
# 16-channel digital input/output
|
14
16
|
class BrickletIO16 < Device
|
@@ -60,7 +62,7 @@ module Tinkerforge
|
|
60
62
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
61
63
|
# the IP Connection <tt>ipcon</tt>.
|
62
64
|
def initialize(uid, ipcon)
|
63
|
-
super uid, ipcon
|
65
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
64
66
|
|
65
67
|
@api_version = [2, 0, 1]
|
66
68
|
|
@@ -80,9 +82,10 @@ module Tinkerforge
|
|
80
82
|
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
83
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
82
84
|
|
83
|
-
@callback_formats[CALLBACK_INTERRUPT] = 'k C C'
|
84
|
-
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'k C C'
|
85
|
+
@callback_formats[CALLBACK_INTERRUPT] = [11, 'k C C']
|
86
|
+
@callback_formats[CALLBACK_MONOFLOP_DONE] = [11, 'k C C']
|
85
87
|
|
88
|
+
@ipcon.add_device self
|
86
89
|
end
|
87
90
|
|
88
91
|
# Sets the output value (high or low) for a port ("a" or "b") with a bitmask
|
@@ -98,14 +101,18 @@ module Tinkerforge
|
|
98
101
|
# This function does nothing for pins that are configured as input.
|
99
102
|
# Pull-up resistors can be switched on with BrickletIO16#set_port_configuration.
|
100
103
|
def set_port(port, value_mask)
|
101
|
-
|
104
|
+
check_validity
|
105
|
+
|
106
|
+
send_request FUNCTION_SET_PORT, [port, value_mask], 'k C', 8, ''
|
102
107
|
end
|
103
108
|
|
104
109
|
# Returns a bitmask of the values that are currently measured on the
|
105
110
|
# specified port. This function works if the pin is configured to input
|
106
111
|
# as well as if it is configured to output.
|
107
112
|
def get_port(port)
|
108
|
-
|
113
|
+
check_validity
|
114
|
+
|
115
|
+
send_request FUNCTION_GET_PORT, [port], 'k', 9, 'C'
|
109
116
|
end
|
110
117
|
|
111
118
|
# Configures the value and direction of a specified port. Possible directions
|
@@ -127,7 +134,9 @@ module Tinkerforge
|
|
127
134
|
# Running monoflop timers for the selected pins will be aborted if this
|
128
135
|
# function is called.
|
129
136
|
def set_port_configuration(port, selection_mask, direction, value)
|
130
|
-
|
137
|
+
check_validity
|
138
|
+
|
139
|
+
send_request FUNCTION_SET_PORT_CONFIGURATION, [port, selection_mask, direction, value], 'k C k ?', 8, ''
|
131
140
|
end
|
132
141
|
|
133
142
|
# Returns a direction bitmask and a value bitmask for the specified port. A 1 in
|
@@ -141,7 +150,9 @@ module Tinkerforge
|
|
141
150
|
# * pins 4 and 5 are configured as output high
|
142
151
|
# * and pins 6 and 7 are configured as output low.
|
143
152
|
def get_port_configuration(port)
|
144
|
-
|
153
|
+
check_validity
|
154
|
+
|
155
|
+
send_request FUNCTION_GET_PORT_CONFIGURATION, [port], 'k', 10, 'C C'
|
145
156
|
end
|
146
157
|
|
147
158
|
# Sets the debounce period of the CALLBACK_INTERRUPT callback.
|
@@ -150,12 +161,16 @@ module Tinkerforge
|
|
150
161
|
# maximal every 100ms. This is necessary if something that bounces is
|
151
162
|
# connected to the IO-16 Bricklet, such as a button.
|
152
163
|
def set_debounce_period(debounce)
|
153
|
-
|
164
|
+
check_validity
|
165
|
+
|
166
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
154
167
|
end
|
155
168
|
|
156
169
|
# Returns the debounce period as set by BrickletIO16#set_debounce_period.
|
157
170
|
def get_debounce_period
|
158
|
-
|
171
|
+
check_validity
|
172
|
+
|
173
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
159
174
|
end
|
160
175
|
|
161
176
|
# Sets the pins on which an interrupt is activated with a bitmask.
|
@@ -167,13 +182,17 @@ module Tinkerforge
|
|
167
182
|
#
|
168
183
|
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
169
184
|
def set_port_interrupt(port, interrupt_mask)
|
170
|
-
|
185
|
+
check_validity
|
186
|
+
|
187
|
+
send_request FUNCTION_SET_PORT_INTERRUPT, [port, interrupt_mask], 'k C', 8, ''
|
171
188
|
end
|
172
189
|
|
173
190
|
# Returns the interrupt bitmask for the specified port as set by
|
174
191
|
# BrickletIO16#set_port_interrupt.
|
175
192
|
def get_port_interrupt(port)
|
176
|
-
|
193
|
+
check_validity
|
194
|
+
|
195
|
+
send_request FUNCTION_GET_PORT_INTERRUPT, [port], 'k', 9, 'C'
|
177
196
|
end
|
178
197
|
|
179
198
|
# Configures a monoflop of the pins specified by the second parameter as 8 bit
|
@@ -196,7 +215,9 @@ module Tinkerforge
|
|
196
215
|
# of two seconds and pin 0 set to high. Pin 0 will be high all the time. If now
|
197
216
|
# the RS485 connection is lost, then pin 0 will get low in at most two seconds.
|
198
217
|
def set_port_monoflop(port, selection_mask, value_mask, time)
|
199
|
-
|
218
|
+
check_validity
|
219
|
+
|
220
|
+
send_request FUNCTION_SET_PORT_MONOFLOP, [port, selection_mask, value_mask, time], 'k C C L', 8, ''
|
200
221
|
end
|
201
222
|
|
202
223
|
# Returns (for the given pin) the current value and the time as set by
|
@@ -205,7 +226,9 @@ module Tinkerforge
|
|
205
226
|
# If the timer is not running currently, the remaining time will be returned
|
206
227
|
# as 0.
|
207
228
|
def get_port_monoflop(port, pin)
|
208
|
-
|
229
|
+
check_validity
|
230
|
+
|
231
|
+
send_request FUNCTION_GET_PORT_MONOFLOP, [port, pin], 'k C', 17, 'C L L'
|
209
232
|
end
|
210
233
|
|
211
234
|
# Sets the output value (high or low) for a port ("a" or "b" with a bitmask,
|
@@ -222,7 +245,9 @@ module Tinkerforge
|
|
222
245
|
# This function does nothing for pins that are configured as input.
|
223
246
|
# Pull-up resistors can be switched on with BrickletIO16#set_port_configuration.
|
224
247
|
def set_selected_values(port, selection_mask, value_mask)
|
225
|
-
|
248
|
+
check_validity
|
249
|
+
|
250
|
+
send_request FUNCTION_SET_SELECTED_VALUES, [port, selection_mask, value_mask], 'k C C', 8, ''
|
226
251
|
end
|
227
252
|
|
228
253
|
# Returns the current value of the edge counter for the selected pin on port A.
|
@@ -233,7 +258,9 @@ module Tinkerforge
|
|
233
258
|
#
|
234
259
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
235
260
|
def get_edge_count(pin, reset_counter)
|
236
|
-
|
261
|
+
check_validity
|
262
|
+
|
263
|
+
send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 12, 'L'
|
237
264
|
end
|
238
265
|
|
239
266
|
# Configures the edge counter for the selected pin of port A. Pins 0 and 1
|
@@ -253,7 +280,9 @@ module Tinkerforge
|
|
253
280
|
#
|
254
281
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
255
282
|
def set_edge_count_config(pin, edge_type, debounce)
|
256
|
-
|
283
|
+
check_validity
|
284
|
+
|
285
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [pin, edge_type, debounce], 'C C C', 8, ''
|
257
286
|
end
|
258
287
|
|
259
288
|
# Returns the edge type and debounce time for the selected pin of port A as set by
|
@@ -261,19 +290,24 @@ module Tinkerforge
|
|
261
290
|
#
|
262
291
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
263
292
|
def get_edge_count_config(pin)
|
264
|
-
|
293
|
+
check_validity
|
294
|
+
|
295
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 10, 'C C'
|
265
296
|
end
|
266
297
|
|
267
298
|
# Returns the UID, the UID where the Bricklet is connected to,
|
268
299
|
# the position, the hardware and firmware version as well as the
|
269
300
|
# device identifier.
|
270
301
|
#
|
271
|
-
# The position can be 'a', 'b', 'c' or '
|
302
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
303
|
+
# The Raspberry Pi HAT (Zero) Brick is always at position 'i' and the Bricklet
|
304
|
+
# connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always as
|
305
|
+
# position 'z'.
|
272
306
|
#
|
273
307
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
274
308
|
# |device_identifier_constant|
|
275
309
|
def get_identity
|
276
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
310
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
277
311
|
end
|
278
312
|
|
279
313
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|