Attempts to merge SPI_TFT2 & SPI_TFT_ILI9341
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary by
Revision 58:4d06288d75a2, committed 2013-04-09
- Comitter:
- garygid
- Date:
- Tue Apr 09 20:09:31 2013 +0000
- Parent:
- 57:0d81e107b449
- Child:
- 59:58894493fb29
- Child:
- 60:9d191ff745fb
- Commit message:
- Button-Highlight Experiment - GG from v57
Changed in this revision
--- a/displayModes.cpp Tue Apr 09 13:00:12 2013 +0000 +++ b/displayModes.cpp Tue Apr 09 20:09:31 2013 +0000 @@ -983,6 +983,45 @@ } } +//--------------------- +// gg - highlight +//void highlightButton(unsigned char column, unsigned char row, char * text1, char * text2, unsigned char columns, unsigned char rows){ +void highlightButton(unsigned char column, unsigned char row, unsigned char tScn, unsigned char cScn, unsigned char columns, unsigned char rows){ + + // tScn is the screen number derived from the touch location, is 0 or 1 + // cScn is the whichTouched screen value, apparently also 0 and 1 + + unsigned short x1,x2,y1,y2; + + x1=column*(320/columns)+btnGap/2; + x2=(column+1)*(320/columns)-btnGap/2; + y1=row*(240/rows)+btnGap/2; + y2=(row+1)*(240/rows)-btnGap/2; + if( tScn == cScn ){ + // screens match + if( tScn == 0 ) + // paint the whole button box + tt.fillrect(x1,y1,x2,y2,White); // DarkCyan); + else + tt.fillrect(x1,y1,x2,y2,Green); // DarkCyan); + } else { + // screens do not match + tt.fillrect(x1,y1,x2,y2,Red); // DarkCyan); + } + + // paint the outer pixel as a yellow frame + tt.rect(x1,y1,x2,y2,Yellow) ; // DarkCyan); + + + // adapt formatting of text to the smaller 4x4 box + //tt.locate(x1+btnGap/2,y1+btnGap); // gg - 4x4 + //printf("%s\n",text1); + + //tt.locate(x1+btnGap/2,y1+btnGap+20); + //printf("%s\n",text2); +} + +//--------------------- void showButton(unsigned char column, unsigned char row, char * text1, char * text2, unsigned char columns, unsigned char rows){ unsigned short x1,x2,y1,y2;
--- a/displayModes.h Tue Apr 09 13:00:12 2013 +0000 +++ b/displayModes.h Tue Apr 09 20:09:31 2013 +0000 @@ -49,4 +49,6 @@ void showDateTime(bool force, bool showButtons); void updateDisplay(char display); void showButton(unsigned char column, unsigned char row, char * text1, char * text2, unsigned char columns, unsigned char rows); + void highlightButton(unsigned char column, unsigned char row, unsigned char tScn, unsigned char cScn, unsigned char columns, unsigned char rows); + } \ No newline at end of file
--- a/main.cpp Tue Apr 09 13:00:12 2013 +0000 +++ b/main.cpp Tue Apr 09 20:09:31 2013 +0000 @@ -163,7 +163,9 @@ //sprintf(sTemp,"CANary firmware rev51-gg3\n"); // gg - cleaned 4x4 button and touches, //sprintf(sTemp,"CANary firmware rev52\n"); //sprintf(sTemp,"CANary firmware rev54\n"); // merged 53 (51-gg3) and 52 - sprintf(sTemp,"CANary firmware rev57\n"); + //sprintf(sTemp,"CANary firmware rev57\n"); + //sprintf(sTemp,"CANary firmware rev57-gg1\n"); // gg - highlight experiment + sprintf(sTemp,"CANary firmware rev58\n"); // gg - highlight experiment commit and publish logMsg(sTemp); // Look for new binary on thumbdrive @@ -352,7 +354,7 @@ } //--------------- // gg - 4x4 touch - //unsigned char tScrn = 0 ; // screen 0 + unsigned char tScrn = 0 ; // screen 0 unsigned char tCol ; unsigned char tRow ; @@ -372,12 +374,18 @@ //-------------- // gg - 4x4 touch tCol = buttonX(lastTouch.x,4) ; - //if( tCol >= 4 ){ tCol -= 4; tScrn = 1 ; } // touch is on screen 1 - if( tCol >= 4 ){ tCol -= 4; } // touch is on screen 1 + if( tCol >= 4 ){ tCol -= 4; tScrn = 1 ; } // touch is on screen 1 + //if( tCol >= 4 ){ tCol -= 4; } // touch is on screen 1 tRow = buttonY(lastTouch.y,4) ; - if( tRow == tNavRow ) tRow = 7 ; + // highlight the button (what screen?) + // different highlight for tScrn, whichTouched combinations, for debugging + highlightButton( tCol,tRow, tScrn, whichTouched, 4,4) ; // g - highlight + // usually the screen is re-drawn after + // for now, this gives us good feedback that we can use + + if( tRow == tNavRow ) tRow = 7 ; // switch ( (tCol*10) + tRow ) { //--------------------------------- case 00: // 00 on screen 0 or 1
--- a/utility.cpp Tue Apr 09 13:00:12 2013 +0000 +++ b/utility.cpp Tue Apr 09 20:09:31 2013 +0000 @@ -269,6 +269,7 @@ logMsg(sTemp); //tt.setcal(5570, 34030, 80, 108, 33700, 5780, 82, 108, 32500);// bypass calibration using my values tt.calibrate(); // run touchscreen calibration routine + // NOTE: calibrates screen 1 first, then screen 0. saveConfig(); } else { ledHi = 0.823;