UniGraphic library test using MPS2+
Dependencies: MMA8451Q SPI_STMPE610 UniGraphic mbed
Fork of testUniGraphic_150217 by
Revision 4:76d15fd29c9f, committed 2017-02-21
- Comitter:
- MACRUM
- Date:
- Tue Feb 21 13:37:48 2017 +0000
- Parent:
- 3:1cd979ad1e1d
- Commit message:
- MPS2+ board test
Changed in this revision
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) ; } }
diff -r 1cd979ad1e1d -r 76d15fd29c9f main.h --- a/main.h Thu Feb 19 01:49:53 2015 +0000 +++ b/main.h Tue Feb 21 13:37:48 2017 +0000 @@ -25,8 +25,33 @@ #define PIN_TSC_INTR PTC9 #define PIN_RESET_TFT PTB10 +#elif defined (TARGET_ARM_MPS2_M7) +#define PIN_MOSI CLCD_MOSI +#define PIN_MISO CLCD_MISO +#define PIN_SCLK CLCD_SCLK +#define PIN_CS_TFT CLCD_SSEL +#define PIN_DC_TFT PTD2 +#define PIN_BL_TFT PTC9 +#define PIN_CS_SD PTA4 +#define PIN_CS_TSC PTA13 +#define PIN_TSC_INTR PTC9 +#define PIN_RESET_TFT CLCD_RESET + +//#elif defined (TARGET_K64F) #else - #error TARGET NOT DEFINED +#define PIN_MOSI D11 +#define PIN_MISO D12 +#define PIN_SCLK D13 +#define PIN_CS_TFT D10 +#define PIN_DC_TFT D9 +#define PIN_BL_TFT D7 +#define PIN_CS_SD D4 +#define PIN_CS_TSC D8 +#define PIN_TSC_INTR D7 +#define PIN_RESET_TFT LED1 + +//#else +// #error TARGET NOT DEFINED #endif #endif /* _MAIN_H_ */ \ No newline at end of file
diff -r 1cd979ad1e1d -r 76d15fd29c9f mbed.bld --- a/mbed.bld Thu Feb 19 01:49:53 2015 +0000 +++ b/mbed.bld Tue Feb 21 13:37:48 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file