Skip to content

Commit dcb5cdc

Browse files
Tinyu-Zhaolbuque
authored andcommitted
lib/units: Add GPS_V1.1 Unit Support.
Signed-off-by: Tinyu <[email protected]>
1 parent 70b67b1 commit dcb5cdc

File tree

3 files changed

+676
-0
lines changed

3 files changed

+676
-0
lines changed

docs/en/refs/unit.gps_v11.ref

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
.. |GPSV11Unit| image:: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/products/unit/Unit-GPS%20v1.1/4.webp
3+
:target: https://docs.m5stack.com/en/unit/Unit-GPS%20v1.1
4+
:height: 200px
5+
:width: 200px
6+
7+
.. |init.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/init.png
8+
.. |set_work_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/set_work_mode.png
9+
.. |get_work_mode.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_work_mode.png
10+
.. |get_antenna_state.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_antenna_state.png
11+
.. |get_gps_time.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_gps_time.png
12+
.. |get_gps_date.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_gps_date.png
13+
.. |get_gps_date_time.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_gps_date_time.png
14+
.. |get_timestamp.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_timestamp.png
15+
.. |get_latitude.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_latitude.png
16+
.. |get_longitude.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_longitude.png
17+
.. |get_altitude.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_altitude.png
18+
.. |get_satellite_num.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_satellite_num.png
19+
.. |get_pos_quality.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_pos_quality.png
20+
.. |get_corse_over_ground.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_corse_over_ground.png
21+
.. |get_speed_over_ground.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_speed_over_ground.png
22+
.. |set_time_zone.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/set_time_zone.png
23+
.. |get_time_zone.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/get_time_zone.png
24+
.. |deinit.png| image:: https://static-cdn.m5stack.com/mpy_docs//gps_v11/deinit.png
25+
26+
27+
.. |gps_example.m5f2| raw:: html
28+
29+
<a
30+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/unit/gps_v11/gps_example.m5f2"
31+
target="_blank"
32+
>
33+
gps_example.m5f2
34+
</a>
35+

