PAN1080 Peripheral API
Data Structures | Macros | Functions
pan_i2c.h File Reference

Panchip series i2c driver header file. More...

Go to the source code of this file.

Data Structures

struct  I2C_InitTypeDef
 Structure with i2c init feature. More...
 

Macros

#define PAN_I2C_MODE_MASTER   ((uint16_t)0x0021)
 
#define PAN_I2C_MODE_SLAVE   ((uint16_t)0x0000)
 
#define IS_I2C_MODE(MODE)
 
#define I2C_SPEED_STANDARD_MODE   (uint16_t)(0x0002)
 
#define I2C_SPEED_FAST_MODE   (uint16_t)(0x0004)
 
#define I2C_SPEED_HIGH_MODE   (uint16_t)(0x0006)
 
#define I2C_DutyCycle_16_9   ((uint16_t)0x4000)
 
#define I2C_DutyCycle_2   ((uint16_t)0xBFFF)
 
#define IS_I2C_DUTY_CYCLE(CYCLE)
 
#define I2C_AcknowledgedAddress_7bit   ((uint16_t)0x4000)
 
#define I2C_AcknowledgedAddress_10bit   ((uint16_t)0xC000)
 
#define I2C_CMD_WR   ((uint8_t)0x00)
 
#define I2C_CMD_RD   ((uint8_t)0x01)
 
#define I2C_CMD_STOP   ((uint8_t)0x02)
 
#define I2C_CMD_RESTART   ((uint8_t)0x04)
 
#define I2C_RX_TL_0   ((uint8_t)0x00)
 
#define I2C_RX_TL_1   ((uint8_t)0x01)
 
#define I2C_RX_TL_2   ((uint8_t)0x02)
 
#define I2C_RX_TL_3   ((uint8_t)0x03)
 
#define I2C_RX_TL_4   ((uint8_t)0x04)
 
#define I2C_RX_TL_5   ((uint8_t)0x05)
 
#define I2C_RX_TL_6   ((uint8_t)0x06)
 
#define I2C_RX_TL_7   ((uint8_t)0x07)
 
#define I2C_RX_TL_8   ((uint8_t)0x08)
 
#define I2C_TX_TL_0   ((uint8_t)0x00)
 
#define I2C_TX_TL_1   ((uint8_t)0x01)
 
#define I2C_TX_TL_2   ((uint8_t)0x02)
 
#define I2C_TX_TL_3   ((uint8_t)0x03)
 
#define I2C_TX_TL_4   ((uint8_t)0x04)
 
#define I2C_TX_TL_5   ((uint8_t)0x05)
 
#define I2C_TX_TL_6   ((uint8_t)0x06)
 
#define I2C_TX_TL_7   ((uint8_t)0x07)
 
#define I2C_TX_TL_8   ((uint8_t)0x08)
 
#define I2C_IT_RX_UNDER   ((uint16_t)0x0001)
 
#define I2C_IT_RX_OVER   ((uint16_t)0x0002)
 
#define I2C_IT_RX_FULL   ((uint16_t)0x0004)
 
#define I2C_IT_TX_OVER   ((uint16_t)0x0008)
 
#define I2C_IT_TX_EMPTY   ((uint16_t)0x0010)
 
#define I2C_IT_RD_REQ   ((uint16_t)0x0020)
 
#define I2C_IT_TX_ABORT   ((uint16_t)0x0040)
 
#define I2C_IT_RX_DONE   ((uint16_t)0x0080)
 
#define I2C_IT_ACTIVITY   ((uint16_t)0x0100)
 
#define I2C_IT_STOP_DET   ((uint16_t)0x0200)
 
#define I2C_IT_START_DET   ((uint16_t)0x0400)
 
#define I2C_IT_GEN_CALL   ((uint16_t)0x0800)
 
#define I2C_IT_MST_ON_HOLD   ((uint16_t)0x2000)
 
#define I2C_IT_ALL   ((uint16_t)0x2FFF)
 
#define I2C_FLAG_SLV_ACTIVITY   ((uint32_t)0x00000040)
 
#define I2C_FLAG_MST_ACTIVITY   ((uint32_t)0x00000020)
 
#define I2C_FLAG_RFF   ((uint32_t)0x00000010)
 
#define I2C_FLAG_RFNE   ((uint32_t)0x00000008)
 
#define I2C_FLAG_TFE   ((uint32_t)0x00000004)
 
#define I2C_FLAG_TFNF   ((uint32_t)0x00000002)
 
#define I2C_FLAG_ACTIVITY   ((uint32_t)0x00000001)
 
