tinkerforge 2.1.13 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -78,12 +78,11 @@ module Tinkerforge
|
|
78
78
|
@response_expected[FUNCTION_SET_CALIBRATION] = RESPONSE_EXPECTED_FALSE
|
79
79
|
@response_expected[FUNCTION_GET_CALIBRATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
80
80
|
@response_expected[FUNCTION_GET_ADC_VALUES] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
|
-
@response_expected[CALLBACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
82
|
-
@response_expected[CALLBACK_VOLTAGE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
83
81
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
84
82
|
|
85
83
|
@callback_formats[CALLBACK_VOLTAGE] = 'C l'
|
86
84
|
@callback_formats[CALLBACK_VOLTAGE_REACHED] = 'C l'
|
85
|
+
|
87
86
|
end
|
88
87
|
|
89
88
|
# Returns the voltage for the given channel in mV.
|
@@ -92,7 +91,7 @@ module Tinkerforge
|
|
92
91
|
# CALLBACK_VOLTAGE callback and set the period with
|
93
92
|
# BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
|
94
93
|
def get_voltage(channel)
|
95
|
-
send_request
|
94
|
+
send_request FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l'
|
96
95
|
end
|
97
96
|
|
98
97
|
# Sets the period in ms with which the CALLBACK_VOLTAGE callback is triggered
|
@@ -103,12 +102,12 @@ module Tinkerforge
|
|
103
102
|
#
|
104
103
|
# The default value is 0.
|
105
104
|
def set_voltage_callback_period(channel, period)
|
106
|
-
send_request
|
105
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [channel, period], 'C L', 0, ''
|
107
106
|
end
|
108
107
|
|
109
108
|
# Returns the period as set by BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
|
110
109
|
def get_voltage_callback_period(channel)
|
111
|
-
send_request
|
110
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [channel], 'C', 4, 'L'
|
112
111
|
end
|
113
112
|
|
114
113
|
# Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback for the given
|
@@ -126,12 +125,12 @@ module Tinkerforge
|
|
126
125
|
#
|
127
126
|
# The default value is ('x', 0, 0).
|
128
127
|
def set_voltage_callback_threshold(channel, option, min, max)
|
129
|
-
send_request
|
128
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [channel, option, min, max], 'C k l l', 0, ''
|
130
129
|
end
|
131
130
|
|
132
131
|
# Returns the threshold as set by BrickletIndustrialDualAnalogIn#set_voltage_callback_threshold.
|
133
132
|
def get_voltage_callback_threshold(channel)
|
134
|
-
send_request
|
133
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [channel], 'C', 9, 'k l l'
|
135
134
|
end
|
136
135
|
|
137
136
|
# Sets the period in ms with which the threshold callback
|
@@ -146,12 +145,12 @@ module Tinkerforge
|
|
146
145
|
#
|
147
146
|
# The default value is 100.
|
148
147
|
def set_debounce_period(debounce)
|
149
|
-
send_request
|
148
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
150
149
|
end
|
151
150
|
|
152
151
|
# Returns the debounce period as set by BrickletIndustrialDualAnalogIn#set_debounce_period.
|
153
152
|
def get_debounce_period
|
154
|
-
send_request
|
153
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
155
154
|
end
|
156
155
|
|
157
156
|
# Sets the sample rate. The sample rate can be between 1 sample per second
|
@@ -160,12 +159,12 @@ module Tinkerforge
|
|
160
159
|
#
|
161
160
|
# The default value is 6 (2 samples per second).
|
162
161
|
def set_sample_rate(rate)
|
163
|
-
send_request
|
162
|
+
send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
|
164
163
|
end
|
165
164
|
|
166
165
|
# Returns the sample rate as set by BrickletIndustrialDualAnalogIn#set_sample_rate.
|
167
166
|
def get_sample_rate
|
168
|
-
send_request
|
167
|
+
send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
|
169
168
|
end
|
170
169
|
|
171
170
|
# Sets offset and gain of MCP3911 internal calibration registers.
|
@@ -174,18 +173,18 @@ module Tinkerforge
|
|
174
173
|
# is already factory calibrated by Tinkerforge. It should not be necessary
|
175
174
|
# for you to use this function
|
176
175
|
def set_calibration(offset, gain)
|
177
|
-
send_request
|
176
|
+
send_request FUNCTION_SET_CALIBRATION, [offset, gain], 'l2 l2', 0, ''
|
178
177
|
end
|
179
178
|
|
180
179
|
# Returns the calibration as set by BrickletIndustrialDualAnalogIn#set_calibration.
|
181
180
|
def get_calibration
|
182
|
-
send_request
|
181
|
+
send_request FUNCTION_GET_CALIBRATION, [], '', 16, 'l2 l2'
|
183
182
|
end
|
184
183
|
|
185
184
|
# Returns the ADC values as given by the MCP3911 IC. This function
|
186
185
|
# is needed for proper calibration, see BrickletIndustrialDualAnalogIn#set_calibration.
|
187
186
|
def get_adc_values
|
188
|
-
send_request
|
187
|
+
send_request FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2'
|
189
188
|
end
|
190
189
|
|
191
190
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -197,7 +196,7 @@ module Tinkerforge
|
|
197
196
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
198
197
|
# |device_identifier_constant|
|
199
198
|
def get_identity
|
200
|
-
send_request
|
199
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
201
200
|
end
|
202
201
|
|
203
202
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -45,11 +45,11 @@ module Tinkerforge
|
|
45
45
|
@response_expected[FUNCTION_SET_GROUP] = RESPONSE_EXPECTED_FALSE
|
46
46
|
@response_expected[FUNCTION_GET_GROUP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
47
47
|
@response_expected[FUNCTION_GET_AVAILABLE_FOR_GROUP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
48
|
-
@response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
49
48
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
50
49
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
51
50
|
|
52
51
|
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'S S'
|
52
|
+
|
53
53
|
end
|
54
54
|
|
55
55
|
# Sets the output value with a bitmask (16bit). A 1 in the bitmask means relay
|
@@ -65,12 +65,12 @@ module Tinkerforge
|
|
65
65
|
# Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3
|
66
66
|
# pins 8-11 and element 4 pins 12-15.
|
67
67
|
def set_value(value_mask)
|
68
|
-
send_request
|
68
|
+
send_request FUNCTION_SET_VALUE, [value_mask], 'S', 0, ''
|
69
69
|
end
|
70
70
|
|
71
71
|
# Returns the bitmask as set by BrickletIndustrialQuadRelay#set_value.
|
72
72
|
def get_value
|
73
|
-
send_request
|
73
|
+
send_request FUNCTION_GET_VALUE, [], '', 2, 'S'
|
74
74
|
end
|
75
75
|
|
76
76
|
# Configures a monoflop of the pins specified by the first parameter
|
@@ -92,7 +92,7 @@ module Tinkerforge
|
|
92
92
|
# of two seconds and pin 0 closed. Pin 0 will be closed all the time. If now
|
93
93
|
# the RS485 connection is lost, then pin 0 will be opened in at most two seconds.
|
94
94
|
def set_monoflop(selection_mask, value_mask, time)
|
95
|
-
send_request
|
95
|
+
send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'S S L', 0, ''
|
96
96
|
end
|
97
97
|
|
98
98
|
# Returns (for the given pin) the current value and the time as set by
|
@@ -101,7 +101,7 @@ module Tinkerforge
|
|
101
101
|
# If the timer is not running currently, the remaining time will be returned
|
102
102
|
# as 0.
|
103
103
|
def get_monoflop(pin)
|
104
|
-
send_request
|
104
|
+
send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 10, 'S L L'
|
105
105
|
end
|
106
106
|
|
107
107
|
# Sets a group of Quad Relay Bricklets that should work together. You can
|
@@ -120,19 +120,19 @@ module Tinkerforge
|
|
120
120
|
# pins on the Quad Relay on port B are assigned to 4-7. It is now possible
|
121
121
|
# to call BrickletIndustrialQuadRelay#set_value and control two Bricklets at the same time.
|
122
122
|
def set_group(group)
|
123
|
-
send_request
|
123
|
+
send_request FUNCTION_SET_GROUP, [group], 'k4', 0, ''
|
124
124
|
end
|
125
125
|
|
126
126
|
# Returns the group as set by BrickletIndustrialQuadRelay#set_group
|
127
127
|
def get_group
|
128
|
-
send_request
|
128
|
+
send_request FUNCTION_GET_GROUP, [], '', 4, 'k4'
|
129
129
|
end
|
130
130
|
|
131
131
|
# Returns a bitmask of ports that are available for grouping. For example the
|
132
132
|
# value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
|
133
133
|
# can be grouped together.
|
134
134
|
def get_available_for_group
|
135
|
-
send_request
|
135
|
+
send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C'
|
136
136
|
end
|
137
137
|
|
138
138
|
# Sets the output value with a bitmask, according to the selection mask.
|
@@ -149,7 +149,7 @@ module Tinkerforge
|
|
149
149
|
# Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3
|
150
150
|
# pins 8-11 and element 4 pins 12-15.
|
151
151
|
def set_selected_values(selection_mask, value_mask)
|
152
|
-
send_request
|
152
|
+
send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'S S', 0, ''
|
153
153
|
end
|
154
154
|
|
155
155
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -161,7 +161,7 @@ module Tinkerforge
|
|
161
161
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
162
162
|
# |device_identifier_constant|
|
163
163
|
def get_identity
|
164
|
-
send_request
|
164
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
165
165
|
end
|
166
166
|
|
167
167
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -72,10 +72,8 @@ module Tinkerforge
|
|
72
72
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
73
73
|
@response_expected[FUNCTION_SET_PORT_INTERRUPT] = RESPONSE_EXPECTED_TRUE
|
74
74
|
@response_expected[FUNCTION_GET_PORT_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
75
|
-
@response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
76
75
|
@response_expected[FUNCTION_SET_PORT_MONOFLOP] = RESPONSE_EXPECTED_FALSE
|
77
76
|
@response_expected[FUNCTION_GET_PORT_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
78
|
-
@response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
79
77
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
80
78
|
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
79
|
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_FALSE
|
@@ -84,6 +82,7 @@ module Tinkerforge
|
|
84
82
|
|
85
83
|
@callback_formats[CALLBACK_INTERRUPT] = 'k C C'
|
86
84
|
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'k C C'
|
85
|
+
|
87
86
|
end
|
88
87
|
|
89
88
|
# Sets the output value (high or low) for a port ("a" or "b") with a bitmask
|
@@ -96,14 +95,14 @@ module Tinkerforge
|
|
96
95
|
# This function does nothing for pins that are configured as input.
|
97
96
|
# Pull-up resistors can be switched on with BrickletIO16#set_port_configuration.
|
98
97
|
def set_port(port, value_mask)
|
99
|
-
send_request
|
98
|
+
send_request FUNCTION_SET_PORT, [port, value_mask], 'k C', 0, ''
|
100
99
|
end
|
101
100
|
|
102
101
|
# Returns a bitmask of the values that are currently measured on the
|
103
102
|
# specified port. This function works if the pin is configured to input
|
104
103
|
# as well as if it is configured to output.
|
105
104
|
def get_port(port)
|
106
|
-
send_request
|
105
|
+
send_request FUNCTION_GET_PORT, [port], 'k', 1, 'C'
|
107
106
|
end
|
108
107
|
|
109
108
|
# Configures the value and direction of a specified port. Possible directions
|
@@ -124,7 +123,7 @@ module Tinkerforge
|
|
124
123
|
#
|
125
124
|
# The default configuration is input with pull-up.
|
126
125
|
def set_port_configuration(port, selection_mask, direction, value)
|
127
|
-
send_request
|
126
|
+
send_request FUNCTION_SET_PORT_CONFIGURATION, [port, selection_mask, direction, value], 'k C k ?', 0, ''
|
128
127
|
end
|
129
128
|
|
130
129
|
# Returns a direction bitmask and a value bitmask for the specified port. A 1 in
|
@@ -138,7 +137,7 @@ module Tinkerforge
|
|
138
137
|
# * pins 4 and 5 are configured as output high
|
139
138
|
# * and pins 6 and 7 are configured as output low.
|
140
139
|
def get_port_configuration(port)
|
141
|
-
send_request
|
140
|
+
send_request FUNCTION_GET_PORT_CONFIGURATION, [port], 'k', 2, 'C C'
|
142
141
|
end
|
143
142
|
|
144
143
|
# Sets the debounce period of the CALLBACK_INTERRUPT callback in ms.
|
@@ -149,12 +148,12 @@ module Tinkerforge
|
|
149
148
|
#
|
150
149
|
# The default value is 100.
|
151
150
|
def set_debounce_period(debounce)
|
152
|
-
send_request
|
151
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
153
152
|
end
|
154
153
|
|
155
154
|
# Returns the debounce period as set by BrickletIO16#set_debounce_period.
|
156
155
|
def get_debounce_period
|
157
|
-
send_request
|
156
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
158
157
|
end
|
159
158
|
|
160
159
|
# Sets the pins on which an interrupt is activated with a bitmask.
|
@@ -166,13 +165,13 @@ module Tinkerforge
|
|
166
165
|
#
|
167
166
|
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
168
167
|
def set_port_interrupt(port, interrupt_mask)
|
169
|
-
send_request
|
168
|
+
send_request FUNCTION_SET_PORT_INTERRUPT, [port, interrupt_mask], 'k C', 0, ''
|
170
169
|
end
|
171
170
|
|
172
171
|
# Returns the interrupt bitmask for the specified port as set by
|
173
172
|
# BrickletIO16#set_port_interrupt.
|
174
173
|
def get_port_interrupt(port)
|
175
|
-
send_request
|
174
|
+
send_request FUNCTION_GET_PORT_INTERRUPT, [port], 'k', 1, 'C'
|
176
175
|
end
|
177
176
|
|
178
177
|
# Configures a monoflop of the pins specified by the second parameter as 8 bit
|
@@ -195,7 +194,7 @@ module Tinkerforge
|
|
195
194
|
# of two seconds and pin 0 set to high. Pin 0 will be high all the time. If now
|
196
195
|
# the RS485 connection is lost, then pin 0 will get low in at most two seconds.
|
197
196
|
def set_port_monoflop(port, selection_mask, value_mask, time)
|
198
|
-
send_request
|
197
|
+
send_request FUNCTION_SET_PORT_MONOFLOP, [port, selection_mask, value_mask, time], 'k C C L', 0, ''
|
199
198
|
end
|
200
199
|
|
201
200
|
# Returns (for the given pin) the current value and the time as set by
|
@@ -204,7 +203,7 @@ module Tinkerforge
|
|
204
203
|
# If the timer is not running currently, the remaining time will be returned
|
205
204
|
# as 0.
|
206
205
|
def get_port_monoflop(port, pin)
|
207
|
-
send_request
|
206
|
+
send_request FUNCTION_GET_PORT_MONOFLOP, [port, pin], 'k C', 9, 'C L L'
|
208
207
|
end
|
209
208
|
|
210
209
|
# Sets the output value (high or low) for a port ("a" or "b" with a bitmask,
|
@@ -218,7 +217,7 @@ module Tinkerforge
|
|
218
217
|
# This function does nothing for pins that are configured as input.
|
219
218
|
# Pull-up resistors can be switched on with BrickletIO16#set_port_configuration.
|
220
219
|
def set_selected_values(port, selection_mask, value_mask)
|
221
|
-
send_request
|
220
|
+
send_request FUNCTION_SET_SELECTED_VALUES, [port, selection_mask, value_mask], 'k C C', 0, ''
|
222
221
|
end
|
223
222
|
|
224
223
|
# Returns the current value of the edge counter for the selected pin on port A.
|
@@ -229,7 +228,7 @@ module Tinkerforge
|
|
229
228
|
#
|
230
229
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
231
230
|
def get_edge_count(pin, reset_counter)
|
232
|
-
send_request
|
231
|
+
send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L'
|
233
232
|
end
|
234
233
|
|
235
234
|
# Configures the edge counter for the selected pin of port A. Pins 0 and 1
|
@@ -253,7 +252,7 @@ module Tinkerforge
|
|
253
252
|
#
|
254
253
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
255
254
|
def set_edge_count_config(pin, edge_type, debounce)
|
256
|
-
send_request
|
255
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [pin, edge_type, debounce], 'C C C', 0, ''
|
257
256
|
end
|
258
257
|
|
259
258
|
# Returns the edge type and debounce time for the selected pin of port A as set by
|
@@ -261,7 +260,7 @@ module Tinkerforge
|
|
261
260
|
#
|
262
261
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
263
262
|
def get_edge_count_config(pin)
|
264
|
-
send_request
|
263
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C'
|
265
264
|
end
|
266
265
|
|
267
266
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -273,7 +272,7 @@ module Tinkerforge
|
|
273
272
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
274
273
|
# |device_identifier_constant|
|
275
274
|
def get_identity
|
276
|
-
send_request
|
275
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
277
276
|
end
|
278
277
|
|
279
278
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2017-
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -71,10 +71,8 @@ module Tinkerforge
|
|
71
71
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
72
72
|
@response_expected[FUNCTION_SET_INTERRUPT] = RESPONSE_EXPECTED_TRUE
|
73
73
|
@response_expected[FUNCTION_GET_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
74
|
-
@response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
75
74
|
@response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
|
76
75
|
@response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
77
|
-
@response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
78
76
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
79
77
|
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
80
78
|
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_FALSE
|
@@ -83,6 +81,7 @@ module Tinkerforge
|
|
83
81
|
|
84
82
|
@callback_formats[CALLBACK_INTERRUPT] = 'C C'
|
85
83
|
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C C'
|
84
|
+
|
86
85
|
end
|
87
86
|
|
88
87
|
# Sets the output value (high or low) with a bitmask (4bit). A 1 in the bitmask
|
@@ -95,14 +94,14 @@ module Tinkerforge
|
|
95
94
|
# This function does nothing for pins that are configured as input.
|
96
95
|
# Pull-up resistors can be switched on with BrickletIO4#set_configuration.
|
97
96
|
def set_value(value_mask)
|
98
|
-
send_request
|
97
|
+
send_request FUNCTION_SET_VALUE, [value_mask], 'C', 0, ''
|
99
98
|
end
|
100
99
|
|
101
100
|
# Returns a bitmask of the values that are currently measured.
|
102
101
|
# This function works if the pin is configured to input
|
103
102
|
# as well as if it is configured to output.
|
104
103
|
def get_value
|
105
|
-
send_request
|
104
|
+
send_request FUNCTION_GET_VALUE, [], '', 1, 'C'
|
106
105
|
end
|
107
106
|
|
108
107
|
# Configures the value and direction of the specified pins. Possible directions
|
@@ -123,7 +122,7 @@ module Tinkerforge
|
|
123
122
|
#
|
124
123
|
# The default configuration is input with pull-up.
|
125
124
|
def set_configuration(selection_mask, direction, value)
|
126
|
-
send_request
|
125
|
+
send_request FUNCTION_SET_CONFIGURATION, [selection_mask, direction, value], 'C k ?', 0, ''
|
127
126
|
end
|
128
127
|
|
129
128
|
# Returns a value bitmask and a direction bitmask. A 1 in the direction bitmask
|
@@ -137,7 +136,7 @@ module Tinkerforge
|
|
137
136
|
# * pin 2 is configured as output high and
|
138
137
|
# * pin 3 is are configured as output low.
|
139
138
|
def get_configuration
|
140
|
-
send_request
|
139
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
|
141
140
|
end
|
142
141
|
|
143
142
|
# Sets the debounce period of the CALLBACK_INTERRUPT callback in ms.
|
@@ -148,12 +147,12 @@ module Tinkerforge
|
|
148
147
|
#
|
149
148
|
# The default value is 100.
|
150
149
|
def set_debounce_period(debounce)
|
151
|
-
send_request
|
150
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
152
151
|
end
|
153
152
|
|
154
153
|
# Returns the debounce period as set by BrickletIO4#set_debounce_period.
|
155
154
|
def get_debounce_period
|
156
|
-
send_request
|
155
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
157
156
|
end
|
158
157
|
|
159
158
|
# Sets the pins on which an interrupt is activated with a bitmask.
|
@@ -165,12 +164,12 @@ module Tinkerforge
|
|
165
164
|
#
|
166
165
|
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
167
166
|
def set_interrupt(interrupt_mask)
|
168
|
-
send_request
|
167
|
+
send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'C', 0, ''
|
169
168
|
end
|
170
169
|
|
171
170
|
# Returns the interrupt bitmask as set by BrickletIO4#set_interrupt.
|
172
171
|
def get_interrupt
|
173
|
-
send_request
|
172
|
+
send_request FUNCTION_GET_INTERRUPT, [], '', 1, 'C'
|
174
173
|
end
|
175
174
|
|
176
175
|
# Configures a monoflop of the pins specified by the first parameter as 4 bit
|
@@ -193,7 +192,7 @@ module Tinkerforge
|
|
193
192
|
# of two seconds and pin 0 set to high. Pin 0 will be high all the time. If now
|
194
193
|
# the RS485 connection is lost, then pin 0 will get low in at most two seconds.
|
195
194
|
def set_monoflop(selection_mask, value_mask, time)
|
196
|
-
send_request
|
195
|
+
send_request FUNCTION_SET_MONOFLOP, [selection_mask, value_mask, time], 'C C L', 0, ''
|
197
196
|
end
|
198
197
|
|
199
198
|
# Returns (for the given pin) the current value and the time as set by
|
@@ -202,7 +201,7 @@ module Tinkerforge
|
|
202
201
|
# If the timer is not running currently, the remaining time will be returned
|
203
202
|
# as 0.
|
204
203
|
def get_monoflop(pin)
|
205
|
-
send_request
|
204
|
+
send_request FUNCTION_GET_MONOFLOP, [pin], 'C', 9, 'C L L'
|
206
205
|
end
|
207
206
|
|
208
207
|
# Sets the output value (high or low) with a bitmask, according to
|
@@ -216,7 +215,7 @@ module Tinkerforge
|
|
216
215
|
# This function does nothing for pins that are configured as input.
|
217
216
|
# Pull-up resistors can be switched on with BrickletIO4#set_configuration.
|
218
217
|
def set_selected_values(selection_mask, value_mask)
|
219
|
-
send_request
|
218
|
+
send_request FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'C C', 0, ''
|
220
219
|
end
|
221
220
|
|
222
221
|
# Returns the current value of the edge counter for the selected pin. You can
|
@@ -227,7 +226,7 @@ module Tinkerforge
|
|
227
226
|
#
|
228
227
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
229
228
|
def get_edge_count(pin, reset_counter)
|
230
|
-
send_request
|
229
|
+
send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L'
|
231
230
|
end
|
232
231
|
|
233
232
|
# Configures the edge counter for the selected pins.
|
@@ -250,7 +249,7 @@ module Tinkerforge
|
|
250
249
|
#
|
251
250
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
252
251
|
def set_edge_count_config(selection_mask, edge_type, debounce)
|
253
|
-
send_request
|
252
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'C C C', 0, ''
|
254
253
|
end
|
255
254
|
|
256
255
|
# Returns the edge type and debounce time for the selected pin as set by
|
@@ -258,7 +257,7 @@ module Tinkerforge
|
|
258
257
|
#
|
259
258
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
260
259
|
def get_edge_count_config(pin)
|
261
|
-
send_request
|
260
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C'
|
262
261
|
end
|
263
262
|
|
264
263
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -270,7 +269,7 @@ module Tinkerforge
|
|
270
269
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
271
270
|
# |device_identifier_constant|
|
272
271
|
def get_identity
|
273
|
-
send_request
|
272
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
274
273
|
end
|
275
274
|
|
276
275
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|