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

Go to the source code of this file.

Macros

#define MAX_TX_BUFFER_SIZE   10 /* Maximum transmit buffer size in Chip_I2C_MasterWriteReg() function */
 

Functions

static CCU_CLK_T Chip_I2C_DetermineClk (LPC_I2C_Type *I2Cx)
 
static I2C_ID_Type Chip_I2C_Get_BusNum (LPC_I2C_Type *I2Cx)
 
void Chip_I2C_Init (LPC_I2C_Type *I2Cx)
 Initializes the LPC_I2C peripheral with specified parameter.
 
void Chip_I2C_DeInit (LPC_I2C_Type *I2Cx)
 De-initializes the I2C peripheral registers to their default reset values.
 
void Chip_I2C_SetClockRate (LPC_I2C_Type *I2Cx, uint32_t clockrate)
 Set up clock rate for LPC_I2C peripheral.
 
uint32_t Chip_I2C_GetClockRate (LPC_I2C_Type *I2Cx)
 Get current clock rate for LPC_I2C peripheral.
 
Status Chip_I2C_MasterTransferData (LPC_I2C_Type *I2Cx, I2C_M_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Transmit and Receive data in master mode.
 
Status Chip_I2C_MasterTransmitData (LPC_I2C_Type *I2Cx, I2C_M_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Transmit an array of bytes in Master mode.
 
Status Chip_I2C_MasterReceiveData (LPC_I2C_Type *I2Cx, I2C_M_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Receive an array of bytes in Master mode.
 
uint32_t Chip_I2C_MasterWriteReg (LPC_I2C_Type *I2Cx, uint32_t SlaveAddr, uint8_t regAddr, uint8_t *buffer, uint8_t buffer_len)
 Write byte(s) to slave register.
 
uint32_t Chip_I2C_MasterReadReg (LPC_I2C_Type *I2Cx, uint32_t SlaveAddr, uint8_t regAddr, uint8_t *buffer, uint8_t buffer_len)
 Read slave register content.
 
void Chip_I2C_Interrupt_MasterHandler (LPC_I2C_Type *I2Cx)
 General Master Interrupt handler for I2C peripheral.
 
bool Chip_I2C_Interrupt_MasterTransferComplete (LPC_I2C_Type *I2Cx)
 Get status of Master Transfer.
 
Status Chip_I2C_SlaveTransferData (LPC_I2C_Type *I2Cx, I2C_S_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Receive and Transmit data in slave mode.
 
Status Chip_I2C_SlaveTransmitData (LPC_I2C_Type *I2Cx, I2C_S_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Transmit an array of bytes in Slave mode.
 
Status Chip_I2C_SlaveReceiveData (LPC_I2C_Type *I2Cx, I2C_S_SETUP_Type *TransferCfg, I2C_TRANSFER_OPT_Type Opt)
 Receive an array of bytes in Slave mode.
 
void Chip_I2C_Interrupt_SlaveHandler (LPC_I2C_Type *I2Cx)
 General Slave Interrupt handler for I2C peripheral.
 
bool Chip_I2C_Interrupt_SlaveTransferComplete (LPC_I2C_Type *I2Cx)
 Get status of Slave Transfer.
 

Variables

static uint32_t i2cClockrate [2]
 
static I2C_M_SETUP_Type TransferMCfg
 
static uint8_t p_regAddr
 
static uint8_t tx_buffer [MAX_TX_BUFFER_SIZE]
 

Macro Definition Documentation

#define MAX_TX_BUFFER_SIZE   10 /* Maximum transmit buffer size in Chip_I2C_MasterWriteReg() function */

Definition at line 39 of file i2c_18xx_43xx.c.

Function Documentation

static CCU_CLK_T Chip_I2C_DetermineClk ( LPC_I2C_Type I2Cx)
static

Definition at line 55 of file i2c_18xx_43xx.c.

static I2C_ID_Type Chip_I2C_Get_BusNum ( LPC_I2C_Type I2Cx)
static

Definition at line 71 of file i2c_18xx_43xx.c.

Variable Documentation

uint32_t i2cClockrate[2]
static

Definition at line 41 of file i2c_18xx_43xx.c.

uint8_t p_regAddr
static

Definition at line 43 of file i2c_18xx_43xx.c.

I2C_M_SETUP_Type TransferMCfg
static

Definition at line 42 of file i2c_18xx_43xx.c.

uint8_t tx_buffer[MAX_TX_BUFFER_SIZE]
static

Definition at line 44 of file i2c_18xx_43xx.c.