LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
i2c_001.c File Reference
#include "i2c_001.h"

Go to the source code of this file.

Data Structures

struct  I2C_CFG_T
 

Macros

#define BLOCKING_TIMEOUT   (0x000FFFFFUL)
 
#define RESTRANSMISSION_MAX   (0x000000FFUL)
 

Functions

static uint32_t IP_I2C_Start (IP_I2C_001_Type *LPC_I2C, I2C_TRANSFER_OPT_Type Opt)
 
static Status IP_I2C_Stop (IP_I2C_001_Type *LPC_I2C, I2C_TRANSFER_OPT_Type Opt)
 
static uint32_t IP_I2C_SendByte (IP_I2C_001_Type *LPC_I2C, uint8_t databyte)
 
static uint32_t IP_I2C_GetByte (IP_I2C_001_Type *LPC_I2C, uint8_t *retdat, bool ack)
 
static int32_t IP_I2C_MasterHanleStates (IP_I2C_001_Type *LPC_I2C, uint32_t CodeStatus, I2C_M_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 
static int32_t IP_I2C_SlaveHanleStates (IP_I2C_001_Type *LPC_I2C, uint32_t CodeStatus, I2C_S_SETUP_Type *TransferCfg)
 
void IP_I2C_Init (IP_I2C_001_Type *LPC_I2C)
 Initializes the LPC_I2C peripheral.
 
void IP_I2C_DeInit (IP_I2C_001_Type *LPC_I2C)
 De-initializes the I2C peripheral registers to their default reset values.
 
void IP_I2C_SetClockRate (IP_I2C_001_Type *LPC_I2C, uint32_t SCLValue)
 Set up clock rate for I2Cx.
 
void IP_I2C_Cmd (IP_I2C_001_Type *LPC_I2C, I2C_Mode Mode, FunctionalState NewState)
 Enable or disable I2C peripheral's operation.
 
void IP_I2C_Interrupt_MasterHandler (IP_I2C_001_Type *LPC_I2C, I2C_ID_Type I2C_Num)
 General Master Interrupt handler for I2C peripheral.
 
void IP_I2C_Interrupt_SlaveHandler (IP_I2C_001_Type *LPC_I2C, I2C_ID_Type I2C_Num)
 General Slave Interrupt handler for I2C peripheral.
 
Status IP_I2C_MasterTransferData (IP_I2C_001_Type *LPC_I2C, I2C_ID_Type I2C_Num, I2C_M_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Transmit and Receive data in master mode.
 
Status IP_I2C_SlaveTransferData (IP_I2C_001_Type *LPC_I2C, I2C_ID_Type I2C_Num, I2C_S_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Receive and Transmit data in slave mode.
 
bool IP_I2C_Interrupt_MasterTransferComplete (I2C_ID_Type I2C_Num)
 Get status of Master Transfer.
 
bool IP_I2C_Interrupt_SlaveTransferComplete (I2C_ID_Type I2C_Num)
 Get status of Slave Transfer.
 
void IP_I2C_SetOwnSlaveAddr (IP_I2C_001_Type *LPC_I2C, I2C_OWNSLAVEADDR_CFG_Type *OwnSlaveAddrConfigStruct)
 Set Own slave address in I2C peripheral corresponding to parameter specified in OwnSlaveAddrConfigStruct.
 

Variables

static I2C_CFG_T i2cdat [3]
 
static bool I2C_MasterComplete [3]
 
static bool I2C_SlaveComplete [3]
 

Macro Definition Documentation

#define BLOCKING_TIMEOUT   (0x000FFFFFUL)

Definition at line 48 of file i2c_001.c.

#define RESTRANSMISSION_MAX   (0x000000FFUL)

Definition at line 49 of file i2c_001.c.

Function Documentation

static uint32_t IP_I2C_GetByte ( IP_I2C_001_Type LPC_I2C,
uint8_t *  retdat,
bool  ack 
)
static

Definition at line 137 of file i2c_001.c.

static int32_t IP_I2C_MasterHanleStates ( IP_I2C_001_Type LPC_I2C,
uint32_t  CodeStatus,
I2C_M_SETUP_Type TransferCfg,
I2C_TRANSFER_OPT_Type  Opt 
)
static

Definition at line 154 of file i2c_001.c.

static uint32_t IP_I2C_SendByte ( IP_I2C_001_Type LPC_I2C,
uint8_t  databyte 
)
static

Definition at line 116 of file i2c_001.c.

static int32_t IP_I2C_SlaveHanleStates ( IP_I2C_001_Type LPC_I2C,
uint32_t  CodeStatus,
I2C_S_SETUP_Type TransferCfg 
)
static

Definition at line 293 of file i2c_001.c.

static uint32_t IP_I2C_Start ( IP_I2C_001_Type LPC_I2C,
I2C_TRANSFER_OPT_Type  Opt 
)
static

Definition at line 66 of file i2c_001.c.

static Status IP_I2C_Stop ( IP_I2C_001_Type LPC_I2C,
I2C_TRANSFER_OPT_Type  Opt 
)
static

Definition at line 88 of file i2c_001.c.

Variable Documentation

bool I2C_MasterComplete[3]
static

Definition at line 54 of file i2c_001.c.

bool I2C_SlaveComplete[3]
static

Definition at line 55 of file i2c_001.c.

I2C_CFG_T i2cdat[3]
static

Definition at line 52 of file i2c_001.c.