Changes done in ECG and BT

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of merged_code2_20sept_2017_4th_oct_2017 by nikita teggi

battery.cpp

Committer:
avp2417
Date:
2017-07-29
Revision:
37:92fcbf22bf91
Parent:
22:ffa88619551d
Child:
45:067673dae242

File content as of revision 37:92fcbf22bf91:

#include "mbed.h"
#include "battery.h"
#include "display_modules.h"
AnalogIn A(PTB1);

uint8_t battery_voltage() {
float b_voltage;
uint8_t battery_condition=0;
        b_voltage = A.read_u16()*(3.3/65535)*2;
        wait(0.001f);
      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;
}