Dual CANbus monitor and instrumentation cluster
Dependencies: SPI_TFTx2 TFT_fonts TOUCH_TFTx2 beep mbed
Fork of CANary by
Diff: displayModes.cpp
- Revision:
- 58:4d06288d75a2
- Parent:
- 55:591406a71fa8
- Child:
- 59:58894493fb29
- Child:
- 60:9d191ff745fb
--- 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;