Read nRF51822(BLE Chip) VDD voltage and return 100 to 0% charging level

Dependents:   BLE_Temp_Vdd_via_UART_TY BLE_EddystoneBeacon_w_ACC_TY51822 BLE_LoopbackUART_low_pwr_w_RTC1 BLE_Paired_Server ... more

This is only for nRF51822.

You don't need any hardware circuit. Just read internal Vdd voltage using ADC function inside of the chip.

Files at this revision

API Documentation at this revision

Comitter:
kenjiArai
Date:
Sat Apr 14 04:55:32 2018 +0000
Parent:
2:9b1e219a7695
Commit message:
small modification

Changed in this revision

nRF51_Vdd.cpp Show annotated file Show diff for this revision Revisions of this file
nRF51_Vdd.h Show annotated file Show diff for this revision Revisions of this file
nRF51_WakeUp.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 9b1e219a7695 -r faf2e448c15b nRF51_Vdd.cpp
--- a/nRF51_Vdd.cpp	Sun May 29 00:54:11 2016 +0000
+++ b/nRF51_Vdd.cpp	Sat Apr 14 04:55:32 2018 +0000
@@ -3,11 +3,11 @@
  *  Read nRF51822 VDD volatage and return 100 to 0% charging level
  *      https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF51822
  *
- * Copyright (c) 2016 Kenji Arai / JH1PJL
+ * Copyright (c) 2016,'18 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
- *  http://mbed.org/users/kenjiArai/
+ *  https://os.mbed.com/users/kenjiArai/
  *      Created:    January   23rd, 2016
- *      Revised:    May       29th, 2016
+ *      Revised:    April     14th, 2018
  *
  * 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
@@ -71,7 +71,7 @@
         NRF_ADC->POWER       = 0;
         nrf_delay_us(5);
     }
-    return ((float)wrk / 1024 * 1.2 * 3.0);            
+    return ((float)wrk / 1024.0f * 1.2f * 3.0f);            
 }
 
 uint8_t nRF51_Vdd::read(void){
diff -r 9b1e219a7695 -r faf2e448c15b nRF51_Vdd.h
--- a/nRF51_Vdd.h	Sun May 29 00:54:11 2016 +0000
+++ b/nRF51_Vdd.h	Sat Apr 14 04:55:32 2018 +0000
@@ -3,11 +3,11 @@
  *  Read nRF51822 VDD volatage and return 100 to 0% charging level
  *      https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF51822
  *
- * Copyright (c) 2016 Kenji Arai / JH1PJL
+ * Copyright (c) 2016,'18 Kenji Arai / JH1PJL
  *  http://www.page.sannet.ne.jp/kenjia/index.html
- *  http://mbed.org/users/kenjiArai/
+ *  https://os.mbed.com/users/kenjiArai/
  *      Created:    January   23rd, 2016
- *      Revised:    May       29th, 2016
+ *      Revised:    April     14th, 2018
  *
  * 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
diff -r 9b1e219a7695 -r faf2e448c15b nRF51_WakeUp.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF51_WakeUp.lib	Sat Apr 14 04:55:32 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/kenjiArai/code/nRF51_WakeUp/#cc54cd1df555