use I²C NAK to indicate programming is disabled
This commit is contained in:
parent
df611e4436
commit
41435806b8
6
main.c
6
main.c
|
@ -503,6 +503,7 @@ level pulse on the Hot Plug Detect pin. This pulse shall be at least 100 msec.
|
|||
if (i2c_prog) { // received data over i2c to be programmed
|
||||
if (EDID_PORT->IDR.reg & EDID_PIN) { // EDID switched off
|
||||
puts("I²C prog disabled\r\n");
|
||||
I2C_CR2 &= I2C_CR2_ACK; // NACK next received byte to indicate programming it disabled
|
||||
} else { // EDID programming allowed
|
||||
/*
|
||||
puts("I²C prog ");
|
||||
|
@ -525,7 +526,7 @@ level pulse on the Hot Plug Detect pin. This pulse shall be at least 100 msec.
|
|||
if (!(FLASH_IAPSR & FLASH_IAPSR_EOP)) {
|
||||
FLASH_IAPSR &= ~FLASH_IAPSR_DUL; // re-enable write protection
|
||||
LED_PORT->ODR.reg &= ~LED_PIN; // switch LED on to indicate programming failed
|
||||
//I2C_CR2 &= I2C_CR2_ACK; // NACK next received byte
|
||||
I2C_CR2 &= I2C_CR2_ACK; // NACK next received byte to indicate programming error
|
||||
puts("EEPROM byte prog failed\r\n");
|
||||
}
|
||||
FLASH_IAPSR &= ~FLASH_IAPSR_DUL; // re-enable write protection
|
||||
|
@ -564,6 +565,9 @@ void i2c(void) __interrupt(IRQ_I2C) // auto wakeup
|
|||
} else { // received data byte
|
||||
i2c_prog = true; // notify main loop data needs to be programmed
|
||||
}
|
||||
if (EDID_PORT->IDR.reg & EDID_PIN) { // EDID programming is not enabled
|
||||
I2C_CR2 &= I2C_CR2_ACK; // NACK next received byte to indicate programming it disabled
|
||||
}
|
||||
}
|
||||
if (sr1 & I2C_SR1_STOPF) { // stop received
|
||||
I2C_CR2 |= I2C_CR2_ACK; // this is just to clear the flag
|
||||
|
|
Loading…
Reference in New Issue