
UM10800
All information provided in this document is subject to legal disclaimers.
© NXP Semiconductors N.V. 2016. All rights reserved.
User manual
Rev. 1.2 — 5 October 2016
424 of 487
NXP Semiconductors
UM10800
Chapter 29: LPC82x ROM API I2C driver routines
I2C_CALLBK_T func_pt; // callback function pointer
uint8_t stop_flag;
uint8_t dummy[3] ; // required for word alignment
} I2C_PARAM ;
The RESULT structure is as follows:
typedef struct i2c_R { // RESULTs struct--results are here when returned
uint32_t n_bytes_sent ;
uint32_t n_bytes_recd ;
} I2C_RESULT ;
29.4.23 Error structure
The error code returned by the I2C ROM driver is an enum structure. The Error structure
is as follows:
typedef enum
{
LPC_OK=0, /**< enum value returned on Success */
ERROR,
ERR_I2C_BASE = 0x00060000,
/*0x00060001*/ ERR_I2C_NAK=ERR_I1,
/*0x00060002*/ ERR_I2C_BUFFER_OVERFLOW,
/*0x00060003*/ ERR_I2C_BYTE_COUNT_ERR,
/*0x00060004*/ ERR_I2C_LOSS_OF_ARBRITRATION,
/*0x00060005*/ ERR_I2C_SLAVE_NOT_ADDRESSED,
/*0x00060006*/ ERR_I2C_LOSS_OF_ARBRITRATION_NAK_BIT,
/*0x00060007*/ ERR_I2C_GENERAL_FAILURE,
/*0x00060008*/ ERR_I2C_REGS_SET_TO_DEFAULT
} ErrorCode_t;
29.4.24 I2C Mode
The i2c_get_status() function returns the current status of the I2C engine. The return
codes can be defined as an enum structure:
typedef enum I2C_mode {
IDLE,
MASTER_SEND,
MASTER_RECEIVE,
SLAVE_SEND,
SLAVE_RECEIVE
} I2C_MODE_T ;
29.5 Functional description
29.5.1 I2C Set-up
Before calling any setup functions in the I2C ROM, the application program is responsible
for doing the following:
1. Enable the clock to the I2C peripheral.