Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SPI_TFT_ILI9341 by
Revision 17:8794e2eadd8d, committed 2014-12-08
- Comitter:
- gregeric
- Date:
- Mon Dec 08 13:20:28 2014 +0000
- Parent:
- 16:51b40ebe3280
- Commit message:
- Applied changes to _NUCLEO & _NXP versions (untested, no hardware).
Changed in this revision
--- a/SPI_TFT_ILI9341.cpp Mon Dec 08 10:03:05 2014 +0000 +++ b/SPI_TFT_ILI9341.cpp Mon Dec 08 13:20:28 2014 +0000 @@ -620,20 +620,20 @@ w=zeichen[0]; //check whether there are sufficient pixels to render character - if (char_x + w+2 > width()) { //was hor, now w+2 -> enables squeezing extra char at end of line) + if (char_x + (w+2) > width()) { //was hor, now w+2 -> enables squeezing extra char at end of line) char_x = 0; char_y = char_y + vert; if (char_y >= height() - vert) { char_y = 0; } } - window(char_x, char_y,w+2,vert); // was hor, now w+2 -> char box shrunk to smallest size we need (speedup) + window(char_x, char_y,(w+2),vert); // was hor, now w+2 -> char box shrunk to smallest size we need (speedup) wr_cmd(0x2C); // send pixel #ifndef TARGET_KL25Z // 16 Bit SPI SPI::format(16,3); #endif // switch to 16 bit Mode 3 for (j=0; j<vert; j++) { // vert line - for (i=0; i<w+2; i++) { //w+2 was hor, send just enough pixel data to fill window // horz line + for (i=0; i<(w+2); i++) { //w+2 was hor, send just enough pixel data to fill window // horz line z = zeichen[bpl * i + ((j & 0xF8) >> 3)+1]; b = 1 << (j & 0x07); if (( z & b ) == 0x00) {
--- a/SPI_TFT_ILI9341_NUCLEO.cpp Mon Dec 08 10:03:05 2014 +0000 +++ b/SPI_TFT_ILI9341_NUCLEO.cpp Mon Dec 08 13:20:28 2014 +0000 @@ -789,31 +789,32 @@ if ((c < 31) || (c > 127)) return; // test char range // read font parameter from start of array - offset = font[0]; // bytes / char - hor = font[1]; // get hor size of font - vert = font[2]; // get vert size of font - bpl = font[3]; // bytes per line + offset = font[0]<<8+font[1]; // bytes / char + hor = font[2]; // get hor size of font + vert = font[3]; // get vert size of font + bpl = font[4]; // bytes per line - if (char_x + hor > width()) { + zeichen = &font[((c -32) * offset) + 5]; // start of char bitmap + w = zeichen[0]; // width of actual char + + if (char_x + (w+2) > width()) { char_x = 0; char_y = char_y + vert; - if (char_y >= height() - font[2]) { + if (char_y >= height() - vert) { char_y = 0; } } - window(char_x, char_y,hor,vert); // setup char box + window(char_x, char_y,(w+2),vert); // setup char box wr_cmd(0x2C); spi_16(1); // switch to 16 bit Mode #ifdef use_ram - pixel = hor * vert; // calculate buffer size + pixel = (w+2) * vert; // calculate buffer size buffer = (uint16_t *) malloc (2*pixel); // we need a buffer for the font if(buffer != NULL) { // there is memory space -> use dma - zeichen = &font[((c -32) * offset) + 4]; // start of char bitmap - w = zeichen[0]; // width of actual char p = 0; // construct the font into the buffer for (j=0; j<vert; j++) { // vert line - for (i=0; i<hor; i++) { // horz line + for (i=0; i<(w+2); i++) { // horz line z = zeichen[bpl * i + ((j & 0xF8) >> 3)+1]; b = 1 << (j & 0x07); if (( z & b ) == 0x00) { @@ -895,10 +896,8 @@ else{ #endif - zeichen = &font[((c -32) * offset) + 4]; // start of char bitmap - w = zeichen[0]; // width of actual char for (j=0; j<vert; j++) { // vert line - for (i=0; i<hor; i++) { // horz line + for (i=0; i<(w+2); i++) { // horz line z = zeichen[bpl * i + ((j & 0xF8) >> 3)+1]; b = 1 << (j & 0x07); if (( z & b ) == 0x00) {
--- a/SPI_TFT_ILI9341_NXP.cpp Mon Dec 08 10:03:05 2014 +0000 +++ b/SPI_TFT_ILI9341_NXP.cpp Mon Dec 08 13:20:28 2014 +0000 @@ -685,31 +685,32 @@ if ((c < 31) || (c > 127)) return; // test char range // read font parameter from start of array - offset = font[0]; // bytes / char - hor = font[1]; // get hor size of font - vert = font[2]; // get vert size of font - bpl = font[3]; // bytes per line + offset = (font[0]<<8) + font[1]; // bytes / char + hor = font[2]; // get hor size of font + vert = font[3]; // get vert size of font + bpl = font[4]; // bytes per line - if (char_x + hor > width()) { + zeichen = &font[((c -32) * offset) + 5]; // start of char bitmap + w = zeichen[0]; // width of actual char + + if (char_x + (w+2) > width()) { char_x = 0; char_y = char_y + vert; - if (char_y >= height() - font[2]) { + if (char_y >= height() - vert) { char_y = 0; } } - window(char_x, char_y,hor,vert); // setup char box + window(char_x, char_y,(w+2),vert); // setup char box wr_cmd(0x2C); spi_16(1); // switch to 16 bit Mode #ifdef use_ram - pixel = hor * vert; // calculate buffer size + pixel = (w+2) * vert; // calculate buffer size buffer = (uint16_t *) malloc (2*pixel); // we need a buffer for the font if(buffer != NULL) { // there is memory space -> use dma - zeichen = &font[((c -32) * offset) + 4]; // start of char bitmap - w = zeichen[0]; // width of actual char p = 0; // construct the font into the buffer for (j=0; j<vert; j++) { // vert line - for (i=0; i<hor; i++) { // horz line + for (i=0; i<(w+2); i++) { // horz line z = zeichen[bpl * i + ((j & 0xF8) >> 3)+1]; b = 1 << (j & 0x07); if (( z & b ) == 0x00) { @@ -761,10 +762,8 @@ else { #endif - zeichen = &font[((c -32) * offset) + 4]; // start of char bitmap - w = zeichen[0]; // width of actual char for (j=0; j<vert; j++) { // vert line - for (i=0; i<hor; i++) { // horz line + for (i=0; i<(w+2); i++) { // horz line z = zeichen[bpl * i + ((j & 0xF8) >> 3)+1]; b = 1 << (j & 0x07); if (( z & b ) == 0x00) {