/* Battery interfacing (ADC sense + FET drive) - C3-DevKitM-1 PINOUT DEFINITIONS FOR USING THE BOARD's MECHANISMS FOR MONITORING BATTERY LEVEL VIA ADC (USING VOLTAGE DIVIDER SUBCIRCUIT) BY TOGGLING THE FET SWITCHES PRESENT ON THE IoT Carrier ADDITIONALLY PROVIDED A CONSTANT,BASED ON BOARD's COMPONENT VALUES THIS CONSTANT IS TO BE USED WHEN CALCULATING BATTERY LEVEL DO NOT CHANGE PIN AND CONSTANT DEFINITIONS */ #ifndef BATTERY_INTERFACING_H #define BATTERY_INTERFACING_H #define BATTERY_ADC_PIN 1 /* ADC input pin,whose function is to gauge battery level via the voltage divider on the PCB */ #define FET_DRIVE_PIN 5 /*FET enable pin, to drive the NMOS switch to close,in order to close the PMOS switch as well,which allows reading the battery voltage*/ #define ADC_DIVIDER_GAIN 1.5f//V_ADC = VBAT * (R15 / R14 + R15), therefore VBAT = V_ADC * ((R14 + R15)/ R15). The latter is the formula to be used to get the battery level by using the ADC input. The resistor ratio is 1.5 #endif