example application with TFT display and SMS receive send

Dependencies:   C027 C027_Support SeeedStudioTFTv2 TFT_fonts UbloxUSBModem mbed

Fork of C027_DisplayTest by Michael Ammann

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. /media/uploads/mazgch/c027_display.jpg

Committer:
amwe
Date:
Mon Mar 17 10:34:37 2014 +0000
Revision:
10:2b1e6015e413
Parent:
9:e3dd986ab08c
Child:
11:5c7f76702799
C027 with Application board 128*32 LCD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mazgch 0:bd6ef6f73032 1 #include "mbed.h"
amwe 10:2b1e6015e413 2 #include "C12832.h"
mazgch 2:fde6fc911c61 3 #include "C027.h"
mazgch 2:fde6fc911c61 4 #include "GPS.h"
mazgch 4:b18b0bc4142f 5 #include "SerialPipe.h"
mazgch 0:bd6ef6f73032 6
amwe 10:2b1e6015e413 7 DigitalOut myled(LED);
amwe 10:2b1e6015e413 8 C12832 lcd(D11, D13, D12, D7, D10); // jumper connections
mazgch 2:fde6fc911c61 9
mazgch 0:bd6ef6f73032 10 int main()
mazgch 0:bd6ef6f73032 11 {
mazgch 4:b18b0bc4142f 12 C027 c027;
amwe 10:2b1e6015e413 13 GPSSerial gps;
mazgch 4:b18b0bc4142f 14 c027.gpsPower(true);
mazgch 4:b18b0bc4142f 15
amwe 10:2b1e6015e413 16 lcd.locate(0,0);
amwe 10:2b1e6015e413 17 lcd.printf("u-blox C027-C20/U20/G35");
amwe 10:2b1e6015e413 18 lcd.locate(0,11);
amwe 10:2b1e6015e413 19 lcd.printf("Positioning demonstrator");
amwe 10:2b1e6015e413 20 wait(2.5);
amwe 10:2b1e6015e413 21 lcd.cls();
amwe 10:2b1e6015e413 22 lcd.locate(0,0);
amwe 10:2b1e6015e413 23 lcd.printf("C027 Position:");
mazgch 0:bd6ef6f73032 24
amwe 10:2b1e6015e413 25 char msg[160+1] = "";
amwe 10:2b1e6015e413 26
mazgch 0:bd6ef6f73032 27 while(true)
mazgch 0:bd6ef6f73032 28 {
mazgch 2:fde6fc911c61 29 int ret;
amwe 10:2b1e6015e413 30
mazgch 4:b18b0bc4142f 31 while ((ret = gps.getMessage(msg, sizeof(msg))) > 0)
mazgch 2:fde6fc911c61 32 {
amwe 10:2b1e6015e413 33
amwe 10:2b1e6015e413 34 printf("%s\n", msg); // for debugging connect PC terminal program 9600 9,1 no flowctrl
mazgch 2:fde6fc911c61 35 int len = LENGTH(ret);
mazgch 2:fde6fc911c61 36 if (PROTOCOL(ret) == NMEA && !strncmp("$GPGLL", msg, 6))
mazgch 2:fde6fc911c61 37 {
mazgch 2:fde6fc911c61 38 double la = 0, lo = 0;
mazgch 2:fde6fc911c61 39 char cLa = 0, cLo = 0, ch = 0;
mazgch 2:fde6fc911c61 40 if (gps.getNmeaItem(1,msg,len,la) && gps.getNmeaItem(2,msg,len,cLa) &&
mazgch 2:fde6fc911c61 41 gps.getNmeaItem(3,msg,len,lo) && gps.getNmeaItem(4,msg,len,cLo) &&
mazgch 2:fde6fc911c61 42 gps.getNmeaItem(6,msg,len,ch) && ch == 'A')
mazgch 2:fde6fc911c61 43 {
mazgch 3:4ec009118465 44 la *= 0.01;
mazgch 3:4ec009118465 45 lo *= 0.01;
mazgch 3:4ec009118465 46 int iLa = (int)la;
mazgch 3:4ec009118465 47 int iLo = (int)lo;
mazgch 3:4ec009118465 48 la = (la - iLa) / 0.6 + iLa;
mazgch 3:4ec009118465 49 lo = (lo - iLo) / 0.6 + iLo;
mazgch 2:fde6fc911c61 50 if (cLa == 'S') la = -la;
amwe 10:2b1e6015e413 51 if (cLo == 'W') lo = -lo;
mazgch 3:4ec009118465 52
amwe 10:2b1e6015e413 53 lcd.locate(0,11);
amwe 10:2b1e6015e413 54 lcd.printf("%c", cLa);
amwe 10:2b1e6015e413 55 lcd.printf(":%10.6f ", la);
amwe 10:2b1e6015e413 56 lcd.locate(0,22);
amwe 10:2b1e6015e413 57 lcd.printf("%c", cLo);
amwe 10:2b1e6015e413 58 lcd.printf(":%10.6f ", lo);
mazgch 2:fde6fc911c61 59 }
mazgch 2:fde6fc911c61 60 }
mazgch 2:fde6fc911c61 61 }
mazgch 0:bd6ef6f73032 62 }
mazgch 0:bd6ef6f73032 63 }