Print actual status and data on TWI error

The contents of `TWSR` (TWI Status Register) and `TWDR` (TWI Data
Register) are printed when an error occured.
This commit is contained in:
finga 2021-09-23 22:47:17 +02:00
parent 664aa4bad5
commit 2579ae3686

View file

@ -336,6 +336,20 @@ static void lcd_splash(void) {
static void twi_error(void) {
lcd_fill(0xFF);
for (uint8_t i = 0; i < 2; i++) {
lcd_move_cursor(0, i);
lcd_write_string_page("TW_STATUS:\0", i, true);
lcd_write_kerning(2, true);
lcd_write_integer_page(TW_STATUS, 3, i, true);
}
for (uint8_t i = 0; i < 2; i++) {
lcd_move_cursor(0, i + 2);
lcd_write_string_page("TW_DATA:\0", i, true);
lcd_write_kerning(16, true);
lcd_write_integer_page(TWDR, 3, i, true);
}
for (;;);
}