MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
eusci_b_i2c

Functions

void EUSCI_B_I2C_initMaster (uint16_t baseAddress, EUSCI_B_I2C_initMasterParam *param)
 Initializes the I2C Master block. More...
 
void EUSCI_B_I2C_initSlave (uint16_t baseAddress, EUSCI_B_I2C_initSlaveParam *param)
 Initializes the I2C Slave block. More...
 
void EUSCI_B_I2C_enable (uint16_t baseAddress)
 Enables the I2C block. More...
 
void EUSCI_B_I2C_disable (uint16_t baseAddress)
 Disables the I2C block. More...
 
void EUSCI_B_I2C_setSlaveAddress (uint16_t baseAddress, uint8_t slaveAddress)
 Sets the address that the I2C Master will place on the bus. More...
 
void EUSCI_B_I2C_setMode (uint16_t baseAddress, uint8_t mode)
 Sets the mode of the I2C device. More...
 
uint8_t EUSCI_B_I2C_getMode (uint16_t baseAddress)
 Gets the mode of the I2C device. More...
 
void EUSCI_B_I2C_slavePutData (uint16_t baseAddress, uint8_t transmitData)
 Transmits a byte from the I2C Module. More...
 
uint8_t EUSCI_B_I2C_slaveGetData (uint16_t baseAddress)
 Receives a byte that has been sent to the I2C Module. More...
 
uint16_t EUSCI_B_I2C_isBusBusy (uint16_t baseAddress)
 Indicates whether or not the I2C bus is busy. More...
 
uint16_t EUSCI_B_I2C_masterIsStopSent (uint16_t baseAddress)
 Indicates whether STOP got sent. More...
 
uint16_t EUSCI_B_I2C_masterIsStartSent (uint16_t baseAddress)
 Indicates whether Start got sent. More...
 
void EUSCI_B_I2C_enableInterrupt (uint16_t baseAddress, uint16_t mask)
 Enables individual I2C interrupt sources. More...
 
void EUSCI_B_I2C_disableInterrupt (uint16_t baseAddress, uint16_t mask)
 Disables individual I2C interrupt sources. More...
 
void EUSCI_B_I2C_clearInterrupt (uint16_t baseAddress, uint16_t mask)
 Clears I2C interrupt sources. More...
 
uint16_t EUSCI_B_I2C_getInterruptStatus (uint16_t baseAddress, uint16_t mask)
 Gets the current I2C interrupt status. More...
 
void EUSCI_B_I2C_masterSendSingleByte (uint16_t baseAddress, uint8_t txData)
 Does single byte transmission from Master to Slave. More...
 
uint8_t EUSCI_B_I2C_masterReceiveSingleByte (uint16_t baseAddress)
 Does single byte reception from Slave. More...
 
bool EUSCI_B_I2C_masterSendSingleByteWithTimeout (uint16_t baseAddress, uint8_t txData, uint32_t timeout)
 Does single byte transmission from Master to Slave with timeout. More...
 
void EUSCI_B_I2C_masterSendMultiByteStart (uint16_t baseAddress, uint8_t txData)
 Starts multi-byte transmission from Master to Slave. More...
 
bool EUSCI_B_I2C_masterSendMultiByteStartWithTimeout (uint16_t baseAddress, uint8_t txData, uint32_t timeout)
 Starts multi-byte transmission from Master to Slave with timeout. More...
 
void EUSCI_B_I2C_masterSendMultiByteNext (uint16_t baseAddress, uint8_t txData)
 Continues multi-byte transmission from Master to Slave. More...
 
bool EUSCI_B_I2C_masterSendMultiByteNextWithTimeout (uint16_t baseAddress, uint8_t txData, uint32_t timeout)
 Continues multi-byte transmission from Master to Slave with timeout. More...
 
void EUSCI_B_I2C_masterSendMultiByteFinish (uint16_t baseAddress, uint8_t txData)
 Finishes multi-byte transmission from Master to Slave. More...
 
bool EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout (uint16_t baseAddress, uint8_t txData, uint32_t timeout)
 Finishes multi-byte transmission from Master to Slave with timeout. More...
 
void EUSCI_B_I2C_masterSendStart (uint16_t baseAddress)
 This function is used by the Master module to initiate START. More...
 
void EUSCI_B_I2C_masterSendMultiByteStop (uint16_t baseAddress)
 Send STOP byte at the end of a multi-byte transmission from Master to Slave. More...
 
