Enter Low Power mode not to use sd_power_system_off() subroutine

Dependents:   BLE_EddystoneBeacon_w_ACC_TY51822 BLE_LoopbackUART_low_pwr_w_RTC1 BLE_Paired_Server BLE_Paired_Client

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sat Jun 11 00:45:36 2016 +0000
Parent:
1:4c3f4f1e154e
Commit message:
added delay()

Changed in this revision

nRF51_lowpwr.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51_lowpwr.h Show annotated file Show diff for this revision Revisions of this file
diff -r 4c3f4f1e154e -r ffd5168de563 nRF51_lowpwr.cpp
--- a/nRF51_lowpwr.cpp	Fri Jun 03 02:24:37 2016 +0000
+++ b/nRF51_lowpwr.cpp	Sat Jun 11 00:45:36 2016 +0000
@@ -6,7 +6,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Started:    April     30th, 2016
- *      Revised:    June       3rd, 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
@@ -32,6 +32,7 @@
         NRF_UART0->TASKS_STOPRX     = 1;
         nrf_delay_us(5);
         NRF_UART0->POWER            = 0;
+        nrf_delay_us(5);
     }
     if (param->i2c_function == false){
         //#warning    "Disable I2C function!"
@@ -42,9 +43,10 @@
         NRF_TWI0->ENABLE            = 0;
         nrf_delay_us(5);
         NRF_TWI0->POWER             = 0;
+        nrf_delay_us(5);
         NRF_TWI1->EVENTS_ERROR      = 0;
         nrf_delay_us(5);
-        NRF_TWI0->INTENCLR          = 0xffffffff;
+        NRF_TWI1->INTENCLR          = 0xffffffff;
         nrf_delay_us(5);
         NRF_TWI1->ENABLE            = 0;
         nrf_delay_us(5);
@@ -57,11 +59,13 @@
         NRF_SPI0->ENABLE            = 0;
         nrf_delay_us(5);
         NRF_SPI0->POWER             = 0;
+        nrf_delay_us(5);
         NRF_SPI1->INTENCLR          = 0xffffffff;
         nrf_delay_us(5);
         NRF_SPI1->ENABLE            = 0;
         nrf_delay_us(5);
         NRF_SPI1->POWER             = 0;
+        nrf_delay_us(5);
         NRF_SPIS1->INTENCLR          = 0xffffffff;
         nrf_delay_us(5);
         NRF_SPIS1->ENABLE            = 0;
@@ -76,16 +80,19 @@
         NRF_TIMER0->TASKS_STOP      = 1;
         nrf_delay_us(5);
         NRF_TIMER0->POWER           = 0;
+        nrf_delay_us(5);
         NRF_TIMER1->INTENCLR        = 0xffffffff;
         nrf_delay_us(5);
         NRF_TIMER1->TASKS_STOP      = 1;
         nrf_delay_us(5);
         NRF_TIMER1->POWER           = 0;
+        nrf_delay_us(5);
         NRF_TIMER2->INTENCLR        = 0xffffffff;
         nrf_delay_us(5);
         NRF_TIMER2->TASKS_STOP      = 1;
         nrf_delay_us(5);
         NRF_TIMER2->POWER           = 0;
+        nrf_delay_us(5);
         // PPI
         NRF_PPI->TASKS_CHG[0].DIS   = 1;
         NRF_PPI->TASKS_CHG[1].DIS   = 1;
@@ -99,9 +106,12 @@
     if (param->analog_function == false){
         //#warning    "Disable ADC function!"
         NRF_ADC->TASKS_STOP         = 1;
+        nrf_delay_us(5);
         NRF_ADC->CONFIG             = 0x18;
+        nrf_delay_us(5);
         NRF_ADC->ENABLE             = 0;
         nrf_delay_us(5);
         NRF_ADC->POWER              = 0;
+        nrf_delay_us(5);
     }
 }
diff -r 4c3f4f1e154e -r ffd5168de563 nRF51_lowpwr.h
--- a/nRF51_lowpwr.h	Fri Jun 03 02:24:37 2016 +0000
+++ b/nRF51_lowpwr.h	Sat Jun 11 00:45:36 2016 +0000
@@ -6,7 +6,7 @@
  *  http://www.page.sannet.ne.jp/kenjia/index.html
  *  http://mbed.org/users/kenjiArai/
  *      Started:    April     30th, 2016
- *      Revised:    June       3rd, 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