Kinetis Bootloader  2.0.0
Common bootloader for Kinetis devices

LPI2C peripheral interface. More...

+ Collaboration diagram for LPI2C Peripheral:

Data Structures

struct  lpi2c_transfer_info_t
 Synchronization state between LPI2C ISR and read/write functions. More...
 

Enumerations

enum  {
  kLPI2CGlitchFilterWidth_ns = 50,
  kLPI2CGlitchFilterMaxCycles = 15,
  kLPI2CDataValidDelayCycles = 1,
  kLPI2CClockHoldCycles = 2,
  kLPI2CShutdownTimeout_ms = 100
}
 

Functions

static bool lpi2c_poll_for_activity (const peripheral_descriptor_t *self)
 
static status_t lpi2c_full_init (const peripheral_descriptor_t *self, serial_byte_receive_func_t function)
 
static void lpi2c_full_shutdown (const peripheral_descriptor_t *self)
 
static status_t lpi2c_write (const peripheral_descriptor_t *self, const uint8_t *buffer, uint32_t byteCount)
 
static void lpi2c_set_glitch_filter_width (uint32_t instance, uint32_t busClock_Hz, uint32_t glitchWidth_ns)
 
static void lpi2c_data_source (uint8_t *source_byte)
 
static void lpi2c_initial_data_sink (uint8_t sink_byte, uint32_t instance)
 
static void lpi2c_data_sink (uint8_t sink_byte, uint32_t instance)
 
static void lpi2c_SlaveIRQHandler (uint32_t instance)
 LPI2C Slave Generic IRQ handler. More...
 
void LPI2C_SetSystemIRQ (uint32_t instance, PeripheralSystemIRQSetting set)
 
void LPI2C0_IRQHandler (void)
 Implementation of LPI2C0 handler named in startup code. More...
 
void LPI2C1_IRQHandler (void)
 Implementation of LPI2C1 handler named in startup code. More...
 
void LPI2C2_IRQHandler (void)
 Implementation of LPI2C2 handler named in startup code. More...
 

Variables

const peripheral_control_interface_t g_lpi2cControlInterface
 Control interface for the LPI2C peripheral driver. More...
 
const peripheral_byte_inteface_t g_lpi2cByteInterface = {.init = NULL, .write = lpi2c_write }
 Byte I/O interface for the LPI2C peripheral driver.
 
static lpi2c_transfer_info_t s_lpi2cInfo
 Global state for the LPI2C peripheral interface. More...
 
static bool s_lpi2cActivity [FSL_FEATURE_SOC_LPI2C_COUNT] = { false }
 
static bool s_lpi2cIntialized [FSL_FEATURE_SOC_LPI2C_COUNT] = { false }
 
static const uint32_t g_lpi2cBaseAddr [] = LPI2C_BASE_ADDRS
 
static serial_byte_receive_func_t s_lpi2c_app_data_sink_callback
 

Usage Information

LPI2C peripheral interface.


Data Structure Documentation

struct lpi2c_transfer_info_t

Synchronization state between LPI2C ISR and read/write functions.

Data Fields

const uint8_t * writeData
 The applications data to write.
 
volatile uint32_t bytesToTransfer
 The total number of bytes to be transmitted.
 
void(* data_source )(uint8_t *source_byte)
 
void(* data_sink )(uint8_t sink_byte, uint32_t instance)
 

Enumeration Type Documentation

anonymous enum
Enumerator
kLPI2CGlitchFilterWidth_ns 

Width of glitches to filter in nanoseconds.

kLPI2CDataValidDelayCycles 

Part of SDA data valid delay time.

kLPI2CClockHoldCycles 

Part of SCL clock hold time.

kLPI2CShutdownTimeout_ms 

Timeout before shut down module.

Function Documentation

void LPI2C0_IRQHandler ( void  )

Implementation of LPI2C0 handler named in startup code.

Passes instance to generic LPI2C IRQ handler.

void LPI2C1_IRQHandler ( void  )

Implementation of LPI2C1 handler named in startup code.

Passes instance to generic LPI2C IRQ handler.

void LPI2C2_IRQHandler ( void  )

Implementation of LPI2C2 handler named in startup code.

Passes instance to generic LPI2C IRQ handler.

static void lpi2c_SlaveIRQHandler ( uint32_t  instance)
static

LPI2C Slave Generic IRQ handler.

Implements the flow chart at the end of the LPI2C chapter in the Kinetis KL25 Sub-Family Reference Manual. It uses callbacks to get/put data from/to the application as well as alert the application of an error condition.

Parameters
instanceInstance number of the LPI2C module.

Variable Documentation

const peripheral_control_interface_t g_lpi2cControlInterface
Initial value:
= {
.pollForActivity = lpi2c_poll_for_activity, .init = lpi2c_full_init, .shutdown = lpi2c_full_shutdown, .pump = 0
}

Control interface for the LPI2C peripheral driver.

lpi2c_transfer_info_t s_lpi2cInfo
static
Initial value:
= {
.writeData = 0, .bytesToTransfer = 0, .data_source = lpi2c_data_source, .data_sink = lpi2c_initial_data_sink
}

Global state for the LPI2C peripheral interface.