Wake-up function using RTC1. This revision, current consumption is around 80uA at deep sleep mode and this is not enough!! I cannot reduce it until today. This is a temporary revision which I need your help.

Dependents:   BLE_LoopbackUART_low_pwr_w_RTC1 BLE_Uart_Server

Please refer following notebook.
/users/kenjiArai/notebook/ty51822r3-current-consumption-using-nrf51_wakeup-l/#

Revision:
1:cc54cd1df555
Parent:
0:f50677171f2d
--- a/nRF51_WakeUp.cpp	Sat Apr 02 06:19:14 2016 +0000
+++ b/nRF51_WakeUp.cpp	Sat Jun 11 00:52:47 2016 +0000
@@ -6,7 +6,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Created:    March     24th, 2016
- *      Revised:    April      2nd, 2016
+ *      Revised:    June      11th, 2016
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
@@ -64,18 +64,56 @@
     NRF_RTC1->TASKS_START = 1;
     nrf_delay_us(MAX_RTC_TASKS_DELAY);
     //----- Goto Deep Sleep mode --------------------------
-    NRF_RADIO->POWER = 0;
-    NRF_UART0->POWER = 0;
-    NRF_RADIO->POWER = 0;
-    NRF_SPI0->POWER  = 0;
-    NRF_SPI1->POWER  = 0;
-    NRF_TWI0->POWER  = 0;
-    NRF_TWI1->POWER  = 0;
-    NRF_POWER->RAMON =
-          POWER_RAMON_ONRAM0_RAM0On   << POWER_RAMON_ONRAM0_Pos
-        | POWER_RAMON_ONRAM1_RAM1On   << POWER_RAMON_ONRAM1_Pos
-        | POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos
-        | POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos;
+    // RADIO
+    NRF_RADIO->POWER            = 0;
+    nrf_delay_us(5);
+    // UART
+    NRF_UART0->POWER            = 0;
+    nrf_delay_us(5);
+    // I2C
+    NRF_TWI1->POWER             = 0;
+    nrf_delay_us(5);
+    // SPI
+    NRF_SPI0->POWER             = 0;
+    nrf_delay_us(5);
+    NRF_SPI1->POWER             = 0;
+    nrf_delay_us(5);
+    NRF_SPIS1->POWER            = 0;
+    nrf_delay_us(5);
+    // PWM(Timer0,1,2)
+    NRF_TIMER0->POWER           = 0;
+    nrf_delay_us(5);
+    NRF_TIMER1->POWER           = 0;
+    nrf_delay_us(5);
+    NRF_TIMER2->POWER           = 0;
+    nrf_delay_us(5);
+    // PPI (use CH[0])
+    NRF_PPI->TASKS_CHG[1].DIS   = 1;
+    NRF_PPI->TASKS_CHG[2].DIS   = 1;
+    NRF_PPI->TASKS_CHG[3].DIS   = 1;
+    for (uint8_t n = 1; n <16 ; n++){
+        NRF_PPI->CH[n].TEP = 0;
+        NRF_PPI->CH[n].EEP = 0;
+    }
+    // ADC
+    NRF_ADC->POWER              = 0;
+    nrf_delay_us(5);
+    // Temperature senosr
+    NRF_TEMP->TASKS_STOP        = 1;
+    nrf_delay_us(5);
+    // Others
+    NRF_RNG->POWER              = 0;
+    NRF_ECB->POWER              = 0;
+    NRF_AAR->POWER              = 0;
+    NRF_CCM->POWER              = 0;
+    NRF_WDT->POWER              = 0;
+    NRF_QDEC->POWER             = 0;
+    NRF_LPCOMP->POWER           = 0;
+    // Cock & Power
+    NRF_CLOCK->TASKS_HFCLKSTOP  = 1;
+    NRF_POWER->DCDCEN           = 0;
+    //sd_power_system_off();
+    //NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter;
     while(true){
         deepsleep();
     }