docs/en/units/gps_v11.rst

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
2+
GPSUnit V1.1
3+
============
4+
5+
.. include:: ../refs/.gpsunit.ref
6+
7+
GPS Unit v1.1 is a GNSS global positioning navigation unit, integrating the high-performance CASIC navigation chip AT6668 and signal amplifier chip MAX2659, with a built-in ceramic antenna, providing more precise and reliable satellite positioning services.
8+
9+
Support the following products:
10+
11+
|GPSV11Unit|
12+
13+
Micropython Example:
14+
15+
.. literalinclude:: ../../../examples/unit/gps_example.py
16+
:language: python
17+
:linenos:
18+
19+
20+
UIFLOW2 Example:
21+
22+
|example.png|
23+
24+
.. only:: builder_html
25+
26+
|gps_example.m5f2|
27+
28+
class GPSV11Unit
29+
-------------
30+
31+
Constructors
32+
------------
33+
34+
.. class:: GPSV11Unit(id, port)
35+
36+
Initialize the GPSV11Unit with a specific UART id and port for communication.
37+
38+
:param int id: The UART ID for communication with the GPS module. It can be 0, 1, or 2.
39+
:param port: A list or tuple containing the TX and RX pins for UART communication.
40+
41+
UIFLOW2:
42+
43+
|init.png|
44+
45+
46+
Methods
47+
-------
48+
49+
.. method:: GPSV11Unit.set_work_mode(mode)
50+
51+
Set the working mode of the GPS module.
52+
53+
:param int mode: The mode to set, defined by the GPS module.
54+
55+
UIFLOW2:
56+
57+
|set_work_mode.png|
58+
59+
.. method:: GPSV11Unit.get_work_mode()
60+
61+
Get the current working mode of the GPS module.
62+
63+
:return: The current working mode of the GPS module.
64+
65+
UIFLOW2:
66+
67+
|get_work_mode.png|
68+
69+
.. method:: GPSV11Unit.get_antenna_state()
70+
71+
Get the state of the antenna.
72+
73+
:return: The antenna state.
74+
75+
UIFLOW2:
76+
77+
|get_antenna_state.png|
78+
79+
.. method:: GPSV11Unit.get_gps_time()
80+
81+
Get the current GPS time.
82+
83+
:return: The GPS time as a list of strings [hour, minute, second].
84+
85+
UIFLOW2:
86+
87+
|get_gps_time.png|
88+
89+
.. method:: GPSV11Unit.get_gps_date()
90+
91+
Get the current GPS date.
92+
93+
:return: The GPS date as a list of strings [day, month, year].
94+
95+
UIFLOW2:
96+
97+
|get_gps_date.png|
98+
99+
.. method:: GPSV11Unit.get_gps_date_time()
100+
101+
Get the current GPS date and time combined.
102+
103+
:return: The GPS date and time as a list of strings [year, month, day, hour, minute, second].
104+
105+
UIFLOW2:
106+
107+
|get_gps_date_time.png|
108+
109+
.. method:: GPSV11Unit.get_timestamp()
110+
111+
Get the timestamp of the current GPS time.
112+
113+
:return: The timestamp representing the current GPS time.
114+
115+
UIFLOW2:
116+
117+
|get_timestamp.png|
118+
119+
.. method:: GPSV11Unit.get_latitude()
120+
121+
Get the current latitude.
122+
123+
:return: The current latitude in string format.
124+
125+
UIFLOW2:
126+
127+
|get_latitude.png|
128+
129+
.. method:: GPSV11Unit.get_longitude()
130+
131+
Get the current longitude.
132+
133+
:return: The current longitude in string format.
134+
135+
UIFLOW2:
136+
137+
|get_longitude.png|
138+
139+
.. method:: GPSV11Unit.get_altitude()
140+
141+
Get the current altitude.
142+
143+
:return: The current altitude in string format.
144+
145+
UIFLOW2:
146+
147+
|get_altitude.png|
148+
149+
.. method:: GPSV11Unit.get_satellite_num()
150+
151+
Get the number of satellites used for positioning.
152+
153+
:return: The number of satellites.
154+
155+
UIFLOW2:
156+
157+
|get_satellite_num.png|
158+
159+
.. method:: GPSV11Unit.get_pos_quality()
160+
161+
Get the quality of the GPS position.
162+
163+
:return: The position quality indicator.
164+
165+
UIFLOW2:
166+
167+
|get_pos_quality.png|
168+
169+
.. method:: GPSV11Unit.get_corse_over_ground()
170+
171+
Get the course over ground (COG).
172+
173+
:return: The course over ground in degrees.
174+
175+
UIFLOW2:
176+
177+
|get_corse_over_ground.png|
178+
179+
.. method:: GPSV11Unit.get_speed_over_ground()
180+
181+
Get the speed over ground (SOG).
182+
183+
:return: The speed over ground in knots.
184+
185+
UIFLOW2:
186+
187+
|get_speed_over_ground.png|
188+
189+
.. method:: GPSV11Unit.set_time_zone(value)
190+
191+
Set the time zone offset for the GPS time.
192+
193+
:param value: The time zone offset value to set.
194+
195+
UIFLOW2:
196+
197+
|set_time_zone.png|
198+
199+
.. method:: GPSV11Unit.get_time_zone()
200+
201+
Get the current time zone offset.
202+
203+
:return: The current time zone offset.
204+
205+
UIFLOW2:
206+
207+
|get_time_zone.png|
208+
209+
.. method:: GPSV11Unit.deinit()
210+
211+
Deinitialize the GPS unit, stopping any running tasks and releasing resources.
212+
213+
UIFLOW2:
214+
215+
|deinit.png|
216+
217+
218+
.. method:: GPSV11Unit._add_checksum(message)
219+
220+
Add checksum to the message for communication with the GPS module.
221+
222+
:param str message: The message to which the checksum will be added.
223+
224+
:return: The message with added checksum.
225+
226+
227+
.. method:: GPSV11Unit._decode_gga(data)
228+
229+
Decode the GGA sentence to extract GPS quality, number of satellites, and altitude.
230+
231+
:param str data: The GGA sentence to decode.
232+
233+
234+
.. method:: GPSV11Unit._decode_rmc(data)
235+
236+
Decode the RMC sentence to extract GPS time, latitude, longitude, speed, course, and date.
237+
238+
:param str data: The RMC sentence to decode.
239+
240+
241+
.. method:: GPSV11Unit._decode_txt(data)
242+
243+
Decode the TXT sentence to extract antenna state.
244+
245+
:param str data: The TXT sentence to decode.
246+
247+
248+
.. method:: GPSV11Unit._monitor()
249+
250+
Monitor the GPS data and decode incoming sentences.

0 commit comments

Comments
 (0)