Skip to content

Commit 33aec7e

Browse files
chenzhjielbuque
authored andcommitted
lib/gnss: Add Gnss Module Support.
Signed-off-by: chcj <[email protected]>
1 parent c42b6ad commit 33aec7e

File tree

9 files changed

+1185
-3
lines changed

9 files changed

+1185
-3
lines changed

docs/en/module/gnss.rst

Lines changed: 350 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,350 @@
1+
2+
GNSSModule
3+
==========
4+
5+
.. include:: ../refs/module.gnssmodule.ref
6+
7+
GNSS Module is a global positioning wireless communication module featuring the NEO-M9N-00B GPS module. It incorporates BMI270, BMM150 and a barometric pressure sensor.
8+
9+
Support the following products:
10+
11+
|GNSSModule|
12+
13+
Micropython Example:
14+
15+
.. literalinclude:: ../../../examples/module/gnss/gnss_core2_example.py
16+
:language: python
17+
:linenos:
18+
19+
20+
UIFLOW2 Example:
21+
22+
|example.png|
23+
24+
.. only:: builder_html
25+
26+
|gnss_core2_example.m5f2|
27+
28+
class GNSSModule
29+
----------------
30+
31+
Constructors
32+
------------
33+
34+
.. class:: GNSSModule(id, rx, tx, address)
35+
36+
initialize Function.
37+
38+
:param int id: UART controllers id, the range is 0 to 2.
39+
:param int rx: UART rx pin.
40+
:param int tx: UART tx pin.
41+
:param int address:
42+
43+
UIFLOW2:
44+
45+
|init.png|
46+
47+
48+
Methods
49+
-------
50+
51+
.. method:: GNSSModule.set_accel_gyro_odr(accel_odr, gyro_odr)
52+
53+
Set the accelerometer and gyroscope output data rate.
54+
55+
:param accel_odr: range of 0.78 Hz … 1.6 kHz.
56+
Options:
57+
- ``25``: 25
58+
- ``50``: 50
59+
- ``100``: 100
60+
- ``200``: 200
61+
- ``400``: 400
62+
- ``800``: 800
63+
- ``1600``: 1600
64+
- ``0.78``: 0.78
65+
- ``1.5``: 1.5
66+
- ``3.1``: 3.1
67+
- ``6.25``: 6.25
68+
- ``12.5``: 12.5
69+
:param gyro_odr: range of 25 Hz … 6.4 kHz.
70+
Options:
71+
- ``25``: 25
72+
- ``50``: 50
73+
- ``100``: 100
74+
- ``200``: 200
75+
- ``400``: 400
76+
- ``800``: 800
77+
- ``1600``: 1600
78+
- ``3200``: 3200
79+
80+
UIFLOW2:
81+
82+
|set_accel_gyro_odr.png|
83+
84+
.. method:: GNSSModule.set_accel_range(accel_scale)
85+
86+
Set the accelerometer scale range.
87+
88+
:param accel_scale: scale range of ±2g, ±4g, ±8g and ±16g.
89+
Options:
90+
- ``2``: 2
91+
- ``4``: 4
92+
- ``8``: 8
93+
- ``16``: 16
94+
95+
UIFLOW2:
96+
97+
|set_accel_range.png|
98+
99+
.. method:: GNSSModule.set_gyro_range(gyro_scale)
100+
101+
Set the gyroscope scale range.
102+
103+
:param gyro_scale:
104+
Options:
105+
- ``125``: 125
106+
- ``250``: 250
107+
- ``500``: 500
108+
- ``1000``: 1000
109+
- ``2000``: 2000
110+
111+
UIFLOW2:
112+
113+
|set_gyro_range.png|
114+
115+
.. method:: GNSSModule.set_magnet_odr(magnet_odr)
116+
117+
118+
:param magnet_odr:
119+
Options:
120+
- ``2``: 2
121+
- ``6``: 6
122+
- ``8``: 8
123+
- ``10``: 10
124+
- ``15``: 15
125+
- ``20``: 20
126+
- ``25``: 25
127+
- ``30``: 30
128+
129+
UIFLOW2:
130+
131+
|set_magnet_odr.png|
132+
133+
.. method:: GNSSModule.set_gyro_offsets(x, y, z)
134+
135+
Set the manual gyro calibrations offsets value.
136+
137+
:param x: gyro calibrations offsets value of X-axis
138+
:param y: gyro calibrations offsets value of Y-axis
139+
:param z: gyro calibrations offsets value of Z-axis
140+
141+
UIFLOW2:
142+
143+
|set_gyro_offsets.png|
144+
145+
.. method:: GNSSModule.get_gyroscope()
146+
147+
Get the tuple of x, y, and z values of the gyroscope and gyroscope vector in rad/sec.
148+
149+
:return (tuple): gyroscope tuple (float, float, float)
150+
151+
UIFLOW2:
152+
153+
|get_gyroscope.png|
154+
155+
.. method:: GNSSModule.get_accelerometer()
156+
157+
Get the tuple of x, y, and z values of the accelerometer and acceleration vector in gravity units (9.81m/s^2).
158+
159+
:return (tuple): accelerometer tuple (float, float, float)
160+
161+
UIFLOW2:
162+
163+
|get_accelerometer.png|
164+
165+
.. method:: GNSSModule.get_magnetometer()
166+
167+
Get the tuple of x, y, and z values of the magnetometer and magnetometer vector in uT.
168+
169+
:return (tuple): magnetometer tuple (float, float, float)
170+
171+
UIFLOW2:
172+
173+
|get_magnetometer.png|
174+
175+
.. method:: GNSSModule.get_compass()
176+
177+
Get the compass heading value is in range of 0º ~ 360º.
178+
179+
:return (float): range is 0 to 360 degree
180+
181+
UIFLOW2:
182+
183+
|get_compass.png|
184+
185+
.. method:: GNSSModule.get_attitude()
186+
187+
Get the attitude angles as yaw, pitch, and roll in degrees.
188+
189+
:return (tuple): tuple of yaw, pitch, and roll (float, float, float)
190+
191+
UIFLOW2:
192+
193+
|get_attitude.png|
194+
195+
.. method:: GNSSModule.get_temperature()
196+
197+
Get the temperature value in degrees celsius from the BMP280 sensor.
198+
199+
:return (float): range is -40 ~ +85 °C.
200+
201+
UIFLOW2:
202+
203+
|get_temperature.png|
204+
205+
.. method:: GNSSModule.get_pressure()
206+
207+
Get the pressure value in pascals from the BMP280 sensor.
208+
209+
:return (float): range is 300 ~ 1100 hPa.
210+
211+
UIFLOW2:
212+
213+
|get_pressure.png|
214+
215+
.. method:: GNSSModule.set_time_zone(value)
216+
217+
set timezone function.
218+
219+
:param int value: timezone value
220+
221+
UIFLOW2:
222+
223+
|set_time_zone.png|
224+
225+
.. method:: GNSSModule.get_time_zone()
226+
227+
get timezone function.
228+
229+
:return (int): timezone value
230+
231+
UIFLOW2:
232+
233+
|get_time_zone.png|
234+
235+
.. method:: GNSSModule.get_satellite_num()
236+
237+
get satellite numbers.
238+
239+
:return (str): satellite numbers value.
240+
241+
UIFLOW2:
242+
243+
|get_satellite_num.png|
244+
245+
.. method:: GNSSModule.get_altitude()
246+
247+
get altitude.
248+
249+
:return (str): altitude unit is meter.
250+
251+
UIFLOW2:
252+
253+
|get_altitude.png|
254+
255+
.. method:: GNSSModule.get_time()
256+
257+
get time.
258+
259+
:return (str): time(hh:mm:ss)
260+
261+
UIFLOW2:
262+
263+
|get_time.png|
264+
265+
.. method:: GNSSModule.get_date()
266+
267+
get date.
268+
269+
:return (str): date(dd/mm/yy)
270+
271+
UIFLOW2:
272+
273+
|get_date.png|
274+
275+
.. method:: GNSSModule.get_latitude()
276+
277+
get latitude.
278+
279+
:return (str): latitude, using degrees minutes format (ddmm.mmmmmN/S).
280+
281+
UIFLOW2:
282+
283+
|get_latitude.png|
284+
285+
.. method:: GNSSModule.get_longitude()
286+
287+
get longitude.
288+
289+
:return (str): longitude, using degrees minutes format (ddmm.mmmmmE/W).
290+
291+
UIFLOW2:
292+
293+
|get_longitude.png|
294+
295+
.. method:: GNSSModule.get_latitude_decimal()
296+
297+
get latitude decimal.
298+
299+
:return (float): latitude decimal(dd.dddd).
300+
301+
UIFLOW2:
302+
303+
|get_latitude_decimal.png|
304+
305+
.. method:: GNSSModule.get_longitude_decimal()
306+
307+
get longitude decimal.
308+
309+
:return (float): longitude decimal(dd.dddd).
310+
311+
UIFLOW2:
312+
313+
|get_longitude_decimal.png|
314+
315+
.. method:: GNSSModule.get_speed(type)
316+
317+
get speed.
318+
319+
:return (str): speed.
320+
:param int type: speed type, 0 km/h, 1 knot/h
321+
Options:
322+
- ``km/h``: 0
323+
- ``knot/h``: 1
324+
325+
UIFLOW2:
326+
327+
|get_speed.png|
328+
329+
.. method:: GNSSModule.get_course()
330+
331+
get course.
332+
333+
:return (str): course unit is °.
334+
335+
UIFLOW2:
336+
337+
|get_course.png|
338+
339+
.. method:: GNSSModule.is_locate_valid()
340+
341+
get locate status.
342+
343+
:return (bool): locate status, true is locate, false is not locate.
344+
345+
UIFLOW2:
346+
347+
|is_locate_valid.png|
348+
349+
350+

docs/en/module/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Module
88
ain4.rst
99
display.rst
1010
dualkmeter.rst
11+
gnss.rst
1112
grbl.rst
1213
hmi.rst
1314
llm.rst

0 commit comments

Comments
 (0)