LPCOpen Platform for LPC112X microcontrollers  112X
LPCOpen Platform for the NXP LPC112X family of Microcontrollers
Data Structures | Functions
i2cm_112x.h File Reference
#include "i2c_common_112x.h"

Go to the source code of this file.

Data Structures

struct  I2CM_XFER_T
 Master transfer data structure definitions. More...
 

Macros

#define I2CM_XFER_OPTION_IGNORE_NACK   0x01
 
#define I2CM_XFER_OPTION_LAST_RX_ACK   0x02
 
#define I2CM_STATUS_OK   0x00
 
#define I2CM_STATUS_ERROR   0x01
 
#define I2CM_STATUS_NAK   0x02
 
#define I2CM_STATUS_BUS_ERROR   0x03
 
#define I2CM_STATUS_SLAVE_NAK   0x04
 
#define I2CM_STATUS_ARBLOST   0x05
 
#define I2CM_STATUS_BUSY   0xFF
 

Functions

void Chip_I2CM_Init (LPC_I2C_T *pI2C)
 Initialize I2C Interface. More...
 
void Chip_I2CM_DeInit (LPC_I2C_T *pI2C)
 Shutdown I2C Interface. More...
 
static INLINE void Chip_I2CM_SetDutyCycle (LPC_I2C_T *pI2C, uint16_t sclH, uint16_t sclL)
 Sets HIGH and LOW duty cycle registers. More...
 
void Chip_I2CM_SetBusSpeed (LPC_I2C_T *pI2C, uint32_t busSpeed)
 Set up bus speed for LPC_I2C controller. More...
 
static INLINE void Chip_I2CM_SendStart (LPC_I2C_T *pI2C)
 Transmit START or Repeat-START signal on I2C bus. More...
 
static INLINE void Chip_I2CM_ResetControl (LPC_I2C_T *pI2C)
 Reset I2C controller state. More...
 
static INLINE void Chip_I2CM_WriteByte (LPC_I2C_T *pI2C, uint8_t data)
 Transmit a single data byte through the I2C peripheral. More...
 
static INLINE uint8_t Chip_I2CM_ReadByte (LPC_I2C_T *pI2C)
 Read a single byte data from the I2C peripheral. More...
 
static INLINE void Chip_I2CM_NackNextByte (LPC_I2C_T *pI2C)
 Generate NACK after receiving next byte. More...
 
static INLINE void Chip_I2CM_SendStop (LPC_I2C_T *pI2C)
 Transmit STOP signal on I2C bus. More...
 
static INLINE void Chip_I2CM_ForceStart (LPC_I2C_T *pI2C)
 Force start I2C transmit. More...
 
static INLINE void Chip_I2CM_SendStartAfterStop (LPC_I2C_T *pI2C)
 Transmit STOP+START signal on I2C bus. More...
 
static INLINE uint32_t Chip_I2CM_StateChanged (LPC_I2C_T *pI2C)
 Check if I2C controller state changed. More...
 
static INLINE void Chip_I2CM_ClearSI (LPC_I2C_T *pI2C)
 Clear state change interrupt flag. More...
 
static INLINE uint32_t Chip_I2CM_BusFree (LPC_I2C_T *pI2C)
 Check if I2C bus is free per our controller. More...
 
static INLINE uint32_t Chip_I2CM_GetCurState (LPC_I2C_T *pI2C)
 Get current state of the I2C controller. More...
 
static INLINE void Chip_I2CM_Disable (LPC_I2C_T *pI2C)
 Disable I2C interface. More...
 
uint32_t Chip_I2CM_XferHandler (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
 Transfer state change handler handler. More...
 
void Chip_I2CM_Xfer (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
 Transmit and Receive data in master mode. More...
 
uint32_t Chip_I2CM_XferBlocking (LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
 Transmit and Receive data in master mode. More...
 
uint32_t Chip_I2CM_Write (LPC_I2C_T *pI2C, const uint8_t *buff, uint32_t len)
 Write given buffer of data to I2C interface. More...
 
uint32_t Chip_I2CM_Read (LPC_I2C_T *pI2C, uint8_t *buff, uint32_t len)
 Read data from I2C slave to given buffer. More...