UoS³ Flight Computer Firmware
 All Data Structures Files Functions Groups Pages
gpstest.c
1 
2 // gps test
3 //
4 // Suzanna Lucarotti (c) 01/09/2017
5 //
6 // for use with the UoS3 Cubesat
7 //
8 // current initial aim is to display coms messages from GPS chip to serial, problems locking and NMEA decoding a step further
9 //
10 // not finding the UART layer suitable for detailed reading from gps, so rewriting uart base layer
11 
12 #include "../firmware.h"
13 
14 #include "inc/hw_types.h"
15 
16 #include <stdlib.h>
17 #include <stdarg.h>
18 
19 #include "../board/uart.h"
20 
21 #include "inc/tm4c123gh6pm.h"
22 #include "inc/hw_memmap.h"
23 
24 #include "driverlib/gpio.h"
25 #include "driverlib/uart.h"
26 #include "driverlib/sysctl.h"
27 #include "driverlib/pin_map.h"
28 
29 #define DEBUG_SERIAL UART_CAMERA // this is the serial port debug messages will come through (UART_CAMERA or UART_GNSS)
30 #define GPS_SERIAL UART_GNSS
31 #define CAM_SERIAL UART_CAMERA
32 
33 #define DEBUG_SERIAL CAM_SERIAL
34 
36  // the actual main code
38 
39 int main(void)
40 {
41  Board_init(); // start the board
42  setupwatchdoginterrupt();
43 
44  UART_init(DEBUG_SERIAL,115200); DISP1("\n\n\r Satellite GPS test.\n")
45  UART_init(GPS_SERIAL,9600); // initial starting baud for gps
46 
47  // start the console, print bootup message (below)
48 
49  while(1) // infinite loop
50  {
51 
52  UART_puts(GPS_SERIAL,"fix position\n\r");
53 
54  while (UART_charsAvail(GPS_SERIAL))
55  {
56  char c=UART_getc(GPS_SERIAL);
57  UART_putc_nonblocking(DEBUG_SERIAL,c);
58  }
59  }
60 }
void UART_init(uint8_t uart_num, uint32_t baudrate)
Definition: uart.c:78
char UART_getc(uint8_t uart_num)
Definition: uart.c:113
int main(void)
Runs all module tests.
Definition: test.c:19
bool UART_charsAvail(uint8_t uart_num)
Definition: uart.c:203
bool UART_putc_nonblocking(uint8_t uart_num, char c)
Definition: uart.c:163
void UART_puts(uint8_t uart_num, char *str)
Definition: uart.c:129
void Board_init(void)
Definition: board.c:13