MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual
PMC Example

This example shows typical use of the Power Mode Controller (PMC) Driver.

Source code:
/******************************************************************************
* (c) Copyright 2010-2015, Freescale Semiconductor Inc.
* ALL RIGHTS RESERVED.
******************************************************************************
* pmc_test.c
******************************************************************************/
#include "drivers.h"
/* LEDs definition */
#define LVW_WARN_LED PIN3 /* PTJ3 */
#define LVD_WARN_LED PIN4 /* PTJ4 */
/* callback function declaration */
static void pmc_callback (PMC_CALLBACK_TYPE type);
void main (void)
{
PORT_Init (PORTJ, PORT_MODULE_LED_MODE, LVW_WARN_LED);
PORT_Init (PORTJ, PORT_MODULE_LED_MODE, LVD_WARN_LED);
GPIO_Init (GPIOJ, GPIO_OUT_LOGIC1_MODE, LVW_WARN_LED);
GPIO_Init (GPIOJ, GPIO_OUT_LOGIC1_MODE, LVD_WARN_LED);
while(1);
}
/* callback function definition */
static void pmc_callback (PMC_CALLBACK_TYPE type)
{
if (type == LVW_CALLBACK)
{
GPIO_Tgl (GPIOJ, LVW_WARN_LED); /* toggles when voltage below 3.00 V */
arch_delay (400000l);
}
if (type == LVD_CALLBACK) /* toggles when voltage below 2.56 V */
{
GPIO_Tgl (GPIOJ, LVD_WARN_LED);
arch_delay (400000l);
}
}
Toolchain support:
IAR EWARM 7.40.7KEIL uVision 5.15CrossWorks 3.6ATOLLIC TrueStudio 5.3.0Kinetis Design Studio 3.0.0