From 888a5af823e524218fc9be1f4c9323705aeb1ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Wed, 7 Dec 2022 11:18:40 +0100 Subject: [PATCH] =?UTF-8?q?NAK=20I=C2=B2C=20write=20when=20EDID=20protecte?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index cedf44e..b85931f 100644 --- a/main.c +++ b/main.c @@ -580,7 +580,11 @@ void i2c(void) __interrupt(IRQ_I2C) // auto wakeup I2C_DR = *(uint8_t*)(EEPROM_ADDR + i2c_addr++); // transmit selected byte i2c_input_new = false; // notify we send data } else { // we will receive data - I2C_CR2 |= I2C_CR2_ACK; // ACK next received byte + if (EDID_PORT->IDR.reg & EDID_PIN) { // EDID switched off + I2C_CR2 &= I2C_CR2_ACK; // NACK next received byte to indicate programming it disabled + } else { + I2C_CR2 |= I2C_CR2_ACK; // ACK next received byte + } i2c_input_new = true; // notify we get data } }