X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/6dc0e5dfc2d00d5f2fd0cf684c87cf889b9d4ae9..4292be14c78b8f30075c9e4837dd026f6fec532e:/drivers/displays/bitmap/ssd1306/ssd1306.c diff --git a/drivers/displays/bitmap/ssd1306/ssd1306.c b/drivers/displays/bitmap/ssd1306/ssd1306.c index f7d55b0..304d1ec 100644 --- a/drivers/displays/bitmap/ssd1306/ssd1306.c +++ b/drivers/displays/bitmap/ssd1306/ssd1306.c @@ -216,7 +216,7 @@ static void ssd1306DrawChar(uint16_t x, uint16_t y, uint8_t c, struct FONT_DEF f // Retrieve appropriate columns from font data for (col = 0; col < font.u8Width; col++) { - column[col] = font.au8FontTable[((c - 32) * font.u8Width) + col]; // Get first column of appropriate character + column[col] = font.au8FontTable[((c - font.u8FirstChar) * font.u8Width) + col]; // Get first column of appropriate character } } else @@ -351,16 +351,6 @@ void ssd1306Init(uint8_t vccstate) // I2C Initialisation #if defined SSD1306_BUS_I2C - // Set all pins to output - gpioSetDir(SSD1306_RST_PORT, SSD1306_RST_PORT, gpioDirection_Output); - - // Reset the LCD - gpioSetValue(SSD1306_RST_PORT, SSD1306_RST_PIN, 1); - DELAY(1); - gpioSetValue(SSD1306_RST_PORT, SSD1306_RST_PIN, 0); - DELAY(10); - gpioSetValue(SSD1306_RST_PORT, SSD1306_RST_PIN, 1); - #if defined SSD1306_128_32 // Init sequence taken from datasheet for UG-2832HSWEG04 (128x32 OLED module) ssd1306SendCommand(SSD1306_DISPLAYOFF); // 0xAE @@ -500,7 +490,7 @@ uint8_t ssd1306GetPixel(uint8_t x, uint8_t y) /**************************************************************************/ void ssd1306ClearScreen() { - memset(_ssd1306buffer, 0, 1024); + memset(_ssd1306buffer, 0x00, sizeof(_ssd1306buffer)); } /**************************************************************************/ @@ -516,7 +506,7 @@ void ssd1306Refresh(void) CMD(SSD1306_SETSTARTLINE | 0x0); // line #0 uint16_t i; - for (i=0; i<1024; i++) + for (i = 0; i < sizeof(_ssd1306buffer); i++) { DATA(_ssd1306buffer[i]); } @@ -528,7 +518,7 @@ void ssd1306Refresh(void) ssd1306SendCommand(SSD1306_SETSTARTLINE | 0x0); // line #0 uint16_t i; - for (i=0; i<1024; i++) + for (i = 0; i < sizeof(_ssd1306buffer); i++) { ssd1306SendData(_ssd1306buffer[i]); }