bool EUSCI_B_I2C_masterSendMultiByteStopWithTimeout (uint16_t baseAddress, uint32_t timeout)
 Send STOP byte at the end of a multi-byte transmission from Master to Slave with timeout. More...
 
void EUSCI_B_I2C_masterReceiveStart (uint16_t baseAddress)
 Starts reception at the Master end. More...
 
uint8_t EUSCI_B_I2C_masterReceiveMultiByteNext (uint16_t baseAddress)
 Starts multi-byte reception at the Master end one byte at a time. More...
 
uint8_t EUSCI_B_I2C_masterReceiveMultiByteFinish (uint16_t baseAddress)
 Finishes multi-byte reception at the Master end. More...
 
bool EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout (uint16_t baseAddress, uint8_t *txData, uint32_t timeout)
 Finishes multi-byte reception at the Master end with timeout. More...
 
void EUSCI_B_I2C_masterReceiveMultiByteStop (uint16_t baseAddress)
 Sends the STOP at the end of a multi-byte reception at the Master end. More...
 
void EUSCI_B_I2C_enableMultiMasterMode (uint16_t baseAddress)
 Enables Multi Master Mode. More...
 
void EUSCI_B_I2C_disableMultiMasterMode (uint16_t baseAddress)
 Disables Multi Master Mode. More...
 
uint8_t EUSCI_B_I2C_masterReceiveSingle (uint16_t baseAddress)
 receives a byte that has been sent to the I2C Master Module. More...
 
uint32_t EUSCI_B_I2C_getReceiveBufferAddress (uint16_t baseAddress)
 Returns the address of the RX Buffer of the I2C for the DMA module. More...
 
uint32_t EUSCI_B_I2C_getTransmitBufferAddress (uint16_t baseAddress)
 Returns the address of the TX Buffer of the I2C for the DMA module. More...
 

Detailed Description

Function Documentation

void EUSCI_B_I2C_clearInterrupt ( uint16_t  baseAddress,
uint16_t  mask 
)

Clears I2C interrupt sources.

The I2C interrupt source is cleared, so that it no longer asserts. The highest interrupt flag is automatically cleared when an interrupt vector generator is used.

Parameters
baseAddressis the base address of the I2C module.
maskis a bit mask of the interrupt sources to be cleared. Mask value is the logical OR of any of the following:
  • EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
  • EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
  • EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
  • EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
  • EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
  • EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
  • EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
  • EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
  • EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
  • EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt enable
  • EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable

Modified bits of UCBxIFG register.

Returns
None
void EUSCI_B_I2C_disable ( uint16_t  baseAddress)

Disables the I2C block.

This will disable operation of the I2C block.

Parameters
baseAddressis the base address of the USCI I2C module.

Modified bits are UCSWRST of UCBxCTLW0 register.

Returns
None
void EUSCI_B_I2C_disableInterrupt ( uint16_t  baseAddress,
uint16_t  mask 
)

Disables individual I2C interrupt sources.

Disables the indicated I2C interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
baseAddressis the base address of the I2C module.
maskis the bit mask of the interrupt sources to be disabled. Mask value is the logical OR of any of the following:
  • EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
  • EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
  • EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
  • EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
  • EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
  • EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
  • EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
  • EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
  • EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
  • EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt enable
  • EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable

Modified bits of UCBxIE register.

Returns
None
void EUSCI_B_I2C_disableMultiMasterMode ( uint16_t  baseAddress)

Disables Multi Master Mode.

At the end of this function, the I2C module is still disabled till EUSCI_B_I2C_enable is invoked

Parameters
baseAddressis the base address of the I2C module.

Modified bits are UCSWRST and UCMM of UCBxCTLW0 register.

Returns
None
void EUSCI_B_I2C_enable ( uint16_t  baseAddress)

Enables the I2C block.

This will enable operation of the I2C block.

Parameters
baseAddressis the base address of the USCI I2C module.

Modified bits are UCSWRST of UCBxCTLW0 register.

Returns
None
void EUSCI_B_I2C_enableInterrupt ( uint16_t  baseAddress,
uint16_t  mask 
)

Enables individual I2C interrupt sources.

Enables the indicated I2C interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
baseAddressis the base address of the I2C module.
maskis the bit mask of the interrupt sources to be enabled. Mask value is the logical OR of any of the following:
  • EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
  • EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
  • EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
  • EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
  • EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
  • EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
  • EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
  • EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
  • EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
  • EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt enable
  • EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable

