Dimitar Minchev / Mbed 2 deprecated SIR

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DisplayN18.cpp Source File

DisplayN18.cpp

00001 #include "DisplayN18.h"
00002 
00003 const uint16_t DisplayN18::White = DisplayN18::rgbToShort(0xff, 0xff, 0xff);
00004 const uint16_t DisplayN18::Silver = DisplayN18::rgbToShort(0xc0, 0xc0, 0xc0);
00005 const uint16_t DisplayN18::Gray = DisplayN18::rgbToShort(0x80, 0x80, 0x80);
00006 const uint16_t DisplayN18::Black = DisplayN18::rgbToShort(0x00, 0x00, 0x00);
00007 const uint16_t DisplayN18::Red = DisplayN18::rgbToShort(0xff, 0x00, 0x00);
00008 const uint16_t DisplayN18::Maroon = DisplayN18::rgbToShort(0x80, 0x00, 0x00);
00009 const uint16_t DisplayN18::Yellow = DisplayN18::rgbToShort(0xff, 0xff, 0x00);
00010 const uint16_t DisplayN18::Olive = DisplayN18::rgbToShort(0x80, 0x80, 0x00);
00011 const uint16_t DisplayN18::Lime = DisplayN18::rgbToShort(0x00, 0xff, 0x00);
00012 const uint16_t DisplayN18::Green = DisplayN18::rgbToShort(0x00, 0x80, 0x00);
00013 const uint16_t DisplayN18::Aqua = DisplayN18::rgbToShort(0x00, 0xff, 0xff);
00014 const uint16_t DisplayN18::Teal = DisplayN18::rgbToShort(0x00, 0x80, 0x80);
00015 const uint16_t DisplayN18::Blue = DisplayN18::rgbToShort(0x00, 0x00, 0xff);
00016 const uint16_t DisplayN18::Navy = DisplayN18::rgbToShort(0x00, 0x00, 0x80);
00017 const uint16_t DisplayN18::Fuchsia = DisplayN18::rgbToShort(0xff, 0x00, 0xff);
00018 const uint16_t DisplayN18::Purple = DisplayN18::rgbToShort(0x80, 0x00, 0x80);
00019 
00020 DisplayN18::DisplayN18() : resetPin(P0_20), backlightPin(P0_19), rsPin(P0_7), csPin(P0_2), spi(P0_21, P0_22, P1_15) {
00021     this->resetPin.write(false);
00022     this->backlightPin.write(true);
00023     this->rsPin.write(false);
00024     
00025     this->spi.format(8, 3);
00026     this->spi.frequency(15000000);
00027     
00028     this->initialize();
00029 }
00030 
00031 void DisplayN18::writeCommand(unsigned char command) {
00032     this->rsPin.write(false);
00033     
00034     this->csPin.write(false);
00035     
00036     this->spi.write(command);
00037     
00038     this->csPin.write(true);
00039 }
00040 
00041 void DisplayN18::writeData(unsigned char data) {
00042     this->writeData(&data, 1);
00043 }
00044 
00045 void DisplayN18::writeData(const unsigned char* data, unsigned int length) {
00046     this->rsPin.write(true);
00047     
00048     this->csPin.write(false);
00049     
00050     for (unsigned int i = 0; i < length; i++)
00051         this->spi.write(data[i]);
00052     
00053     this->csPin.write(true);
00054 }
00055 
00056 void DisplayN18::reset() {
00057     this->resetPin.write(false);
00058     wait_ms(300);
00059     
00060     this->resetPin.write(true);
00061     wait_ms(500);
00062 }
00063 
00064 void DisplayN18::initialize() {
00065     this->reset();
00066 
00067     this->writeCommand(0x11);
00068     
00069     wait_ms(120);
00070 
00071     this->writeCommand(0xB1);
00072     this->writeData(0x01); this->writeData(0x2C); this->writeData(0x2D);
00073     this->writeCommand(0xB2);
00074     this->writeData(0x01); this->writeData(0x2C); this->writeData(0x2D);
00075     this->writeCommand(0xB3);
00076     this->writeData(0x01); this->writeData(0x2C); this->writeData(0x2D);
00077     this->writeData(0x01); this->writeData(0x2C); this->writeData(0x2D);
00078 
00079     this->writeCommand(0xB4);
00080     this->writeData(0x07);
00081 
00082     this->writeCommand(0xC0);
00083     this->writeData(0xA2); this->writeData(0x02); this->writeData(0x84);
00084     this->writeCommand(0xC1); this->writeData(0xC5);
00085     this->writeCommand(0xC2);
00086     this->writeData(0x0A); this->writeData(0x00);
00087     this->writeCommand(0xC3);
00088     this->writeData(0x8A); this->writeData(0x2A);
00089     this->writeCommand(0xC4);
00090     this->writeData(0x8A); this->writeData(0xEE);
00091 
00092     this->writeCommand(0xC5);
00093     this->writeData(0x0E);
00094 
00095     this->writeCommand(0x36);
00096     this->writeData(0xA8);
00097 
00098     this->writeCommand(0xe0);
00099     this->writeData(0x0f); this->writeData(0x1a);
00100     this->writeData(0x0f); this->writeData(0x18);
00101     this->writeData(0x2f); this->writeData(0x28);
00102     this->writeData(0x20); this->writeData(0x22);
00103     this->writeData(0x1f); this->writeData(0x1b);
00104     this->writeData(0x23); this->writeData(0x37); this->writeData(0x00);
00105     this->writeData(0x07);
00106     this->writeData(0x02); this->writeData(0x10);
00107 
00108     this->writeCommand(0xe1);
00109     this->writeData(0x0f); this->writeData(0x1b);
00110     this->writeData(0x0f); this->writeData(0x17);
00111     this->writeData(0x33); this->writeData(0x2c);
00112     this->writeData(0x29); this->writeData(0x2e);
00113     this->writeData(0x30); this->writeData(0x30);
00114     this->writeData(0x39); this->writeData(0x3f);
00115     this->writeData(0x00); this->writeData(0x07);
00116     this->writeData(0x03); this->writeData(0x10);
00117 
00118     this->writeCommand(0x2a);
00119     this->writeData(0x00); this->writeData(0x00);
00120     this->writeData(0x00); this->writeData(0x7f);
00121     this->writeCommand(0x2b);
00122     this->writeData(0x00); this->writeData(0x00);
00123     this->writeData(0x00); this->writeData(0x9f);
00124 
00125     this->writeCommand(0xF0);
00126     this->writeData(0x01);
00127     this->writeCommand(0xF6);
00128     this->writeData(0x00);
00129 
00130     this->writeCommand(0x3A);
00131     this->writeData(0x05);
00132 
00133     this->writeCommand(0x29);
00134 
00135     this->clear();
00136 }
00137 
00138 void DisplayN18::setClippingArea(unsigned char x, unsigned char y, unsigned char width, unsigned char height) {
00139     unsigned char data[4] = { 0x00, 0x00, 0x00, 0x00 };
00140 
00141     data[1] = x;
00142     data[3] = x + width;
00143     this->writeCommand(0x2A);
00144     this->writeData(data, 4);
00145 
00146     data[1] = y;
00147     data[3] = y + height;
00148     this->writeCommand(0x2B);
00149     this->writeData(data, 4);
00150 }
00151 
00152 unsigned short DisplayN18::rgbToShort(unsigned char r, unsigned char g, unsigned char b) {
00153     //return ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3)  ;
00154     unsigned short red = r;
00155     unsigned short green = g;
00156     unsigned short blue = b;
00157 
00158     red >>= 3;
00159     green >>= 2;
00160     blue >>= 3;
00161 
00162     red &= 0x1F;
00163     green &= 0x3F;
00164     blue &= 0x1F;
00165 
00166     red <<= 8;
00167     blue <<= 3;
00168     green = ((green & 0x7) << 13) + ((green & 0x38) >> 3);
00169 
00170     return red | green | blue;
00171     
00172 }
00173 
00174 void DisplayN18::clear(unsigned short backColor) {
00175     for (unsigned int i = 0; i < DisplayN18::WIDTH; i += 10)
00176         for (unsigned int j = 0; j < DisplayN18::HEIGHT; j += 8)
00177             this->fillRect(i, j, 10, 8, backColor);
00178 }
00179 
00180 void DisplayN18::draw(const unsigned short* data, int x, int y, int width, int height) {
00181     this->setClippingArea(x, y, width - 1, height - 1);
00182     this->writeCommand(0x2C);
00183     this->writeData(reinterpret_cast<const unsigned char*>(data), width * height * 2);
00184 }
00185 
00186 void DisplayN18::setPixel(int x, int y, unsigned short foreColor) {
00187     this->draw(&foreColor, x, y, 1, 1);
00188 }
00189 
00190 void DisplayN18::fillRect(int x, int y, int width, int height, unsigned short foreColor) {
00191     this->setClippingArea(static_cast<unsigned char>(x), static_cast<unsigned char>(y), static_cast<unsigned char>(width - 1), static_cast<unsigned char>(height));
00192     
00193     this->writeCommand(0x2C);
00194     
00195     unsigned short buffer[50];
00196     for (int j = 0; j < sizeof(buffer) / 2; j++)
00197         buffer[j] = foreColor;
00198 
00199     this->rsPin.write(true);
00200 
00201     int i;
00202     for (i = sizeof(buffer); i < height * width * 2; i += sizeof(buffer))
00203         this->writeData(reinterpret_cast<unsigned char*>(buffer), sizeof(buffer));
00204     
00205     i -= sizeof(buffer);
00206     if (i != height * width * 2)
00207         this->writeData(reinterpret_cast<unsigned char*>(buffer), height * width * 2 - i);
00208 }
00209 
00210 void DisplayN18::drawRect(int x, int y, int width, int height, unsigned short foreColor) {
00211     this->drawLine(x, y, x + width, y, foreColor);
00212     this->drawLine(x, y + height, x + width, y + height, foreColor);
00213     this->drawLine(x, y, x, y + height, foreColor);
00214     this->drawLine(x + width, y, x + width, y + height, foreColor);
00215 }
00216 
00217 void DisplayN18::fillCircle(int x, int y, int radius, unsigned short foreColor) {
00218     int f = 1 - radius;
00219     int dd_f_x = 1;
00220     int dd_f_y = -2 * radius;
00221     int x1 = 0;
00222     int y1 = radius;
00223 
00224     for (int i = y - radius; i <= y + radius; i++)
00225         this->setPixel(x, i, foreColor);
00226 
00227     while (x1 < y1) {
00228         if (f >= 0) {
00229             y1--;
00230             dd_f_y += 2;
00231             f += dd_f_y;
00232         }
00233 
00234         x1++;
00235         dd_f_x += 2;
00236         f += dd_f_x;
00237 
00238         for (int i = y - y1; i <= y + y1; i++) {
00239             this->setPixel(x + x1, i, foreColor);
00240             this->setPixel(x - x1, i, foreColor);
00241         }
00242 
00243         for (int i = y - x1; i <= y + x1; i++) {
00244             this->setPixel(x + y1, i, foreColor);
00245             this->setPixel(x - y1, i, foreColor);
00246         }
00247     }
00248 }
00249 
00250 void DisplayN18::drawCircle(int x, int y, int radius, unsigned short foreColor) {
00251     int f = 1 - radius;
00252     int dd_f_x = 1;
00253     int dd_f_y = -2 * radius;
00254     int x1 = 0;
00255     int y1 = radius;
00256 
00257     this->setPixel(x, y + radius, foreColor);
00258     this->setPixel(x, y - radius, foreColor);
00259     this->setPixel(x + radius, y, foreColor);
00260     this->setPixel(x - radius, y, foreColor);
00261 
00262     while (x1 < y1) {
00263         if (f >= 0) {
00264             y1--;
00265             dd_f_y += 2;
00266             f += dd_f_y;
00267         }
00268 
00269         x1++;
00270         dd_f_x += 2;
00271         f += dd_f_x;
00272 
00273         this->setPixel(x + x1, y + y1, foreColor);
00274         this->setPixel(x - x1, y + y1, foreColor);
00275         this->setPixel(x + x1, y - y1, foreColor);
00276         this->setPixel(x - x1, y - y1, foreColor);
00277 
00278         this->setPixel(x + y1, y + x1, foreColor);
00279         this->setPixel(x - y1, y + x1, foreColor);
00280         this->setPixel(x + y1, y - x1, foreColor);
00281         this->setPixel(x - y1, y - x1, foreColor);
00282     }
00283 }
00284 
00285 void DisplayN18::drawLine(int x0, int y0, int x1, int y1, unsigned short foreColor) {
00286     if (x0 == x1) {
00287         if (y1 < y0) {
00288             int temp = y0;
00289             y0 = y1;
00290             y1 = temp;
00291         }
00292 
00293         this->setClippingArea(static_cast<unsigned char>(x0), static_cast<unsigned char>(y0), 0, static_cast<unsigned char>(y1 - y0 - 1));
00294         this->writeCommand(0x2C);
00295 
00296         unsigned short data[DisplayN18::STEP];
00297         for (int i = 0; i < DisplayN18::STEP; i++)
00298             data[i] = foreColor;
00299 
00300         for (unsigned char thisY = y0; thisY < y1; thisY += DisplayN18::STEP)
00301             this->writeData(reinterpret_cast<unsigned char*>(data), (thisY + DisplayN18::STEP <= y1 ? DisplayN18::STEP : y1 - thisY) * 2);
00302 
00303         return;
00304     }
00305 
00306     if (y0 == y1) {
00307         if (x1 < x0) {
00308             int temp = x0;
00309             x0 = x1;
00310             x1 = temp;
00311         }
00312 
00313         this->setClippingArea(static_cast<unsigned char>(x0), static_cast<unsigned char>(y0), static_cast<unsigned char>(x1 - x0 - 1), 0);
00314         this->writeCommand(0x2C);
00315 
00316         unsigned short data[DisplayN18::STEP];
00317         for (int i = 0; i < DisplayN18::STEP; i++)
00318             data[i] = foreColor;
00319 
00320         for (unsigned char thisX = x0; thisX < x1; thisX += DisplayN18::STEP)
00321             this->writeData(reinterpret_cast<unsigned char*>(data), (thisX + DisplayN18::STEP <= x1 ? DisplayN18::STEP : x1 - thisX) * 2);
00322 
00323         return;
00324     }
00325 
00326     int t;
00327     bool steep = ((y1 - y0) < 0 ? -(y1 - y0) : (y1 - y0)) > ((x1 - x0) < 0 ? -(x1 - x0) : (x1 - x0));
00328 
00329     if (steep) {
00330         t = x0;
00331         x0 = y0;
00332         y0 = t;
00333         t = x1;
00334         x1 = y1;
00335         y1 = t;
00336     }
00337 
00338     if (x0 > x1) {
00339         t = x0;
00340         x0 = x1;
00341         x1 = t;
00342 
00343         t = y0;
00344         y0 = y1;
00345         y1 = t;
00346     }
00347 
00348     int dx, dy;
00349     dx = x1 - x0;
00350     dy = (y1 - y0) < 0 ? -(y1 - y0) : (y1 - y0);
00351 
00352     int err = (dx / 2);
00353     int ystep;
00354 
00355     ystep = y0 < y1 ? 1 : -1;
00356 
00357     for (; x0 < x1; x0++) {
00358         if (steep)
00359             this->setPixel(y0, x0, foreColor);
00360         else
00361             this->setPixel(x0, y0, foreColor);
00362 
00363         err -= dy;
00364 
00365         if (err < 0) {
00366             y0 += (char)ystep;
00367             err += dx;
00368         }
00369     }
00370 }
00371 
00372 unsigned char characters[95 * 5] = {
00373     0x00, 0x00, 0x00, 0x00, 0x00, /* Space  0x20 */
00374     0x00, 0x00, 0x4f, 0x00, 0x00, /* ! */
00375     0x00, 0x07, 0x00, 0x07, 0x00, /* " */
00376     0x14, 0x7f, 0x14, 0x7f, 0x14, /* # */
00377     0x24, 0x2a, 0x7f, 0x2a, 0x12, /* $ */
00378     0x23, 0x13, 0x08, 0x64, 0x62, /* % */
00379     0x36, 0x49, 0x55, 0x22, 0x20, /* & */
00380     0x00, 0x05, 0x03, 0x00, 0x00, /* ' */
00381     0x00, 0x1c, 0x22, 0x41, 0x00, /* ( */
00382     0x00, 0x41, 0x22, 0x1c, 0x00, /* ) */
00383     0x14, 0x08, 0x3e, 0x08, 0x14, /* // */
00384     0x08, 0x08, 0x3e, 0x08, 0x08, /* + */
00385     0x50, 0x30, 0x00, 0x00, 0x00, /* , */
00386     0x08, 0x08, 0x08, 0x08, 0x08, /* - */
00387     0x00, 0x60, 0x60, 0x00, 0x00, /* . */
00388     0x20, 0x10, 0x08, 0x04, 0x02, /* / */
00389     0x3e, 0x51, 0x49, 0x45, 0x3e, /* 0      0x30 */
00390     0x00, 0x42, 0x7f, 0x40, 0x00, /* 1 */
00391     0x42, 0x61, 0x51, 0x49, 0x46, /* 2 */
00392     0x21, 0x41, 0x45, 0x4b, 0x31, /* 3 */
00393     0x18, 0x14, 0x12, 0x7f, 0x10, /* 4 */
00394     0x27, 0x45, 0x45, 0x45, 0x39, /* 5 */
00395     0x3c, 0x4a, 0x49, 0x49, 0x30, /* 6 */
00396     0x01, 0x71, 0x09, 0x05, 0x03, /* 7 */
00397     0x36, 0x49, 0x49, 0x49, 0x36, /* 8 */
00398     0x06, 0x49, 0x49, 0x29, 0x1e, /* 9 */
00399     0x00, 0x36, 0x36, 0x00, 0x00, /* : */
00400     0x00, 0x56, 0x36, 0x00, 0x00, /* ; */
00401     0x08, 0x14, 0x22, 0x41, 0x00, /* < */
00402     0x14, 0x14, 0x14, 0x14, 0x14, /* = */
00403     0x00, 0x41, 0x22, 0x14, 0x08, /* > */
00404     0x02, 0x01, 0x51, 0x09, 0x06, /* ? */
00405     0x3e, 0x41, 0x5d, 0x55, 0x1e, /* @      0x40 */
00406     0x7e, 0x11, 0x11, 0x11, 0x7e, /* A */
00407     0x7f, 0x49, 0x49, 0x49, 0x36, /* B */
00408     0x3e, 0x41, 0x41, 0x41, 0x22, /* C */
00409     0x7f, 0x41, 0x41, 0x22, 0x1c, /* D */
00410     0x7f, 0x49, 0x49, 0x49, 0x41, /* E */
00411     0x7f, 0x09, 0x09, 0x09, 0x01, /* F */
00412     0x3e, 0x41, 0x49, 0x49, 0x7a, /* G */
00413     0x7f, 0x08, 0x08, 0x08, 0x7f, /* H */
00414     0x00, 0x41, 0x7f, 0x41, 0x00, /* I */
00415     0x20, 0x40, 0x41, 0x3f, 0x01, /* J */
00416     0x7f, 0x08, 0x14, 0x22, 0x41, /* K */
00417     0x7f, 0x40, 0x40, 0x40, 0x40, /* L */
00418     0x7f, 0x02, 0x0c, 0x02, 0x7f, /* M */
00419     0x7f, 0x04, 0x08, 0x10, 0x7f, /* N */
00420     0x3e, 0x41, 0x41, 0x41, 0x3e, /* O */
00421     0x7f, 0x09, 0x09, 0x09, 0x06, /* P      0x50 */
00422     0x3e, 0x41, 0x51, 0x21, 0x5e, /* Q */
00423     0x7f, 0x09, 0x19, 0x29, 0x46, /* R */
00424     0x26, 0x49, 0x49, 0x49, 0x32, /* S */
00425     0x01, 0x01, 0x7f, 0x01, 0x01, /* T */
00426     0x3f, 0x40, 0x40, 0x40, 0x3f, /* U */
00427     0x1f, 0x20, 0x40, 0x20, 0x1f, /* V */
00428     0x3f, 0x40, 0x38, 0x40, 0x3f, /* W */
00429     0x63, 0x14, 0x08, 0x14, 0x63, /* X */
00430     0x07, 0x08, 0x70, 0x08, 0x07, /* Y */
00431     0x61, 0x51, 0x49, 0x45, 0x43, /* Z */
00432     0x00, 0x7f, 0x41, 0x41, 0x00, /* [ */
00433     0x02, 0x04, 0x08, 0x10, 0x20, /* \ */
00434     0x00, 0x41, 0x41, 0x7f, 0x00, /* ] */
00435     0x04, 0x02, 0x01, 0x02, 0x04, /* ^ */
00436     0x40, 0x40, 0x40, 0x40, 0x40, /* _ */
00437     0x00, 0x00, 0x03, 0x05, 0x00, /* `      0x60 */
00438     0x20, 0x54, 0x54, 0x54, 0x78, /* a */
00439     0x7F, 0x44, 0x44, 0x44, 0x38, /* b */
00440     0x38, 0x44, 0x44, 0x44, 0x44, /* c */
00441     0x38, 0x44, 0x44, 0x44, 0x7f, /* d */
00442     0x38, 0x54, 0x54, 0x54, 0x18, /* e */
00443     0x04, 0x04, 0x7e, 0x05, 0x05, /* f */
00444     0x08, 0x54, 0x54, 0x54, 0x3c, /* g */
00445     0x7f, 0x08, 0x04, 0x04, 0x78, /* h */
00446     0x00, 0x44, 0x7d, 0x40, 0x00, /* i */
00447     0x20, 0x40, 0x44, 0x3d, 0x00, /* j */
00448     0x7f, 0x10, 0x28, 0x44, 0x00, /* k */
00449     0x00, 0x41, 0x7f, 0x40, 0x00, /* l */
00450     0x7c, 0x04, 0x7c, 0x04, 0x78, /* m */
00451     0x7c, 0x08, 0x04, 0x04, 0x78, /* n */
00452     0x38, 0x44, 0x44, 0x44, 0x38, /* o */
00453     0x7c, 0x14, 0x14, 0x14, 0x08, /* p      0x70 */
00454     0x08, 0x14, 0x14, 0x14, 0x7c, /* q */
00455     0x7c, 0x08, 0x04, 0x04, 0x00, /* r */
00456     0x48, 0x54, 0x54, 0x54, 0x24, /* s */
00457     0x04, 0x04, 0x3f, 0x44, 0x44, /* t */
00458     0x3c, 0x40, 0x40, 0x20, 0x7c, /* u */
00459     0x1c, 0x20, 0x40, 0x20, 0x1c, /* v */
00460     0x3c, 0x40, 0x30, 0x40, 0x3c, /* w */
00461     0x44, 0x28, 0x10, 0x28, 0x44, /* x */
00462     0x0c, 0x50, 0x50, 0x50, 0x3c, /* y */
00463     0x44, 0x64, 0x54, 0x4c, 0x44, /* z */
00464     0x08, 0x36, 0x41, 0x41, 0x00, /* { */
00465     0x00, 0x00, 0x77, 0x00, 0x00, /* | */
00466     0x00, 0x41, 0x41, 0x36, 0x08, /* } */
00467     0x08, 0x08, 0x2a, 0x1c, 0x08  /* ~ */
00468 };
00469 
00470 void DisplayN18::drawCharacter(int x, int y, const char character, unsigned short foreColor, unsigned short backColor, unsigned char fontSize) {
00471     if (character > 126 || character < 32)
00472         return;
00473 
00474     unsigned short* horizontal = new unsigned short[DisplayN18::CHAR_HEIGHT * fontSize];
00475     for (int i = 0; i < DisplayN18::CHAR_WIDTH; i++) {
00476         for (int j = 0; j < DisplayN18::CHAR_HEIGHT; j++)
00477             for (int k = 0; k < fontSize; k++)
00478                 horizontal[j * fontSize + k] = characters[(character - 32) * 5 + i] & (1 << j) ? foreColor : backColor;
00479 
00480         for (int k = 0; k < fontSize; k++)
00481             this->draw(horizontal, x + i * fontSize + k, y, 1, DisplayN18::CHAR_HEIGHT * fontSize);
00482     }
00483 
00484     for (int i = 0; i < DisplayN18::CHAR_HEIGHT; i++)
00485         for (int k = 0; k < fontSize; k++)
00486             horizontal[i * fontSize + k] = backColor;
00487 
00488     for (int k = 0; k < fontSize; k++)
00489         this->draw(horizontal, x + DisplayN18::CHAR_WIDTH * fontSize + k, y, 1, DisplayN18::CHAR_HEIGHT * fontSize);
00490 
00491     delete[] horizontal;
00492 }
00493 
00494 void DisplayN18::drawString(int x, int y, const char* str, unsigned short foreColor, unsigned short backColor, unsigned char fontSize) {
00495     if (*str == '\0')
00496         return;
00497 
00498     do {
00499         this->drawCharacter(x, y, *str, foreColor, backColor, fontSize);
00500         
00501         x += (DisplayN18::CHAR_WIDTH + DisplayN18::CHAR_SPACING) * fontSize;
00502     } while (*(++str) != '\0');
00503 }