Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Lab9-01_All_transmit Lab9-03_Thermal_chamber 3daf572bcae1 Team ... more
Fork of HeptaBattery by
Diff: HeptaBattery.cpp
- Revision:
- 8:92dcd75454b5
- Parent:
- 7:b701e9cd2108
--- a/HeptaBattery.cpp Fri Nov 17 02:08:19 2017 +0000 +++ b/HeptaBattery.cpp Wed Aug 08 10:36:56 2018 +0000 @@ -36,27 +36,29 @@ //*dsize = 4; } -void HeptaBattery::power_saving_mode() +void HeptaBattery::power_saving_mode(int *flag,float* Bat) { - float Bat; - Bat = _bat.read()*1.431*3.3; + *Bat = _bat.read()*1.431*3.3; //4.2以上 - if(Bat>=4.2) { + if(*Bat>=4.2) { _bat_ct = 1; LPC_SC->CCLKCFG = 2; SystemCoreClockUpdate(); + *flag = 0; } //3.7 < Voltage < 4.1 - else if(Bat<=4.1 && Bat>=3.7) { + else if(*Bat<=4.1 && *Bat>=3.7) { _bat_ct = 1; LPC_SC->CCLKCFG = 2; SystemCoreClockUpdate(); + *flag = 0; } //3.5V以下 - else if(Bat<=3.5) { + else if(*Bat<=3.5) { _bat_ct = 0; LPC_SC->CCLKCFG = 5; SystemCoreClockUpdate(); + *flag = 1; } } \ No newline at end of file