tinkerforge 2.0.9 → 2.0.10
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 +2 -2
- data/lib/tinkerforge/brick_imu.rb +2 -2
- data/lib/tinkerforge/brick_master.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +2 -2
- data/lib/tinkerforge/brick_stepper.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +29 -3
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_current12.rb +2 -2
- data/lib/tinkerforge/bricklet_current25.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -3
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_io16.rb +49 -3
- data/lib/tinkerforge/bricklet_io4.rb +48 -3
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
- data/lib/tinkerforge/version.rb +1 -1
- metadata +2 -2
data/lib/tinkerforge/brick_dc.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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,6 +60,8 @@ module Tinkerforge
|
|
60
60
|
FUNCTION_GET_DEBOUNCE_PERIOD = 12 # :nodoc:
|
61
61
|
FUNCTION_SET_RANGE = 17 # :nodoc:
|
62
62
|
FUNCTION_GET_RANGE = 18 # :nodoc:
|
63
|
+
FUNCTION_SET_AVERAGING = 19 # :nodoc:
|
64
|
+
FUNCTION_GET_AVERAGING = 20 # :nodoc:
|
63
65
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
64
66
|
|
65
67
|
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
@@ -72,13 +74,14 @@ module Tinkerforge
|
|
72
74
|
RANGE_UP_TO_10V = 2 # :nodoc:
|
73
75
|
RANGE_UP_TO_36V = 3 # :nodoc:
|
74
76
|
RANGE_UP_TO_45V = 4 # :nodoc:
|
77
|
+
RANGE_UP_TO_3V = 5 # :nodoc:
|
75
78
|
|
76
79
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
77
80
|
# the IP Connection <tt>ipcon</tt>.
|
78
81
|
def initialize(uid, ipcon)
|
79
82
|
super uid, ipcon
|
80
83
|
|
81
|
-
@api_version = [2, 0,
|
84
|
+
@api_version = [2, 0, 2]
|
82
85
|
|
83
86
|
@response_expected[FUNCTION_GET_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
84
87
|
@response_expected[FUNCTION_GET_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -98,6 +101,8 @@ module Tinkerforge
|
|
98
101
|
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
99
102
|
@response_expected[FUNCTION_SET_RANGE] = RESPONSE_EXPECTED_FALSE
|
100
103
|
@response_expected[FUNCTION_GET_RANGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
104
|
+
@response_expected[FUNCTION_SET_AVERAGING] = RESPONSE_EXPECTED_FALSE
|
105
|
+
@response_expected[FUNCTION_GET_AVERAGING] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
101
106
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
102
107
|
|
103
108
|
@callback_formats[CALLBACK_VOLTAGE] = 'S'
|
@@ -238,6 +243,7 @@ module Tinkerforge
|
|
238
243
|
# * 2: 0V - 10.32V, ~2.52mV resolution
|
239
244
|
# * 3: 0V - 36.30V, ~8.86mV resolution
|
240
245
|
# * 4: 0V - 45.00V, ~11.25mV resolution
|
246
|
+
# * 5: 0V - 3.3V, ~0.81mV resolution, new in version 2.0.3 (Plugin)
|
241
247
|
#
|
242
248
|
# The default measurement range is 0.
|
243
249
|
#
|
@@ -253,6 +259,26 @@ module Tinkerforge
|
|
253
259
|
send_request(FUNCTION_GET_RANGE, [], '', 1, 'C')
|
254
260
|
end
|
255
261
|
|
262
|
+
# Set the length of a averaging for the voltage value.
|
263
|
+
#
|
264
|
+
# Setting the length to 0 will turn the averaging completely off. If the
|
265
|
+
# averaging is off, there is more noise on the data, but the data is without
|
266
|
+
# delay.
|
267
|
+
#
|
268
|
+
# The default value is 50.
|
269
|
+
#
|
270
|
+
# .. versionadded:: 2.0.3~(Plugin)
|
271
|
+
def set_averaging(length)
|
272
|
+
send_request(FUNCTION_SET_AVERAGING, [length], 'C', 0, '')
|
273
|
+
end
|
274
|
+
|
275
|
+
# Returns the averaging configuration as set by BrickletAnalogIn#set_averaging.
|
276
|
+
#
|
277
|
+
# .. versionadded:: 2.0.3~(Plugin)
|
278
|
+
def get_averaging
|
279
|
+
send_request(FUNCTION_GET_AVERAGING, [], '', 1, 'C')
|
280
|
+
end
|
281
|
+
|
256
282
|
# Returns the UID, the UID where the Bricklet is connected to,
|
257
283
|
# the position, the hardware and firmware version as well as the
|
258
284
|
# device identifier.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -36,15 +36,21 @@ module Tinkerforge
|
|
36
36
|
FUNCTION_GET_DEBOUNCE_PERIOD = 6 # :nodoc:
|
37
37
|
FUNCTION_SET_INTERRUPT = 7 # :nodoc:
|
38
38
|
FUNCTION_GET_INTERRUPT = 8 # :nodoc:
|
39
|
+
FUNCTION_GET_EDGE_COUNT = 10 # :nodoc:
|
40
|
+
FUNCTION_SET_EDGE_COUNT_CONFIG = 11 # :nodoc:
|
41
|
+
FUNCTION_GET_EDGE_COUNT_CONFIG = 12 # :nodoc:
|
39
42
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
40
43
|
|
44
|
+
EDGE_TYPE_RISING = 0 # :nodoc:
|
45
|
+
EDGE_TYPE_FALLING = 1 # :nodoc:
|
46
|
+
EDGE_TYPE_BOTH = 2 # :nodoc:
|
41
47
|
|
42
48
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
43
49
|
# the IP Connection <tt>ipcon</tt>.
|
44
50
|
def initialize(uid, ipcon)
|
45
51
|
super uid, ipcon
|
46
52
|
|
47
|
-
@api_version = [2, 0,
|
53
|
+
@api_version = [2, 0, 1]
|
48
54
|
|
49
55
|
@response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
50
56
|
@response_expected[FUNCTION_SET_GROUP] = RESPONSE_EXPECTED_FALSE
|
@@ -55,6 +61,9 @@ module Tinkerforge
|
|
55
61
|
@response_expected[FUNCTION_SET_INTERRUPT] = RESPONSE_EXPECTED_TRUE
|
56
62
|
@response_expected[FUNCTION_GET_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
57
63
|
@response_expected[CALLBACK_INTERRUPT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
64
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
65
|
+
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_FALSE
|
66
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
58
67
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
59
68
|
|
60
69
|
@callback_formats[CALLBACK_INTERRUPT] = 'S S'
|
@@ -92,6 +101,9 @@ module Tinkerforge
|
|
92
101
|
# Now the pins on the Digital In 4 on port A are assigned to 0-3 and the
|
93
102
|
# pins on the Digital In 4 on port B are assigned to 4-7. It is now possible
|
94
103
|
# to call BrickletIndustrialDigitalIn4#get_value and read out two Bricklets at the same time.
|
104
|
+
#
|
105
|
+
# Changing the group configuration resets the alle edge counter configurations
|
106
|
+
# and values.
|
95
107
|
def set_group(group)
|
96
108
|
send_request(FUNCTION_SET_GROUP, [group], 'k4', 0, '')
|
97
109
|
end
|
@@ -143,6 +155,42 @@ module Tinkerforge
|
|
143
155
|
send_request(FUNCTION_GET_INTERRUPT, [], '', 2, 'S')
|
144
156
|
end
|
145
157
|
|
158
|
+
# Returns the current value of the edge counter for the selected pin. You can
|
159
|
+
# configure the edges that are counted with BrickletIndustrialDigitalIn4#set_edge_count_config.
|
160
|
+
#
|
161
|
+
# If you set the reset counter to *true*, the count is set back to 0
|
162
|
+
# directly after it is read.
|
163
|
+
#
|
164
|
+
# .. versionadded:: 2.0.1~(Plugin)
|
165
|
+
def get_edge_count(pin, reset_counter)
|
166
|
+
send_request(FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L')
|
167
|
+
end
|
168
|
+
|
169
|
+
# Configures the edge counter for the selected pins.
|
170
|
+
#
|
171
|
+
# The edge type parameter configures if rising edges, falling edges or
|
172
|
+
# both are counted if the pin is configured for input.
|
173
|
+
#
|
174
|
+
# The debounce time is given in ms.
|
175
|
+
#
|
176
|
+
# If you don't know what any of this means, just leave it at default. The
|
177
|
+
# default configuration is very likely OK for you.
|
178
|
+
#
|
179
|
+
# Default values: 0 (edge type) and 100ms (debounce time)
|
180
|
+
#
|
181
|
+
# .. versionadded:: 2.0.1~(Plugin)
|
182
|
+
def set_edge_count_config(selection_mask, edge_type, debounce)
|
183
|
+
send_request(FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'S C C', 0, '')
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the edge type and debounce time for the selected pin as set by
|
187
|
+
# BrickletIndustrialDigitalIn4#set_edge_count_config.
|
188
|
+
#
|
189
|
+
# .. versionadded:: 2.0.1~(Plugin)
|
190
|
+
def get_edge_count_config(pin)
|
191
|
+
send_request(FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C')
|
192
|
+
end
|
193
|
+
|
146
194
|
# Returns the UID, the UID where the Bricklet is connected to,
|
147
195
|
# the position, the hardware and firmware version as well as the
|
148
196
|
# device identifier.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -46,17 +46,23 @@ module Tinkerforge
|
|
46
46
|
FUNCTION_SET_PORT_MONOFLOP = 10 # :nodoc:
|
47
47
|
FUNCTION_GET_PORT_MONOFLOP = 11 # :nodoc:
|
48
48
|
FUNCTION_SET_SELECTED_VALUES = 13 # :nodoc:
|
49
|
+
FUNCTION_GET_EDGE_COUNT = 14 # :nodoc:
|
50
|
+
FUNCTION_SET_EDGE_COUNT_CONFIG = 15 # :nodoc:
|
51
|
+
FUNCTION_GET_EDGE_COUNT_CONFIG = 16 # :nodoc:
|
49
52
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
50
53
|
|
51
54
|
DIRECTION_IN = 'i' # :nodoc:
|
52
55
|
DIRECTION_OUT = 'o' # :nodoc:
|
56
|
+
EDGE_TYPE_RISING = 0 # :nodoc:
|
57
|
+
EDGE_TYPE_FALLING = 1 # :nodoc:
|
58
|
+
EDGE_TYPE_BOTH = 2 # :nodoc:
|
53
59
|
|
54
60
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
55
61
|
# the IP Connection <tt>ipcon</tt>.
|
56
62
|
def initialize(uid, ipcon)
|
57
63
|
super uid, ipcon
|
58
64
|
|
59
|
-
@api_version = [2, 0,
|
65
|
+
@api_version = [2, 0, 1]
|
60
66
|
|
61
67
|
@response_expected[FUNCTION_SET_PORT] = RESPONSE_EXPECTED_FALSE
|
62
68
|
@response_expected[FUNCTION_GET_PORT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -71,6 +77,9 @@ module Tinkerforge
|
|
71
77
|
@response_expected[FUNCTION_GET_PORT_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
72
78
|
@response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
73
79
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
80
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
|
+
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_FALSE
|
82
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
74
83
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
75
84
|
|
76
85
|
@callback_formats[CALLBACK_INTERRUPT] = 'k C C'
|
@@ -215,6 +224,43 @@ module Tinkerforge
|
|
215
224
|
send_request(FUNCTION_SET_SELECTED_VALUES, [port, selection_mask, value_mask], 'k C C', 0, '')
|
216
225
|
end
|
217
226
|
|
227
|
+
# Returns the current value of the edge counter for pin 0 of the selected port.
|
228
|
+
# You can configure the edges that are counted with BrickletIO16#set_edge_count_config.
|
229
|
+
#
|
230
|
+
# If you set the reset counter to *true*, the count is set back to 0
|
231
|
+
# directly after it is read.
|
232
|
+
#
|
233
|
+
# .. versionadded:: 2.0.3~(Plugin)
|
234
|
+
def get_edge_count(port, reset_counter)
|
235
|
+
send_request(FUNCTION_GET_EDGE_COUNT, [port, reset_counter], 'k ?', 4, 'L')
|
236
|
+
end
|
237
|
+
|
238
|
+
# Configures the edge counter for pin 0 of the selected port. Pin 1-7 don't
|
239
|
+
# support edge counting.
|
240
|
+
#
|
241
|
+
# The edge type parameter configures if rising edges, falling edges or
|
242
|
+
# both are counted if the pin is configured for input.
|
243
|
+
#
|
244
|
+
# The debounce time is given in ms.
|
245
|
+
#
|
246
|
+
# If you don't know what any of this means, just leave it at default. The
|
247
|
+
# default configuration is very likely OK for you.
|
248
|
+
#
|
249
|
+
# Default values: 0 (edge type) and 100ms (debounce time)
|
250
|
+
#
|
251
|
+
# .. versionadded:: 2.0.3~(Plugin)
|
252
|
+
def set_edge_count_config(port, edge_type, debounce)
|
253
|
+
send_request(FUNCTION_SET_EDGE_COUNT_CONFIG, [port, edge_type, debounce], 'k C C', 0, '')
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the edge type and debounce time for pin 0 of the selected port as set by
|
257
|
+
# BrickletIO16#set_edge_count_config.
|
258
|
+
#
|
259
|
+
# .. versionadded:: 2.0.3~(Plugin)
|
260
|
+
def get_edge_count_config(port)
|
261
|
+
send_request(FUNCTION_GET_EDGE_COUNT_CONFIG, [port], 'k', 2, 'C C')
|
262
|
+
end
|
263
|
+
|
218
264
|
# Returns the UID, the UID where the Bricklet is connected to,
|
219
265
|
# the position, the hardware and firmware version as well as the
|
220
266
|
# device identifier.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -46,17 +46,23 @@ module Tinkerforge
|
|
46
46
|
FUNCTION_SET_MONOFLOP = 10 # :nodoc:
|
47
47
|
FUNCTION_GET_MONOFLOP = 11 # :nodoc:
|
48
48
|
FUNCTION_SET_SELECTED_VALUES = 13 # :nodoc:
|
49
|
+
FUNCTION_GET_EDGE_COUNT = 14 # :nodoc:
|
50
|
+
FUNCTION_SET_EDGE_COUNT_CONFIG = 15 # :nodoc:
|
51
|
+
FUNCTION_GET_EDGE_COUNT_CONFIG = 16 # :nodoc:
|
49
52
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
50
53
|
|
51
54
|
DIRECTION_IN = 'i' # :nodoc:
|
52
55
|
DIRECTION_OUT = 'o' # :nodoc:
|
56
|
+
EDGE_TYPE_RISING = 0 # :nodoc:
|
57
|
+
EDGE_TYPE_FALLING = 1 # :nodoc:
|
58
|
+
EDGE_TYPE_BOTH = 2 # :nodoc:
|
53
59
|
|
54
60
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
55
61
|
# the IP Connection <tt>ipcon</tt>.
|
56
62
|
def initialize(uid, ipcon)
|
57
63
|
super uid, ipcon
|
58
64
|
|
59
|
-
@api_version = [2, 0,
|
65
|
+
@api_version = [2, 0, 1]
|
60
66
|
|
61
67
|
@response_expected[FUNCTION_SET_VALUE] = RESPONSE_EXPECTED_FALSE
|
62
68
|
@response_expected[FUNCTION_GET_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -71,6 +77,9 @@ module Tinkerforge
|
|
71
77
|
@response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
72
78
|
@response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
73
79
|
@response_expected[FUNCTION_SET_SELECTED_VALUES] = RESPONSE_EXPECTED_FALSE
|
80
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
|
+
@response_expected[FUNCTION_SET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_FALSE
|
82
|
+
@response_expected[FUNCTION_GET_EDGE_COUNT_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
74
83
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
75
84
|
|
76
85
|
@callback_formats[CALLBACK_INTERRUPT] = 'C C'
|
@@ -214,6 +223,42 @@ module Tinkerforge
|
|
214
223
|
send_request(FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'C C', 0, '')
|
215
224
|
end
|
216
225
|
|
226
|
+
# Returns the current value of the edge counter for the selected pin. You can
|
227
|
+
# configure the edges that are counted with BrickletIO4#set_edge_count_config.
|
228
|
+
#
|
229
|
+
# If you set the reset counter to *true*, the count is set back to 0
|
230
|
+
# directly after it is read.
|
231
|
+
#
|
232
|
+
# .. versionadded:: 2.0.1~(Plugin)
|
233
|
+
def get_edge_count(pin, reset_counter)
|
234
|
+
send_request(FUNCTION_GET_EDGE_COUNT, [pin, reset_counter], 'C ?', 4, 'L')
|
235
|
+
end
|
236
|
+
|
237
|
+
# Configures the edge counter for the selected pins.
|
238
|
+
#
|
239
|
+
# The edge type parameter configures if rising edges, falling edges or
|
240
|
+
# both are counted if the pin is configured for input.
|
241
|
+
#
|
242
|
+
# The debounce time is given in ms.
|
243
|
+
#
|
244
|
+
# If you don't know what any of this means, just leave it at default. The
|
245
|
+
# default configuration is very likely OK for you.
|
246
|
+
#
|
247
|
+
# Default values: 0 (edge type) and 100ms (debounce time)
|
248
|
+
#
|
249
|
+
# .. versionadded:: 2.0.1~(Plugin)
|
250
|
+
def set_edge_count_config(selection_mask, edge_type, debounce)
|
251
|
+
send_request(FUNCTION_SET_EDGE_COUNT_CONFIG, [selection_mask, edge_type, debounce], 'C C C', 0, '')
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the edge type and debounce time for the selected pin as set by
|
255
|
+
# BrickletIO4#set_edge_count_config.
|
256
|
+
#
|
257
|
+
# .. versionadded:: 2.0.1~(Plugin)
|
258
|
+
def get_edge_count_config(pin)
|
259
|
+
send_request(FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C')
|
260
|
+
end
|
261
|
+
|
217
262
|
# Returns the UID, the UID where the Bricklet is connected to,
|
218
263
|
# the position, the hardware and firmware version as well as the
|
219
264
|
# device identifier.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on 2013-08-
|
3
|
+
# This file was automatically generated on 2013-08-28. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.0.
|
5
|
+
# Bindings Version 2.0.10 #
|
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 #
|
data/lib/tinkerforge/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinkerforge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: matthias@tinkerforge.com
|