tinkerforge 2.1.13 → 2.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 #
|
|
@@ -60,12 +60,11 @@ module Tinkerforge
|
|
|
60
60
|
@response_expected[FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
61
61
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
62
62
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
63
|
-
@response_expected[CALLBACK_UV_LIGHT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
64
|
-
@response_expected[CALLBACK_UV_LIGHT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
65
63
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
66
64
|
|
|
67
65
|
@callback_formats[CALLBACK_UV_LIGHT] = 'L'
|
|
68
66
|
@callback_formats[CALLBACK_UV_LIGHT_REACHED] = 'L'
|
|
67
|
+
|
|
69
68
|
end
|
|
70
69
|
|
|
71
70
|
# Returns the UV light intensity of the sensor, the intensity is given
|
|
@@ -78,7 +77,7 @@ module Tinkerforge
|
|
|
78
77
|
# CALLBACK_UV_LIGHT callback and set the period with
|
|
79
78
|
# BrickletUVLight#set_uv_light_callback_period.
|
|
80
79
|
def get_uv_light
|
|
81
|
-
send_request
|
|
80
|
+
send_request FUNCTION_GET_UV_LIGHT, [], '', 4, 'L'
|
|
82
81
|
end
|
|
83
82
|
|
|
84
83
|
# Sets the period in ms with which the CALLBACK_UV_LIGHT callback is triggered
|
|
@@ -89,12 +88,12 @@ module Tinkerforge
|
|
|
89
88
|
#
|
|
90
89
|
# The default value is 0.
|
|
91
90
|
def set_uv_light_callback_period(period)
|
|
92
|
-
send_request
|
|
91
|
+
send_request FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
93
92
|
end
|
|
94
93
|
|
|
95
94
|
# Returns the period as set by BrickletUVLight#set_uv_light_callback_period.
|
|
96
95
|
def get_uv_light_callback_period
|
|
97
|
-
send_request
|
|
96
|
+
send_request FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
98
97
|
end
|
|
99
98
|
|
|
100
99
|
# Sets the thresholds for the CALLBACK_UV_LIGHT_REACHED callback.
|
|
@@ -111,12 +110,12 @@ module Tinkerforge
|
|
|
111
110
|
#
|
|
112
111
|
# The default value is ('x', 0, 0).
|
|
113
112
|
def set_uv_light_callback_threshold(option, min, max)
|
|
114
|
-
send_request
|
|
113
|
+
send_request FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 0, ''
|
|
115
114
|
end
|
|
116
115
|
|
|
117
116
|
# Returns the threshold as set by BrickletUVLight#set_uv_light_callback_threshold.
|
|
118
117
|
def get_uv_light_callback_threshold
|
|
119
|
-
send_request
|
|
118
|
+
send_request FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 9, 'k L L'
|
|
120
119
|
end
|
|
121
120
|
|
|
122
121
|
# Sets the period in ms with which the threshold callbacks
|
|
@@ -131,12 +130,12 @@ module Tinkerforge
|
|
|
131
130
|
#
|
|
132
131
|
# The default value is 100.
|
|
133
132
|
def set_debounce_period(debounce)
|
|
134
|
-
send_request
|
|
133
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
|
135
134
|
end
|
|
136
135
|
|
|
137
136
|
# Returns the debounce period as set by BrickletUVLight#set_debounce_period.
|
|
138
137
|
def get_debounce_period
|
|
139
|
-
send_request
|
|
138
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
|
140
139
|
end
|
|
141
140
|
|
|
142
141
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -148,7 +147,7 @@ module Tinkerforge
|
|
|
148
147
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
149
148
|
# |device_identifier_constant|
|
|
150
149
|
def get_identity
|
|
151
|
-
send_request
|
|
150
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
152
151
|
end
|
|
153
152
|
|
|
154
153
|
# 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_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
90
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
91
|
-
@response_expected[CALLBACK_VOLTAGE_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_VOLTAGE] = 'S'
|
|
96
92
|
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
|
97
93
|
@callback_formats[CALLBACK_VOLTAGE_REACHED] = 'S'
|
|
98
94
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
|
95
|
+
|
|
99
96
|
end
|
|
100
97
|
|
|
101
98
|
# Returns the voltage of the sensor. The value is in mV and
|
|
@@ -105,7 +102,7 @@ module Tinkerforge
|
|
|
105
102
|
# CALLBACK_VOLTAGE callback and set the period with
|
|
106
103
|
# BrickletVoltage#set_voltage_callback_period.
|
|
107
104
|
def get_voltage
|
|
108
|
-
send_request
|
|
105
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 2, 'S'
|
|
109
106
|
end
|
|
110
107
|
|
|
111
108
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
|
@@ -121,7 +118,7 @@ module Tinkerforge
|
|
|
121
118
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
|
122
119
|
# BrickletVoltage#set_analog_value_callback_period.
|
|
123
120
|
def get_analog_value
|
|
124
|
-
send_request
|
|
121
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
|
|
125
122
|
end
|
|
126
123
|
|
|
127
124
|
# Sets the period in ms with which the CALLBACK_VOLTAGE callback is triggered
|
|
@@ -132,12 +129,12 @@ module Tinkerforge
|
|
|
132
129
|
#
|
|
133
130
|
# The default value is 0.
|
|
134
131
|
def set_voltage_callback_period(period)
|
|
135
|
-
send_request
|
|
132
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
136
133
|
end
|
|
137
134
|
|
|
138
135
|
# Returns the period as set by BrickletVoltage#set_voltage_callback_period.
|
|
139
136
|
def get_voltage_callback_period
|
|
140
|
-
send_request
|
|
137
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
141
138
|
end
|
|
142
139
|
|
|
143
140
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
|
@@ -148,12 +145,12 @@ module Tinkerforge
|
|
|
148
145
|
#
|
|
149
146
|
# The default value is 0.
|
|
150
147
|
def set_analog_value_callback_period(period)
|
|
151
|
-
send_request
|
|
148
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
152
149
|
end
|
|
153
150
|
|
|
154
151
|
# Returns the period as set by BrickletVoltage#set_analog_value_callback_period.
|
|
155
152
|
def get_analog_value_callback_period
|
|
156
|
-
send_request
|
|
153
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
157
154
|
end
|
|
158
155
|
|
|
159
156
|
# Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
|
|
@@ -170,12 +167,12 @@ module Tinkerforge
|
|
|
170
167
|
#
|
|
171
168
|
# The default value is ('x', 0, 0).
|
|
172
169
|
def set_voltage_callback_threshold(option, min, max)
|
|
173
|
-
send_request
|
|
170
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
|
174
171
|
end
|
|
175
172
|
|
|
176
173
|
# Returns the threshold as set by BrickletVoltage#set_voltage_callback_threshold.
|
|
177
174
|
def get_voltage_callback_threshold
|
|
178
|
-
send_request
|
|
175
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
|
179
176
|
end
|
|
180
177
|
|
|
181
178
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
|
@@ -192,12 +189,12 @@ module Tinkerforge
|
|
|
192
189
|
#
|
|
193
190
|
# The default value is ('x', 0, 0).
|
|
194
191
|
def set_analog_value_callback_threshold(option, min, max)
|
|
195
|
-
send_request
|
|
192
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
|
196
193
|
end
|
|
197
194
|
|
|
198
195
|
# Returns the threshold as set by BrickletVoltage#set_analog_value_callback_threshold.
|
|
199
196
|
def get_analog_value_callback_threshold
|
|
200
|
-
send_request
|
|
197
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
|
201
198
|
end
|
|
202
199
|
|
|
203
200
|
# Sets the period in ms with which the threshold callbacks
|
|
@@ -214,12 +211,12 @@ module Tinkerforge
|
|
|
214
211
|
#
|
|
215
212
|
# The default value is 100.
|
|
216
213
|
def set_debounce_period(debounce)
|
|
217
|
-
send_request
|
|
214
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
|
218
215
|
end
|
|
219
216
|
|
|
220
217
|
# Returns the debounce period as set by BrickletVoltage#set_debounce_period.
|
|
221
218
|
def get_debounce_period
|
|
222
|
-
send_request
|
|
219
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
|
223
220
|
end
|
|
224
221
|
|
|
225
222
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -231,7 +228,7 @@ module Tinkerforge
|
|
|
231
228
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
232
229
|
# |device_identifier_constant|
|
|
233
230
|
def get_identity
|
|
234
|
-
send_request
|
|
231
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
235
232
|
end
|
|
236
233
|
|
|
237
234
|
# 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 #
|
|
@@ -128,12 +128,6 @@ module Tinkerforge
|
|
|
128
128
|
@response_expected[FUNCTION_GET_POWER_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
129
129
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
130
130
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
131
|
-
@response_expected[CALLBACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
132
|
-
@response_expected[CALLBACK_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
133
|
-
@response_expected[CALLBACK_POWER] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
134
|
-
@response_expected[CALLBACK_CURRENT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
135
|
-
@response_expected[CALLBACK_VOLTAGE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
136
|
-
@response_expected[CALLBACK_POWER_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
137
131
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
138
132
|
|
|
139
133
|
@callback_formats[CALLBACK_CURRENT] = 'l'
|
|
@@ -142,6 +136,7 @@ module Tinkerforge
|
|
|
142
136
|
@callback_formats[CALLBACK_CURRENT_REACHED] = 'l'
|
|
143
137
|
@callback_formats[CALLBACK_VOLTAGE_REACHED] = 'l'
|
|
144
138
|
@callback_formats[CALLBACK_POWER_REACHED] = 'l'
|
|
139
|
+
|
|
145
140
|
end
|
|
146
141
|
|
|
147
142
|
# Returns the current. The value is in mA
|
|
@@ -151,7 +146,7 @@ module Tinkerforge
|
|
|
151
146
|
# CALLBACK_CURRENT callback and set the period with
|
|
152
147
|
# BrickletVoltageCurrent#set_current_callback_period.
|
|
153
148
|
def get_current
|
|
154
|
-
send_request
|
|
149
|
+
send_request FUNCTION_GET_CURRENT, [], '', 4, 'l'
|
|
155
150
|
end
|
|
156
151
|
|
|
157
152
|
# Returns the voltage. The value is in mV
|
|
@@ -161,7 +156,7 @@ module Tinkerforge
|
|
|
161
156
|
# CALLBACK_VOLTAGE callback and set the period with
|
|
162
157
|
# BrickletVoltageCurrent#set_voltage_callback_period.
|
|
163
158
|
def get_voltage
|
|
164
|
-
send_request
|
|
159
|
+
send_request FUNCTION_GET_VOLTAGE, [], '', 4, 'l'
|
|
165
160
|
end
|
|
166
161
|
|
|
167
162
|
# Returns the power. The value is in mW
|
|
@@ -171,7 +166,7 @@ module Tinkerforge
|
|
|
171
166
|
# CALLBACK_POWER callback and set the period with
|
|
172
167
|
# BrickletVoltageCurrent#set_power_callback_period.
|
|
173
168
|
def get_power
|
|
174
|
-
send_request
|
|
169
|
+
send_request FUNCTION_GET_POWER, [], '', 4, 'l'
|
|
175
170
|
end
|
|
176
171
|
|
|
177
172
|
# Sets the configuration of the Voltage/Current Bricklet. It is
|
|
@@ -207,12 +202,12 @@ module Tinkerforge
|
|
|
207
202
|
# The default values are 3, 4 and 4 (64, 1.1ms, 1.1ms) for averaging, voltage
|
|
208
203
|
# conversion and current conversion.
|
|
209
204
|
def set_configuration(averaging, voltage_conversion_time, current_conversion_time)
|
|
210
|
-
send_request
|
|
205
|
+
send_request FUNCTION_SET_CONFIGURATION, [averaging, voltage_conversion_time, current_conversion_time], 'C C C', 0, ''
|
|
211
206
|
end
|
|
212
207
|
|
|
213
208
|
# Returns the configuration as set by BrickletVoltageCurrent#set_configuration.
|
|
214
209
|
def get_configuration
|
|
215
|
-
send_request
|
|
210
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C'
|
|
216
211
|
end
|
|
217
212
|
|
|
218
213
|
# Since the shunt resistor that is used to measure the current is not
|
|
@@ -223,12 +218,12 @@ module Tinkerforge
|
|
|
223
218
|
# are measuring 1023mA, you can calibrate the Voltage/Current Bricklet
|
|
224
219
|
# by setting the multiplier to 1000 and the divisor to 1023.
|
|
225
220
|
def set_calibration(gain_multiplier, gain_divisor)
|
|
226
|
-
send_request
|
|
221
|
+
send_request FUNCTION_SET_CALIBRATION, [gain_multiplier, gain_divisor], 'S S', 0, ''
|
|
227
222
|
end
|
|
228
223
|
|
|
229
224
|
# Returns the calibration as set by BrickletVoltageCurrent#set_calibration.
|
|
230
225
|
def get_calibration
|
|
231
|
-
send_request
|
|
226
|
+
send_request FUNCTION_GET_CALIBRATION, [], '', 4, 'S S'
|
|
232
227
|
end
|
|
233
228
|
|
|
234
229
|
# Sets the period in ms with which the CALLBACK_CURRENT callback is triggered
|
|
@@ -239,12 +234,12 @@ module Tinkerforge
|
|
|
239
234
|
#
|
|
240
235
|
# The default value is 0.
|
|
241
236
|
def set_current_callback_period(period)
|
|
242
|
-
send_request
|
|
237
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
243
238
|
end
|
|
244
239
|
|
|
245
240
|
# Returns the period as set by BrickletVoltageCurrent#set_current_callback_period.
|
|
246
241
|
def get_current_callback_period
|
|
247
|
-
send_request
|
|
242
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
248
243
|
end
|
|
249
244
|
|
|
250
245
|
# Sets the period in ms with which the CALLBACK_VOLTAGE callback is triggered
|
|
@@ -255,12 +250,12 @@ module Tinkerforge
|
|
|
255
250
|
#
|
|
256
251
|
# The default value is 0.
|
|
257
252
|
def set_voltage_callback_period(period)
|
|
258
|
-
send_request
|
|
253
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
259
254
|
end
|
|
260
255
|
|
|
261
256
|
# Returns the period as set by BrickletVoltageCurrent#set_voltage_callback_period.
|
|
262
257
|
def get_voltage_callback_period
|
|
263
|
-
send_request
|
|
258
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
264
259
|
end
|
|
265
260
|
|
|
266
261
|
# Sets the period in ms with which the CALLBACK_POWER callback is triggered
|
|
@@ -271,12 +266,12 @@ module Tinkerforge
|
|
|
271
266
|
#
|
|
272
267
|
# The default value is 0.
|
|
273
268
|
def set_power_callback_period(period)
|
|
274
|
-
send_request
|
|
269
|
+
send_request FUNCTION_SET_POWER_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
275
270
|
end
|
|
276
271
|
|
|
277
272
|
# Returns the period as set by BrickletVoltageCurrent#get_power_callback_period.
|
|
278
273
|
def get_power_callback_period
|
|
279
|
-
send_request
|
|
274
|
+
send_request FUNCTION_GET_POWER_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
280
275
|
end
|
|
281
276
|
|
|
282
277
|
# Sets the thresholds for the CALLBACK_CURRENT_REACHED callback.
|
|
@@ -293,12 +288,12 @@ module Tinkerforge
|
|
|
293
288
|
#
|
|
294
289
|
# The default value is ('x', 0, 0).
|
|
295
290
|
def set_current_callback_threshold(option, min, max)
|
|
296
|
-
send_request
|
|
291
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
|
297
292
|
end
|
|
298
293
|
|
|
299
294
|
# Returns the threshold as set by BrickletVoltageCurrent#set_current_callback_threshold.
|
|
300
295
|
def get_current_callback_threshold
|
|
301
|
-
send_request
|
|
296
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
|
302
297
|
end
|
|
303
298
|
|
|
304
299
|
# Sets the thresholds for the CALLBACK_VOLTAGE_REACHED callback.
|
|
@@ -315,12 +310,12 @@ module Tinkerforge
|
|
|
315
310
|
#
|
|
316
311
|
# The default value is ('x', 0, 0).
|
|
317
312
|
def set_voltage_callback_threshold(option, min, max)
|
|
318
|
-
send_request
|
|
313
|
+
send_request FUNCTION_SET_VOLTAGE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
|
319
314
|
end
|
|
320
315
|
|
|
321
316
|
# Returns the threshold as set by BrickletVoltageCurrent#set_voltage_callback_threshold.
|
|
322
317
|
def get_voltage_callback_threshold
|
|
323
|
-
send_request
|
|
318
|
+
send_request FUNCTION_GET_VOLTAGE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
|
324
319
|
end
|
|
325
320
|
|
|
326
321
|
# Sets the thresholds for the CALLBACK_POWER_REACHED callback.
|
|
@@ -337,12 +332,12 @@ module Tinkerforge
|
|
|
337
332
|
#
|
|
338
333
|
# The default value is ('x', 0, 0).
|
|
339
334
|
def set_power_callback_threshold(option, min, max)
|
|
340
|
-
send_request
|
|
335
|
+
send_request FUNCTION_SET_POWER_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
|
341
336
|
end
|
|
342
337
|
|
|
343
338
|
# Returns the threshold as set by BrickletVoltageCurrent#set_power_callback_threshold.
|
|
344
339
|
def get_power_callback_threshold
|
|
345
|
-
send_request
|
|
340
|
+
send_request FUNCTION_GET_POWER_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
|
346
341
|
end
|
|
347
342
|
|
|
348
343
|
# Sets the period in ms with which the threshold callbacks
|
|
@@ -361,12 +356,12 @@ module Tinkerforge
|
|
|
361
356
|
#
|
|
362
357
|
# The default value is 100.
|
|
363
358
|
def set_debounce_period(debounce)
|
|
364
|
-
send_request
|
|
359
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
|
365
360
|
end
|
|
366
361
|
|
|
367
362
|
# Returns the debounce period as set by BrickletVoltageCurrent#set_debounce_period.
|
|
368
363
|
def get_debounce_period
|
|
369
|
-
send_request
|
|
364
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
|
370
365
|
end
|
|
371
366
|
|
|
372
367
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -378,7 +373,7 @@ module Tinkerforge
|
|
|
378
373
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
379
374
|
# |device_identifier_constant|
|
|
380
375
|
def get_identity
|
|
381
|
-
send_request
|
|
376
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
382
377
|
end
|
|
383
378
|
|
|
384
379
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|