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 #
|
@@ -55,15 +55,15 @@ module Tinkerforge
|
|
55
55
|
@response_expected[FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
56
56
|
@response_expected[FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
57
57
|
@response_expected[FUNCTION_EDGE_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
58
|
-
@response_expected[CALLBACK_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
59
58
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
60
59
|
|
61
60
|
@callback_formats[CALLBACK_EDGE_COUNT] = 'L ?'
|
61
|
+
|
62
62
|
end
|
63
63
|
|
64
64
|
# Returns *true* if a magnetic field of 35 Gauss (3.5mT) or greater is detected.
|
65
65
|
def get_value
|
66
|
-
send_request
|
66
|
+
send_request FUNCTION_GET_VALUE, [], '', 1, '?'
|
67
67
|
end
|
68
68
|
|
69
69
|
# Returns the current value of the edge counter. You can configure
|
@@ -73,7 +73,7 @@ module Tinkerforge
|
|
73
73
|
# If you set the reset counter to *true*, the count is set back to 0
|
74
74
|
# directly after it is read.
|
75
75
|
def get_edge_count(reset_counter)
|
76
|
-
send_request
|
76
|
+
send_request FUNCTION_GET_EDGE_COUNT, [reset_counter], '?', 4, 'L'
|
77
77
|
end
|
78
78
|
|
79
79
|
# The edge type parameter configures if rising edges, falling edges or
|
@@ -98,12 +98,12 @@ module Tinkerforge
|
|
98
98
|
#
|
99
99
|
# Default values: 0 (edge type) and 100ms (debounce time)
|
100
100
|
def set_edge_count_config(edge_type, debounce)
|
101
|
-
send_request
|
101
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [edge_type, debounce], 'C C', 0, ''
|
102
102
|
end
|
103
103
|
|
104
104
|
# Returns the edge type and debounce time as set by BrickletHallEffect#set_edge_count_config.
|
105
105
|
def get_edge_count_config
|
106
|
-
send_request
|
106
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [], '', 2, 'C C'
|
107
107
|
end
|
108
108
|
|
109
109
|
# Sets the number of edges until an interrupt is invoked.
|
@@ -114,12 +114,12 @@ module Tinkerforge
|
|
114
114
|
#
|
115
115
|
# Default value is 0.
|
116
116
|
def set_edge_interrupt(edges)
|
117
|
-
send_request
|
117
|
+
send_request FUNCTION_SET_EDGE_INTERRUPT, [edges], 'L', 0, ''
|
118
118
|
end
|
119
119
|
|
120
120
|
# Returns the edges as set by BrickletHallEffect#set_edge_interrupt.
|
121
121
|
def get_edge_interrupt
|
122
|
-
send_request
|
122
|
+
send_request FUNCTION_GET_EDGE_INTERRUPT, [], '', 4, 'L'
|
123
123
|
end
|
124
124
|
|
125
125
|
# Sets the period in ms with which the CALLBACK_EDGE_COUNT callback is triggered
|
@@ -130,12 +130,12 @@ module Tinkerforge
|
|
130
130
|
#
|
131
131
|
# The default value is 0.
|
132
132
|
def set_edge_count_callback_period(period)
|
133
|
-
send_request
|
133
|
+
send_request FUNCTION_SET_EDGE_COUNT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
134
134
|
end
|
135
135
|
|
136
136
|
# Returns the period as set by BrickletHallEffect#set_edge_count_callback_period.
|
137
137
|
def get_edge_count_callback_period
|
138
|
-
send_request
|
138
|
+
send_request FUNCTION_GET_EDGE_COUNT_CALLBACK_PERIOD, [], '', 4, 'L'
|
139
139
|
end
|
140
140
|
|
141
141
|
# This callback is triggered every n-th count, as configured with
|
@@ -143,7 +143,7 @@ module Tinkerforge
|
|
143
143
|
# current count and the current value (see BrickletHallEffect#get_value and
|
144
144
|
# BrickletHallEffect#get_edge_count).
|
145
145
|
def edge_interrupt
|
146
|
-
send_request
|
146
|
+
send_request FUNCTION_EDGE_INTERRUPT, [], '', 5, 'L ?'
|
147
147
|
end
|
148
148
|
|
149
149
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -155,7 +155,7 @@ module Tinkerforge
|
|
155
155
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
156
156
|
# |device_identifier_constant|
|
157
157
|
def get_identity
|
158
|
-
send_request
|
158
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
159
159
|
end
|
160
160
|
|
161
161
|
# 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 #
|
@@ -86,16 +86,13 @@ module Tinkerforge
|
|
86
86
|
@response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
87
87
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
88
88
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
|
-
@response_expected[CALLBACK_HUMIDITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
90
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
91
|
-
@response_expected[CALLBACK_HUMIDITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
92
|
-
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
93
89
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
94
90
|
|
95
91
|
@callback_formats[CALLBACK_HUMIDITY] = 'S'
|
96
92
|
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
97
93
|
@callback_formats[CALLBACK_HUMIDITY_REACHED] = 'S'
|
98
94
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
95
|
+
|
99
96
|
end
|
100
97
|
|
101
98
|
# Returns the humidity of the sensor. The value
|
@@ -106,7 +103,7 @@ module Tinkerforge
|
|
106
103
|
# CALLBACK_HUMIDITY callback and set the period with
|
107
104
|
# BrickletHumidity#set_humidity_callback_period.
|
108
105
|
def get_humidity
|
109
|
-
send_request
|
106
|
+
send_request FUNCTION_GET_HUMIDITY, [], '', 2, 'S'
|
110
107
|
end
|
111
108
|
|
112
109
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
@@ -125,7 +122,7 @@ module Tinkerforge
|
|
125
122
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
126
123
|
# BrickletHumidity#set_analog_value_callback_period.
|
127
124
|
def get_analog_value
|
128
|
-
send_request
|
125
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
|
129
126
|
end
|
130
127
|
|
131
128
|
# Sets the period in ms with which the CALLBACK_HUMIDITY callback is triggered
|
@@ -136,12 +133,12 @@ module Tinkerforge
|
|
136
133
|
#
|
137
134
|
# The default value is 0.
|
138
135
|
def set_humidity_callback_period(period)
|
139
|
-
send_request
|
136
|
+
send_request FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, [period], 'L', 0, ''
|
140
137
|
end
|
141
138
|
|
142
139
|
# Returns the period as set by BrickletHumidity#set_humidity_callback_period.
|
143
140
|
def get_humidity_callback_period
|
144
|
-
send_request
|
141
|
+
send_request FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD, [], '', 4, 'L'
|
145
142
|
end
|
146
143
|
|
147
144
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -152,12 +149,12 @@ module Tinkerforge
|
|
152
149
|
#
|
153
150
|
# The default value is 0.
|
154
151
|
def set_analog_value_callback_period(period)
|
155
|
-
send_request
|
152
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
156
153
|
end
|
157
154
|
|
158
155
|
# Returns the period as set by BrickletHumidity#set_analog_value_callback_period.
|
159
156
|
def get_analog_value_callback_period
|
160
|
-
send_request
|
157
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
161
158
|
end
|
162
159
|
|
163
160
|
# Sets the thresholds for the CALLBACK_HUMIDITY_REACHED callback.
|
@@ -174,12 +171,12 @@ module Tinkerforge
|
|
174
171
|
#
|
175
172
|
# The default value is ('x', 0, 0).
|
176
173
|
def set_humidity_callback_threshold(option, min, max)
|
177
|
-
send_request
|
174
|
+
send_request FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
178
175
|
end
|
179
176
|
|
180
177
|
# Returns the threshold as set by BrickletHumidity#set_humidity_callback_threshold.
|
181
178
|
def get_humidity_callback_threshold
|
182
|
-
send_request
|
179
|
+
send_request FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
183
180
|
end
|
184
181
|
|
185
182
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -196,12 +193,12 @@ module Tinkerforge
|
|
196
193
|
#
|
197
194
|
# The default value is ('x', 0, 0).
|
198
195
|
def set_analog_value_callback_threshold(option, min, max)
|
199
|
-
send_request
|
196
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
200
197
|
end
|
201
198
|
|
202
199
|
# Returns the threshold as set by BrickletHumidity#set_analog_value_callback_threshold.
|
203
200
|
def get_analog_value_callback_threshold
|
204
|
-
send_request
|
201
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
205
202
|
end
|
206
203
|
|
207
204
|
# Sets the period in ms with which the threshold callbacks
|
@@ -218,12 +215,12 @@ module Tinkerforge
|
|
218
215
|
#
|
219
216
|
# The default value is 100.
|
220
217
|
def set_debounce_period(debounce)
|
221
|
-
send_request
|
218
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
222
219
|
end
|
223
220
|
|
224
221
|
# Returns the debounce period as set by BrickletHumidity#set_debounce_period.
|
225
222
|
def get_debounce_period
|
226
|
-
send_request
|
223
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
227
224
|
end
|
228
225
|
|
229
226
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -235,7 +232,7 @@ module Tinkerforge
|
|
235
232
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
236
233
|
# |device_identifier_constant|
|
237
234
|
def get_identity
|
238
|
-
send_request
|
235
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
239
236
|
end
|
240
237
|
|
241
238
|
# 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 #
|
@@ -50,25 +50,26 @@ module Tinkerforge
|
|
50
50
|
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
51
51
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
52
52
|
|
53
|
+
|
53
54
|
end
|
54
55
|
|
55
56
|
# Enables the output of voltage and current.
|
56
57
|
#
|
57
58
|
# The default is disabled.
|
58
59
|
def enable
|
59
|
-
send_request
|
60
|
+
send_request FUNCTION_ENABLE, [], '', 0, ''
|
60
61
|
end
|
61
62
|
|
62
63
|
# Disables the output of voltage and current.
|
63
64
|
#
|
64
65
|
# The default is disabled.
|
65
66
|
def disable
|
66
|
-
send_request
|
67
|
+
send_request FUNCTION_DISABLE, [], '', 0, ''
|
67
68
|
end
|
68
69
|
|
69
70
|
# Returns *true* if output of voltage and current is enabled, *false* otherwise.
|
70
71
|
def is_enabled
|
71
|
-
send_request
|
72
|
+
send_request FUNCTION_IS_ENABLED, [], '', 1, '?'
|
72
73
|
end
|
73
74
|
|
74
75
|
# Sets the output voltage in mV.
|
@@ -76,12 +77,12 @@ module Tinkerforge
|
|
76
77
|
# The output voltage and output current are linked. Changing the output voltage
|
77
78
|
# also changes the output current.
|
78
79
|
def set_voltage(voltage)
|
79
|
-
send_request
|
80
|
+
send_request FUNCTION_SET_VOLTAGE, [voltage], 'S', 0, ''
|
80
81
|
end
|
81
82
|
|
82
83
|
# Returns the voltage as set by BrickletIndustrialAnalogOut#set_voltage.
|
83
84
|
def get_voltage
|
84
|
-
send_request
|
85
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
|
85
86
|
end
|
86
87
|
|
87
88
|
# Sets the output current in µA.
|
@@ -89,12 +90,12 @@ module Tinkerforge
|
|
89
90
|
# The output current and output voltage are linked. Changing the output current
|
90
91
|
# also changes the output voltage.
|
91
92
|
def set_current(current)
|
92
|
-
send_request
|
93
|
+
send_request FUNCTION_SET_CURRENT, [current], 'S', 0, ''
|
93
94
|
end
|
94
95
|
|
95
96
|
# Returns the current as set by BrickletIndustrialAnalogOut#set_current.
|
96
97
|
def get_current
|
97
|
-
send_request
|
98
|
+
send_request FUNCTION_GET_CURRENT, [], '', 2, 'S'
|
98
99
|
end
|
99
100
|
|
100
101
|
# Configures the voltage and current range.
|
@@ -113,12 +114,12 @@ module Tinkerforge
|
|
113
114
|
# The resolution will always be 12 bit. This means, that the
|
114
115
|
# precision is higher with a smaller range.
|
115
116
|
def set_configuration(voltage_range, current_range)
|
116
|
-
send_request
|
117
|
+
send_request FUNCTION_SET_CONFIGURATION, [voltage_range, current_range], 'C C', 0, ''
|
117
118
|
end
|
118
119
|
|
119
120
|
# Returns the configuration as set by BrickletIndustrialAnalogOut#set_configuration.
|
120
121
|
def get_configuration
|
121
|
-
send_request
|
122
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
|
122
123
|
end
|
123
124
|
|
124
125
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -130,7 +131,7 @@ module Tinkerforge
|
|
130
131
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
131
132
|
# |device_identifier_constant|
|
132
133
|
def get_identity
|
133
|
-
send_request
|
134
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
134
135
|
end
|
135
136
|
|
136
137
|
end
|
@@ -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 #
|
@@ -61,13 +61,13 @@ module Tinkerforge
|
|
61
61
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
62
62
|
@response_expected[FUNCTION_SET_INTERRUPT] = RESPONSE_EXPECTED_TRUE
|
63
63
|
@response_expected[FUNCTION_GET_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
64
|
-
@response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
65
64
|
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
66
65
|
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_FALSE
|
67
66
|
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
68
67
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
69
68
|
|
70
69
|
@callback_formats[CALLBACK_INTERRUPT] = 'S S'
|
70
|
+
|
71
71
|
end
|
72
72
|
|
73
73
|
# Returns the input value with a bitmask. The bitmask is 16bit long, *true*
|
@@ -83,7 +83,7 @@ module Tinkerforge
|
|
83
83
|
# Element 1 in the group will get pins 0-3, element 2 pins 4-7, element 3
|
84
84
|
# pins 8-11 and element 4 pins 12-15.
|
85
85
|
def get_value
|
86
|
-
send_request
|
86
|
+
send_request FUNCTION_GET_VALUE, [], '', 2, 'S'
|
87
87
|
end
|
88
88
|
|
89
89
|
# Sets a group of Digital In 4 Bricklets that should work together. You can
|
@@ -105,19 +105,19 @@ module Tinkerforge
|
|
105
105
|
# Changing the group configuration resets all edge counter configurations
|
106
106
|
# and values.
|
107
107
|
def set_group(group)
|
108
|
-
send_request
|
108
|
+
send_request FUNCTION_SET_GROUP, [group], 'k4', 0, ''
|
109
109
|
end
|
110
110
|
|
111
111
|
# Returns the group as set by BrickletIndustrialDigitalIn4#set_group
|
112
112
|
def get_group
|
113
|
-
send_request
|
113
|
+
send_request FUNCTION_GET_GROUP, [], '', 4, 'k4'
|
114
114
|
end
|
115
115
|
|
116
116
|
# Returns a bitmask of ports that are available for grouping. For example the
|
117
117
|
# value 5 or 0b0101 means: Port A and port C are connected to Bricklets that
|
118
118
|
# can be grouped together.
|
119
119
|
def get_available_for_group
|
120
|
-
send_request
|
120
|
+
send_request FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C'
|
121
121
|
end
|
122
122
|
|
123
123
|
# Sets the debounce period of the CALLBACK_INTERRUPT callback in ms.
|
@@ -128,12 +128,12 @@ module Tinkerforge
|
|
128
128
|
#
|
129
129
|
# The default value is 100.
|
130
130
|
def set_debounce_period(debounce)
|
131
|
-
send_request
|
131
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
132
132
|
end
|
133
133
|
|
134
134
|
# Returns the debounce period as set by BrickletIndustrialDigitalIn4#set_debounce_period.
|
135
135
|
def get_debounce_period
|
136
|
-
send_request
|
136
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
137
137
|
end
|
138
138
|
|
139
139
|
# Sets the pins on which an interrupt is activated with a bitmask.
|
@@ -147,12 +147,12 @@ module Tinkerforge
|
|
147
147
|
#
|
148
148
|
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
149
149
|
def set_interrupt(interrupt_mask)
|
150
|
-
send_request
|
150
|
+
send_request FUNCTION_SET_INTERRUPT, [interrupt_mask], 'S', 0, ''
|
151
151
|
end
|
152
152
|
|
153
153
|
# Returns the interrupt bitmask as set by BrickletIndustrialDigitalIn4#set_interrupt.
|
154
154
|
def get_interrupt
|
155
|
-
send_request
|
155
|
+
send_request FUNCTION_GET_INTERRUPT, [], '', 2, 'S'
|
156
156
|
end
|
157
157
|
|
158
158
|
# Returns the current value of the edge counter for the selected pin. You can
|
@@ -163,7 +163,7 @@ module Tinkerforge
|
|
163
163
|
#
|
164
164
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
165
165
|
def get_edge_count(pin, reset_counter)
|
166
|
-
send_request
|
166
|
+
send_request FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L'
|
167
167
|
end
|
168
168
|
|
169
169
|
# Configures the edge counter for the selected pins. A bitmask of 9 or 0b1001 will
|
@@ -187,7 +187,7 @@ module Tinkerforge
|
|
187
187
|
#
|
188
188
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
189
189
|
def set_edge_count_config(selection_mask, edge_type, debounce)
|
190
|
-
send_request
|
190
|
+
send_request FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'S C C', 0, ''
|
191
191
|
end
|
192
192
|
|
193
193
|
# Returns the edge type and debounce time for the selected pin as set by
|
@@ -195,7 +195,7 @@ module Tinkerforge
|
|
195
195
|
#
|
196
196
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
197
197
|
def get_edge_count_config(pin)
|
198
|
-
send_request
|
198
|
+
send_request FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C'
|
199
199
|
end
|
200
200
|
|
201
201
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -207,7 +207,7 @@ module Tinkerforge
|
|
207
207
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
208
208
|
# |device_identifier_constant|
|
209
209
|
def get_identity
|
210
|
-
send_request
|
210
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
211
211
|
end
|
212
212
|
|
213
213
|
# 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 high
|
@@ -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 BrickletIndustrialDigitalOut4#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 high. Pin 0 will be high all the time. If now
|
93
93
|
# the RS485 connection is lost, then pin 0 will turn low 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 Digital Out 4 Bricklets that should work together. You can
|
@@ -120,19 +120,19 @@ module Tinkerforge
|
|
120
120
|
# pins on the Digital Out 4 on port B are assigned to 4-7. It is now possible
|
121
121
|
# to call BrickletIndustrialDigitalOut4#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 BrickletIndustrialDigitalOut4#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 #
|
@@ -68,12 +68,11 @@ module Tinkerforge
|
|
68
68
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
69
69
|
@response_expected[FUNCTION_SET_SAMPLE_RATE] = RESPONSE_EXPECTED_FALSE
|
70
70
|
@response_expected[FUNCTION_GET_SAMPLE_RATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
71
|
-
@response_expected[CALLBACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
72
|
-
@response_expected[CALLBACK_CURRENT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
73
71
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
74
72
|
|
75
73
|
@callback_formats[CALLBACK_CURRENT] = 'C l'
|
76
74
|
@callback_formats[CALLBACK_CURRENT_REACHED] = 'C l'
|
75
|
+
|
77
76
|
end
|
78
77
|
|
79
78
|
# Returns the current of the specified sensor (0 or 1). The value is in nA
|
@@ -90,7 +89,7 @@ module Tinkerforge
|
|
90
89
|
# CALLBACK_CURRENT callback and set the period with
|
91
90
|
# BrickletIndustrialDual020mA#set_current_callback_period.
|
92
91
|
def get_current(sensor)
|
93
|
-
send_request
|
92
|
+
send_request FUNCTION_GET_CURRENT, [sensor], 'C', 4, 'l'
|
94
93
|
end
|
95
94
|
|
96
95
|
# Sets the period in ms with which the CALLBACK_CURRENT callback is triggered
|
@@ -101,12 +100,12 @@ module Tinkerforge
|
|
101
100
|
#
|
102
101
|
# The default value is 0.
|
103
102
|
def set_current_callback_period(sensor, period)
|
104
|
-
send_request
|
103
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [sensor, period], 'C L', 0, ''
|
105
104
|
end
|
106
105
|
|
107
106
|
# Returns the period as set by BrickletIndustrialDual020mA#set_current_callback_period.
|
108
107
|
def get_current_callback_period(sensor)
|
109
|
-
send_request
|
108
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [sensor], 'C', 4, 'L'
|
110
109
|
end
|
111
110
|
|
112
111
|
# Sets the thresholds for the CALLBACK_CURRENT_REACHED callback for the given
|
@@ -124,12 +123,12 @@ module Tinkerforge
|
|
124
123
|
#
|
125
124
|
# The default value is ('x', 0, 0).
|
126
125
|
def set_current_callback_threshold(sensor, option, min, max)
|
127
|
-
send_request
|
126
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [sensor, option, min, max], 'C k l l', 0, ''
|
128
127
|
end
|
129
128
|
|
130
129
|
# Returns the threshold as set by BrickletIndustrialDual020mA#set_current_callback_threshold.
|
131
130
|
def get_current_callback_threshold(sensor)
|
132
|
-
send_request
|
131
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [sensor], 'C', 9, 'k l l'
|
133
132
|
end
|
134
133
|
|
135
134
|
# Sets the period in ms with which the threshold callback
|
@@ -144,12 +143,12 @@ module Tinkerforge
|
|
144
143
|
#
|
145
144
|
# The default value is 100.
|
146
145
|
def set_debounce_period(debounce)
|
147
|
-
send_request
|
146
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
148
147
|
end
|
149
148
|
|
150
149
|
# Returns the debounce period as set by BrickletIndustrialDual020mA#set_debounce_period.
|
151
150
|
def get_debounce_period
|
152
|
-
send_request
|
151
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
153
152
|
end
|
154
153
|
|
155
154
|
# Sets the sample rate to either 240, 60, 15 or 4 samples per second.
|
@@ -164,12 +163,12 @@ module Tinkerforge
|
|
164
163
|
#
|
165
164
|
# The default value is 3 (4 samples per second with 18 bit resolution).
|
166
165
|
def set_sample_rate(rate)
|
167
|
-
send_request
|
166
|
+
send_request FUNCTION_SET_SAMPLE_RATE, [rate], 'C', 0, ''
|
168
167
|
end
|
169
168
|
|
170
169
|
# Returns the sample rate as set by BrickletIndustrialDual020mA#set_sample_rate.
|
171
170
|
def get_sample_rate
|
172
|
-
send_request
|
171
|
+
send_request FUNCTION_GET_SAMPLE_RATE, [], '', 1, 'C'
|
173
172
|
end
|
174
173
|
|
175
174
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -181,7 +180,7 @@ module Tinkerforge
|
|
181
180
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
182
181
|
# |device_identifier_constant|
|
183
182
|
def get_identity
|
184
|
-
send_request
|
183
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
185
184
|
end
|
186
185
|
|
187
186
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|