Modified bits of UCBxIE register.

Returns
None
void EUSCI_B_I2C_enableMultiMasterMode ( uint16_t  baseAddress)

Enables Multi Master Mode.

At the end of this function, the I2C module is still disabled till EUSCI_B_I2C_enable is invoked

Parameters
baseAddressis the base address of the I2C module.

Modified bits are UCSWRST and UCMM of UCBxCTLW0 register.

Returns
None
uint16_t EUSCI_B_I2C_getInterruptStatus ( uint16_t  baseAddress,
uint16_t  mask 
)

Gets the current I2C interrupt status.

This returns the interrupt status for the I2C module based on which flag is passed.

Parameters
baseAddressis the base address of the I2C module.
maskis the masked interrupt flag status to be returned. Mask value is the logical OR of any of the following:
  • EUSCI_B_I2C_NAK_INTERRUPT - Not-acknowledge interrupt
  • EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT - Arbitration lost interrupt
  • EUSCI_B_I2C_STOP_INTERRUPT - STOP condition interrupt
  • EUSCI_B_I2C_START_INTERRUPT - START condition interrupt
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT0 - Transmit interrupt0
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT1 - Transmit interrupt1
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT2 - Transmit interrupt2
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT3 - Transmit interrupt3
  • EUSCI_B_I2C_RECEIVE_INTERRUPT0 - Receive interrupt0
  • EUSCI_B_I2C_RECEIVE_INTERRUPT1 - Receive interrupt1
  • EUSCI_B_I2C_RECEIVE_INTERRUPT2 - Receive interrupt2
  • EUSCI_B_I2C_RECEIVE_INTERRUPT3 - Receive interrupt3
  • EUSCI_B_I2C_BIT9_POSITION_INTERRUPT - Bit position 9 interrupt
  • EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT - Clock low timeout interrupt enable
  • EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT - Byte counter interrupt enable
Returns
Logical OR of any of the following:
  • EUSCI_B_I2C_NAK_INTERRUPT Not-acknowledge interrupt
  • EUSCI_B_I2C_ARBITRATIONLOST_INTERRUPT Arbitration lost interrupt
  • EUSCI_B_I2C_STOP_INTERRUPT STOP condition interrupt
  • EUSCI_B_I2C_START_INTERRUPT START condition interrupt
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT0 Transmit interrupt0
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT1 Transmit interrupt1
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT2 Transmit interrupt2
  • EUSCI_B_I2C_TRANSMIT_INTERRUPT3 Transmit interrupt3
  • EUSCI_B_I2C_RECEIVE_INTERRUPT0 Receive interrupt0
  • EUSCI_B_I2C_RECEIVE_INTERRUPT1 Receive interrupt1
  • EUSCI_B_I2C_RECEIVE_INTERRUPT2 Receive interrupt2
  • EUSCI_B_I2C_RECEIVE_INTERRUPT3 Receive interrupt3
  • EUSCI_B_I2C_BIT9_POSITION_INTERRUPT Bit position 9 interrupt
  • EUSCI_B_I2C_CLOCK_LOW_TIMEOUT_INTERRUPT Clock low timeout interrupt enable
  • EUSCI_B_I2C_BYTE_COUNTER_INTERRUPT Byte counter interrupt enable
    indicating the status of the masked interrupts
uint8_t EUSCI_B_I2C_getMode ( uint16_t  baseAddress)

Gets the mode of the I2C device.

Current I2C transmit/receive mode.

Parameters
baseAddressis the base address of the I2C module.

Modified bits are UCTR of UCBxCTLW0 register.

Returns
One of the following:
  • EUSCI_B_I2C_TRANSMIT_MODE
  • EUSCI_B_I2C_RECEIVE_MODE
    indicating the current mode
uint32_t EUSCI_B_I2C_getReceiveBufferAddress ( uint16_t  baseAddress)

Returns the address of the RX Buffer of the I2C for the DMA module.

Returns the address of the I2C RX Buffer. This can be used in conjunction with the DMA to store the received data directly to memory.

Parameters
baseAddressis the base address of the I2C module.
Returns
The address of the I2C RX Buffer
uint32_t EUSCI_B_I2C_getTransmitBufferAddress ( uint16_t  baseAddress)

Returns the address of the TX Buffer of the I2C for the DMA module.

