X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=Src%2Fdisplay.c;h=3ef49bca14a8b1f41ce300debc1724abf53a6e27;hb=b0af12e0dcbfe488ec9b7c4fb49915406da27e70;hp=06c5fe22aff217f9ccb761f2a73e19d87a7cd737;hpb=4b65af0c3b9e7d965515044e5761ba3003ee38aa;p=home-hw.git 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 }