add the implementation of LP1768 wakeup based on the old WakeUp library

Dependencies:   LPC1114_WakeInterruptIn

Fork of WakeUp by steven niu

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Wed Jul 30 20:39:57 2014 +0000
Parent:
14:fd24cec76d5a
Commit message:
Calibrate on LPC1114 now restores pin function settings afterwards (previously this broke wakeups were dp24 was used).
;
; Moved WakeInterruptIn to Device folder.

Changed in this revision

Device/LPC1114_WakeInterruptIn.lib Show annotated file Show diff for this revision Revisions of this file
Device/WakeUp_LPC11XX.cpp Show annotated file Show diff for this revision Revisions of this file
LPC1114_WakeInterruptIn.lib Show diff for this revision Revisions of this file
diff -r fd24cec76d5a -r 6bf547e1e62d Device/LPC1114_WakeInterruptIn.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Device/LPC1114_WakeInterruptIn.lib	Wed Jul 30 20:39:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/LPC1114_WakeInterruptIn/#128f3fe79240
diff -r fd24cec76d5a -r 6bf547e1e62d Device/WakeUp_LPC11XX.cpp
--- 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) {
diff -r fd24cec76d5a -r 6bf547e1e62d LPC1114_WakeInterruptIn.lib
--- a/LPC1114_WakeInterruptIn.lib	Wed Jul 30 20:02:47 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/Sissors/code/LPC1114_WakeInterruptIn/#128f3fe79240