diff --git a/cpu/cc26xx/dev/batmon-sensor.c b/cpu/cc26xx/dev/batmon-sensor.c index 8131307a0..3af7a578a 100644 --- a/cpu/cc26xx/dev/batmon-sensor.c +++ b/cpu/cc26xx/dev/batmon-sensor.c @@ -61,28 +61,25 @@ static int enabled = SENSOR_STATUS_DISABLED; * \brief Returns a reading from the sensor * \param type BATMON_SENSOR_TYPE_TEMP or BATMON_SENSOR_TYPE_VOLT * - * \return The raw sensor reading, not converted to human-readable form + * \return The value as returned by the respective CC26xxware function */ static int value(int type) { - uint32_t tmp_value; - if(enabled == SENSOR_STATUS_DISABLED) { PRINTF("Sensor Disabled\n"); return 0; } if(type == BATMON_SENSOR_TYPE_TEMP) { - tmp_value = ti_lib_aon_batmon_temperature_get(); + return (int)ti_lib_aon_batmon_temperature_get_deg_c(); } else if(type == BATMON_SENSOR_TYPE_VOLT) { - tmp_value = ti_lib_aon_batmon_battery_voltage_get(); + return (int)ti_lib_aon_batmon_battery_voltage_get(); } else { PRINTF("Invalid type\n"); - return 0; } - return (int)tmp_value; + return 0; } /*---------------------------------------------------------------------------*/ /** @@ -101,7 +98,6 @@ configure(int type, int enable) switch(type) { case SENSORS_HW_INIT: ti_lib_aon_batmon_enable(); - ti_lib_aon_batmon_measurement_cycle_set(AON_BATMON_CYCLE_32); enabled = SENSOR_STATUS_ENABLED; break; case SENSORS_ACTIVE: diff --git a/cpu/cc26xx/ti-lib.h b/cpu/cc26xx/ti-lib.h index 61ad146fe..567f4f396 100644 --- a/cpu/cc26xx/ti-lib.h +++ b/cpu/cc26xx/ti-lib.h @@ -57,12 +57,7 @@ #define ti_lib_aon_batmon_enable(...) AONBatMonEnable(__VA_ARGS__) #define ti_lib_aon_batmon_disable(...) AONBatMonDisable(__VA_ARGS__) -#define ti_lib_aon_batmon_measurement_cycle_set(...) AONBatMonMeasurementCycleSet(__VA_ARGS__) -#define ti_lib_aon_batmon_measurement_cycle_get(...) AONBatMonMeasurementCycleGet(__VA_ARGS__) -#define ti_lib_aon_batmon_battery_trim_set(...) AONBatMonBatteryTrimSet(__VA_ARGS__) -#define ti_lib_aon_batmon_temperature_trim_set(...) AONBatMonTemperatureTrimSet(__VA_ARGS__) -#define ti_lib_aon_batmon_temperature_get(...) AONBatMonTemperatureGet(__VA_ARGS__) -#define ti_lib_aon_batmon_temp_get_deg(...) AON_BatmonTempGetDegC(__VA_ARGS__) +#define ti_lib_aon_batmon_temperature_get_deg_c(...) AONBatMonTemperatureGetDegC(__VA_ARGS__) #define ti_lib_aon_batmon_battery_voltage_get(...) AONBatMonBatteryVoltageGet(__VA_ARGS__) #define ti_lib_aon_batmon_new_battery_measure_ready(...) AONBatMonNewBatteryMeasureReady(__VA_ARGS__) #define ti_lib_aon_batmon_new_temp_measure_ready(...) AONBatMonNewTempMeasureReady(__VA_ARGS__) diff --git a/examples/cc26xx/cc26xx-demo.c b/examples/cc26xx/cc26xx-demo.c index b7bf56132..1426bb983 100644 --- a/examples/cc26xx/cc26xx-demo.c +++ b/examples/cc26xx/cc26xx-demo.c @@ -329,8 +329,7 @@ get_sync_sensor_readings(void) printf("-----------------------------------------\n"); value = batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP); - printf("Bat: Temp=%d.%02d C (%08x)\n", value >> 2, - (value & 0x00000003) * 25, value); + printf("Bat: Temp=%d C\n", value); value = batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT); printf("Bat: Volt=%d mV\n", (value * 125) >> 5); diff --git a/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c b/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c index d2c2bf77b..4d8c9ca86 100644 --- a/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c +++ b/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c @@ -392,8 +392,7 @@ get_batmon_reading(void *data) buf = batmon_temp_reading.converted; memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value >> 2, - (value & 0x00000003) * 25); + snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d", value); } }