Wake-up timer library to wake from deepsleep/power-down
Dependencies: LPC1114_WakeInterruptIn
Fork of WakeUp by
Diff: Device/WakeUp_LPC11XX.cpp
- Revision:
- 14:6bf547e1e62d
- Parent:
- 13:fd24cec76d5a
--- a/Device/WakeUp_LPC11XX.cpp Wed Jul 30 20:02:47 2014 +0000 +++ b/Device/WakeUp_LPC11XX.cpp Wed Jul 30 20:39:57 2014 +0000 @@ -108,6 +108,10 @@ void WakeUp::calibrate(void) { + //Save current pin function + __IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + (dp24 & 0xFF)); + uint32_t old_pinfun = *reg; + //Set oscillator for 20kHz LPC_SYSCON->PDRUNCFG &= ~PDRUNCFG_WDTOSC_PD; LPC_SYSCON->WDTOSCCTRL = 14 | (1<<5); @@ -130,6 +134,10 @@ count++; } cycles_per_ms = (float)count / 100.0f; + + //Set old pin function back, disable CLKOUT + *reg = old_pinfun; + LPC_SYSCON->CLKOUTDIV = 0; } static inline void restore(void) {