m06e00 ok

This commit is contained in:
hugo LAMY
2025-03-16 10:43:33 +01:00
parent de938b5377
commit 28f0617e48
3 changed files with 25 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
#define TWI_PRESCALE_VALUE 1 // can be 1, 4, 16, 64
#define TWI_FREQ 100000UL // 100kHz I2C
#define SLAVE_ADDRESS 42 // 22.3.3 : address 0000000 and 1111xxx are reserved, 42 is 0101010
#define SLAVE_ADDRESS 0x38 // doc AHT20, 7.3 : address of thermistor
void i2c_init(void) {
TWSR = TWI_PRESCALE_SET(TWI_PRESCALE_VALUE); // 22.9.3 : (Status Register) set prescaler
@@ -14,7 +14,6 @@ void i2c_start(void) {
while (!(TEST(TWCR, TWINT))); // p225 example code : Wait for TWINT Flag set. This indicates that the START condition has been transmitted
uint8_t status = TWSR & 0b11111000; // Table 22-2. Status codes for Master Transmitter Mode
uart_printstr_itoa_base_endl(status, 2);
if (status != TW_START && status != TW_REP_START) {
TWCR = SEND_STOP_CONDITION;
return;