-
Notifications
You must be signed in to change notification settings - Fork 2
/
neo_m8_app.c
69 lines (58 loc) · 1.32 KB
/
neo_m8_app.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* neo_m8_app.c
*
* Created on: Jul 17, 2018
* Author: alexis
*/
#ifndef NEO_M8_APP_C_
#define NEO_M8_APP_C_
/* Standard libraries */
#include <stdio.h>
/* RTOS api */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* Peripheral files generated by CubeMX */
#include "usart.h"
/* Low layer GPS */
#include "neo_m8_gps.h"
#include "neo_m8_messages.h"
#include "neo_m8_ubx_structs.h"
#include "neo_m8_conversion.h"
ubx_nav_pvt_msg_t navPvt;
static char dbg_buf[128]; //store dbg msg
static uint32_t s; //store n elts
void GpsInfiniteLoop(void);
void GPSTask(void const * argument)
{
osDelay(200);
/* Initialisation */
HAL_UART_Transmit(&huart3, "GPS Task begin\n", sizeof("GPS Task begin\n"), 0xffff);
neoInit();
/* Infinite loop */
for(;;)
{
/* New message received from the GPS */
GpsInfiniteLoop();
osDelay(50); /* Reduce loop frequency ; slow process */
}
}
void GpsInfiniteLoop(void)
{
/* New message received from the GPS */
if (neoRetrieveMsg() == UBX_NEW_DATA)
{
//switch (neoGetMsgClass())
if (neoGetMsgClass() == UBX_MSG_CLASS_NAV)
{
if (neoGetMsgId() == UBX_MSG_ID_NAV_PVT)
{
s = snprintf(dbg_buf, 128, "%d New PVT\n", HAL_GetTick());
HAL_UART_Transmit(&huart3, dbg_buf, s, 0xffff);
UBXUpdate_NAV_PVT(&navPvt);
;
}
}
}
}
#endif /* NEO_M8_APP_C_ */