39 #include "lib/sensors.h" 43 #include <ti/devices/DeviceFamily.h> 44 #include DeviceFamily_constructPath(driverlib/aon_batmon.h) 51 #define PRINTF(...) printf(__VA_ARGS__) 56 #define SENSOR_STATUS_DISABLED 0 57 #define SENSOR_STATUS_ENABLED 1 59 static int enabled = SENSOR_STATUS_DISABLED;
70 if(enabled == SENSOR_STATUS_DISABLED) {
71 PRINTF(
"Sensor Disabled\n");
72 return BATMON_SENSOR_READING_ERROR;
76 case BATMON_SENSOR_TYPE_TEMP:
return (
int)AONBatMonTemperatureGetDegC();
77 case BATMON_SENSOR_TYPE_VOLT:
return (
int)AONBatMonBatteryVoltageGet();
79 PRINTF(
"Invalid type\n");
80 return BATMON_SENSOR_READING_ERROR;
100 enabled = SENSOR_STATUS_ENABLED;
105 enabled = SENSOR_STATUS_ENABLED;
108 enabled = SENSOR_STATUS_DISABLED;
133 return SENSOR_STATUS_DISABLED;
static int value(int type)
Returns a reading from the sensor.
static int status(int type)
Returns the status of the sensor.
static int configure(int type, int enable)
Configuration function for the battery monitor sensor.