Move shifting of TWI slave address
As this may be obscure the shifting of the TWI slave address is moved to where it is used instead of where it is set.
This commit is contained in:
parent
c0f8cac065
commit
2beecbe722
1 changed files with 4 additions and 4 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue