tinkerforge 2.1.13 → 2.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-07-27. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -39,11 +39,11 @@ module Tinkerforge
|
|
|
39
39
|
@response_expected[FUNCTION_GET_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
40
40
|
@response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
|
|
41
41
|
@response_expected[FUNCTION_GET_MONOFLOP] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
42
|
-
@response_expected[CALLBACK_MONOFLOP_DONE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
43
42
|
@response_expected[FUNCTION_SET_SELECTED_STATE] = RESPONSE_EXPECTED_FALSE
|
|
44
43
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
45
44
|
|
|
46
45
|
@callback_formats[CALLBACK_MONOFLOP_DONE] = 'C ?'
|
|
46
|
+
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
# Sets the state of the relays, *true* means on and *false* means off.
|
|
@@ -57,12 +57,12 @@ module Tinkerforge
|
|
|
57
57
|
#
|
|
58
58
|
# The default value is (*false*, *false*).
|
|
59
59
|
def set_state(relay1, relay2)
|
|
60
|
-
send_request
|
|
60
|
+
send_request FUNCTION_SET_STATE, [relay1, relay2], '? ?', 0, ''
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Returns the state of the relays, *true* means on and *false* means off.
|
|
64
64
|
def get_state
|
|
65
|
-
send_request
|
|
65
|
+
send_request FUNCTION_GET_STATE, [], '', 2, '? ?'
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# The first parameter can be 1 or 2 (relay 1 or relay 2). The second parameter
|
|
@@ -79,7 +79,7 @@ module Tinkerforge
|
|
|
79
79
|
# of two seconds. The relay will be on all the time. If now the RS485
|
|
80
80
|
# connection is lost, the relay will turn off in at most two seconds.
|
|
81
81
|
def set_monoflop(relay, state, time)
|
|
82
|
-
send_request
|
|
82
|
+
send_request FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 0, ''
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
# Returns (for the given relay) the current state and the time as set by
|
|
@@ -88,14 +88,14 @@ module Tinkerforge
|
|
|
88
88
|
# If the timer is not running currently, the remaining time will be returned
|
|
89
89
|
# as 0.
|
|
90
90
|
def get_monoflop(relay)
|
|
91
|
-
send_request
|
|
91
|
+
send_request FUNCTION_GET_MONOFLOP, [relay], 'C', 9, '? L L'
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# Sets the state of the selected relay (1 or 2), *true* means on and *false* means off.
|
|
95
95
|
#
|
|
96
96
|
# The other relay remains untouched.
|
|
97
97
|
def set_selected_state(relay, state)
|
|
98
|
-
send_request
|
|
98
|
+
send_request FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 0, ''
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -107,7 +107,7 @@ module Tinkerforge
|
|
|
107
107
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
108
108
|
# |device_identifier_constant|
|
|
109
109
|
def get_identity
|
|
110
|
-
send_request
|
|
110
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
# 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 #
|
|
@@ -62,14 +62,13 @@ module Tinkerforge
|
|
|
62
62
|
@response_expected[FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
63
63
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
64
64
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
65
|
-
@response_expected[CALLBACK_DUST_DENSITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
66
|
-
@response_expected[CALLBACK_DUST_DENSITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
67
65
|
@response_expected[FUNCTION_SET_MOVING_AVERAGE] = RESPONSE_EXPECTED_FALSE
|
|
68
66
|
@response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
69
67
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
70
68
|
|
|
71
69
|
@callback_formats[CALLBACK_DUST_DENSITY] = 'S'
|
|
72
70
|
@callback_formats[CALLBACK_DUST_DENSITY_REACHED] = 'S'
|
|
71
|
+
|
|
73
72
|
end
|
|
74
73
|
|
|
75
74
|
# Returns the dust density in µg/m³.
|
|
@@ -78,7 +77,7 @@ module Tinkerforge
|
|
|
78
77
|
# to use the CALLBACK_DUST_DENSITY callback and set the period with
|
|
79
78
|
# BrickletDustDetector#set_dust_density_callback_period.
|
|
80
79
|
def get_dust_density
|
|
81
|
-
send_request
|
|
80
|
+
send_request FUNCTION_GET_DUST_DENSITY, [], '', 2, 'S'
|
|
82
81
|
end
|
|
83
82
|
|
|
84
83
|
# Sets the period in ms with which the CALLBACK_DUST_DENSITY callback is triggered
|
|
@@ -89,12 +88,12 @@ module Tinkerforge
|
|
|
89
88
|
#
|
|
90
89
|
# The default value is 0.
|
|
91
90
|
def set_dust_density_callback_period(period)
|
|
92
|
-
send_request
|
|
91
|
+
send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
93
92
|
end
|
|
94
93
|
|
|
95
94
|
# Returns the period as set by BrickletDustDetector#set_dust_density_callback_period.
|
|
96
95
|
def get_dust_density_callback_period
|
|
97
|
-
send_request
|
|
96
|
+
send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
98
97
|
end
|
|
99
98
|
|
|
100
99
|
# Sets the thresholds for the CALLBACK_DUST_DENSITY_REACHED callback.
|
|
@@ -111,12 +110,12 @@ module Tinkerforge
|
|
|
111
110
|
#
|
|
112
111
|
# The default value is ('x', 0, 0).
|
|
113
112
|
def set_dust_density_callback_threshold(option, min, max)
|
|
114
|
-
send_request
|
|
113
|
+
send_request FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
|
115
114
|
end
|
|
116
115
|
|
|
117
116
|
# Returns the threshold as set by BrickletDustDetector#set_dust_density_callback_threshold.
|
|
118
117
|
def get_dust_density_callback_threshold
|
|
119
|
-
send_request
|
|
118
|
+
send_request FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
|
120
119
|
end
|
|
121
120
|
|
|
122
121
|
# Sets the period in ms with which the threshold callback
|
|
@@ -131,12 +130,12 @@ module Tinkerforge
|
|
|
131
130
|
#
|
|
132
131
|
# The default value is 100.
|
|
133
132
|
def set_debounce_period(debounce)
|
|
134
|
-
send_request
|
|
133
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
|
135
134
|
end
|
|
136
135
|
|
|
137
136
|
# Returns the debounce period as set by BrickletDustDetector#set_debounce_period.
|
|
138
137
|
def get_debounce_period
|
|
139
|
-
send_request
|
|
138
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
|
140
139
|
end
|
|
141
140
|
|
|
142
141
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
|
@@ -149,12 +148,12 @@ module Tinkerforge
|
|
|
149
148
|
#
|
|
150
149
|
# The default value is 100.
|
|
151
150
|
def set_moving_average(average)
|
|
152
|
-
send_request
|
|
151
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
|
|
153
152
|
end
|
|
154
153
|
|
|
155
154
|
# Returns the length moving average as set by BrickletDustDetector#set_moving_average.
|
|
156
155
|
def get_moving_average
|
|
157
|
-
send_request
|
|
156
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
|
|
158
157
|
end
|
|
159
158
|
|
|
160
159
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -166,7 +165,7 @@ module Tinkerforge
|
|
|
166
165
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
167
166
|
# |device_identifier_constant|
|
|
168
167
|
def get_identity
|
|
169
|
-
send_request
|
|
168
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
170
169
|
end
|
|
171
170
|
|
|
172
171
|
# 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 #
|
|
@@ -107,11 +107,6 @@ module Tinkerforge
|
|
|
107
107
|
@response_expected[FUNCTION_GET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
108
108
|
@response_expected[FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
109
109
|
@response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
110
|
-
@response_expected[CALLBACK_COORDINATES] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
111
|
-
@response_expected[CALLBACK_STATUS] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
112
|
-
@response_expected[CALLBACK_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
113
|
-
@response_expected[CALLBACK_MOTION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
114
|
-
@response_expected[CALLBACK_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
115
110
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
111
|
|
|
117
112
|
@callback_formats[CALLBACK_COORDINATES] = 'L k L k S S S S'
|
|
@@ -119,6 +114,7 @@ module Tinkerforge
|
|
|
119
114
|
@callback_formats[CALLBACK_ALTITUDE] = 'l l'
|
|
120
115
|
@callback_formats[CALLBACK_MOTION] = 'L L'
|
|
121
116
|
@callback_formats[CALLBACK_DATE_TIME] = 'L L'
|
|
117
|
+
|
|
122
118
|
end
|
|
123
119
|
|
|
124
120
|
# Returns the GPS coordinates. Latitude and longitude are given in the
|
|
@@ -135,12 +131,12 @@ module Tinkerforge
|
|
|
135
131
|
#
|
|
136
132
|
# EPE is the "Estimated Position Error". The EPE is given in cm. This is not the
|
|
137
133
|
# absolute maximum error, it is the error with a specific confidence. See
|
|
138
|
-
# `here <
|
|
134
|
+
# `here <https://www.nps.gov/gis/gps/WhatisEPE.html>`__ for more information.
|
|
139
135
|
#
|
|
140
136
|
# This data is only valid if there is currently a fix as indicated by
|
|
141
137
|
# BrickletGPS#get_status.
|
|
142
138
|
def get_coordinates
|
|
143
|
-
send_request
|
|
139
|
+
send_request FUNCTION_GET_COORDINATES, [], '', 18, 'L k L k S S S S'
|
|
144
140
|
end
|
|
145
141
|
|
|
146
142
|
# Returns the current fix status, the number of satellites that are in view and
|
|
@@ -157,7 +153,7 @@ module Tinkerforge
|
|
|
157
153
|
# There is also a :ref:`blue LED <gps_bricklet_fix_led>` on the Bricklet that
|
|
158
154
|
# indicates the fix status.
|
|
159
155
|
def get_status
|
|
160
|
-
send_request
|
|
156
|
+
send_request FUNCTION_GET_STATUS, [], '', 3, 'C C C'
|
|
161
157
|
end
|
|
162
158
|
|
|
163
159
|
# Returns the current altitude and corresponding geoidal separation.
|
|
@@ -167,7 +163,7 @@ module Tinkerforge
|
|
|
167
163
|
# This data is only valid if there is currently a fix as indicated by
|
|
168
164
|
# BrickletGPS#get_status.
|
|
169
165
|
def get_altitude
|
|
170
|
-
send_request
|
|
166
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 8, 'l l'
|
|
171
167
|
end
|
|
172
168
|
|
|
173
169
|
# Returns the current course and speed. Course is given in hundredths degree
|
|
@@ -180,7 +176,7 @@ module Tinkerforge
|
|
|
180
176
|
# This data is only valid if there is currently a fix as indicated by
|
|
181
177
|
# BrickletGPS#get_status.
|
|
182
178
|
def get_motion
|
|
183
|
-
send_request
|
|
179
|
+
send_request FUNCTION_GET_MOTION, [], '', 8, 'L L'
|
|
184
180
|
end
|
|
185
181
|
|
|
186
182
|
# Returns the current date and time. The date is
|
|
@@ -188,7 +184,7 @@ module Tinkerforge
|
|
|
188
184
|
# in the format ``hhmmss.sss``. For example, 140713 means
|
|
189
185
|
# 14.05.13 as date and 195923568 means 19:59:23.568 as time.
|
|
190
186
|
def get_date_time
|
|
191
|
-
send_request
|
|
187
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 8, 'L L'
|
|
192
188
|
end
|
|
193
189
|
|
|
194
190
|
# Restarts the GPS Bricklet, the following restart types are available:
|
|
@@ -200,7 +196,7 @@ module Tinkerforge
|
|
|
200
196
|
# "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
|
|
201
197
|
# "3", "Factory reset (clear all system/user configurations at restart)"
|
|
202
198
|
def restart(restart_type)
|
|
203
|
-
send_request
|
|
199
|
+
send_request FUNCTION_RESTART, [restart_type], 'C', 0, ''
|
|
204
200
|
end
|
|
205
201
|
|
|
206
202
|
# Sets the period in ms with which the CALLBACK_COORDINATES callback is triggered
|
|
@@ -211,12 +207,12 @@ module Tinkerforge
|
|
|
211
207
|
#
|
|
212
208
|
# The default value is 0.
|
|
213
209
|
def set_coordinates_callback_period(period)
|
|
214
|
-
send_request
|
|
210
|
+
send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
215
211
|
end
|
|
216
212
|
|
|
217
213
|
# Returns the period as set by BrickletGPS#set_coordinates_callback_period.
|
|
218
214
|
def get_coordinates_callback_period
|
|
219
|
-
send_request
|
|
215
|
+
send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
220
216
|
end
|
|
221
217
|
|
|
222
218
|
# Sets the period in ms with which the CALLBACK_STATUS callback is triggered
|
|
@@ -227,12 +223,12 @@ module Tinkerforge
|
|
|
227
223
|
#
|
|
228
224
|
# The default value is 0.
|
|
229
225
|
def set_status_callback_period(period)
|
|
230
|
-
send_request
|
|
226
|
+
send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
231
227
|
end
|
|
232
228
|
|
|
233
229
|
# Returns the period as set by BrickletGPS#set_status_callback_period.
|
|
234
230
|
def get_status_callback_period
|
|
235
|
-
send_request
|
|
231
|
+
send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
236
232
|
end
|
|
237
233
|
|
|
238
234
|
# Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
|
|
@@ -243,12 +239,12 @@ module Tinkerforge
|
|
|
243
239
|
#
|
|
244
240
|
# The default value is 0.
|
|
245
241
|
def set_altitude_callback_period(period)
|
|
246
|
-
send_request
|
|
242
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
247
243
|
end
|
|
248
244
|
|
|
249
245
|
# Returns the period as set by BrickletGPS#set_altitude_callback_period.
|
|
250
246
|
def get_altitude_callback_period
|
|
251
|
-
send_request
|
|
247
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
252
248
|
end
|
|
253
249
|
|
|
254
250
|
# Sets the period in ms with which the CALLBACK_MOTION callback is triggered
|
|
@@ -259,12 +255,12 @@ module Tinkerforge
|
|
|
259
255
|
#
|
|
260
256
|
# The default value is 0.
|
|
261
257
|
def set_motion_callback_period(period)
|
|
262
|
-
send_request
|
|
258
|
+
send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
263
259
|
end
|
|
264
260
|
|
|
265
261
|
# Returns the period as set by BrickletGPS#set_motion_callback_period.
|
|
266
262
|
def get_motion_callback_period
|
|
267
|
-
send_request
|
|
263
|
+
send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
268
264
|
end
|
|
269
265
|
|
|
270
266
|
# Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
|
|
@@ -275,12 +271,12 @@ module Tinkerforge
|
|
|
275
271
|
#
|
|
276
272
|
# The default value is 0.
|
|
277
273
|
def set_date_time_callback_period(period)
|
|
278
|
-
send_request
|
|
274
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
279
275
|
end
|
|
280
276
|
|
|
281
277
|
# Returns the period as set by BrickletGPS#set_date_time_callback_period.
|
|
282
278
|
def get_date_time_callback_period
|
|
283
|
-
send_request
|
|
279
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
284
280
|
end
|
|
285
281
|
|
|
286
282
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -292,7 +288,7 @@ module Tinkerforge
|
|
|
292
288
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
293
289
|
# |device_identifier_constant|
|
|
294
290
|
def get_identity
|
|
295
|
-
send_request
|
|
291
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
296
292
|
end
|
|
297
293
|
|
|
298
294
|
# 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 #
|
|
@@ -158,12 +158,6 @@ module Tinkerforge
|
|
|
158
158
|
@response_expected[FUNCTION_GET_MOTION_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
159
159
|
@response_expected[FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
160
160
|
@response_expected[FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
161
|
-
@response_expected[CALLBACK_PULSE_PER_SECOND] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
162
|
-
@response_expected[CALLBACK_COORDINATES] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
163
|
-
@response_expected[CALLBACK_STATUS] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
164
|
-
@response_expected[CALLBACK_ALTITUDE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
165
|
-
@response_expected[CALLBACK_MOTION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
166
|
-
@response_expected[CALLBACK_DATE_TIME] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
167
161
|
@response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
168
162
|
@response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
169
163
|
@response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -183,6 +177,7 @@ module Tinkerforge
|
|
|
183
177
|
@callback_formats[CALLBACK_ALTITUDE] = 'l l'
|
|
184
178
|
@callback_formats[CALLBACK_MOTION] = 'L L'
|
|
185
179
|
@callback_formats[CALLBACK_DATE_TIME] = 'L L'
|
|
180
|
+
|
|
186
181
|
end
|
|
187
182
|
|
|
188
183
|
# Returns the GPS coordinates. Latitude and longitude are given in the
|
|
@@ -194,7 +189,7 @@ module Tinkerforge
|
|
|
194
189
|
# This data is only valid if there is currently a fix as indicated by
|
|
195
190
|
# BrickletGPSV2#get_status.
|
|
196
191
|
def get_coordinates
|
|
197
|
-
send_request
|
|
192
|
+
send_request FUNCTION_GET_COORDINATES, [], '', 10, 'L k L k'
|
|
198
193
|
end
|
|
199
194
|
|
|
200
195
|
# Returns if a fix is currently available as well as the, the number of
|
|
@@ -203,7 +198,7 @@ module Tinkerforge
|
|
|
203
198
|
# There is also a :ref:`green LED <gps_v2_bricklet_fix_led>` on the Bricklet that
|
|
204
199
|
# indicates the fix status.
|
|
205
200
|
def get_status
|
|
206
|
-
send_request
|
|
201
|
+
send_request FUNCTION_GET_STATUS, [], '', 2, '? C'
|
|
207
202
|
end
|
|
208
203
|
|
|
209
204
|
# Returns the current altitude and corresponding geoidal separation.
|
|
@@ -213,7 +208,7 @@ module Tinkerforge
|
|
|
213
208
|
# This data is only valid if there is currently a fix as indicated by
|
|
214
209
|
# BrickletGPSV2#get_status.
|
|
215
210
|
def get_altitude
|
|
216
|
-
send_request
|
|
211
|
+
send_request FUNCTION_GET_ALTITUDE, [], '', 8, 'l l'
|
|
217
212
|
end
|
|
218
213
|
|
|
219
214
|
# Returns the current course and speed. Course is given in hundredths degree
|
|
@@ -226,7 +221,7 @@ module Tinkerforge
|
|
|
226
221
|
# This data is only valid if there is currently a fix as indicated by
|
|
227
222
|
# BrickletGPSV2#get_status.
|
|
228
223
|
def get_motion
|
|
229
|
-
send_request
|
|
224
|
+
send_request FUNCTION_GET_MOTION, [], '', 8, 'L L'
|
|
230
225
|
end
|
|
231
226
|
|
|
232
227
|
# Returns the current date and time. The date is
|
|
@@ -234,7 +229,7 @@ module Tinkerforge
|
|
|
234
229
|
# in the format ``hhmmss.sss``. For example, 140713 means
|
|
235
230
|
# 14.05.13 as date and 195923568 means 19:59:23.568 as time.
|
|
236
231
|
def get_date_time
|
|
237
|
-
send_request
|
|
232
|
+
send_request FUNCTION_GET_DATE_TIME, [], '', 8, 'L L'
|
|
238
233
|
end
|
|
239
234
|
|
|
240
235
|
# Restarts the GPS Bricklet, the following restart types are available:
|
|
@@ -246,12 +241,12 @@ module Tinkerforge
|
|
|
246
241
|
# "2", "Cold start (don't use time, position, almanacs and ephemeris at restart)"
|
|
247
242
|
# "3", "Factory reset (clear all system/user configurations at restart)"
|
|
248
243
|
def restart(restart_type)
|
|
249
|
-
send_request
|
|
244
|
+
send_request FUNCTION_RESTART, [restart_type], 'C', 0, ''
|
|
250
245
|
end
|
|
251
246
|
|
|
252
247
|
# Returns the
|
|
253
248
|
#
|
|
254
|
-
# * satellite numbers list
|
|
249
|
+
# * satellite numbers list (up to 12 items)
|
|
255
250
|
# * fix value,
|
|
256
251
|
# * PDOP value,
|
|
257
252
|
# * HDOP value and
|
|
@@ -264,7 +259,7 @@ module Tinkerforge
|
|
|
264
259
|
# the numbers of the satellites that are currently utilized. The number 0 is not
|
|
265
260
|
# a valid satellite number and can be ignored in the list.
|
|
266
261
|
def get_satellite_system_status_low_level(satellite_system)
|
|
267
|
-
send_request
|
|
262
|
+
send_request FUNCTION_GET_SATELLITE_SYSTEM_STATUS_LOW_LEVEL, [satellite_system], 'C', 20, 'C C12 C S S S'
|
|
268
263
|
end
|
|
269
264
|
|
|
270
265
|
# Returns the current
|
|
@@ -280,7 +275,7 @@ module Tinkerforge
|
|
|
280
275
|
#
|
|
281
276
|
# Galileo is not yet supported.
|
|
282
277
|
def get_satellite_status(satellite_system, satellite_number)
|
|
283
|
-
send_request
|
|
278
|
+
send_request FUNCTION_GET_SATELLITE_STATUS, [satellite_system, satellite_number], 'C C', 6, 's s s'
|
|
284
279
|
end
|
|
285
280
|
|
|
286
281
|
# Sets the fix LED configuration. By default the LED shows if
|
|
@@ -292,12 +287,12 @@ module Tinkerforge
|
|
|
292
287
|
#
|
|
293
288
|
# If the Bricklet is in bootloader mode, the LED is off.
|
|
294
289
|
def set_fix_led_config(config)
|
|
295
|
-
send_request
|
|
290
|
+
send_request FUNCTION_SET_FIX_LED_CONFIG, [config], 'C', 0, ''
|
|
296
291
|
end
|
|
297
292
|
|
|
298
293
|
# Returns the configuration as set by BrickletGPSV2#set_fix_led_config
|
|
299
294
|
def get_fix_led_config
|
|
300
|
-
send_request
|
|
295
|
+
send_request FUNCTION_GET_FIX_LED_CONFIG, [], '', 1, 'C'
|
|
301
296
|
end
|
|
302
297
|
|
|
303
298
|
# Sets the period in ms with which the CALLBACK_COORDINATES callback is triggered
|
|
@@ -308,12 +303,12 @@ module Tinkerforge
|
|
|
308
303
|
#
|
|
309
304
|
# The default value is 0.
|
|
310
305
|
def set_coordinates_callback_period(period)
|
|
311
|
-
send_request
|
|
306
|
+
send_request FUNCTION_SET_COORDINATES_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
312
307
|
end
|
|
313
308
|
|
|
314
309
|
# Returns the period as set by BrickletGPSV2#set_coordinates_callback_period.
|
|
315
310
|
def get_coordinates_callback_period
|
|
316
|
-
send_request
|
|
311
|
+
send_request FUNCTION_GET_COORDINATES_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
317
312
|
end
|
|
318
313
|
|
|
319
314
|
# Sets the period in ms with which the CALLBACK_STATUS callback is triggered
|
|
@@ -324,12 +319,12 @@ module Tinkerforge
|
|
|
324
319
|
#
|
|
325
320
|
# The default value is 0.
|
|
326
321
|
def set_status_callback_period(period)
|
|
327
|
-
send_request
|
|
322
|
+
send_request FUNCTION_SET_STATUS_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
328
323
|
end
|
|
329
324
|
|
|
330
325
|
# Returns the period as set by BrickletGPSV2#set_status_callback_period.
|
|
331
326
|
def get_status_callback_period
|
|
332
|
-
send_request
|
|
327
|
+
send_request FUNCTION_GET_STATUS_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
333
328
|
end
|
|
334
329
|
|
|
335
330
|
# Sets the period in ms with which the CALLBACK_ALTITUDE callback is triggered
|
|
@@ -340,12 +335,12 @@ module Tinkerforge
|
|
|
340
335
|
#
|
|
341
336
|
# The default value is 0.
|
|
342
337
|
def set_altitude_callback_period(period)
|
|
343
|
-
send_request
|
|
338
|
+
send_request FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
344
339
|
end
|
|
345
340
|
|
|
346
341
|
# Returns the period as set by BrickletGPSV2#set_altitude_callback_period.
|
|
347
342
|
def get_altitude_callback_period
|
|
348
|
-
send_request
|
|
343
|
+
send_request FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
349
344
|
end
|
|
350
345
|
|
|
351
346
|
# Sets the period in ms with which the CALLBACK_MOTION callback is triggered
|
|
@@ -356,12 +351,12 @@ module Tinkerforge
|
|
|
356
351
|
#
|
|
357
352
|
# The default value is 0.
|
|
358
353
|
def set_motion_callback_period(period)
|
|
359
|
-
send_request
|
|
354
|
+
send_request FUNCTION_SET_MOTION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
360
355
|
end
|
|
361
356
|
|
|
362
357
|
# Returns the period as set by BrickletGPSV2#set_motion_callback_period.
|
|
363
358
|
def get_motion_callback_period
|
|
364
|
-
send_request
|
|
359
|
+
send_request FUNCTION_GET_MOTION_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
365
360
|
end
|
|
366
361
|
|
|
367
362
|
# Sets the period in ms with which the CALLBACK_DATE_TIME callback is triggered
|
|
@@ -372,12 +367,12 @@ module Tinkerforge
|
|
|
372
367
|
#
|
|
373
368
|
# The default value is 0.
|
|
374
369
|
def set_date_time_callback_period(period)
|
|
375
|
-
send_request
|
|
370
|
+
send_request FUNCTION_SET_DATE_TIME_CALLBACK_PERIOD, [period], 'L', 0, ''
|
|
376
371
|
end
|
|
377
372
|
|
|
378
373
|
# Returns the period as set by BrickletGPSV2#set_date_time_callback_period.
|
|
379
374
|
def get_date_time_callback_period
|
|
380
|
-
send_request
|
|
375
|
+
send_request FUNCTION_GET_DATE_TIME_CALLBACK_PERIOD, [], '', 4, 'L'
|
|
381
376
|
end
|
|
382
377
|
|
|
383
378
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -392,7 +387,7 @@ module Tinkerforge
|
|
|
392
387
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
393
388
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
394
389
|
def get_spitfp_error_count
|
|
395
|
-
send_request
|
|
390
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
|
|
396
391
|
end
|
|
397
392
|
|
|
398
393
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -405,12 +400,12 @@ module Tinkerforge
|
|
|
405
400
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
406
401
|
# necessary to call it in a normal user program.
|
|
407
402
|
def set_bootloader_mode(mode)
|
|
408
|
-
send_request
|
|
403
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
|
|
409
404
|
end
|
|
410
405
|
|
|
411
406
|
# Returns the current bootloader mode, see BrickletGPSV2#set_bootloader_mode.
|
|
412
407
|
def get_bootloader_mode
|
|
413
|
-
send_request
|
|
408
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
|
|
414
409
|
end
|
|
415
410
|
|
|
416
411
|
# Sets the firmware pointer for func:`WriteFirmware`. The pointer has
|
|
@@ -420,7 +415,7 @@ module Tinkerforge
|
|
|
420
415
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
421
416
|
# necessary to call it in a normal user program.
|
|
422
417
|
def set_write_firmware_pointer(pointer)
|
|
423
|
-
send_request
|
|
418
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
|
|
424
419
|
end
|
|
425
420
|
|
|
426
421
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -432,7 +427,7 @@ module Tinkerforge
|
|
|
432
427
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
433
428
|
# necessary to call it in a normal user program.
|
|
434
429
|
def write_firmware(data)
|
|
435
|
-
send_request
|
|
430
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
|
|
436
431
|
end
|
|
437
432
|
|
|
438
433
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -443,12 +438,12 @@ module Tinkerforge
|
|
|
443
438
|
#
|
|
444
439
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
445
440
|
def set_status_led_config(config)
|
|
446
|
-
send_request
|
|
441
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
|
|
447
442
|
end
|
|
448
443
|
|
|
449
444
|
# Returns the configuration as set by BrickletGPSV2#set_status_led_config
|
|
450
445
|
def get_status_led_config
|
|
451
|
-
send_request
|
|
446
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
|
|
452
447
|
end
|
|
453
448
|
|
|
454
449
|
# Returns the temperature in °C as measured inside the microcontroller. The
|
|
@@ -458,7 +453,7 @@ module Tinkerforge
|
|
|
458
453
|
# accuracy. Practically it is only useful as an indicator for
|
|
459
454
|
# temperature changes.
|
|
460
455
|
def get_chip_temperature
|
|
461
|
-
send_request
|
|
456
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
|
|
462
457
|
end
|
|
463
458
|
|
|
464
459
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -468,7 +463,7 @@ module Tinkerforge
|
|
|
468
463
|
# calling functions on the existing ones will result in
|
|
469
464
|
# undefined behavior!
|
|
470
465
|
def reset
|
|
471
|
-
send_request
|
|
466
|
+
send_request FUNCTION_RESET, [], '', 0, ''
|
|
472
467
|
end
|
|
473
468
|
|
|
474
469
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -477,13 +472,13 @@ module Tinkerforge
|
|
|
477
472
|
#
|
|
478
473
|
# We recommend that you use Brick Viewer to change the UID.
|
|
479
474
|
def write_uid(uid)
|
|
480
|
-
send_request
|
|
475
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
|
|
481
476
|
end
|
|
482
477
|
|
|
483
478
|
# Returns the current UID as an integer. Encode as
|
|
484
479
|
# Base58 to get the usual string version.
|
|
485
480
|
def read_uid
|
|
486
|
-
send_request
|
|
481
|
+
send_request FUNCTION_READ_UID, [], '', 4, 'L'
|
|
487
482
|
end
|
|
488
483
|
|
|
489
484
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
@@ -495,7 +490,27 @@ module Tinkerforge
|
|
|
495
490
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
496
491
|
# |device_identifier_constant|
|
|
497
492
|
def get_identity
|
|
498
|
-
send_request
|
|
493
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
# Returns the
|
|
497
|
+
#
|
|
498
|
+
# * satellite numbers list (up to 12 items)
|
|
499
|
+
# * fix value,
|
|
500
|
+
# * PDOP value,
|
|
501
|
+
# * HDOP value and
|
|
502
|
+
# * VDOP value
|
|
503
|
+
#
|
|
504
|
+
# for a given satellite system. Currently GPS and GLONASS are supported, Galileo
|
|
505
|
+
# is not yet supported.
|
|
506
|
+
#
|
|
507
|
+
# The GPS and GLONASS satellites have unique numbers and the satellite list gives
|
|
508
|
+
# the numbers of the satellites that are currently utilized. The number 0 is not
|
|
509
|
+
# a valid satellite number and can be ignored in the list.
|
|
510
|
+
def get_satellite_system_status(satellite_system)
|
|
511
|
+
ret = get_satellite_system_status_low_level satellite_system
|
|
512
|
+
|
|
513
|
+
[ret[1][0, ret[0]], ret[2], ret[3], ret[4], ret[5]]
|
|
499
514
|
end
|
|
500
515
|
|
|
501
516
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|