Returns the address of the I2C TX Buffer. This can be used in conjunction with the DMA to obtain transmitted data directly from memory.

Parameters
baseAddressis the base address of the I2C module.
Returns
The address of the I2C TX Buffer
void EUSCI_B_I2C_initMaster ( uint16_t  baseAddress,
EUSCI_B_I2C_initMasterParam param 
)

Initializes the I2C Master block.

This function initializes operation of the I2C Master block. Upon successful initialization of the I2C block, this function will have set the bus speed for the master; however I2C module is still disabled till EUSCI_B_I2C_enable is invoked.

Parameters
baseAddressis the base address of the I2C Master module.
paramis the pointer to the struct for master initialization.
Returns
None

References EUSCI_B_I2C_initMasterParam::autoSTOPGeneration, EUSCI_B_I2C_initMasterParam::byteCounterThreshold, EUSCI_B_I2C_initMasterParam::dataRate, EUSCI_B_I2C_initMasterParam::i2cClk, and EUSCI_B_I2C_initMasterParam::selectClockSource.

void EUSCI_B_I2C_initSlave ( uint16_t  baseAddress,
EUSCI_B_I2C_initSlaveParam param 
)

Initializes the I2C Slave block.

This function initializes operation of the I2C as a Slave mode. Upon successful initialization of the I2C blocks, this function will have set the slave address but the I2C module is still disabled till EUSCI_B_I2C_enable is invoked.

Parameters
baseAddressis the base address of the I2C Slave module.
paramis the pointer to the struct for slave initialization.
Returns
None

References EUSCI_B_I2C_initSlaveParam::slaveAddress, EUSCI_B_I2C_initSlaveParam::slaveAddressOffset, and EUSCI_B_I2C_initSlaveParam::slaveOwnAddressEnable.

uint16_t EUSCI_B_I2C_isBusBusy ( uint16_t  baseAddress)

Indicates whether or not the I2C bus is busy.

This function returns an indication of whether or not the I2C bus is busy. This function checks the status of the bus via UCBBUSY bit in UCBxSTAT register.

Parameters
baseAddressis the base address of the I2C module.
Returns
One of the following:
  • EUSCI_B_I2C_BUS_BUSY
  • EUSCI_B_I2C_BUS_NOT_BUSY
    indicating whether the bus is busy
uint16_t EUSCI_B_I2C_masterIsStartSent ( uint16_t  baseAddress)

Indicates whether Start got sent.

This function returns an indication of whether or not Start got sent This function checks the status of the bus via UCTXSTT bit in UCBxCTL1 register.

Parameters
baseAddressis the base address of the I2C Master module.
Returns
One of the following:
  • EUSCI_B_I2C_START_SEND_COMPLETE
  • EUSCI_B_I2C_SENDING_START
    indicating whether the start was sent
uint16_t EUSCI_B_I2C_masterIsStopSent ( uint16_t  baseAddress)

Indicates whether STOP got sent.

This function returns an indication of whether or not STOP got sent This function checks the status of the bus via UCTXSTP bit in UCBxCTL1 register.

Parameters
baseAddressis the base address of the I2C Master module.
Returns
One of the following:
  • EUSCI_B_I2C_STOP_SEND_COMPLETE
  • EUSCI_B_I2C_SENDING_STOP
    indicating whether the stop was sent
uint8_t EUSCI_B_I2C_masterReceiveMultiByteFinish ( uint16_t  baseAddress)

Finishes multi-byte reception at the Master end.

This function is used by the Master module to initiate completion of a multi-byte reception. This function receives the current byte and initiates the STOP from master to slave.

Parameters
baseAddressis the base address of the I2C Master module.

Modified bits are UCTXSTP of UCBxCTLW0 register.

Returns
Received byte at Master end.
bool EUSCI_B_I2C_masterReceiveMultiByteFinishWithTimeout ( uint16_t  baseAddress,
uint8_t *  txData,
uint32_t  timeout 
)

Finishes multi-byte reception at the Master end with timeout.

This function is used by the Master module to initiate completion of a multi-byte reception. This function receives the current byte and initiates the STOP from master to slave.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais a pointer to the location to store the received byte at master end
timeoutis the amount of time to wait until giving up

Modified bits are UCTXSTP of UCBxCTLW0 register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the reception process
uint8_t EUSCI_B_I2C_masterReceiveMultiByteNext ( uint16_t  baseAddress)

