diff --git a/main.c b/main.c --- a/main.c +++ b/main.c @@ -29,6 +29,8 @@ uint32_t packet_sent=1; uint32_t packet_receive=1; + + static __IO uint32_t TimingDelay; // Move to header file @@ -68,8 +70,10 @@ int main(void) ssd1306_Init(); ssd1306_block_write(); - ssd1306_DrawString("Hello World!", 0, 10); + ssd1306_DrawString("therm 0.1", 0, 40); + ssd1306_DrawString("Status: Idle", 2, 40); // ssd1306_block_write(); + ssd1306_test(); uint8_t toggle = 0; while(1) @@ -93,11 +97,11 @@ int main(void) if(!sw_btn) { GPIO_ToggleBits(LED_STAT); if(!toggle) { - ssd1306_DrawString("I freaking work!", 2, 10); + ssd1306_DrawString("________________", 3, 32); toggle = ! toggle; } else { - ssd1306_block_write(); + ssd1306_DrawString("----------------", 3, 32); toggle = ! toggle; } } diff --git a/ssd1306.c b/ssd1306.c --- a/ssd1306.c +++ b/ssd1306.c @@ -635,6 +635,60 @@ void setStartColumn(unsigned char d) // Default => 0x10 } + +const uint8_t row[4][32] = { + + +{0x00,0x00,0x01,0x03,0x07,0x0F,0x1E,0x3C,0x3C,0x7C,0x7C,0x7C,0xFC,0xFF,0xFF,0xFC,0xFC,0xFC,0xFC,0xFF,0x7F,0x7F,0x7F,0x3C,0x3C,0x1C,0x0C,0x06,0x03,0x01,0x00,0x00}, + +{0x0F,0x7F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x3F,0x3F,0x7F,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x7F,0x0F}, + +{0xF0,0xFE,0xFF,0xFF,0xFF,0xC7,0x00,0x00,0x00,0x00,0x87,0xC7,0xC7,0xFF,0xFF,0x00,0x00,0x00,0x00,0x87,0x87,0xC7,0xC3,0x03,0x07,0x07,0x0F,0x7F,0xFF,0xFF,0xFE,0xF0}, + +{0x00,0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFF,0xFF,0xFF,0x1F,0x1F,0x1F,0x1F,0xFF,0xFE,0xFE,0xFE,0xFC,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00}, + + + + +}; + +void ssd1306_test() +{ + uint8_t i = 0; + setStartPage(3); + setStartColumn(0); + for(i = 0; i<32; i++) + { + WriteData(row[0][i]); + } + + WriteData(0x00); + + setStartPage(2); + setStartColumn(0); + for(i = 0; i<32; i++) + { + WriteData(row[1][i]); + } + WriteData(0x00); + + setStartPage(1); + setStartColumn(0); + for(i = 0; i<32; i++) + { + WriteData(row[2][i]); + } + WriteData(0x00); + + setStartPage(0); + setStartColumn(0); + for(i = 0; i<32; i++) + { + WriteData(row[3][i]); + } + WriteData(0x00); +} + /* Print a single character from font.cpp */ void ssd1306_DrawChar(char ascii, unsigned char row, unsigned char xPos) { diff --git a/ssd1306.h b/ssd1306.h --- a/ssd1306.h +++ b/ssd1306.h @@ -50,5 +50,6 @@ unsigned long ssd1306_DrawPoint(Pos_t x, void ssd1306_block_write(void); void ssd1306_DrawChar(char ascii, unsigned char row, unsigned char xPos); void ssd1306_DrawString(const char *dataPtr, unsigned char row, unsigned char xPos); +void ssd1306_test(); #endif