Functions
hal/i2c.h File Reference

I2C interface using AVR Two-Wire Interface (TWI) hardware. More...

#include <util/twi.h>
#include "i2cconf.h"

Functions

void i2cInit (void)
 Initialize I2C (TWI) interface.
void i2cSetBitrate (uint16_t bitrateKHz)
 Set the I2C transaction bitrate (in KHz)
void i2cSetLocalDeviceAddr (uint8_t deviceAddr, uint8_t genCallEn)
 Set the local (AVR processor's) I2C device address.
void i2cSetSlaveReceiveHandler (void(*i2cSlaveRx_func)(uint8_t receiveDataLength, uint8_t *recieveData))
 Set the user function which handles receiving (incoming) data as a slave.
void i2cSetSlaveTransmitHandler (uint8_t(*i2cSlaveTx_func)(uint8_t transmitDataLengthMax, uint8_t *transmitData))
 Set the user function which handles transmitting (outgoing) data as a slave.
void i2cSendStart (void)
 Send an I2C start condition in Master mode.
void i2cSendStop (void)
 Send an I2C stop condition in Master mode.
void i2cWaitForComplete (void)
 Wait for current I2C operation to complete.
void i2cSendByte (uint8_t data)
 Send an (address|R/W) combination or a data byte over I2C.
void i2cReceiveByte (uint8_t ackFlag)
 Receive a data byte over I2C.
uint8_t i2cGetReceivedByte (void)
 Pick up the data that was received with i2cReceiveByte()
uint8_t i2cGetStatus (void)
 Get current I2c bus status from TWSR.
void i2cMasterSend (uint8_t deviceAddr, uint8_t length, uint8_t *data)
 send I2C data to a device on the bus
void i2cMasterReceive (uint8_t deviceAddr, uint8_t length, uint8_t *data)
 receive I2C data from a device on the bus
void i2cMasterSendNI (uint8_t deviceAddr, uint8_t length, uint8_t *data)
 send I2C data to a device on the bus (non-interrupt based)
void i2cMasterReceiveNI (uint8_t deviceAddr, uint8_t length, uint8_t *data)
 receive I2C data from a device on the bus (non-interrupt based)

Detailed Description