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 #
|
@@ -69,12 +69,11 @@ module Tinkerforge
|
|
69
69
|
@response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
70
70
|
@response_expected[FUNCTION_SET_ALARM] = RESPONSE_EXPECTED_TRUE
|
71
71
|
@response_expected[FUNCTION_GET_ALARM] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
72
|
-
@response_expected[CALLBACK_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
73
|
-
@response_expected[CALLBACK_ALARM] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
74
72
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
75
73
|
|
76
74
|
@callback_formats[CALLBACK_DATE_TIME] = 'S C C C C C C C q'
|
77
75
|
@callback_formats[CALLBACK_ALARM] = 'S C C C C C C C q'
|
76
|
+
|
78
77
|
end
|
79
78
|
|
80
79
|
# Sets the current date (including weekday) and the current time with hundredths
|
@@ -98,20 +97,20 @@ module Tinkerforge
|
|
98
97
|
# accordingly. But leap seconds, time zones and daylight saving time are not
|
99
98
|
# handled.
|
100
99
|
def set_date_time(year, month, day, hour, minute, second, centisecond, weekday)
|
101
|
-
send_request
|
100
|
+
send_request FUNCTION_SET_DATE_TIME, [year, month, day, hour, minute, second, centisecond, weekday], 'S C C C C C C C', 0, ''
|
102
101
|
end
|
103
102
|
|
104
103
|
# Returns the current date (including weekday) and the current time of the
|
105
104
|
# real-time clock with hundredths of a second resolution.
|
106
105
|
def get_date_time
|
107
|
-
send_request
|
106
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 9, 'S C C C C C C C'
|
108
107
|
end
|
109
108
|
|
110
109
|
# Returns the current date and the time of the real-time clock converted to
|
111
110
|
# milliseconds. The timestamp has an effective resolution of hundredths of a
|
112
111
|
# second.
|
113
112
|
def get_timestamp
|
114
|
-
send_request
|
113
|
+
send_request FUNCTION_GET_TIMESTAMP, [], '', 8, 'q'
|
115
114
|
end
|
116
115
|
|
117
116
|
# Sets the offset the real-time clock should compensate for in 2.17 ppm steps
|
@@ -140,12 +139,12 @@ module Tinkerforge
|
|
140
139
|
# The offset is saved in the EEPROM of the Bricklet and only needs to be
|
141
140
|
# configured once.
|
142
141
|
def set_offset(offset)
|
143
|
-
send_request
|
142
|
+
send_request FUNCTION_SET_OFFSET, [offset], 'c', 0, ''
|
144
143
|
end
|
145
144
|
|
146
145
|
# Returns the offset as set by BrickletRealTimeClock#set_offset.
|
147
146
|
def get_offset
|
148
|
-
send_request
|
147
|
+
send_request FUNCTION_GET_OFFSET, [], '', 1, 'c'
|
149
148
|
end
|
150
149
|
|
151
150
|
# Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
|
@@ -158,14 +157,14 @@ module Tinkerforge
|
|
158
157
|
#
|
159
158
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
160
159
|
def set_date_time_callback_period(period)
|
161
|
-
send_request
|
160
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, ''
|
162
161
|
end
|
163
162
|
|
164
163
|
# Returns the period as set by BrickletRealTimeClock#set_date_time_callback_period.
|
165
164
|
#
|
166
165
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
167
166
|
def get_date_time_callback_period
|
168
|
-
send_request
|
167
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
|
169
168
|
end
|
170
169
|
|
171
170
|
# Configures a repeatable alarm. The CALLBACK_ALARM callback is triggered if the
|
@@ -195,14 +194,14 @@ module Tinkerforge
|
|
195
194
|
#
|
196
195
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
197
196
|
def set_alarm(month, day, hour, minute, second, weekday, interval)
|
198
|
-
send_request
|
197
|
+
send_request FUNCTION_SET_ALARM, [month, day, hour, minute, second, weekday, interval], 'c c c c c c l', 0, ''
|
199
198
|
end
|
200
199
|
|
201
200
|
# Returns the alarm configuration as set by BrickletRealTimeClock#set_alarm.
|
202
201
|
#
|
203
202
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
204
203
|
def get_alarm
|
205
|
-
send_request
|
204
|
+
send_request FUNCTION_GET_ALARM, [], '', 10, 'c c c c c c l'
|
206
205
|
end
|
207
206
|
|
208
207
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -214,7 +213,7 @@ module Tinkerforge
|
|
214
213
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
215
214
|
# |device_identifier_constant|
|
216
215
|
def get_identity
|
217
|
-
send_request
|
216
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
218
217
|
end
|
219
218
|
|
220
219
|
# 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 #
|
@@ -43,7 +43,6 @@ module Tinkerforge
|
|
43
43
|
|
44
44
|
@response_expected[FUNCTION_SWITCH_SOCKET] = RESPONSE_EXPECTED_FALSE
|
45
45
|
@response_expected[FUNCTION_GET_SWITCHING_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
46
|
-
@response_expected[CALLBACK_SWITCHING_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
47
46
|
@response_expected[FUNCTION_SET_REPEATS] = RESPONSE_EXPECTED_FALSE
|
48
47
|
@response_expected[FUNCTION_GET_REPEATS] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
49
48
|
@response_expected[FUNCTION_SWITCH_SOCKET_A] = RESPONSE_EXPECTED_FALSE
|
@@ -53,11 +52,12 @@ module Tinkerforge
|
|
53
52
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
54
53
|
|
55
54
|
@callback_formats[CALLBACK_SWITCHING_DONE] = ''
|
55
|
+
|
56
56
|
end
|
57
57
|
|
58
58
|
# This function is deprecated, use BrickletRemoteSwitch#switch_socket_a instead.
|
59
59
|
def switch_socket(house_code, receiver_code, switch_to)
|
60
|
-
send_request
|
60
|
+
send_request FUNCTION_SWITCH_SOCKET, [house_code, receiver_code, switch_to], 'C C C', 0, ''
|
61
61
|
end
|
62
62
|
|
63
63
|
# Returns the current switching state. If the current state is busy, the
|
@@ -67,7 +67,7 @@ module Tinkerforge
|
|
67
67
|
# How long the switching takes is dependent on the number of repeats, see
|
68
68
|
# BrickletRemoteSwitch#set_repeats.
|
69
69
|
def get_switching_state
|
70
|
-
send_request
|
70
|
+
send_request FUNCTION_GET_SWITCHING_STATE, [], '', 1, 'C'
|
71
71
|
end
|
72
72
|
|
73
73
|
# Sets the number of times the code is send when of the BrickletRemoteSwitch#switch_socket
|
@@ -79,12 +79,12 @@ module Tinkerforge
|
|
79
79
|
#
|
80
80
|
# The default value is 5.
|
81
81
|
def set_repeats(repeats)
|
82
|
-
send_request
|
82
|
+
send_request FUNCTION_SET_REPEATS, [repeats], 'C', 0, ''
|
83
83
|
end
|
84
84
|
|
85
85
|
# Returns the number of repeats as set by BrickletRemoteSwitch#set_repeats.
|
86
86
|
def get_repeats
|
87
|
-
send_request
|
87
|
+
send_request FUNCTION_GET_REPEATS, [], '', 1, 'C'
|
88
88
|
end
|
89
89
|
|
90
90
|
# To switch a type A socket you have to give the house code, receiver code and the
|
@@ -97,7 +97,7 @@ module Tinkerforge
|
|
97
97
|
#
|
98
98
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
99
99
|
def switch_socket_a(house_code, receiver_code, switch_to)
|
100
|
-
send_request
|
100
|
+
send_request FUNCTION_SWITCH_SOCKET_A, [house_code, receiver_code, switch_to], 'C C C', 0, ''
|
101
101
|
end
|
102
102
|
|
103
103
|
# To switch a type B socket you have to give the address, unit and the state
|
@@ -112,7 +112,7 @@ module Tinkerforge
|
|
112
112
|
#
|
113
113
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
114
114
|
def switch_socket_b(address, unit, switch_to)
|
115
|
-
send_request
|
115
|
+
send_request FUNCTION_SWITCH_SOCKET_B, [address, unit, switch_to], 'L C C', 0, ''
|
116
116
|
end
|
117
117
|
|
118
118
|
# To control a type B dimmer you have to give the address, unit and the
|
@@ -126,7 +126,7 @@ module Tinkerforge
|
|
126
126
|
#
|
127
127
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
128
128
|
def dim_socket_b(address, unit, dim_value)
|
129
|
-
send_request
|
129
|
+
send_request FUNCTION_DIM_SOCKET_B, [address, unit, dim_value], 'L C C', 0, ''
|
130
130
|
end
|
131
131
|
|
132
132
|
# To switch a type C socket you have to give the system code, device code and the
|
@@ -140,7 +140,7 @@ module Tinkerforge
|
|
140
140
|
#
|
141
141
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
142
142
|
def switch_socket_c(system_code, device_code, switch_to)
|
143
|
-
send_request
|
143
|
+
send_request FUNCTION_SWITCH_SOCKET_C, [system_code, device_code, switch_to], 'k C C', 0, ''
|
144
144
|
end
|
145
145
|
|
146
146
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -152,7 +152,7 @@ module Tinkerforge
|
|
152
152
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
153
153
|
# |device_identifier_constant|
|
154
154
|
def get_identity
|
155
|
-
send_request
|
155
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
156
156
|
end
|
157
157
|
|
158
158
|
# 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 #
|
@@ -31,16 +31,17 @@ module Tinkerforge
|
|
31
31
|
@response_expected[FUNCTION_GET_RGB_VALUE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
32
32
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
33
33
|
|
34
|
+
|
34
35
|
end
|
35
36
|
|
36
37
|
# Sets the *rgb* value for the LED.
|
37
38
|
def set_rgb_value(r, g, b)
|
38
|
-
send_request
|
39
|
+
send_request FUNCTION_SET_RGB_VALUE, [r, g, b], 'C C C', 0, ''
|
39
40
|
end
|
40
41
|
|
41
42
|
# Returns the *rgb* value of the LED as set by BrickletRGBLED#set_rgb_value.
|
42
43
|
def get_rgb_value
|
43
|
-
send_request
|
44
|
+
send_request FUNCTION_GET_RGB_VALUE, [], '', 3, 'C C C'
|
44
45
|
end
|
45
46
|
|
46
47
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -52,7 +53,7 @@ module Tinkerforge
|
|
52
53
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
53
54
|
# |device_identifier_constant|
|
54
55
|
def get_identity
|
55
|
-
send_request
|
56
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
56
57
|
end
|
57
58
|
|
58
59
|
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 #
|
@@ -67,17 +67,14 @@ module Tinkerforge
|
|
67
67
|
@response_expected[FUNCTION_GET_COUNT_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
68
68
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
69
69
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
70
|
-
@response_expected[CALLBACK_COUNT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
71
|
-
@response_expected[CALLBACK_COUNT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
72
70
|
@response_expected[FUNCTION_IS_PRESSED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
73
|
-
@response_expected[CALLBACK_PRESSED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
74
|
-
@response_expected[CALLBACK_RELEASED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
75
71
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
76
72
|
|
77
73
|
@callback_formats[CALLBACK_COUNT] = 'l'
|
78
74
|
@callback_formats[CALLBACK_COUNT_REACHED] = 'l'
|
79
75
|
@callback_formats[CALLBACK_PRESSED] = ''
|
80
76
|
@callback_formats[CALLBACK_RELEASED] = ''
|
77
|
+
|
81
78
|
end
|
82
79
|
|
83
80
|
# Returns the current count of the encoder. If you set reset
|
@@ -89,7 +86,7 @@ module Tinkerforge
|
|
89
86
|
# Turning the encoder to the left decrements the counter,
|
90
87
|
# so a negative count is possible.
|
91
88
|
def get_count(reset)
|
92
|
-
send_request
|
89
|
+
send_request FUNCTION_GET_COUNT, [reset], '?', 4, 'l'
|
93
90
|
end
|
94
91
|
|
95
92
|
# Sets the period in ms with which the CALLBACK_COUNT callback is triggered
|
@@ -100,12 +97,12 @@ module Tinkerforge
|
|
100
97
|
#
|
101
98
|
# The default value is 0.
|
102
99
|
def set_count_callback_period(period)
|
103
|
-
send_request
|
100
|
+
send_request FUNCTION_SET_COUNT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
104
101
|
end
|
105
102
|
|
106
103
|
# Returns the period as set by BrickletRotaryEncoder#set_count_callback_period.
|
107
104
|
def get_count_callback_period
|
108
|
-
send_request
|
105
|
+
send_request FUNCTION_GET_COUNT_CALLBACK_PERIOD, [], '', 4, 'L'
|
109
106
|
end
|
110
107
|
|
111
108
|
# Sets the thresholds for the CALLBACK_COUNT_REACHED callback.
|
@@ -122,12 +119,12 @@ module Tinkerforge
|
|
122
119
|
#
|
123
120
|
# The default value is ('x', 0, 0).
|
124
121
|
def set_count_callback_threshold(option, min, max)
|
125
|
-
send_request
|
122
|
+
send_request FUNCTION_SET_COUNT_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
126
123
|
end
|
127
124
|
|
128
125
|
# Returns the threshold as set by BrickletRotaryEncoder#set_count_callback_threshold.
|
129
126
|
def get_count_callback_threshold
|
130
|
-
send_request
|
127
|
+
send_request FUNCTION_GET_COUNT_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
131
128
|
end
|
132
129
|
|
133
130
|
# Sets the period in ms with which the threshold callback
|
@@ -142,12 +139,12 @@ module Tinkerforge
|
|
142
139
|
#
|
143
140
|
# The default value is 100.
|
144
141
|
def set_debounce_period(debounce)
|
145
|
-
send_request
|
142
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
146
143
|
end
|
147
144
|
|
148
145
|
# Returns the debounce period as set by BrickletRotaryEncoder#set_debounce_period.
|
149
146
|
def get_debounce_period
|
150
|
-
send_request
|
147
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
151
148
|
end
|
152
149
|
|
153
150
|
# Returns *true* if the button is pressed and *false* otherwise.
|
@@ -155,7 +152,7 @@ module Tinkerforge
|
|
155
152
|
# It is recommended to use the CALLBACK_PRESSED and CALLBACK_RELEASED callbacks
|
156
153
|
# to handle the button.
|
157
154
|
def is_pressed
|
158
|
-
send_request
|
155
|
+
send_request FUNCTION_IS_PRESSED, [], '', 1, '?'
|
159
156
|
end
|
160
157
|
|
161
158
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -167,7 +164,7 @@ module Tinkerforge
|
|
167
164
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
168
165
|
# |device_identifier_constant|
|
169
166
|
def get_identity
|
170
|
-
send_request
|
167
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
171
168
|
end
|
172
169
|
|
173
170
|
# 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_POSITION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
90
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
91
|
-
@response_expected[CALLBACK_POSITION_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_POSITION] = 's'
|
96
92
|
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
97
93
|
@callback_formats[CALLBACK_POSITION_REACHED] = 's'
|
98
94
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
95
|
+
|
99
96
|
end
|
100
97
|
|
101
98
|
# Returns the position of the rotary potentiometer. The value is in degree
|
@@ -105,7 +102,7 @@ module Tinkerforge
|
|
105
102
|
# CALLBACK_POSITION callback and set the period with
|
106
103
|
# BrickletRotaryPoti#set_position_callback_period.
|
107
104
|
def get_position
|
108
|
-
send_request
|
105
|
+
send_request FUNCTION_GET_POSITION, [], '', 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
|
# BrickletRotaryPoti#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_POSITION callback is triggered
|
@@ -132,12 +129,12 @@ module Tinkerforge
|
|
132
129
|
#
|
133
130
|
# The default value is 0.
|
134
131
|
def set_position_callback_period(period)
|
135
|
-
send_request
|
132
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
136
133
|
end
|
137
134
|
|
138
135
|
# Returns the period as set by BrickletRotaryPoti#set_position_callback_period.
|
139
136
|
def get_position_callback_period
|
140
|
-
send_request
|
137
|
+
send_request FUNCTION_GET_POSITION_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 BrickletRotaryPoti#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_POSITION_REACHED callback.
|
@@ -170,12 +167,12 @@ module Tinkerforge
|
|
170
167
|
#
|
171
168
|
# The default value is ('x', 0, 0).
|
172
169
|
def set_position_callback_threshold(option, min, max)
|
173
|
-
send_request
|
170
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
|
174
171
|
end
|
175
172
|
|
176
173
|
# Returns the threshold as set by BrickletRotaryPoti#set_position_callback_threshold.
|
177
174
|
def get_position_callback_threshold
|
178
|
-
send_request
|
175
|
+
send_request FUNCTION_GET_POSITION_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 BrickletRotaryPoti#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 BrickletRotaryPoti#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 #
|
@@ -87,13 +87,12 @@ module Tinkerforge
|
|
87
87
|
@response_expected[FUNCTION_IS_READ_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
88
88
|
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
89
89
|
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
90
|
-
@response_expected[CALLBACK_READ] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
91
|
-
@response_expected[CALLBACK_ERROR] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
92
90
|
@response_expected[FUNCTION_SET_BREAK_CONDITION] = RESPONSE_EXPECTED_FALSE
|
93
91
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
94
92
|
|
95
93
|
@callback_formats[CALLBACK_READ] = 'k60 C'
|
96
94
|
@callback_formats[CALLBACK_ERROR] = 'C'
|
95
|
+
|
97
96
|
end
|
98
97
|
|
99
98
|
# Writes a string of up to 60 characters to the RS232 interface. The string
|
@@ -106,7 +105,7 @@ module Tinkerforge
|
|
106
105
|
# See BrickletRS232#set_configuration for configuration possibilities
|
107
106
|
# regarding baudrate, parity and so on.
|
108
107
|
def write(message, length)
|
109
|
-
send_request
|
108
|
+
send_request FUNCTION_WRITE, [message, length], 'k60 C', 1, 'C'
|
110
109
|
end
|
111
110
|
|
112
111
|
# Returns the currently buffered message. The maximum length
|
@@ -116,27 +115,27 @@ module Tinkerforge
|
|
116
115
|
# Instead of polling with this function, you can also use
|
117
116
|
# callbacks. See BrickletRS232#enable_read_callback and CALLBACK_READ callback.
|
118
117
|
def read
|
119
|
-
send_request
|
118
|
+
send_request FUNCTION_READ, [], '', 61, 'k60 C'
|
120
119
|
end
|
121
120
|
|
122
121
|
# Enables the CALLBACK_READ callback.
|
123
122
|
#
|
124
123
|
# By default the callback is disabled.
|
125
124
|
def enable_read_callback
|
126
|
-
send_request
|
125
|
+
send_request FUNCTION_ENABLE_READ_CALLBACK, [], '', 0, ''
|
127
126
|
end
|
128
127
|
|
129
128
|
# Disables the CALLBACK_READ callback.
|
130
129
|
#
|
131
130
|
# By default the callback is disabled.
|
132
131
|
def disable_read_callback
|
133
|
-
send_request
|
132
|
+
send_request FUNCTION_DISABLE_READ_CALLBACK, [], '', 0, ''
|
134
133
|
end
|
135
134
|
|
136
135
|
# Returns *true* if the CALLBACK_READ callback is enabled,
|
137
136
|
# *false* otherwise.
|
138
137
|
def is_read_callback_enabled
|
139
|
-
send_request
|
138
|
+
send_request FUNCTION_IS_READ_CALLBACK_ENABLED, [], '', 1, '?'
|
140
139
|
end
|
141
140
|
|
142
141
|
# Sets the configuration for the RS232 communication. Available options:
|
@@ -149,12 +148,12 @@ module Tinkerforge
|
|
149
148
|
#
|
150
149
|
# The default is: 115200 baud, parity none, 1 stop bit, word length 8, hard-/software flow control off.
|
151
150
|
def set_configuration(baudrate, parity, stopbits, wordlength, hardware_flowcontrol, software_flowcontrol)
|
152
|
-
send_request
|
151
|
+
send_request FUNCTION_SET_CONFIGURATION, [baudrate, parity, stopbits, wordlength, hardware_flowcontrol, software_flowcontrol], 'C C C C C C', 0, ''
|
153
152
|
end
|
154
153
|
|
155
154
|
# Returns the configuration as set by BrickletRS232#set_configuration.
|
156
155
|
def get_configuration
|
157
|
-
send_request
|
156
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 6, 'C C C C C C'
|
158
157
|
end
|
159
158
|
|
160
159
|
# Sets a break condition (the TX output is forced to a logic 0 state).
|
@@ -162,7 +161,7 @@ module Tinkerforge
|
|
162
161
|
#
|
163
162
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
164
163
|
def set_break_condition(break_time)
|
165
|
-
send_request
|
164
|
+
send_request FUNCTION_SET_BREAK_CONDITION, [break_time], 'S', 0, ''
|
166
165
|
end
|
167
166
|
|
168
167
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -174,7 +173,7 @@ module Tinkerforge
|
|
174
173
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
175
174
|
# |device_identifier_constant|
|
176
175
|
def get_identity
|
177
|
-
send_request
|
176
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
178
177
|
end
|
179
178
|
|
180
179
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|