From: Martin Mares Date: Sun, 24 Jun 2018 23:31:32 +0000 (+0200) Subject: Display debugged X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b0af12e0dcbfe488ec9b7c4fb49915406da27e70;p=home-hw.git Display debugged --- diff --git a/Src/display.c b/Src/display.c index 06c5fe2..3ef49bc 100644 --- a/Src/display.c +++ b/Src/display.c @@ -56,8 +56,7 @@ static const byte display_init_cmds[] = { SSD1306_SETCONTRAST, 0x7F, // contrast level 127 SSD1306_SETPRECHARGE, 0xF1, // pre-charge period (1, 15) SSD1306_SETVCOMDETECT, 0x40, // vcomh regulator level- - // SSD1306_DISPLAYALLON_RESUME, - SSD1306_DISPLAYALLON, + SSD1306_DISPLAYALLON_RESUME, SSD1306_NORMALDISPLAY, SSD1306_DISPLAYON, }; @@ -80,6 +79,8 @@ static void display_cmd(byte cmd) LL_I2C_ClearFlag_ADDR(I2C2); display_send_byte(0x00); // Will send a command display_send_byte(cmd); + while (!LL_I2C_IsActiveFlag_TXE(I2C2)) + ; LL_I2C_GenerateStopCondition(I2C2); } @@ -102,6 +103,8 @@ static void display_data(byte d) static void display_data_end(void) { + while (!LL_I2C_IsActiveFlag_TXE(I2C2)) + ; LL_I2C_GenerateStopCondition(I2C2); } @@ -128,7 +131,6 @@ void display_init(void) void display_counter(uint cnt) { -#if 0 byte d[5]; for (uint i=0; i<5; i++) { @@ -155,5 +157,4 @@ void display_counter(uint cnt) } display_data_end(); } -#endif }