
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
423 of 487
NXP Semiconductors
UM10800
Chapter 29: LPC82x ROM API I2C driver routines
29.4.20 I2C Status code
29.4.21 I2C ROM driver variables
The I2C ROM driver requires specific variables to be declared and initialized for proper
usage. Depending on the operating mode, some variables can be omitted.
29.4.21.1 I2C Handle
The I2C handle is a pointer allocated for the I2C ROM driver. The handle needs to be
defined as an I2C handle TYPE:
typedef void* I2C_HANDLE_T
After the definition of the handle, the handle must be initialized with I2C base address and
RAM reserved for the I2C ROM driver by making a call to the i2c_setup() function.
The callback function type must be defined if interrupts for the I2C ROM driver are used:
typedef void (*I2C_CALLBK_T) (uint32_t err_code, uint32_t n)
The callback function will be called by the I2C ROM driver upon completion of a task when
interrupts are used.
29.4.22 PARAM and RESULT structure
The I2C ROM driver input parameters consist of two structures, a PARAM structure and a
RESULT structure. The PARAM structure contains the parameters passed to the I2C
ROM driver and the RESULT structure contains the results after the I2C ROM driver is
called.
The PARAM structure is as follows:
typedef struct i2c_A { //parameters passed to ROM function
uint32_t num_bytes_send ;
uint32_t num_bytes_rec ;
uint8_t *buffer_ptr_send ;
uint8_t *buffer_ptr_rec ;
0x0006 0008
ERR_I2C_REGS_SET_TO_DEFAULT
I2C clock frequency could not be set. Default value
of 0x04 is loaded into SCLH and SCLL.
0x0006 0009
ERR_I2C_TIMEOUT
-
0x0006 000A
ERR_I2C_BUFFER_UNDERFLOW
-
Table 383. Error codes
Error Code
Description
Comment
Table 384. I2C Status code
Status code
Description
0
IDLE
1
MASTER_SEND
2
MASTER_RECEIVE
3
SLAVE_SEND
4
SLAVE_RECEIVE