![](/media/cache/profiles/9bd5ee6fe55aaeb673025dbcb8f939c1.50x50_q85.jpg)
UniGraphic library test using MPS2+
Dependencies: MMA8451Q SPI_STMPE610 UniGraphic mbed
Fork of testUniGraphic_150217 by
Diff: main.cpp
- Revision:
- 4:76d15fd29c9f
- Parent:
- 3:1cd979ad1e1d
diff -r 1cd979ad1e1d -r 76d15fd29c9f main.cpp --- a/main.cpp Thu Feb 19 01:49:53 2015 +0000 +++ b/main.cpp Tue Feb 21 13:37:48 2017 +0000 @@ -1,5 +1,5 @@ #include "mbed.h" -#include "MMA8451Q.h" +//#include "MMA8451Q.h" #include <ILI9341.h> #include "Arial12x12.h" #include "Arial24x23.h" @@ -9,16 +9,16 @@ #include "main.h" DigitalOut myled(LED1); -ILI9341 TFT(SPI_8, 10000000, +ILI9341 TFT(SPI_8, 48000000, PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TFT, PIN_RESET_TFT, PIN_DC_TFT, "Adafruit2.8") ; - -SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ; + +//SPI_STMPE610 TSC(PIN_MOSI, PIN_MISO, PIN_SCLK, PIN_CS_TSC) ; DigitalOut backlight(PIN_BL_TFT) ; #define MMA8451_I2C_ADDRESS (0x1d<<1) -MMA8451Q *acc = 0 ; +//MMA8451Q *acc = 0 ; int page = 0 ; int numPage = 3 ; @@ -35,10 +35,12 @@ void screen1(void) // Welcome Screen { +printf("screen1\n"); backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.cls() ; +printf("screen clear\n"); wait(0.1) ; TFT.set_font((unsigned char*) Arial24x23); @@ -190,7 +192,7 @@ TFT.printf("Xtrinsic Accelerometer") ; TFT.locate(90, 300) ; TFT.printf("MMA8451Q") ; - +#if 0 prev[0] = xoffset + (signalHeight * clip((1.0 + acc->getAccX()))) ; prev[1] = yoffset + (signalHeight * clip((1.0 + acc->getAccY()))) ; prev[2] = zoffset + (signalHeight * clip((1.0 + acc->getAccZ()))) ; @@ -210,6 +212,7 @@ wait(0.01) ; } TFT.BusEnable(false) ; +#endif } void incPage(void) @@ -232,16 +235,18 @@ uint16_t x, y, z ; int prevPage = 0 ; - acc = new MMA8451Q(PTE25, PTE24, MMA8451_I2C_ADDRESS) ; + //acc = new MMA8451Q(PTE25, PTE24, MMA8451_I2C_ADDRESS) ; + printf("\nInitializing TFT module\n") ; initTFT() ; + printf("Initialized TFT module\n") ; screen1() ; printf("Program Started!\n\r") ; for(;;) { -// printf("TFT width = %d, height = %d\n\r", TFT.width(), TFT.height()) ; + printf("%02d: TFT width = %d, height = %d\n\r", page, TFT.width(), TFT.height()) ; switch(page) { case 0: if (prevPage != page) { @@ -270,6 +275,7 @@ } prevPage = page ; +#if 0 TSC.getRAWPoint(&x, &y, &z) ; if ((x != 0)||(y != 0) || (z != 0)) { if (x < 1000) { // left @@ -278,6 +284,9 @@ incPage() ; } } -// wait(1) ; +#else + page++; +#endif + wait(1) ; } }