Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
Diff: battery.cpp
- Revision:
- 37:92fcbf22bf91
- Parent:
- 22:ffa88619551d
- Child:
- 45:067673dae242
diff -r 00d96aa14658 -r 92fcbf22bf91 battery.cpp --- a/battery.cpp Sat Jul 29 11:23:19 2017 +0000 +++ b/battery.cpp Sat Jul 29 12:12:28 2017 +0000 @@ -1,17 +1,34 @@ #include "mbed.h" #include "battery.h" - +#include "display_modules.h" AnalogIn A(PTB1); -float battery_voltage() { - // GLC_PWR=1; - // Enable=1;Shutdown=1; +uint8_t battery_voltage() { float b_voltage; - //unsigned int samples1[4]; - //unsigned int data2n; - - b_voltage = A.read_u16()*(3.3/65535)*2; +uint8_t battery_condition=0; + b_voltage = A.read_u16()*(3.3/65535)*2; wait(0.001f); - -return b_voltage; + if (b_voltage>3.64) + { + battery_screen_charge(); + battery_condition=0; + } + else if (3.605>b_voltage>3.57) ///15% to 10% + { + battery_low_charge(); + battery_condition=1; + } + else if (3.57>b_voltage>3.535) /// 10% to 5% + { + battery_critically_low_charge(); + battery_condition=2; + } + else if (3.535>b_voltage) + { + battery_screen_nocharge(); + battery_condition=3; + } + + +return battery_condition; } \ No newline at end of file