MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual
LPUART Interrupt Mode

This example shows typical use of the Low-Power Universal Asynchronous Receiver/Transmitter (LPUART) module in interrupt mode.

Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* lpuartisr_test.c
******************************************************************************/
#include "drivers.h"
/* uart callback function prototype */
static void lpuart_callback (LPUART_CALLBACK_SRC module, LPUART_CALLBACK_TYPE type,
int32 status);
/* data type definitions */
volatile char c;
void main (void)
{
/* route core clock to PTF7 */
/* clock mode 1:1:1, 24MHz */
/* BUS clock selected as the LPUART clock source */
/* LPUART init 9600bd */
LPUART_InstallCallback (PRI_LVL1, lpuart_callback);
LPUART_PutStr(LPUART0,"\n\rCharacters will be echoed on the screen:\n");
while(1);
}
/* lpuart callback function definition */
static void lpuart_callback (LPUART_CALLBACK_SRC module, LPUART_CALLBACK_TYPE type,
int32 status)
{
if (module == LPUART0_CALLBACK)
{
if (type == LPUART_TX_CALLBACK)
{
LPUART_PutChar (LPUART0, c);
}
if (type == LPUART_RX_CALLBACK)
{
c = LPUART_GetChar (LPUART0);
LPUART_TxIsrEnable (LPUART0);
}
}
}
Toolchain support:
IAR EWARM 7.40.7KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0