M480 BSP V3.05.006
The Board Support Package for M480 Series
Macros | Enumerations | Functions
usci_i2c.h File Reference

M480 series USCI I2C(UI2C) driver header file. More...

Go to the source code of this file.

Macros

#define UI2C_CTL_PTRG
 
#define UI2C_CTL_STA
 
#define UI2C_CTL_STO
 
#define UI2C_CTL_AA
 
#define UI2C_GCMODE_ENABLE
 
#define UI2C_GCMODE_DISABLE
 
#define UI2C_DATA_TOGGLE_WK
 
#define UI2C_ADDR_MATCH_WK
 
#define UI2C_TO_INT_MASK
 
#define UI2C_STAR_INT_MASK
 
#define UI2C_STOR_INT_MASK
 
#define UI2C_NACK_INT_MASK
 
#define UI2C_ARBLO_INT_MASK
 
#define UI2C_ERR_INT_MASK
 
#define UI2C_ACK_INT_MASK
 
#define UI2C_SET_CONTROL_REG(ui2c, u8Ctrl)
 This macro sets the USCI_I2C protocol control register at one time. More...
 
#define UI2C_START(ui2c)
 This macro only set START bit to protocol control register of USCI_I2C module. More...
 
#define UI2C_STOP(ui2c)
 This macro only set STOP bit to the control register of USCI_I2C module. More...
 
#define UI2C_GET_DATA(ui2c)
 This macro returns the data stored in data register of USCI_I2C module. More...
 
#define UI2C_SET_DATA(ui2c, u8Data)
 This macro writes the data to data register of USCI_I2C module. More...
 
#define UI2C_GET_TIMEOUT_FLAG(ui2c)
 This macro returns time-out flag. More...
 
#define UI2C_GET_WAKEUP_FLAG(ui2c)
 This macro returns wake-up flag. More...
 
#define UI2C_CLR_WAKEUP_FLAG(ui2c)
 This macro is used to clear USCI_I2C wake-up flag. More...
 
#define UI2C_DISABLE_10BIT_ADDR_MODE(ui2c)
 This macro disables the USCI_I2C 10-bit address mode. More...
 
#define UI2C_ENABLE_10BIT_ADDR_MODE(ui2c)
 This macro enables the 10-bit address mode. More...
 
#define UI2C_GET_PROT_STATUS(ui2c)
 This macro gets USCI_I2C protocol interrupt flag or bus status. More...
 
#define UI2C_CLR_PROT_INT_FLAG(ui2c, u32IntTypeFlag)
 This macro clears specified protocol interrupt flag. More...
 
#define UI2C_ENABLE_PROT_INT(ui2c, u32IntSel)
 This macro enables specified protocol interrupt. More...
 
#define UI2C_DISABLE_PROT_INT(ui2c, u32IntSel)
 This macro disables specified protocol interrupt. More...
 

Enumerations

enum  UI2C_MASTER_EVENT {
  MASTER_SEND_ADDRESS = 10 ,
  MASTER_SEND_H_WR_ADDRESS ,
  MASTER_SEND_H_RD_ADDRESS ,
  MASTER_SEND_L_ADDRESS ,
  MASTER_SEND_DATA ,
  MASTER_SEND_REPEAT_START ,
  MASTER_READ_DATA ,
  MASTER_STOP ,
  MASTER_SEND_START
}
 
enum  UI2C_SLAVE_EVENT {
  SLAVE_ADDRESS_ACK = 100 ,
  SLAVE_H_WR_ADDRESS_ACK ,
  SLAVE_L_WR_ADDRESS_ACK ,
  SLAVE_GET_DATA ,
  SLAVE_SEND_DATA ,
  SLAVE_H_RD_ADDRESS_ACK ,
  SLAVE_L_RD_ADDRESS_ACK
}
 

Functions

uint32_t UI2C_Open (UI2C_T *ui2c, uint32_t u32BusClock)
 This function makes USCI_I2C module be ready and set the wanted bus clock. More...
 
void UI2C_Close (UI2C_T *ui2c)
 This function closes the USCI_I2C module. More...
 
void UI2C_ClearTimeoutFlag (UI2C_T *ui2c)
 This function clears the time-out flag. More...
 
void UI2C_Trigger (UI2C_T *ui2c, uint8_t u8Start, uint8_t u8Stop, uint8_t u8Ptrg, uint8_t u8Ack)
 This function sets the control bit of the USCI_I2C module. More...
 