Starts multi-byte reception at the Master end one byte at a time.

This function is used by the Master module to receive each byte of a multi- byte reception. This function reads currently received byte.

Parameters
baseAddressis the base address of the I2C Master module.
Returns
Received byte at Master end.
void EUSCI_B_I2C_masterReceiveMultiByteStop ( uint16_t  baseAddress)

Sends the STOP at the end of a multi-byte reception at the Master end.

This function is used by the Master module to initiate STOP

Parameters
baseAddressis the base address of the I2C Master module.

Modified bits are UCTXSTP of UCBxCTLW0 register.

Returns
None
uint8_t EUSCI_B_I2C_masterReceiveSingle ( uint16_t  baseAddress)

receives a byte that has been sent to the I2C Master Module.

This function reads a byte of data from the I2C receive data Register.

Parameters
baseAddressis the base address of the I2C Master module.
Returns
Returns the byte received from by the I2C module, cast as an uint8_t.
uint8_t EUSCI_B_I2C_masterReceiveSingleByte ( uint16_t  baseAddress)

Does single byte reception from Slave.

This function is used by the Master module to receive a single byte. This function sends start and stop, waits for data reception and then receives the data from the slave

Parameters
baseAddressis the base address of the I2C Master module.

Modified bits of UCBxTXBUF register, bits of UCBxCTLW0 register, bits of UCBxIE register and bits of UCBxIFG register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
void EUSCI_B_I2C_masterReceiveStart ( uint16_t  baseAddress)

Starts reception at the Master end.

This function is used by the Master module initiate reception of a single byte. This function sends a start.

Parameters
baseAddressis the base address of the I2C Master module.

Modified bits are UCTXSTT of UCBxCTLW0 register.

Returns
None
void EUSCI_B_I2C_masterSendMultiByteFinish ( uint16_t  baseAddress,
uint8_t  txData 
)

Finishes multi-byte transmission from Master to Slave.

This function is used by the Master module to send the last byte and STOP. This function transmits the last data byte of a multi-byte transmission to the slave and then sends a stop.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the last data byte to be transmitted in a multi-byte transmission

Modified bits of UCBxTXBUF register and bits of UCBxCTLW0 register.

Returns
None
bool EUSCI_B_I2C_masterSendMultiByteFinishWithTimeout ( uint16_t  baseAddress,
uint8_t  txData,
uint32_t  timeout 
)

Finishes multi-byte transmission from Master to Slave with timeout.

This function is used by the Master module to send the last byte and STOP. This function transmits the last data byte of a multi-byte transmission to the slave and then sends a stop.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the last data byte to be transmitted in a multi-byte transmission
timeoutis the amount of time to wait until giving up

Modified bits of UCBxTXBUF register and bits of UCBxCTLW0 register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
void EUSCI_B_I2C_masterSendMultiByteNext ( uint16_t  baseAddress,
uint8_t  txData 
)

Continues multi-byte transmission from Master to Slave.

This function is used by the Master module continue each byte of a multi- byte transmission. This function transmits each data byte of a multi-byte transmission to the slave.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the next data byte to be transmitted

Modified bits of UCBxTXBUF register.

Returns
None
bool EUSCI_B_I2C_masterSendMultiByteNextWithTimeout ( uint16_t  baseAddress,
uint8_t  txData,
uint32_t  timeout 
)

Continues multi-byte transmission from Master to Slave with timeout.

This function is used by the Master module continue each byte of a multi- byte transmission. This function transmits each data byte of a multi-byte transmission to the slave.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the next data byte to be transmitted
timeoutis the amount of time to wait until giving up

Modified bits of UCBxTXBUF register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
void EUSCI_B_I2C_masterSendMultiByteStart ( uint16_t  baseAddress,
uint8_t  txData 
)

Starts multi-byte transmission from Master to Slave.

This function is used by the master module to start a multi byte transaction.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the first data byte to be transmitted

Modified bits of UCBxTXBUF register, bits of UCBxCTLW0 register, bits of UCBxIE register and bits of UCBxIFG register.

Returns
None
bool EUSCI_B_I2C_masterSendMultiByteStartWithTimeout ( uint16_t  baseAddress,
uint8_t  txData,
uint32_t  timeout 
)

Starts multi-byte transmission from Master to Slave with timeout.

This function is used by the master module to start a multi byte transaction.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the first data byte to be transmitted
timeoutis the amount of time to wait until giving up

