NetBurner 3.0
Advanced NetBurner I2C Functions

Functions

uint8_t Master_I2CStart (uint8_t addr, bool Read_Not_Write, uint32_t ticks_to_wait=I2C_START_TIMEOUT)
 Start of communication with a slave device. More...
 
uint8_t Master_I2CStop (uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT)
 Will issue a stop signal if the module has master control of the I2C bus and will release the bus if we are a slave device. More...
 
uint8_t Master_I2CSend (uint8_t val, uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT)
 This function sends a single byte on the I2C bus. More...
 
uint8_t Master_I2CRead (puint8_t val, uint32_t ticks_to_wait=I2C_RX_TX_TIMEOUT)
 This function reads a single byte in master mode from the I2C bus. More...
 

Detailed Description

The following functions are used for advanced communications on using the I2C bus. These functions are useful if the user wishes to talk to a device that does not follow the Phillips I2C standard. One example is an EEPROM that first must be addressed and then read from with no restart in between.

Data must be sent or received a byte at a time. Also user must check function returns to verify the status of the bus before performing the next option.

Function Documentation

◆ Master_I2CRead()

uint8_t Master_I2CRead ( puint8_t  val,
uint32_t  ticks_to_wait = I2C_RX_TX_TIMEOUT 
)

This function reads a single byte in master mode from the I2C bus.

Does not handle No ACK of last byte, which needs to have a I2C_SET_NO_ACK called before the last read.

Parameters
valA pointer to a byte location to store the read value.
ticks_to_waitThe number of system time ticks before a timeout occurs.
Returns
i2cMasterReturnValues
See also
Master_I2CStart()
Master_I2CStop()
Master_I2CSend()

◆ Master_I2CSend()

uint8_t Master_I2CSend ( uint8_t  val,
uint32_t  ticks_to_wait = I2C_RX_TX_TIMEOUT 
)

This function sends a single byte on the I2C bus.

Parameters
valThe byte to send.
ticks_to_waitThe number of system time ticks before a timeout occurs.
Returns
i2cMasterReturnValues
See also
Master_I2CStart()
Master_I2CStop()
Master_I2CRead()

◆ Master_I2CStart()

uint8_t Master_I2CStart ( uint8_t  addr,
bool  Read_Not_Write,
uint32_t  ticks_to_wait = I2C_START_TIMEOUT 
)

Start of communication with a slave device.

Parameters
addrThe 7-bit address of the slave device we wish to communicate with on the bus.
Read_Not_WriteTrue to read, false to write. Note: You can use I2C_START_READ or I2C_START_WRITE as values.
ticks_to_waitThe amount of time we will wait for a start transmission to complete this time includes waiting for a busy bus to become active plus the time it takes to receive an an ACK from the slave device.
Returns
i2cMasterReturnValues
See also
Master_I2CStop()
Master_I2CSend()
Master_I2CRead()

◆ Master_I2CStop()

uint8_t Master_I2CStop ( uint32_t  ticks_to_wait = I2C_RX_TX_TIMEOUT)

Will issue a stop signal if the module has master control of the I2C bus and will release the bus if we are a slave device.

Parameters
ticks_to_waitHow long to wait to ensure the bus has been released.
Returns
i2cMasterReturnValues
See also
Master_I2CStart()
Master_I2CSend()
Master_I2CRead()