void UI2C_DisableInt (UI2C_T *ui2c, uint32_t u32Mask)
 This function disables the interrupt of USCI_I2C module. More...
 
void UI2C_EnableInt (UI2C_T *ui2c, uint32_t u32Mask)
 This function enables the interrupt of USCI_I2C module. More...
 
uint32_t UI2C_GetBusClockFreq (UI2C_T *ui2c)
 This function returns the real bus clock of USCI_I2C module. More...
 
uint32_t UI2C_SetBusClockFreq (UI2C_T *ui2c, uint32_t u32BusClock)
 This function sets bus clock frequency of USCI_I2C module. More...
 
uint32_t UI2C_GetIntFlag (UI2C_T *ui2c, uint32_t u32Mask)
 This function gets the interrupt flag of USCI_I2C module. More...
 
void UI2C_ClearIntFlag (UI2C_T *ui2c, uint32_t u32Mask)
 This function clears the interrupt flag of USCI_I2C module. More...
 
uint32_t UI2C_GetData (UI2C_T *ui2c)
 This function returns the data stored in data register of USCI_I2C module. More...
 
void UI2C_SetData (UI2C_T *ui2c, uint8_t u8Data)
 This function writes a byte data to data register of USCI_I2C module. More...
 
void UI2C_SetSlaveAddr (UI2C_T *ui2c, uint8_t u8SlaveNo, uint16_t u16SlaveAddr, uint8_t u8GCMode)
 Configure slave address and enable GC mode. More...
 
void UI2C_SetSlaveAddrMask (UI2C_T *ui2c, uint8_t u8SlaveNo, uint16_t u16SlaveAddrMask)
 Configure the mask bit of slave address. More...
 
void UI2C_EnableTimeout (UI2C_T *ui2c, uint32_t u32TimeoutCnt)
 This function enables time-out function and configures timeout counter. More...
 
void UI2C_DisableTimeout (UI2C_T *ui2c)
 This function disables time-out function. More...
 
void UI2C_EnableWakeup (UI2C_T *ui2c, uint8_t u8WakeupMode)
 This function enables the wakeup function of USCI_I2C module. More...
 
void UI2C_DisableWakeup (UI2C_T *ui2c)
 This function disables the wakeup function of USCI_I2C module. More...
 
uint8_t UI2C_WriteByte (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t data)
 Write a byte to Slave. More...
 
uint32_t UI2C_WriteMultiBytes (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t *data, uint32_t u32wLen)
 Write multi bytes to Slave. More...
 
uint8_t UI2C_WriteByteOneReg (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t data)
 Specify a byte register address and write a byte to Slave. More...
 
uint32_t UI2C_WriteMultiBytesOneReg (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t *data, uint32_t u32wLen)
 Specify a byte register address and write multi bytes to Slave. More...
 
uint8_t UI2C_WriteByteTwoRegs (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t data)
 Specify two bytes register address and Write a byte to Slave. More...
 
uint32_t UI2C_WriteMultiBytesTwoRegs (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t *data, uint32_t u32wLen)
 Specify two bytes register address and write multi bytes to Slave. More...
 
uint8_t UI2C_ReadByte (UI2C_T *ui2c, uint8_t u8SlaveAddr)
 Read a byte from Slave. More...
 
uint32_t UI2C_ReadMultiBytes (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t *rdata, uint32_t u32rLen)
 Read multi bytes from Slave. More...
 
uint8_t UI2C_ReadByteOneReg (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr)
 Specify a byte register address and read a byte from Slave. More...
 
uint32_t UI2C_ReadMultiBytesOneReg (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint8_t u8DataAddr, uint8_t *rdata, uint32_t u32rLen)
 Specify a byte register address and read multi bytes from Slave. More...
 
uint8_t UI2C_ReadByteTwoRegs (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr)
 Specify two bytes register address and read a byte from Slave. More...
 
uint32_t UI2C_ReadMultiBytesTwoRegs (UI2C_T *ui2c, uint8_t u8SlaveAddr, uint16_t u16DataAddr, uint8_t *rdata, uint32_t u32rLen)
 Specify two bytes register address and read multi bytes from Slave. More...
 

Detailed Description

M480 series USCI I2C(UI2C) driver header file.

Version
V3.0

SPDX-License-Identifier: Apache-2.0

Definition in file usci_i2c.h.