From f091b1e316cdc47cb7831b7278ea43a09089187d Mon Sep 17 00:00:00 2001 From: Markus Hitter Date: Wed, 27 Apr 2016 00:04:26 +0200 Subject: [PATCH] display_ssd1306.c: note a possible error recovery strategy. Currently not implemented because this costs additional binary size and, well, with I2C being reliable now, it's difficult to test it. And also because I'm lazy :-) --- display_ssd1306.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/display_ssd1306.c b/display_ssd1306.c index 3b4f62d..a3dc08b 100644 --- a/display_ssd1306.c +++ b/display_ssd1306.c @@ -125,6 +125,15 @@ void display_tick() { return; } + /** + Possible strategy for error recovery: after a failed, aborted I2C + transmisson, 'i2c_state & I2C_INTERRUPTED' in i2c.c evaluates to true. + + Having a getter like displaybus_failed() would allow to test this condition + here, so we could resend the previous data again, instead of grabbing a + new byte from the buffer. + */ + if (buf_canread(display)) { buf_pop(display, data); index = data - 0x20;