#define FLAG_MASK   ((uint32_t)0x007F0FFF)
 
#define ITEN_MASK   ((uint16_t)0x2FFF)
 
#define IT_FLAG_MASK   ((uint16_t)0x2FFF)
 

Functions

__STATIC_INLINE void I2C_SetMode (I2C_T *I2Cx, uint16_t Mode)
 Set I2C mode . More...
 
__STATIC_INLINE void I2C_SetTxTirggerLevel (I2C_T *I2Cx, uint8_t ThresholdValue)
 Set I2C Tx fifo threshold value . More...
 
__STATIC_INLINE void I2C_SetRxTirggerLevel (I2C_T *I2Cx, uint8_t ThresholdValue)
 Set I2C Rx fifo threshold value . More...
 
__STATIC_INLINE void I2C_Cmd (I2C_T *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C peripheral. More...
 
__STATIC_INLINE void I2C_GeneralCallCmd (I2C_T *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C general call feature. More...
 
__STATIC_INLINE void I2C_SendDataCmd (I2C_T *I2Cx, uint8_t Data, uint8_t Cmd)
 Sends a data byte through the I2Cx peripheral. More...
 
__STATIC_INLINE void I2C_SendCmd (I2C_T *I2Cx, uint8_t Cmd)
 Sends a data byte through the I2Cx peripheral. More...
 
__STATIC_INLINE uint8_t I2C_ReceiveData (I2C_T *I2Cx)
 Returns the most recent received data by the I2Cx peripheral. More...
 
__STATIC_INLINE void I2C_AbortTransfer (I2C_T *I2Cx)
 Aborting I2C Transfers. More...
 
__STATIC_INLINE void I2C_DMACmd (I2C_T *I2Cx, FunctionalState NewState)
 Enables or disables the specified I2C DMA requests. More...
 
__STATIC_INLINE void I2C_DMATransferDataLevel (I2C_T *I2Cx, uint8_t Level)
 DMA Transmit Data Level Register. More...
 
__STATIC_INLINE void I2C_DMAReceiveDataLevel (I2C_T *I2Cx, uint8_t Level)
 DMA Receive Data Level Register. More...
 
__STATIC_INLINE ITStatus I2C_GetITStatus (I2C_T *I2Cx, uint16_t I2C_IT)
 Checks whether the specified I2C interrupt has occurred or not. More...
 
__STATIC_INLINE ITStatus I2C_GetRawITStatus (I2C_T *I2Cx, uint16_t I2C_IT)
 Checks whether the specified I2C interrupt has occurred or not. More...
 
__STATIC_INLINE void I2C_ITConfig (I2C_T *I2Cx, uint16_t I2C_IT, FunctionalState NewState)
 Enables or disables the specified I2C interrupts. More...
 
__STATIC_INLINE void I2C_DisableAllIT (I2C_T *I2Cx)
 Enables or disables all the specified I2C interrupts. More...
 
__STATIC_INLINE void I2C_ClearAllITPendingBit (I2C_T *I2Cx)
 Clears all the I2Cx's interrupt pending bits. More...
 
__STATIC_INLINE bool I2C_AbortSrcCheck (I2C_T *I2Cx, uint32_t IC_MSK)
 Get the source of tx_abort. More...
 
__STATIC_INLINE void I2C_SetSlaveAddr (I2C_T *I2Cx, uint32_t addr)
 Set slave address. More...
 
bool I2C_Init (I2C_T *I2Cx, I2C_InitTypeDef *I2C_InitStruct)
 Initializes the I2Cx peripheral according to the specified parameters in the I2C_InitStruct. More...
 
void I2C_Set7bitAddress (I2C_T *I2Cx, uint8_t Address)
 Configure the target address for any master transaction. More...
 
void I2C_Set10bitAddress (I2C_T *I2Cx, uint16_t Address)
 Configure the target address for any master transaction. More...
 
FlagStatus I2C_GetFlagStatus (I2C_T *I2Cx, uint32_t I2C_FLAG)
 Checks whether the specified I2C flag is set or not. More...
 
void I2C_ClearITPendingBit (I2C_T *I2Cx, uint16_t I2C_IT)
 Clears the I2Cx's interrupt pending bits. More...
 
void I2C_Write (I2C_T *I2Cx, uint8_t *WriteBuf, uint32_t Size)
 read data from the I2Cx peripheral. More...
 
void I2C_Read (I2C_T *I2Cx, uint8_t *ReadBuf, uint32_t Size)
 write data to the I2Cx peripheral. More...
 

Detailed Description

Panchip series i2c driver header file.

Version
V1.00
Revision
3
Date
21/11/12 18:33