NetBurner 3.5.6
PDF Version |
NetBurner I2C API for MOD5441x and NANO54415. More...
Go to the source code of this file.
Macros | |
Multichannel I2C Return Values | |
#define | I2C_OK (0) |
Last instruction terminated correctly. | |
#define | I2C_NEXT_WRITE_OK (1) |
I2C bus is OK for a write. | |
#define | I2C_NEXT_READ_OK (2) |
I2C bus is OK for a read. | |
#define | I2C_MASTER_OK (3) |
I2C finished transmission but still owns but (need to stop or restart) | |
#define | I2C_TIMEOUT (4) |
A timeout occurred while trying communicate on I2C bus. | |
#define | I2C_BUS_NOT_AVAIL (5) |
A timeout occurred while trying gain I2C bus control. | |
#define | I2C_NOT_READY (6) |
A read or write was attempted before I2C ready or during a slave transmission. | |
#define | I2C_LOST_ARB (7) |
Lost arbitration during start. | |
#define | I2C_LOST_ARB_ADD (8) |
Lost arbitration and then winner addressed our slave address. | |
#define | I2C_NO_LINK_RX_ACK (9) |
We are in Master TX mode and received no ACK from slave device, possibly during start. | |
Multichannel I2C Macros | |
I2C Macros | |
#define | I2C_SR_BUSY (((0x20 & I2C_SR) == 0x20)) |
Bus is busy (bit 5 of I2SR) | |
#define | I2C_CR_SLAVE (((0x20 & I2C_CR) == 0x00)) |
Bus set as slave (bit 5 of I2CR) | |
#define | I2C_SR_ARB_LOST (((0x10 & I2C_SR) == 0x10)) |
Bus arbitration was lost (bit 4 of I2SR) | |
#define | I2C_SR_ADRES_AS_SLAVE (((0x40 & I2C_SR) == 0x40)) |
Addressed as a slave (bit 6 of I2SR) | |
#define | I2C_SR_SLAVE_TX (((0x04 & I2C_SR) == 0x04)) |
State of read/write bit of the received address command (bit 2 of I2SR) | |
#define | I2C_CR_TX (((0x10 & I2C_CR) == 0x10)) |
Configured for transmit (bit 4 of I2CR) | |
#define | I2C_SR_RX_ACK (((0x01 & I2C_SR) == 0x00)) |
Received a RX ACK after last transmit (bit 0 of I2SR) | |
#define | I2C_CR_RX_ACK (((0x08 & I2C_CR) == 0x00)) |
Configured to RX Ack. | |
#define | I2C_SET_NO_ACK ((I2C_CR |= 0x08)) |
Configure I2C module not to send a RX ACK (bit 3 of I2CR) | |
#define | I2C_SET_ACK ((I2C_CR &= 0xF7)) |
Configure I2C module to send a RX ACK (bit 3 of I2CR) | |
#define | I2C_SET_TX ((I2C_CR |= 0x10)) |
Configure I2C module to be in TX mode (bit 4 of I2CR) | |
#define | I2C_SET_RX ((I2C_CR &= 0xEF)) |
Configure I2C module to be in RX mode (bit 4 of I2CR) | |
#define | I2C_SET_REPEAT_START ((I2C_CR |= 0x04)) |
Configure I2C to send a repeated start signal. | |
#define | I2C_CLR_ARB_LOST ((I2C_SR &= 0xEF)) |
Clear Arbitration lost error condition. | |
Functions | |
void | MultiChannel_I2CInit (int moduleNum=DEFAULT_I2C_MODULE, uint8_t slave_Addr=0x08, uint8_t freqdiv=0x3C) |
Initialize the I2C peripheral module. | |
uint8_t | MultiChannel_I2CSendBuf (int moduleNum, uint8_t addr, puint8_t buf, int num, bool stop=true) |
Send a buffer of bytes to an I2C device. | |
uint8_t | MultiChannel_I2CReadBuf (int moduleNum, uint8_t addr, puint8_t buf, int num, bool stop=true) |
Read a number of bytes from an I2C device and store in the specified buffer. | |
void | I2CMultiChannelResetPeripheral (int moduleNum) |
Reset the specified I2C peripheral module. | |
uint8_t | MultiChannel_I2CRestart (int moduleNum, uint8_t addr, bool Read_Not_Write, uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT) |
Restart communication with a I2C device. | |
uint8_t | MultiChannel_I2CStart (int moduleNum, uint8_t addr, bool Read_Not_Write, uint32_t ticks_to_wait=I2C_START_TIMEOUT) |
Send an I2C start to an I2C device to begin communication. | |
uint8_t | MultiChannel_I2CStop (int moduleNum=DEFAULT_I2C_MODULE, uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT) |
Issue an I2C stop terminate communication with an I2C device and release the bus. | |
uint8_t | MultiChannel_I2CSend (int moduleNum, uint8_t val, uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT) |
Send a single byte on the I2C bus. | |
uint8_t | MultiChannel_I2CRead (int moduleNum, puint8_t val, uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT) |
Read a single byte from the I2C bus. | |
NetBurner I2C API for MOD5441x and NANO54415.