tinkerforge 2.1.4 → 2.1.6
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 +42 -4
- data/lib/tinkerforge/brick_imu.rb +49 -11
- data/lib/tinkerforge/brick_imu_v2.rb +506 -0
- data/lib/tinkerforge/brick_master.rb +86 -46
- data/lib/tinkerforge/brick_red.rb +36 -5
- data/lib/tinkerforge/brick_servo.rb +53 -15
- data/lib/tinkerforge/brick_stepper.rb +43 -14
- data/lib/tinkerforge/bricklet_accelerometer.rb +229 -0
- data/lib/tinkerforge/bricklet_ambient_light.rb +10 -9
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +216 -0
- data/lib/tinkerforge/bricklet_analog_in.rb +13 -12
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +259 -0
- data/lib/tinkerforge/bricklet_analog_out.rb +5 -4
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +66 -0
- data/lib/tinkerforge/bricklet_barometer.rb +11 -9
- data/lib/tinkerforge/bricklet_color.rb +11 -9
- data/lib/tinkerforge/bricklet_current12.rb +5 -4
- data/lib/tinkerforge/bricklet_current25.rb +5 -4
- data/lib/tinkerforge/bricklet_distance_ir.rb +8 -7
- data/lib/tinkerforge/bricklet_distance_us.rb +9 -8
- data/lib/tinkerforge/bricklet_dual_button.rb +5 -4
- data/lib/tinkerforge/bricklet_dual_relay.rb +5 -4
- data/lib/tinkerforge/bricklet_dust_detector.rb +178 -0
- data/lib/tinkerforge/bricklet_gps.rb +6 -5
- data/lib/tinkerforge/bricklet_hall_effect.rb +5 -4
- data/lib/tinkerforge/bricklet_humidity.rb +8 -7
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +137 -0
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +8 -7
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +5 -4
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +6 -5
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +209 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +5 -4
- data/lib/tinkerforge/bricklet_io16.rb +8 -7
- data/lib/tinkerforge/bricklet_io4.rb +8 -7
- data/lib/tinkerforge/bricklet_joystick.rb +5 -4
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +324 -0
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +7 -6
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +11 -10
- data/lib/tinkerforge/bricklet_led_strip.rb +12 -10
- data/lib/tinkerforge/bricklet_line.rb +5 -4
- data/lib/tinkerforge/bricklet_linear_poti.rb +8 -7
- data/lib/tinkerforge/bricklet_load_cell.rb +261 -0
- data/lib/tinkerforge/bricklet_moisture.rb +6 -5
- data/lib/tinkerforge/bricklet_motion_detector.rb +5 -4
- data/lib/tinkerforge/bricklet_multi_touch.rb +5 -4
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +38 -46
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +5 -4
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +6 -5
- data/lib/tinkerforge/bricklet_ptc.rb +5 -4
- data/lib/tinkerforge/bricklet_remote_switch.rb +9 -8
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +5 -4
- data/lib/tinkerforge/bricklet_rotary_poti.rb +5 -4
- data/lib/tinkerforge/bricklet_rs232.rb +183 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -5
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +5 -4
- data/lib/tinkerforge/bricklet_sound_intensity.rb +6 -5
- data/lib/tinkerforge/bricklet_temperature.rb +7 -6
- data/lib/tinkerforge/bricklet_temperature_ir.rb +7 -6
- data/lib/tinkerforge/bricklet_tilt.rb +5 -4
- data/lib/tinkerforge/bricklet_voltage.rb +8 -7
- data/lib/tinkerforge/bricklet_voltage_current.rb +5 -4
- data/lib/tinkerforge/version.rb +1 -1
- metadata +13 -2
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Measures soil moisture
|
14
14
|
class BrickletMoisture < Device
|
15
15
|
DEVICE_IDENTIFIER = 232 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Moisture Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is triggered periodically with the period that is set by
|
18
19
|
# BrickletMoisture#set_moisture_callback_period. The parameter is the moisture value
|
@@ -140,7 +141,7 @@ module Tinkerforge
|
|
140
141
|
send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
|
141
142
|
end
|
142
143
|
|
143
|
-
# Sets the length of a `moving averaging <
|
144
|
+
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
144
145
|
# for the moisture value.
|
145
146
|
#
|
146
147
|
# Setting the length to 0 will turn the averaging completely off. With less
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Passive infrared (PIR) motion sensor, 7m range
|
14
14
|
class BrickletMotionDetector < Device
|
15
15
|
DEVICE_IDENTIFIER = 233 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Motion Detector Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is called after a motion was detected.
|
18
19
|
CALLBACK_MOTION_DETECTED = 2
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Capacitive touch sensor for 12 electrodes
|
14
14
|
class BrickletMultiTouch < Device
|
15
15
|
DEVICE_IDENTIFIER = 234 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Multi Touch Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# Returns the current touch state, see BrickletMultiTouch#get_touch_state for
|
18
19
|
# information about the state.
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Reads and writes NFC and RFID tags
|
14
14
|
class BrickletNFCRFID < Device
|
15
15
|
DEVICE_IDENTIFIER = 246 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'NFC/RFID Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is called if the state of the NFC/RFID Bricklet changes.
|
18
19
|
# See BrickletNFCRFID#get_state for more information about the possible states.
|
@@ -75,9 +76,9 @@ module Tinkerforge
|
|
75
76
|
#
|
76
77
|
# Current the following tag types are supported:
|
77
78
|
#
|
78
|
-
# * Mifare Classic
|
79
|
-
# * NFC Forum Type 1
|
80
|
-
# * NFC Forum Type 2
|
79
|
+
# * Mifare Classic
|
80
|
+
# * NFC Forum Type 1
|
81
|
+
# * NFC Forum Type 2
|
81
82
|
#
|
82
83
|
# After you call BrickletNFCRFID#request_tag_id the NFC/RFID Bricklet will try to read
|
83
84
|
# the tag ID from the tag. After this process is done the state will change.
|
@@ -107,9 +108,10 @@ module Tinkerforge
|
|
107
108
|
#
|
108
109
|
# To get the tag ID of a tag the approach is as follows:
|
109
110
|
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
111
|
+
# 1. Call BrickletNFCRFID#request_tag_id
|
112
|
+
# 2. Wait for state to change to *RequestTagIDReady* (see BrickletNFCRFID#get_state or
|
113
|
+
# CALLBACK_STATE_CHANGED)
|
114
|
+
# 3. Call BrickletNFCRFID#get_tag_id
|
113
115
|
def get_tag_id
|
114
116
|
send_request(FUNCTION_GET_TAG_ID, [], '', 9, 'C C C7')
|
115
117
|
end
|
@@ -128,24 +130,6 @@ module Tinkerforge
|
|
128
130
|
# didn't. If the request worked you can get the page by calling BrickletNFCRFID#get_page.
|
129
131
|
#
|
130
132
|
# The same approach is used analogously for the other API functions.
|
131
|
-
#
|
132
|
-
# Possible states are:
|
133
|
-
#
|
134
|
-
# * Initialization = 0
|
135
|
-
# * Idle = 128
|
136
|
-
# * Error = 192
|
137
|
-
# * RequestTagID = 2
|
138
|
-
# * RequestTagIDReady = 130
|
139
|
-
# * RequestTagIDError = 194
|
140
|
-
# * AuthenticatingMifareClassicPage = 3
|
141
|
-
# * AuthenticatingMifareClassicPageReady = 131
|
142
|
-
# * AuthenticatingMifareClassicPageError = 195
|
143
|
-
# * WritePage = 4
|
144
|
-
# * WritePageReady = 132
|
145
|
-
# * WritePageError = 196
|
146
|
-
# * RequestPage = 5
|
147
|
-
# * RequestPageReady = 133
|
148
|
-
# * RequestPageError = 197
|
149
133
|
def get_state
|
150
134
|
send_request(FUNCTION_GET_STATE, [], '', 2, 'C ?')
|
151
135
|
end
|
@@ -159,13 +143,15 @@ module Tinkerforge
|
|
159
143
|
#
|
160
144
|
# The approach to read or write a Mifare Classic page is as follows:
|
161
145
|
#
|
162
|
-
#
|
163
|
-
#
|
164
|
-
#
|
165
|
-
#
|
166
|
-
#
|
167
|
-
#
|
168
|
-
#
|
146
|
+
# 1. Call BrickletNFCRFID#request_tag_id
|
147
|
+
# 2. Wait for state to change to *RequestTagIDReady* (see BrickletNFCRFID#get_state
|
148
|
+
# or CALLBACK_STATE_CHANGED)
|
149
|
+
# 3. If looking for a specific tag then call BrickletNFCRFID#get_tag_id and check if the
|
150
|
+
# expected tag was found, if it was not found got back to step 1
|
151
|
+
# 4. Call BrickletNFCRFID#authenticate_mifare_classic_page with page and key for the page
|
152
|
+
# 5. Wait for state to change to *AuthenticatingMifareClassicPageReady* (see
|
153
|
+
# BrickletNFCRFID#get_state or CALLBACK_STATE_CHANGED)
|
154
|
+
# 6. Call BrickletNFCRFID#request_page or BrickletNFCRFID#write_page to read/write page
|
169
155
|
def authenticate_mifare_classic_page(page, key_number, key)
|
170
156
|
send_request(FUNCTION_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 0, '')
|
171
157
|
end
|
@@ -179,11 +165,14 @@ module Tinkerforge
|
|
179
165
|
#
|
180
166
|
# The general approach for writing to a tag is as follows:
|
181
167
|
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
168
|
+
# 1. Call BrickletNFCRFID#request_tag_id
|
169
|
+
# 2. Wait for state to change to *RequestTagIDReady* (see BrickletNFCRFID#get_state or
|
170
|
+
# CALLBACK_STATE_CHANGED)
|
171
|
+
# 3. If looking for a specific tag then call BrickletNFCRFID#get_tag_id and check if the
|
172
|
+
# expected tag was found, if it was not found got back to step 1
|
173
|
+
# 4. Call BrickletNFCRFID#write_page with page number and data
|
174
|
+
# 5. Wait for state to change to *WritePageReady* (see BrickletNFCRFID#get_state or
|
175
|
+
# CALLBACK_STATE_CHANGED)
|
187
176
|
#
|
188
177
|
# If you use a Mifare Classic tag you have to authenticate a page before you
|
189
178
|
# can write to it. See BrickletNFCRFID#authenticate_mifare_classic_page.
|
@@ -202,12 +191,15 @@ module Tinkerforge
|
|
202
191
|
#
|
203
192
|
# The general approach for reading a tag is as follows:
|
204
193
|
#
|
205
|
-
#
|
206
|
-
#
|
207
|
-
#
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
194
|
+
# 1. Call BrickletNFCRFID#request_tag_id
|
195
|
+
# 2. Wait for state to change to *RequestTagIDReady* (see BrickletNFCRFID#get_state
|
196
|
+
# or CALLBACK_STATE_CHANGED)
|
197
|
+
# 3. If looking for a specific tag then call BrickletNFCRFID#get_tag_id and check if the
|
198
|
+
# expected tag was found, if it was not found got back to step 1
|
199
|
+
# 4. Call BrickletNFCRFID#request_page with page number
|
200
|
+
# 5. Wait for state to change to *RequestPageReady* (see BrickletNFCRFID#get_state
|
201
|
+
# or CALLBACK_STATE_CHANGED)
|
202
|
+
# 6. Call BrickletNFCRFID#get_page to retrieve the page from the buffer
|
211
203
|
#
|
212
204
|
# If you use a Mifare Classic tag you have to authenticate a page before you
|
213
205
|
# can read it. See BrickletNFCRFID#authenticate_mifare_classic_page.
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Creates 1kHz beep
|
14
14
|
class BrickletPiezoBuzzer < Device
|
15
15
|
DEVICE_IDENTIFIER = 214 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Piezo Buzzer Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is triggered if a beep set by BrickletPiezoBuzzer#beep is finished
|
18
19
|
CALLBACK_BEEP_FINISHED = 3
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Creates beep with configurable frequency
|
14
14
|
class BrickletPiezoSpeaker < Device
|
15
15
|
DEVICE_IDENTIFIER = 242 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Piezo Speaker Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is triggered if a beep set by BrickletPiezoSpeaker#beep is finished
|
18
19
|
CALLBACK_BEEP_FINISHED = 4
|
@@ -52,7 +53,7 @@ module Tinkerforge
|
|
52
53
|
# the piezo buzzer will beep for one second with a frequency of
|
53
54
|
# approximately 2 kHz.
|
54
55
|
#
|
55
|
-
# .. versionchanged:: 2.0.2
|
56
|
+
# .. versionchanged:: 2.0.2$nbsp;(Plugin)
|
56
57
|
# A duration of 0 stops the current beep if any, the frequency parameter is
|
57
58
|
# ignored. A duration of 4294967295 results in an infinite beep.
|
58
59
|
#
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Reads temperatures from Pt100 und Pt1000 sensors
|
14
14
|
class BrickletPTC < Device
|
15
15
|
DEVICE_IDENTIFIER = 226 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'PTC Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is triggered periodically with the period that is set by
|
18
19
|
# BrickletPTC#set_temperature_callback_period. The parameter is the temperature
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# Controls remote mains switches
|
14
14
|
class BrickletRemoteSwitch < Device
|
15
15
|
DEVICE_IDENTIFIER = 235 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Remote Switch Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is called whenever the switching state changes
|
18
19
|
# from busy to ready, see BrickletRemoteSwitch#get_switching_state.
|
@@ -94,7 +95,7 @@ module Tinkerforge
|
|
94
95
|
# A detailed description on how you can figure out the house and receiver code
|
95
96
|
# can be found :ref:`here <remote_switch_bricklet_type_a_house_and_receiver_code>`.
|
96
97
|
#
|
97
|
-
# .. versionadded:: 2.0.1
|
98
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
98
99
|
def switch_socket_a(house_code, receiver_code, switch_to)
|
99
100
|
send_request(FUNCTION_SWITCH_SOCKET_A, [house_code, receiver_code, switch_to], 'C C C', 0, '')
|
100
101
|
end
|
@@ -109,7 +110,7 @@ module Tinkerforge
|
|
109
110
|
# A detailed description on how you can teach a socket the address and unit can
|
110
111
|
# be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.
|
111
112
|
#
|
112
|
-
# .. versionadded:: 2.0.1
|
113
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
113
114
|
def switch_socket_b(address, unit, switch_to)
|
114
115
|
send_request(FUNCTION_SWITCH_SOCKET_B, [address, unit, switch_to], 'L C C', 0, '')
|
115
116
|
end
|
@@ -123,7 +124,7 @@ module Tinkerforge
|
|
123
124
|
# A detailed description on how you can teach a dimmer the address and unit can
|
124
125
|
# be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.
|
125
126
|
#
|
126
|
-
# .. versionadded:: 2.0.1
|
127
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
127
128
|
def dim_socket_b(address, unit, dim_value)
|
128
129
|
send_request(FUNCTION_DIM_SOCKET_B, [address, unit, dim_value], 'L C C', 0, '')
|
129
130
|
end
|
@@ -137,7 +138,7 @@ module Tinkerforge
|
|
137
138
|
# A detailed description on how you can figure out the system and device code
|
138
139
|
# can be found :ref:`here <remote_switch_bricklet_type_c_system_and_device_code>`.
|
139
140
|
#
|
140
|
-
# .. versionadded:: 2.0.1
|
141
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
141
142
|
def switch_socket_c(system_code, device_code, switch_to)
|
142
143
|
send_request(FUNCTION_SWITCH_SOCKET_C, [system_code, device_code, switch_to], 'k C C', 0, '')
|
143
144
|
end
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# 360° rotary encoder with push-button
|
14
14
|
class BrickletRotaryEncoder < Device
|
15
15
|
DEVICE_IDENTIFIER = 236 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Rotary Encoder Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is triggered periodically with the period that is set by
|
18
19
|
# BrickletRotaryEncoder#set_count_callback_period. The parameter is the count of
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
4
|
# #
|
5
|
-
# Bindings Version 2.1.
|
5
|
+
# Bindings Version 2.1.6 #
|
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 #
|
9
|
-
# to the
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
12
|
module Tinkerforge
|
13
|
-
#
|
13
|
+
# 300° rotary potentiometer
|
14
14
|
class BrickletRotaryPoti < Device
|
15
15
|
DEVICE_IDENTIFIER = 215 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'Rotary Poti Bricklet' # :nodoc:
|
16
17
|
|
17
18
|
# This callback is triggered periodically with the period that is set by
|
18
19
|
# BrickletRotaryPoti#set_position_callback_period. The parameter is the position of the
|
@@ -0,0 +1,183 @@
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
2
|
+
#############################################################
|
3
|
+
# This file was automatically generated on 2015-11-17. #
|
4
|
+
# #
|
5
|
+
# Bindings Version 2.1.6 #
|
6
|
+
# #
|
7
|
+
# If you have a bugfix for this file and want to commit it, #
|
8
|
+
# please fix the bug in the generator. You can find a link #
|
9
|
+
# to the generators git repository on tinkerforge.com #
|
10
|
+
#############################################################
|
11
|
+
|
12
|
+
module Tinkerforge
|
13
|
+
# Communicates with RS232 devices
|
14
|
+
class BrickletRS232 < Device
|
15
|
+
DEVICE_IDENTIFIER = 254 # :nodoc:
|
16
|
+
DEVICE_DISPLAY_NAME = 'RS232 Bricklet' # :nodoc:
|
17
|
+
|
18
|
+
# This callback is called if new data is available. The message has
|
19
|
+
# a maximum size of 60 characters. The actual length of the message
|
20
|
+
# is given in addition.
|
21
|
+
#
|
22
|
+
# To enable this callback, use BrickletRS232#enable_read_callback.
|
23
|
+
CALLBACK_READ_CALLBACK = 8
|
24
|
+
|
25
|
+
# This callback is called if an error occurs.
|
26
|
+
# Possible errors are overrun, parity or framing error.
|
27
|
+
#
|
28
|
+
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
29
|
+
CALLBACK_ERROR_CALLBACK = 9
|
30
|
+
|
31
|
+
FUNCTION_WRITE = 1 # :nodoc:
|
32
|
+
FUNCTION_READ = 2 # :nodoc:
|
33
|
+
FUNCTION_ENABLE_READ_CALLBACK = 3 # :nodoc:
|
34
|
+
FUNCTION_DISABLE_READ_CALLBACK = 4 # :nodoc:
|
35
|
+
FUNCTION_IS_READ_CALLBACK_ENABLED = 5 # :nodoc:
|
36
|
+
FUNCTION_SET_CONFIGURATION = 6 # :nodoc:
|
37
|
+
FUNCTION_GET_CONFIGURATION = 7 # :nodoc:
|
38
|
+
FUNCTION_SET_BREAK_CONDITION = 10 # :nodoc:
|
39
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
40
|
+
|
41
|
+
BAUDRATE_300 = 0 # :nodoc:
|
42
|
+
BAUDRATE_600 = 1 # :nodoc:
|
43
|
+
BAUDRATE_1200 = 2 # :nodoc:
|
44
|
+
BAUDRATE_2400 = 3 # :nodoc:
|
45
|
+
BAUDRATE_4800 = 4 # :nodoc:
|
46
|
+
BAUDRATE_9600 = 5 # :nodoc:
|
47
|
+
BAUDRATE_14400 = 6 # :nodoc:
|
48
|
+
BAUDRATE_19200 = 7 # :nodoc:
|
49
|
+
BAUDRATE_28800 = 8 # :nodoc:
|
50
|
+
BAUDRATE_38400 = 9 # :nodoc:
|
51
|
+
BAUDRATE_57600 = 10 # :nodoc:
|
52
|
+
BAUDRATE_115200 = 11 # :nodoc:
|
53
|
+
BAUDRATE_230400 = 12 # :nodoc:
|
54
|
+
PARITY_NONE = 0 # :nodoc:
|
55
|
+
PARITY_ODD = 1 # :nodoc:
|
56
|
+
PARITY_EVEN = 2 # :nodoc:
|
57
|
+
PARITY_FORCED_PARITY_1 = 3 # :nodoc:
|
58
|
+
PARITY_FORCED_PARITY_0 = 4 # :nodoc:
|
59
|
+
STOPBITS_1 = 1 # :nodoc:
|
60
|
+
STOPBITS_2 = 2 # :nodoc:
|
61
|
+
WORDLENGTH_5 = 5 # :nodoc:
|
62
|
+
WORDLENGTH_6 = 6 # :nodoc:
|
63
|
+
WORDLENGTH_7 = 7 # :nodoc:
|
64
|
+
WORDLENGTH_8 = 8 # :nodoc:
|
65
|
+
HARDWARE_FLOWCONTROL_OFF = 0 # :nodoc:
|
66
|
+
HARDWARE_FLOWCONTROL_ON = 1 # :nodoc:
|
67
|
+
SOFTWARE_FLOWCONTROL_OFF = 0 # :nodoc:
|
68
|
+
SOFTWARE_FLOWCONTROL_ON = 1 # :nodoc:
|
69
|
+
ERROR_OVERRUN = 1 # :nodoc:
|
70
|
+
ERROR_PARITY = 2 # :nodoc:
|
71
|
+
ERROR_FRAMING = 4 # :nodoc:
|
72
|
+
|
73
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
74
|
+
# the IP Connection <tt>ipcon</tt>.
|
75
|
+
def initialize(uid, ipcon)
|
76
|
+
super uid, ipcon
|
77
|
+
|
78
|
+
@api_version = [2, 0, 2]
|
79
|
+
|
80
|
+
@response_expected[FUNCTION_WRITE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
81
|
+
@response_expected[FUNCTION_READ] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
82
|
+
@response_expected[FUNCTION_ENABLE_READ_CALLBACK] = RESPONSE_EXPECTED_TRUE
|
83
|
+
@response_expected[FUNCTION_DISABLE_READ_CALLBACK] = RESPONSE_EXPECTED_TRUE
|
84
|
+
@response_expected[FUNCTION_IS_READ_CALLBACK_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
85
|
+
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
86
|
+
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
87
|
+
@response_expected[CALLBACK_READ_CALLBACK] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
88
|
+
@response_expected[CALLBACK_ERROR_CALLBACK] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
89
|
+
@response_expected[FUNCTION_SET_BREAK_CONDITION] = RESPONSE_EXPECTED_FALSE
|
90
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
91
|
+
|
92
|
+
@callback_formats[CALLBACK_READ_CALLBACK] = 'k60 C'
|
93
|
+
@callback_formats[CALLBACK_ERROR_CALLBACK] = 'C'
|
94
|
+
end
|
95
|
+
|
96
|
+
# Writes a string of up to 60 characters to the RS232 interface. The string
|
97
|
+
# can be binary data, ASCII or similar is not necessary.
|
98
|
+
#
|
99
|
+
# The length of the string has to be given as an additional parameter.
|
100
|
+
#
|
101
|
+
# The return value is the number of bytes that could be written.
|
102
|
+
#
|
103
|
+
# See :func:`SetConfigurations` for configuration possibilities
|
104
|
+
# regarding baudrate, parity and so on.
|
105
|
+
def write(message, length)
|
106
|
+
send_request(FUNCTION_WRITE, [message, length], 'k60 C', 1, 'C')
|
107
|
+
end
|
108
|
+
|
109
|
+
# Returns the currently buffered message. The maximum length
|
110
|
+
# of message is 60. If the length is given as 0, there was no
|
111
|
+
# new data available.
|
112
|
+
#
|
113
|
+
# Instead of polling with this function, you can also use
|
114
|
+
# callbacks. See BrickletRS232#enable_read_callback and CALLBACK_READ_CALLBACK.
|
115
|
+
def read
|
116
|
+
send_request(FUNCTION_READ, [], '', 61, 'k60 C')
|
117
|
+
end
|
118
|
+
|
119
|
+
# Enables the CALLBACK_READ_CALLBACK.
|
120
|
+
#
|
121
|
+
# By default the callback is disabled.
|
122
|
+
def enable_read_callback
|
123
|
+
send_request(FUNCTION_ENABLE_READ_CALLBACK, [], '', 0, '')
|
124
|
+
end
|
125
|
+
|
126
|
+
# Disables the CALLBACK_READ_CALLBACK.
|
127
|
+
#
|
128
|
+
# By default the callback is disabled.
|
129
|
+
def disable_read_callback
|
130
|
+
send_request(FUNCTION_DISABLE_READ_CALLBACK, [], '', 0, '')
|
131
|
+
end
|
132
|
+
|
133
|
+
# Returns *true* if the CALLBACK_READ_CALLBACK is enabled,
|
134
|
+
# *false* otherwise.
|
135
|
+
def is_read_callback_enabled
|
136
|
+
send_request(FUNCTION_IS_READ_CALLBACK_ENABLED, [], '', 1, '?')
|
137
|
+
end
|
138
|
+
|
139
|
+
# Sets the configuration for the RS232 communication. Available options:
|
140
|
+
#
|
141
|
+
# * Baudrate between 300 and 230400 baud.
|
142
|
+
# * Parity of none, odd, even or forced parity.
|
143
|
+
# * Stopbits can be 1 or 2.
|
144
|
+
# * Word length of 5 to 8.
|
145
|
+
# * Hard-/Software flow control can each be on or off.
|
146
|
+
#
|
147
|
+
# The default is: 115200 baud, parity none, 1 stop bit, word length 8, hard-/software flow control off.
|
148
|
+
def set_configuration(baudrate, parity, stopbits, wordlength, hardware_flowcontrol, software_flowcontrol)
|
149
|
+
send_request(FUNCTION_SET_CONFIGURATION, [baudrate, parity, stopbits, wordlength, hardware_flowcontrol, software_flowcontrol], 'C C C C C C', 0, '')
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the configuration as set by BrickletRS232#set_configuration.
|
153
|
+
def get_configuration
|
154
|
+
send_request(FUNCTION_GET_CONFIGURATION, [], '', 6, 'C C C C C C')
|
155
|
+
end
|
156
|
+
|
157
|
+
# Sets a break condition (the TX output is forced to a logic 0 state).
|
158
|
+
# The parameter sets the hold-time of the break condition (in ms).
|
159
|
+
#
|
160
|
+
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
161
|
+
def set_break_condition(break_time)
|
162
|
+
send_request(FUNCTION_SET_BREAK_CONDITION, [break_time], 'S', 0, '')
|
163
|
+
end
|
164
|
+
|
165
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
166
|
+
# the position, the hardware and firmware version as well as the
|
167
|
+
# device identifier.
|
168
|
+
#
|
169
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
170
|
+
#
|
171
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
172
|
+
# |device_identifier_constant|
|
173
|
+
def get_identity
|
174
|
+
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
175
|
+
end
|
176
|
+
|
177
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
178
|
+
def register_callback(id, &block)
|
179
|
+
callback = block
|
180
|
+
@registered_callbacks[id] = callback
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|