MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / initMtkL76b

Function initMtkL76b

Tactility/Source/hal/gps/GpsInit.cpp:262–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262bool initMtkL76b(::Device* uart) {
263 // Waveshare Pico-GPS hat uses the L76B with 9600 baud
264 // Initialize the L76B Chip, use GPS + GLONASS
265 // See note in L76_Series_GNSS_Protocol_Specification, chapter 3.29
266 uart_controller_write_bytes(uart, (const uint8_t*)"$PMTK353,1,1,0,0,0*2B\r\n", 23, 250);
267 // Above command will reset the GPS and takes longer before it will accept new commands
268 kernel::delayMillis(1000);
269 // only ask for RMC and GGA (GNRMC and GNGGA)
270 // See note in L76_Series_GNSS_Protocol_Specification, chapter 2.1
271 uart_controller_write_bytes(uart, (const uint8_t*)"$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n", 51, 250);
272 kernel::delayMillis(250);
273 // Enable SBAS
274 uart_controller_write_bytes(uart, (const uint8_t*)"$PMTK301,2*2E\r\n", 15, 250);
275 kernel::delayMillis(250);
276 // Enable PPS for 2D/3D fix only
277 uart_controller_write_bytes(uart, (const uint8_t*)"$PMTK285,3,100*3F\r\n", 19, 250);
278 kernel::delayMillis(250);
279 // Switch to Fitness Mode, for running and walking purpose with low speed (<5 m/s)
280 uart_controller_write_bytes(uart, (const uint8_t*)"$PMTK886,1*29\r\n", 15, 250);
281 kernel::delayMillis(250);
282 return true;
283}
284
285bool initMtk(::Device* uart) {
286 // Initialize the L76K Chip, use GPS + GLONASS + BEIDOU

Callers 1

initFunction · 0.85

Calls 2

delayMillisFunction · 0.85

Tested by

no test coverage detected