Modified bits of UCBxTXBUF register, bits of UCBxCTLW0 register, bits of UCBxIE register and bits of UCBxIFG register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
void EUSCI_B_I2C_masterSendMultiByteStop ( uint16_t  baseAddress)

Send STOP byte at the end of a multi-byte transmission from Master to Slave.

This function is used by the Master module send STOP at the end of a multi- byte transmission. This function sends a stop after current transmission is complete.

Parameters
baseAddressis the base address of the I2C Master module.

Modified bits are UCTXSTP of UCBxCTLW0 register.

Returns
None
bool EUSCI_B_I2C_masterSendMultiByteStopWithTimeout ( uint16_t  baseAddress,
uint32_t  timeout 
)

Send STOP byte at the end of a multi-byte transmission from Master to Slave with timeout.

This function is used by the Master module send STOP at the end of a multi- byte transmission. This function sends a stop after current transmission is complete.

Parameters
baseAddressis the base address of the I2C Master module.
timeoutis the amount of time to wait until giving up

Modified bits are UCTXSTP of UCBxCTLW0 register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
void EUSCI_B_I2C_masterSendSingleByte ( uint16_t  baseAddress,
uint8_t  txData 
)

Does single byte transmission from Master to Slave.

This function is used by the Master module to send a single byte. This function sends a start, then transmits the byte to the slave and then sends a stop.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the data byte to be transmitted

Modified bits of UCBxTXBUF register, bits of UCBxCTLW0 register, bits of UCBxIE register and bits of UCBxIFG register.

Returns
None
bool EUSCI_B_I2C_masterSendSingleByteWithTimeout ( uint16_t  baseAddress,
uint8_t  txData,
uint32_t  timeout 
)

Does single byte transmission from Master to Slave with timeout.

This function is used by the Master module to send a single byte. This function sends a start, then transmits the byte to the slave and then sends a stop.

Parameters
baseAddressis the base address of the I2C Master module.
txDatais the data byte to be transmitted
timeoutis the amount of time to wait until giving up

Modified bits of UCBxTXBUF register, bits of UCBxCTLW0 register, bits of UCBxIE register and bits of UCBxIFG register.

Returns
STATUS_SUCCESS or STATUS_FAILURE of the transmission process.
void EUSCI_B_I2C_masterSendStart ( uint16_t  baseAddress)

This function is used by the Master module to initiate START.

This function is used by the Master module to initiate START

Parameters
baseAddressis the base address of the I2C Master module.

Modified bits are UCTXSTT of UCBxCTLW0 register.

Returns
None
void EUSCI_B_I2C_setMode ( uint16_t  baseAddress,
uint8_t  mode 
)

Sets the mode of the I2C device.

When the receive parameter is set to EUSCI_B_I2C_TRANSMIT_MODE, the address will indicate that the I2C module is in receive mode; otherwise, the I2C module is in send mode.

Parameters
baseAddressis the base address of the USCI I2C module.
modeMode for the EUSCI_B_I2C module Valid values are:
  • EUSCI_B_I2C_TRANSMIT_MODE [Default]
  • EUSCI_B_I2C_RECEIVE_MODE

Modified bits are UCTR of UCBxCTLW0 register.

Returns
None
void EUSCI_B_I2C_setSlaveAddress ( uint16_t  baseAddress,
uint8_t  slaveAddress 
)

Sets the address that the I2C Master will place on the bus.

This function will set the address that the I2C Master will place on the bus when initiating a transaction.

Parameters
baseAddressis the base address of the USCI I2C module.
slaveAddress7-bit slave address

Modified bits of UCBxI2CSA register.

Returns
None
uint8_t EUSCI_B_I2C_slaveGetData ( uint16_t  baseAddress)

Receives a byte that has been sent to the I2C Module.

This function reads a byte of data from the I2C receive data Register.

Parameters
baseAddressis the base address of the I2C Slave module.
Returns
Returns the byte received from by the I2C module, cast as an uint8_t.
void EUSCI_B_I2C_slavePutData ( uint16_t  baseAddress,
uint8_t  transmitData 
)

Transmits a byte from the I2C Module.

This function will place the supplied data into I2C transmit data register to start transmission.

Parameters
baseAddressis the base address of the I2C Slave module.
transmitDatadata to be transmitted from the I2C module

Modified bits of UCBxTXBUF register.

Returns
None

Copyright 2015, Texas Instruments Incorporated