39#define TWI_BIT_RATE_REG ((F_CPU/F_SCL - 16) / 2)
57#define DDR(_x) (*(&_x - 1))
58#define PIN(_x) (*(&_x - 2))
uint8_t twi_write(uint8_t data)
Write one byte to the I2C/TWI bus.
Definition twi.c:51
void twi_init(void)
Initialize TWI unit, enable internal pull-ups, and set SCL frequency.
Definition twi.c:20
void twi_readfrom_mem_into(uint8_t addr, uint8_t memaddr, volatile uint8_t *buf, uint8_t nbytes)
Read into buf from the peripheral, starting from the memory address.
Definition twi.c:132
void twi_stop(void)
Generates Stop condition on I2C/TWI bus.
Definition twi.c:99
uint8_t twi_test_address(uint8_t addr)
Test presence of one I2C device on the bus.
Definition twi.c:111
uint8_t twi_read(uint8_t ack)
Read one byte from the I2C/TWI bus and acknowledge it by ACK or NACK.
Definition twi.c:82
void twi_start(void)
Start communication on I2C/TWI bus.
Definition twi.c:37