Пример #1
0
static void WakeupTest(WKT_CLKSRC_T clkSrc, uint32_t timeoutInSecs, CHIP_PMU_MCUPOWER_T powerTest)
{
	/* 10KHz clock source */
	Chip_WKT_SetClockSource(LPC_WKT, clkSrc);

	/* Setup for wakeup in timeout */
	Chip_WKT_LoadCount(LPC_WKT, Chip_WKT_GetClockRate(LPC_WKT) * timeoutInSecs);

	/* We can optionally call Chip_SYSCTL_SetDeepSleepPD() to power down the
	   BOD and WDT if we aren't using them in deep sleep modes. */
	Chip_SYSCTL_SetDeepSleepPD(SYSCTL_DEEPSLP_BOD_PD | SYSCTL_DEEPSLP_WDTOSC_PD);

	/* We should call Chip_SYSCTL_SetWakeup() to setup any peripherals we want
	   to power back up on wakeup. For this example, we'll power back up the IRC,
	   FLASH, the system oscillator, and the PLL */
	Chip_SYSCTL_SetWakeup(~(SYSCTL_SLPWAKE_IRCOUT_PD | SYSCTL_SLPWAKE_IRC_PD |
							SYSCTL_SLPWAKE_FLASH_PD | SYSCTL_SLPWAKE_SYSOSC_PD | SYSCTL_SLPWAKE_SYSPLL_PD));

	/* Tell PMU to go to sleep */
	Chip_PMU_Sleep(LPC_PMU, powerTest);

	/* Power anything back up here that isn't powered up on wakeup. The example
	   code below powers back up the BOD and WDT oscillator, which weren't setup to
	   pwower up in the Chip_SYSCTL_SetWakeup() function. */
	Chip_SYSCTL_SetDeepSleepPD(0);

	/* Will return here after wakeup and WKT IRQ, LED should be on */
	Chip_WKT_Stop(LPC_WKT);
}
Пример #2
0
/* Start wake-up timer interrupt, set clock source, set timer interval */
void Chip_WKT_Start(LPC_WKT_T *pWKT, WKT_CLKSRC_T clkSrc, uint32_t cntVal)
{
	/* Set the WKT clock source */
	Chip_WKT_SetClockSource(pWKT, (WKT_CLKSRC_T) clkSrc);

	/* Set the WKT counter & start it */
	pWKT->COUNT = cntVal;
}