Works
Dependencies: BMP180 BNO055_fusion Fonts GPSISR HTU21D SDFileSystem UniGraphic mbed uGUI
Fork of Bicycl_Computer_NUCLEO-F411RE by
Diff: main.cpp
- Revision:
- 10:a3cb458d7b1c
- Parent:
- 9:855884782f67
- Child:
- 11:869a102dd31c
--- a/main.cpp Thu Feb 16 23:56:02 2017 +0000 +++ b/main.cpp Mon Feb 20 19:10:30 2017 +0000 @@ -72,7 +72,6 @@ #define TARGET_NECLEO_F411RE #endif - //DigitalOut backlight(PB_3) ; // DigitalOut tsc_cs(PA_9, 1) ; // DigitalOut tft_cs(PB_6, 1) ; @@ -243,37 +242,45 @@ int main() { + TFT.BusEnable(true) ; + TFT.FastWindow(true) ; + wait(0.1); + TFT.cls(); + wait(0.1); Timer refresh_Timer; //sets up a timer for use in loop; how often do we print GPS info? - const int refresh_Time = 1000; //refresh time in ms + const int refresh_Time = 2000; //refresh time in ms refresh_Timer.start(); //starts the clock on the timer - TFT.BusEnable(true) ; //backlight = 0 ; - TFT.background(White) ; - wait(0.1) ; - TFT.cls() ; - wait(0.1) ; + TFT.set_font((unsigned char*) Arial24x23); + TFT.fillrect(2, 2, 237, 317, White); + TFT.foreground(Blue); + TFT.background(White); + wait(0.1); + + while (1) { //check if we recieved a new message from GPS, if so, attempt to parse it, if (refresh_Timer.read_ms() >= refresh_Time) { refresh_Timer.reset(); - //pc.printf("Time: %f\n", myGPS.time); - //MyGPS.getline(); - //pc.printf("%s", MyGPS.msg[0]); - pc.printf("rx_int: %c \n", MyGPS.rx_in); - - if (MyGPS.isdatardy()) { + + if (MyGPS.dataready()) { + MyGPS.read(); pc.printf("NMEA has valid data"); - pc.printf("Sats : %d \n", MyGPS.getSats()); + pc.printf("Sats : %d \n", MyGPS.buffer.satellites); + pc.printf("%d-%d-%d\n", MyGPS.buffer.month, MyGPS.buffer.day, MyGPS.buffer.year); + pc.printf("%d:%d:%d\n", MyGPS.buffer.hours, MyGPS.buffer.minutes, MyGPS.buffer.seconds); + + + TFT.locate(2, 2) ; + TFT.printf("%d-%d-%d", MyGPS.buffer.month, MyGPS.buffer.day, MyGPS.buffer.year); + TFT.locate(2, 26) ; + TFT.printf("%d:%d:%d", MyGPS.buffer.hours, MyGPS.buffer.minutes, MyGPS.buffer.seconds); + } else { pc.printf("NMEA has no valid data"); } - TFT.set_font((unsigned char*) Arial12x12); - TFT.foreground(Blue); - TFT.locate(2, 2); - //TFT.printf("Time: %f\n", myGPS.time); - TFT.BusEnable(false) ; } } @@ -330,4 +337,4 @@ while(waitTouch != false) ; //wait(1) ; } -} +} \ No newline at end of file