diff --git a/firmware/src/main.c b/firmware/src/main.c index 27add27..d51eb62 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -22,7 +22,7 @@ #define TWI_SDA PC4 #define TWI_SCL PC5 -#define SI5351_ADDRESS (0x60 << 1) +#define SI5351_ADDRESS 0x60 #define SYM_ENTRY(SYM) { SYM, sizeof(SYM) / 2 } @@ -386,8 +386,8 @@ static uint8_t twi_read_register(const uint8_t address, const uint8_t reg) { twi_start(); - if (twi_transmit(address) != TW_MT_SLA_ACK) twi_error(); + if (twi_transmit(address << 1) != TW_MT_SLA_ACK) if (twi_transmit(reg) != TW_MT_DATA_ACK) twi_error(); @@ -398,8 +398,8 @@ static uint8_t twi_read_register(const uint8_t address, twi_start(); - if (twi_transmit(address + 1) != TW_MR_SLA_ACK) twi_error(); + if (twi_transmit((address << 1) + 1) != TW_MR_SLA_ACK) if (twi_receive() != TW_MR_DATA_NACK) twi_error(); @@ -414,8 +414,8 @@ static void twi_write_register(const uint8_t address, const uint8_t data) { twi_start(); - if (twi_transmit(address) != TW_MT_SLA_ACK) twi_error(); + if (twi_transmit(address << 1) != TW_MT_SLA_ACK) if (twi_transmit(reg) != TW_MT_DATA_ACK) twi_error();