example application with TFT display and SMS receive send
Dependencies: C027 C027_Support SeeedStudioTFTv2 TFT_fonts UbloxUSBModem mbed
Fork of C027_DisplayTest by
This is an application that combines several libraries together and demonstartes the use of cellular, GPS and a Touch enabled TFT on the u-blox C027 board.
main.cpp
- Committer:
- amwe
- Date:
- 2014-03-17
- Revision:
- 10:2b1e6015e413
- Parent:
- 9:e3dd986ab08c
- Child:
- 11:5c7f76702799
File content as of revision 10:2b1e6015e413:
#include "mbed.h" #include "C12832.h" #include "C027.h" #include "GPS.h" #include "SerialPipe.h" DigitalOut myled(LED); C12832 lcd(D11, D13, D12, D7, D10); // jumper connections int main() { C027 c027; GPSSerial gps; c027.gpsPower(true); lcd.locate(0,0); lcd.printf("u-blox C027-C20/U20/G35"); lcd.locate(0,11); lcd.printf("Positioning demonstrator"); wait(2.5); lcd.cls(); lcd.locate(0,0); lcd.printf("C027 Position:"); char msg[160+1] = ""; while(true) { int ret; while ((ret = gps.getMessage(msg, sizeof(msg))) > 0) { printf("%s\n", msg); // for debugging connect PC terminal program 9600 9,1 no flowctrl int len = LENGTH(ret); if (PROTOCOL(ret) == NMEA && !strncmp("$GPGLL", msg, 6)) { double la = 0, lo = 0; char cLa = 0, cLo = 0, ch = 0; if (gps.getNmeaItem(1,msg,len,la) && gps.getNmeaItem(2,msg,len,cLa) && gps.getNmeaItem(3,msg,len,lo) && gps.getNmeaItem(4,msg,len,cLo) && gps.getNmeaItem(6,msg,len,ch) && ch == 'A') { la *= 0.01; lo *= 0.01; int iLa = (int)la; int iLo = (int)lo; la = (la - iLa) / 0.6 + iLa; lo = (lo - iLo) / 0.6 + iLo; if (cLa == 'S') la = -la; if (cLo == 'W') lo = -lo; lcd.locate(0,11); lcd.printf("%c", cLa); lcd.printf(":%10.6f ", la); lcd.locate(0,22); lcd.printf("%c", cLo); lcd.printf(":%10.6f ", lo); } } } } }