diff --git a/ssd1306.c b/ssd1306.c --- a/ssd1306.c +++ b/ssd1306.c @@ -250,7 +250,7 @@ void ssd1306_drawlogo() setStartPage(0); setStartColumn(0); - for(i = 0; i<32; i++) + for(i = 0; i < 32; i++) { WriteData(row[3][i]); } @@ -260,15 +260,14 @@ void ssd1306_drawlogo() /* Print a single character from font.cpp */ void ssd1306_drawchar(char ascii, unsigned char row, unsigned char xPos) { - char *srcPointer = -1; - unsigned char i; + const char *srcPointer = (char*)-1; srcPointer = &fontData[(ascii-32)][0]; setStartPage(row); setStartColumn(xPos); - for(i=0;i<5;i++) + for(uint8_t i = 0; i < 5; i++) { WriteData(*srcPointer); srcPointer++; @@ -278,8 +277,7 @@ void ssd1306_drawchar(char ascii, unsign void ssd1306_drawcharbig(char ascii, unsigned char row, unsigned char xPos) { - char *srcPointer = -1; - unsigned char i; + const char *srcPointer = (char*)-1; srcPointer = &fontData[(ascii-32)][0]; @@ -287,7 +285,7 @@ void ssd1306_drawcharbig(char ascii, uns setStartColumn(xPos); // Write first row - for(i=0;i<5;i++) + for(uint8_t i = 0; i < 5; i++) { uint8_t data = 0; data |= ((*srcPointer) & 0b1000) << 4; // get top 4 bits @@ -315,7 +313,7 @@ void ssd1306_drawcharbig(char ascii, uns setStartColumn(xPos); // Write second row - for(i=0;i<5;i++) + for(uint8_t i = 0; i < 5; i++) { uint8_t data = 0; data |= (*srcPointer) & 0b10000000; // get top 4 bits