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

Go to the source code of this file.

Macros

#define I2C_MASTER_MODE   1
 
#define I2C_SLAVE_ADDR_7BIT   (0x90)
 
#define I2C_SLAVE_ADDR_10BIT   (0x2CA)
 
#define I2C_ROM_MEM_SIZE   (0x100UL)
 
#define I2C_BITRATE   (1000000)
 
#define BUFFER_SIZE   (0xFF)
 

Functions

static void Buffer_Init (uint8_t *buffer, uint32_t buf_len, uint8_t type)
 
static void spin_on_error (void)
 
static void Buffer_Compare (uint8_t *buffer1, uint8_t *buffer2, uint32_t StartPos, uint32_t StopPos)
 
static void App_I2C_Callback_Receive (uint32_t err_code, uint32_t n)
 
static void App_I2C_Callback_Transmit (uint32_t err_code, uint32_t n)
 
static void App_I2C_Callback_MasterTxRx (uint32_t err_code, uint32_t n)
 
static void App_I2C_Master_Polling (void)
 
static void App_I2C_Master_Interrupt (void)
 
static void App_I2C_Master_10bitAddressTest (void)
 
void I2C_IRQHandler (void)
 I2C Interrupt Service Routine.
 
void HW_Setup (void)
 Set up hardware for lpc8xx I2C example.
 
int main (void)
 Main routine for I2C example.
 

Variables

static I2C_HANDLE_Ti2c_handle
 
static uint32_t i2cmem [I2C_ROM_MEM_SIZE]
 
volatile uint32_t error_code
 
I2C_PARAM_T param
 
I2C_RESULT_T result
 
volatile bool isTxCompleted = false
 
volatile bool isRxCompleted = false
 
volatile bool isTxRxCompleted = false
 
uint8_t Buffer [BUFFER_SIZE]
 
uint8_t TmpBuffer [BUFFER_SIZE]