1313#include "lis302dl.h"
1414
1515#include "Comms.h"
16- #include "TinyGPS .h"
16+ #include "GPS .h"
1717#include "Motors.h"
1818#include "Spektrum.h"
1919
@@ -55,32 +55,6 @@ static msg_t Blink(void *arg){
5555 return 0 ;
5656}
5757
58- /*
59- * GPS setup
60- */
61- static const SerialConfig sd1cfg = {
62- 57600 ,
63- 0 ,
64- USART_CR2_STOP1_BITS | USART_CR2_LINEN ,
65- 0
66- };
67-
68- static WORKING_AREA (GPSWA , 128 ) ;
69- static msg_t GPS (void * arg ){
70-
71- (void )arg ;
72- chRegSetThreadName ("GPS" );
73- while (TRUE){
74- unsigned char newdata = 0 ;
75- // Read a byte off the GPS
76- uint8_t c = chIOGet ((BaseChannel * )& SD1 );
77- if (TinyGPS_encode (c )){
78- newdata = 1 ;
79- }
80- }
81- return 0 ;
82- }
83-
8458/*
8559 * Application entry point.
8660 */
@@ -102,16 +76,6 @@ int main(void){
10276
10377 CommsInit ();
10478
105- /*
106- * Activates the serial driver 1 using the driver default configuration, but at 57600
107- * PA9(TX) and PA10(RX) are routed to USART1.
108- */
109-
110- sdStart (& SD1 , & sd1cfg );
111- palSetPadMode (GPIOA , 9 , PAL_MODE_ALTERNATE (7 )); // not currently connected
112- palSetPadMode (GPIOA , 10 , PAL_MODE_ALTERNATE (7 )); // incoming data from the GPS
113- //TinyGPS_init();
114-
11579 /*
11680 * SPI1 I/O pins setup.
11781 */
@@ -135,11 +99,15 @@ int main(void){
13599 */
136100 MotorsInit ();
137101
102+ /*
103+ * GPS
104+ */
105+ GPSInit ();
106+
138107 /*
139108 * Creates the threads
140109 */
141110 chThdCreateStatic (BlinkWA , sizeof (BlinkWA ), NORMALPRIO , Blink , NULL );
142- chThdCreateStatic (GPSWA , sizeof (GPSWA ), NORMALPRIO , GPS , NULL );
143111
144112 /*
145113 * Normal main() thread activity
0 commit comments