HeptaBattery library
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