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 #
|
@@ -42,14 +42,13 @@ module Tinkerforge
|
|
42
42
|
@api_version = [2, 0, 0]
|
43
43
|
|
44
44
|
@response_expected[FUNCTION_GET_MOTION_DETECTED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
45
|
-
@response_expected[CALLBACK_MOTION_DETECTED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
46
|
-
@response_expected[CALLBACK_DETECTION_CYCLE_ENDED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
47
45
|
@response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
|
48
46
|
@response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
49
47
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
50
48
|
|
51
49
|
@callback_formats[CALLBACK_MOTION_DETECTED] = ''
|
52
50
|
@callback_formats[CALLBACK_DETECTION_CYCLE_ENDED] = ''
|
51
|
+
|
53
52
|
end
|
54
53
|
|
55
54
|
# Returns 1 if a motion was detected. How long this returns 1 after a motion
|
@@ -60,7 +59,7 @@ module Tinkerforge
|
|
60
59
|
# There is also a blue LED on the Bricklet that is on as long as the Bricklet is
|
61
60
|
# in the "motion detected" state.
|
62
61
|
def get_motion_detected
|
63
|
-
send_request
|
62
|
+
send_request FUNCTION_GET_MOTION_DETECTED, [], '', 1, 'C'
|
64
63
|
end
|
65
64
|
|
66
65
|
# Sets the status led configuration.
|
@@ -72,14 +71,14 @@ module Tinkerforge
|
|
72
71
|
#
|
73
72
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
74
73
|
def set_status_led_config(config)
|
75
|
-
send_request
|
74
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
76
75
|
end
|
77
76
|
|
78
77
|
# Returns the configuration as set by BrickletMotionDetector#set_status_led_config.
|
79
78
|
#
|
80
79
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
81
80
|
def get_status_led_config
|
82
|
-
send_request
|
81
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
83
82
|
end
|
84
83
|
|
85
84
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -91,7 +90,7 @@ module Tinkerforge
|
|
91
90
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
92
91
|
# |device_identifier_constant|
|
93
92
|
def get_identity
|
94
|
-
send_request
|
93
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
95
94
|
end
|
96
95
|
|
97
96
|
# 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 #
|
@@ -41,12 +41,12 @@ module Tinkerforge
|
|
41
41
|
@response_expected[FUNCTION_RECALIBRATE] = RESPONSE_EXPECTED_FALSE
|
42
42
|
@response_expected[FUNCTION_SET_ELECTRODE_CONFIG] = RESPONSE_EXPECTED_FALSE
|
43
43
|
@response_expected[FUNCTION_GET_ELECTRODE_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
44
|
-
@response_expected[CALLBACK_TOUCH_STATE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
45
44
|
@response_expected[FUNCTION_SET_ELECTRODE_SENSITIVITY] = RESPONSE_EXPECTED_FALSE
|
46
45
|
@response_expected[FUNCTION_GET_ELECTRODE_SENSITIVITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
47
46
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
48
47
|
|
49
48
|
@callback_formats[CALLBACK_TOUCH_STATE] = 'S'
|
49
|
+
|
50
50
|
end
|
51
51
|
|
52
52
|
# Returns the current touch state. The state is given as a bitfield.
|
@@ -68,13 +68,13 @@ module Tinkerforge
|
|
68
68
|
# or similar on top of a electrode to build a touch panel with
|
69
69
|
# a professional look.
|
70
70
|
def get_touch_state
|
71
|
-
send_request
|
71
|
+
send_request FUNCTION_GET_TOUCH_STATE, [], '', 2, 'S'
|
72
72
|
end
|
73
73
|
|
74
74
|
# Recalibrates the electrodes. Call this function whenever you changed
|
75
75
|
# or moved you electrodes.
|
76
76
|
def recalibrate
|
77
|
-
send_request
|
77
|
+
send_request FUNCTION_RECALIBRATE, [], '', 0, ''
|
78
78
|
end
|
79
79
|
|
80
80
|
# Enables/disables electrodes with a bitfield (see BrickletMultiTouch#get_touch_state).
|
@@ -92,12 +92,12 @@ module Tinkerforge
|
|
92
92
|
#
|
93
93
|
# Default: 8191 = 0x1FFF = 0b1111111111111 (all electrodes enabled)
|
94
94
|
def set_electrode_config(enabled_electrodes)
|
95
|
-
send_request
|
95
|
+
send_request FUNCTION_SET_ELECTRODE_CONFIG, [enabled_electrodes], 'S', 0, ''
|
96
96
|
end
|
97
97
|
|
98
98
|
# Returns the electrode configuration, as set by BrickletMultiTouch#set_electrode_config.
|
99
99
|
def get_electrode_config
|
100
|
-
send_request
|
100
|
+
send_request FUNCTION_GET_ELECTRODE_CONFIG, [], '', 2, 'S'
|
101
101
|
end
|
102
102
|
|
103
103
|
# Sets the sensitivity of the electrodes. An electrode with a high sensitivity
|
@@ -114,12 +114,12 @@ module Tinkerforge
|
|
114
114
|
#
|
115
115
|
# The default sensitivity value is 181.
|
116
116
|
def set_electrode_sensitivity(sensitivity)
|
117
|
-
send_request
|
117
|
+
send_request FUNCTION_SET_ELECTRODE_SENSITIVITY, [sensitivity], 'C', 0, ''
|
118
118
|
end
|
119
119
|
|
120
120
|
# Returns the current sensitivity, as set by BrickletMultiTouch#set_electrode_sensitivity.
|
121
121
|
def get_electrode_sensitivity
|
122
|
-
send_request
|
122
|
+
send_request FUNCTION_GET_ELECTRODE_SENSITIVITY, [], '', 1, 'C'
|
123
123
|
end
|
124
124
|
|
125
125
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -131,7 +131,7 @@ module Tinkerforge
|
|
131
131
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
132
132
|
# |device_identifier_constant|
|
133
133
|
def get_identity
|
134
|
-
send_request
|
134
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
135
135
|
end
|
136
136
|
|
137
137
|
# 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 #
|
@@ -63,10 +63,10 @@ module Tinkerforge
|
|
63
63
|
@response_expected[FUNCTION_WRITE_PAGE] = RESPONSE_EXPECTED_FALSE
|
64
64
|
@response_expected[FUNCTION_REQUEST_PAGE] = RESPONSE_EXPECTED_FALSE
|
65
65
|
@response_expected[FUNCTION_GET_PAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
66
|
-
@response_expected[CALLBACK_STATE_CHANGED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
67
66
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
68
67
|
|
69
68
|
@callback_formats[CALLBACK_STATE_CHANGED] = 'C ?'
|
69
|
+
|
70
70
|
end
|
71
71
|
|
72
72
|
# To read or write a tag that is in proximity of the NFC/RFID Bricklet you
|
@@ -98,7 +98,7 @@ module Tinkerforge
|
|
98
98
|
# In case of any *Error* state the selection is lost and you have to
|
99
99
|
# start again by calling BrickletNFCRFID#request_tag_id.
|
100
100
|
def request_tag_id(tag_type)
|
101
|
-
send_request
|
101
|
+
send_request FUNCTION_REQUEST_TAG_ID, [tag_type], 'C', 0, ''
|
102
102
|
end
|
103
103
|
|
104
104
|
# Returns the tag type, tag ID and the length of the tag ID
|
@@ -113,7 +113,7 @@ module Tinkerforge
|
|
113
113
|
# CALLBACK_STATE_CHANGED callback)
|
114
114
|
# 3. Call BrickletNFCRFID#get_tag_id
|
115
115
|
def get_tag_id
|
116
|
-
send_request
|
116
|
+
send_request FUNCTION_GET_TAG_ID, [], '', 9, 'C C C7'
|
117
117
|
end
|
118
118
|
|
119
119
|
# Returns the current state of the NFC/RFID Bricklet.
|
@@ -131,7 +131,7 @@ module Tinkerforge
|
|
131
131
|
#
|
132
132
|
# The same approach is used analogously for the other API functions.
|
133
133
|
def get_state
|
134
|
-
send_request
|
134
|
+
send_request FUNCTION_GET_STATE, [], '', 2, 'C ?'
|
135
135
|
end
|
136
136
|
|
137
137
|
# Mifare Classic tags use authentication. If you want to read from or write to
|
@@ -153,7 +153,7 @@ module Tinkerforge
|
|
153
153
|
# BrickletNFCRFID#get_state or CALLBACK_STATE_CHANGED callback)
|
154
154
|
# 6. Call BrickletNFCRFID#request_page or BrickletNFCRFID#write_page to read/write page
|
155
155
|
def authenticate_mifare_classic_page(page, key_number, key)
|
156
|
-
send_request
|
156
|
+
send_request FUNCTION_AUTHENTICATE_MIFARE_CLASSIC_PAGE, [page, key_number, key], 'S C C6', 0, ''
|
157
157
|
end
|
158
158
|
|
159
159
|
# Writes 16 bytes starting from the given page. How many pages are written
|
@@ -177,7 +177,7 @@ module Tinkerforge
|
|
177
177
|
# If you use a Mifare Classic tag you have to authenticate a page before you
|
178
178
|
# can write to it. See BrickletNFCRFID#authenticate_mifare_classic_page.
|
179
179
|
def write_page(page, data)
|
180
|
-
send_request
|
180
|
+
send_request FUNCTION_WRITE_PAGE, [page, data], 'S C16', 0, ''
|
181
181
|
end
|
182
182
|
|
183
183
|
# Reads 16 bytes starting from the given page and stores them into a buffer.
|
@@ -204,13 +204,13 @@ module Tinkerforge
|
|
204
204
|
# If you use a Mifare Classic tag you have to authenticate a page before you
|
205
205
|
# can read it. See BrickletNFCRFID#authenticate_mifare_classic_page.
|
206
206
|
def request_page(page)
|
207
|
-
send_request
|
207
|
+
send_request FUNCTION_REQUEST_PAGE, [page], 'S', 0, ''
|
208
208
|
end
|
209
209
|
|
210
210
|
# Returns 16 bytes of data from an internal buffer. To fill the buffer
|
211
211
|
# with specific pages you have to call BrickletNFCRFID#request_page beforehand.
|
212
212
|
def get_page
|
213
|
-
send_request
|
213
|
+
send_request FUNCTION_GET_PAGE, [], '', 16, 'C16'
|
214
214
|
end
|
215
215
|
|
216
216
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -222,7 +222,7 @@ module Tinkerforge
|
|
222
222
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
223
223
|
# |device_identifier_constant|
|
224
224
|
def get_identity
|
225
|
-
send_request
|
225
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
226
226
|
end
|
227
227
|
|
228
228
|
# 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 #
|
@@ -39,6 +39,7 @@ module Tinkerforge
|
|
39
39
|
@response_expected[FUNCTION_WRITE_LINE] = RESPONSE_EXPECTED_FALSE
|
40
40
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
41
41
|
|
42
|
+
|
42
43
|
end
|
43
44
|
|
44
45
|
# Appends 64 byte of data to the window as set by BrickletOLED128x64#new_window.
|
@@ -62,7 +63,7 @@ module Tinkerforge
|
|
62
63
|
# and the next two the second row and so on. To fill the whole display
|
63
64
|
# you need to call BrickletOLED128x64#write 16 times.
|
64
65
|
def write(data)
|
65
|
-
send_request
|
66
|
+
send_request FUNCTION_WRITE, [data], 'C64', 0, ''
|
66
67
|
end
|
67
68
|
|
68
69
|
# Sets the window in which you can write with BrickletOLED128x64#write. One row
|
@@ -70,12 +71,12 @@ module Tinkerforge
|
|
70
71
|
#
|
71
72
|
# The columns have a range of 0 to 127 and the rows have a range of 0 to 7.
|
72
73
|
def new_window(column_from, column_to, row_from, row_to)
|
73
|
-
send_request
|
74
|
+
send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 0, ''
|
74
75
|
end
|
75
76
|
|
76
77
|
# Clears the current content of the window as set by BrickletOLED128x64#new_window.
|
77
78
|
def clear_display
|
78
|
-
send_request
|
79
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
|
79
80
|
end
|
80
81
|
|
81
82
|
# Sets the configuration of the display.
|
@@ -85,12 +86,12 @@ module Tinkerforge
|
|
85
86
|
#
|
86
87
|
# The default values are contrast 143 and inverting off.
|
87
88
|
def set_display_configuration(contrast, invert)
|
88
|
-
send_request
|
89
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 0, ''
|
89
90
|
end
|
90
91
|
|
91
92
|
# Returns the configuration as set by BrickletOLED128x64#set_display_configuration.
|
92
93
|
def get_display_configuration
|
93
|
-
send_request
|
94
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?'
|
94
95
|
end
|
95
96
|
|
96
97
|
# Writes text to a specific line (0 to 7) with a specific position
|
@@ -105,7 +106,7 @@ module Tinkerforge
|
|
105
106
|
# The display uses a special 5x7 pixel charset. You can view the characters
|
106
107
|
# of the charset in Brick Viewer.
|
107
108
|
def write_line(line, position, text)
|
108
|
-
send_request
|
109
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z26', 0, ''
|
109
110
|
end
|
110
111
|
|
111
112
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -117,7 +118,7 @@ module Tinkerforge
|
|
117
118
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
118
119
|
# |device_identifier_constant|
|
119
120
|
def get_identity
|
120
|
-
send_request
|
121
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
121
122
|
end
|
122
123
|
|
123
124
|
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 #
|
@@ -39,6 +39,7 @@ module Tinkerforge
|
|
39
39
|
@response_expected[FUNCTION_WRITE_LINE] = RESPONSE_EXPECTED_FALSE
|
40
40
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
41
41
|
|
42
|
+
|
42
43
|
end
|
43
44
|
|
44
45
|
# Appends 64 byte of data to the window as set by BrickletOLED64x48#new_window.
|
@@ -61,7 +62,7 @@ module Tinkerforge
|
|
61
62
|
# The next call of BrickletOLED64x48#write will write the second row and so on. To
|
62
63
|
# fill the whole display you need to call BrickletOLED64x48#write 6 times.
|
63
64
|
def write(data)
|
64
|
-
send_request
|
65
|
+
send_request FUNCTION_WRITE, [data], 'C64', 0, ''
|
65
66
|
end
|
66
67
|
|
67
68
|
# Sets the window in which you can write with BrickletOLED64x48#write. One row
|
@@ -69,12 +70,12 @@ module Tinkerforge
|
|
69
70
|
#
|
70
71
|
# The columns have a range of 0 to 63 and the rows have a range of 0 to 5.
|
71
72
|
def new_window(column_from, column_to, row_from, row_to)
|
72
|
-
send_request
|
73
|
+
send_request FUNCTION_NEW_WINDOW, [column_from, column_to, row_from, row_to], 'C C C C', 0, ''
|
73
74
|
end
|
74
75
|
|
75
76
|
# Clears the current content of the window as set by BrickletOLED64x48#new_window.
|
76
77
|
def clear_display
|
77
|
-
send_request
|
78
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
|
78
79
|
end
|
79
80
|
|
80
81
|
# Sets the configuration of the display.
|
@@ -84,12 +85,12 @@ module Tinkerforge
|
|
84
85
|
#
|
85
86
|
# The default values are contrast 143 and inverting off.
|
86
87
|
def set_display_configuration(contrast, invert)
|
87
|
-
send_request
|
88
|
+
send_request FUNCTION_SET_DISPLAY_CONFIGURATION, [contrast, invert], 'C ?', 0, ''
|
88
89
|
end
|
89
90
|
|
90
91
|
# Returns the configuration as set by BrickletOLED64x48#set_display_configuration.
|
91
92
|
def get_display_configuration
|
92
|
-
send_request
|
93
|
+
send_request FUNCTION_GET_DISPLAY_CONFIGURATION, [], '', 2, 'C ?'
|
93
94
|
end
|
94
95
|
|
95
96
|
# Writes text to a specific line (0 to 5) with a specific position
|
@@ -104,7 +105,7 @@ module Tinkerforge
|
|
104
105
|
# The display uses a special 5x7 pixel charset. You can view the characters
|
105
106
|
# of the charset in Brick Viewer.
|
106
107
|
def write_line(line, position, text)
|
107
|
-
send_request
|
108
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z13', 0, ''
|
108
109
|
end
|
109
110
|
|
110
111
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -116,7 +117,7 @@ module Tinkerforge
|
|
116
117
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
117
118
|
# |device_identifier_constant|
|
118
119
|
def get_identity
|
119
|
-
send_request
|
120
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
120
121
|
end
|
121
122
|
|
122
123
|
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 #
|
@@ -36,18 +36,17 @@ module Tinkerforge
|
|
36
36
|
|
37
37
|
@response_expected[FUNCTION_BEEP] = RESPONSE_EXPECTED_FALSE
|
38
38
|
@response_expected[FUNCTION_MORSE_CODE] = RESPONSE_EXPECTED_FALSE
|
39
|
-
@response_expected[CALLBACK_BEEP_FINISHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
40
|
-
@response_expected[CALLBACK_MORSE_CODE_FINISHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
41
39
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
42
40
|
|
43
41
|
@callback_formats[CALLBACK_BEEP_FINISHED] = ''
|
44
42
|
@callback_formats[CALLBACK_MORSE_CODE_FINISHED] = ''
|
43
|
+
|
45
44
|
end
|
46
45
|
|
47
46
|
# Beeps with the duration in ms. For example: If you set a value of 1000,
|
48
47
|
# the piezo buzzer will beep for one second.
|
49
48
|
def beep(duration)
|
50
|
-
send_request
|
49
|
+
send_request FUNCTION_BEEP, [duration], 'L', 0, ''
|
51
50
|
end
|
52
51
|
|
53
52
|
# Sets morse code that will be played by the piezo buzzer. The morse code
|
@@ -60,7 +59,7 @@ module Tinkerforge
|
|
60
59
|
#
|
61
60
|
# The maximum string size is 60.
|
62
61
|
def morse_code(morse)
|
63
|
-
send_request
|
62
|
+
send_request FUNCTION_MORSE_CODE, [morse], 'Z60', 0, ''
|
64
63
|
end
|
65
64
|
|
66
65
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -72,7 +71,7 @@ module Tinkerforge
|
|
72
71
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
73
72
|
# |device_identifier_constant|
|
74
73
|
def get_identity
|
75
|
-
send_request
|
74
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
76
75
|
end
|
77
76
|
|
78
77
|
# 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 #
|
@@ -40,12 +40,11 @@ module Tinkerforge
|
|
40
40
|
@response_expected[FUNCTION_BEEP] = RESPONSE_EXPECTED_FALSE
|
41
41
|
@response_expected[FUNCTION_MORSE_CODE] = RESPONSE_EXPECTED_FALSE
|
42
42
|
@response_expected[FUNCTION_CALIBRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
43
|
-
@response_expected[CALLBACK_BEEP_FINISHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
44
|
-
@response_expected[CALLBACK_MORSE_CODE_FINISHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
45
43
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
46
44
|
|
47
45
|
@callback_formats[CALLBACK_BEEP_FINISHED] = ''
|
48
46
|
@callback_formats[CALLBACK_MORSE_CODE_FINISHED] = ''
|
47
|
+
|
49
48
|
end
|
50
49
|
|
51
50
|
# Beeps with the given frequency for the duration in ms. For example:
|
@@ -62,7 +61,7 @@ module Tinkerforge
|
|
62
61
|
# The Piezo Speaker Bricklet can only approximate the frequency, it will play
|
63
62
|
# the best possible match by applying the calibration (see BrickletPiezoSpeaker#calibrate).
|
64
63
|
def beep(duration, frequency)
|
65
|
-
send_request
|
64
|
+
send_request FUNCTION_BEEP, [duration, frequency], 'L S', 0, ''
|
66
65
|
end
|
67
66
|
|
68
67
|
# Sets morse code that will be played by the piezo buzzer. The morse code
|
@@ -76,7 +75,7 @@ module Tinkerforge
|
|
76
75
|
#
|
77
76
|
# The maximum string size is 60.
|
78
77
|
def morse_code(morse, frequency)
|
79
|
-
send_request
|
78
|
+
send_request FUNCTION_MORSE_CODE, [morse, frequency], 'Z60 S', 0, ''
|
80
79
|
end
|
81
80
|
|
82
81
|
# The Piezo Speaker Bricklet can play 512 different tones. This function
|
@@ -89,7 +88,7 @@ module Tinkerforge
|
|
89
88
|
#
|
90
89
|
# Returns *true* after the calibration finishes.
|
91
90
|
def calibrate
|
92
|
-
send_request
|
91
|
+
send_request FUNCTION_CALIBRATE, [], '', 1, '?'
|
93
92
|
end
|
94
93
|
|
95
94
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -101,7 +100,7 @@ module Tinkerforge
|
|
101
100
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
102
101
|
# |device_identifier_constant|
|
103
102
|
def get_identity
|
104
|
-
send_request
|
103
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
105
104
|
end
|
106
105
|
|
107
106
|
# 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 #
|
@@ -96,10 +96,6 @@ module Tinkerforge
|
|
96
96
|
@response_expected[FUNCTION_GET_RESISTANCE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
97
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
98
98
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
99
|
-
@response_expected[CALLBACK_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
100
|
-
@response_expected[CALLBACK_TEMPERATURE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
101
|
-
@response_expected[CALLBACK_RESISTANCE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
102
|
-
@response_expected[CALLBACK_RESISTANCE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
103
99
|
@response_expected[FUNCTION_SET_NOISE_REJECTION_FILTER] = RESPONSE_EXPECTED_FALSE
|
104
100
|
@response_expected[FUNCTION_GET_NOISE_REJECTION_FILTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
105
101
|
@response_expected[FUNCTION_IS_SENSOR_CONNECTED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -109,8 +105,9 @@ module Tinkerforge
|
|
109
105
|
|
110
106
|
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
111
107
|
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = 'l'
|
112
|
-
@callback_formats[CALLBACK_RESISTANCE] = '
|
113
|
-
@callback_formats[CALLBACK_RESISTANCE_REACHED] = '
|
108
|
+
@callback_formats[CALLBACK_RESISTANCE] = 'l'
|
109
|
+
@callback_formats[CALLBACK_RESISTANCE_REACHED] = 'l'
|
110
|
+
|
114
111
|
end
|
115
112
|
|
116
113
|
# Returns the temperature of connected sensor. The value
|
@@ -121,7 +118,7 @@ module Tinkerforge
|
|
121
118
|
# to use the CALLBACK_TEMPERATURE callback and set the period with
|
122
119
|
# BrickletPTC#set_temperature_callback_period.
|
123
120
|
def get_temperature
|
124
|
-
send_request
|
121
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 4, 'l'
|
125
122
|
end
|
126
123
|
|
127
124
|
# Returns the value as measured by the MAX31865 precision delta-sigma ADC.
|
@@ -135,7 +132,7 @@ module Tinkerforge
|
|
135
132
|
# to use the CALLBACK_RESISTANCE callback and set the period with
|
136
133
|
# BrickletPTC#set_resistance_callback_period.
|
137
134
|
def get_resistance
|
138
|
-
send_request
|
135
|
+
send_request FUNCTION_GET_RESISTANCE, [], '', 4, 'l'
|
139
136
|
end
|
140
137
|
|
141
138
|
# Sets the period in ms with which the CALLBACK_TEMPERATURE callback is triggered
|
@@ -146,12 +143,12 @@ module Tinkerforge
|
|
146
143
|
#
|
147
144
|
# The default value is 0.
|
148
145
|
def set_temperature_callback_period(period)
|
149
|
-
send_request
|
146
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
150
147
|
end
|
151
148
|
|
152
149
|
# Returns the period as set by BrickletPTC#set_temperature_callback_period.
|
153
150
|
def get_temperature_callback_period
|
154
|
-
send_request
|
151
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L'
|
155
152
|
end
|
156
153
|
|
157
154
|
# Sets the period in ms with which the CALLBACK_RESISTANCE callback is triggered
|
@@ -162,12 +159,12 @@ module Tinkerforge
|
|
162
159
|
#
|
163
160
|
# The default value is 0.
|
164
161
|
def set_resistance_callback_period(period)
|
165
|
-
send_request
|
162
|
+
send_request FUNCTION_SET_RESISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
166
163
|
end
|
167
164
|
|
168
165
|
# Returns the period as set by BrickletPTC#set_resistance_callback_period.
|
169
166
|
def get_resistance_callback_period
|
170
|
-
send_request
|
167
|
+
send_request FUNCTION_GET_RESISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
|
171
168
|
end
|
172
169
|
|
173
170
|
# Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
|
@@ -184,12 +181,12 @@ module Tinkerforge
|
|
184
181
|
#
|
185
182
|
# The default value is ('x', 0, 0).
|
186
183
|
def set_temperature_callback_threshold(option, min, max)
|
187
|
-
send_request
|
184
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
188
185
|
end
|
189
186
|
|
190
187
|
# Returns the threshold as set by BrickletPTC#set_temperature_callback_threshold.
|
191
188
|
def get_temperature_callback_threshold
|
192
|
-
send_request
|
189
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
193
190
|
end
|
194
191
|
|
195
192
|
# Sets the thresholds for the CALLBACK_RESISTANCE_REACHED callback.
|
@@ -206,12 +203,12 @@ module Tinkerforge
|
|
206
203
|
#
|
207
204
|
# The default value is ('x', 0, 0).
|
208
205
|
def set_resistance_callback_threshold(option, min, max)
|
209
|
-
send_request
|
206
|
+
send_request FUNCTION_SET_RESISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
210
207
|
end
|
211
208
|
|
212
209
|
# Returns the threshold as set by BrickletPTC#set_resistance_callback_threshold.
|
213
210
|
def get_resistance_callback_threshold
|
214
|
-
send_request
|
211
|
+
send_request FUNCTION_GET_RESISTANCE_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
215
212
|
end
|
216
213
|
|
217
214
|
# Sets the period in ms with which the threshold callback
|
@@ -228,12 +225,12 @@ module Tinkerforge
|
|
228
225
|
#
|
229
226
|
# The default value is 100.
|
230
227
|
def set_debounce_period(debounce)
|
231
|
-
send_request
|
228
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
232
229
|
end
|
233
230
|
|
234
231
|
# Returns the debounce period as set by BrickletPTC#set_debounce_period.
|
235
232
|
def get_debounce_period
|
236
|
-
send_request
|
233
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
237
234
|
end
|
238
235
|
|
239
236
|
# Sets the noise rejection filter to either 50Hz (0) or 60Hz (1).
|
@@ -243,13 +240,13 @@ module Tinkerforge
|
|
243
240
|
#
|
244
241
|
# Default value is 0 = 50Hz.
|
245
242
|
def set_noise_rejection_filter(filter)
|
246
|
-
send_request
|
243
|
+
send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 0, ''
|
247
244
|
end
|
248
245
|
|
249
246
|
# Returns the noise rejection filter option as set by
|
250
247
|
# BrickletPTC#set_noise_rejection_filter
|
251
248
|
def get_noise_rejection_filter
|
252
|
-
send_request
|
249
|
+
send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 1, 'C'
|
253
250
|
end
|
254
251
|
|
255
252
|
# Returns *true* if the sensor is connected correctly.
|
@@ -258,7 +255,7 @@ module Tinkerforge
|
|
258
255
|
# returns *false*, there is either no Pt100 or Pt1000 sensor connected,
|
259
256
|
# the sensor is connected incorrectly or the sensor itself is faulty.
|
260
257
|
def is_sensor_connected
|
261
|
-
send_request
|
258
|
+
send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 1, '?'
|
262
259
|
end
|
263
260
|
|
264
261
|
# Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which
|
@@ -267,12 +264,12 @@ module Tinkerforge
|
|
267
264
|
#
|
268
265
|
# The default value is 2 = 2-wire.
|
269
266
|
def set_wire_mode(mode)
|
270
|
-
send_request
|
267
|
+
send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 0, ''
|
271
268
|
end
|
272
269
|
|
273
270
|
# Returns the wire mode as set by BrickletPTC#set_wire_mode
|
274
271
|
def get_wire_mode
|
275
|
-
send_request
|
272
|
+
send_request FUNCTION_GET_WIRE_MODE, [], '', 1, 'C'
|
276
273
|
end
|
277
274
|
|
278
275
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -284,7 +281,7 @@ module Tinkerforge
|
|
284
281
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
285
282
|
# |device_identifier_constant|
|
286
283
|
def get_identity
|
287
|
-
send_request
|
284
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
288
285
|
end
|
289
286
|
|
290
287
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|