51 #include PLATFORM_HEADER
53 #include "hal/error.h"
57 #include "dev/temperature-sensor.h"
59 #undef TEMPERATURE_SENSOR_GPIO
60 #define TEMPERATURE_SENSOR_GPIO PORTB_PIN(7)
75 static int16u ADCvalue;
78 halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE_ADC2_VREF2, ADC_CONVERSION_TIME_US_4096);
80 halReadAdcBlocking(ADC_USER_APP, &ADCvalue);
83 volts = halConvertValueToVolts(ADCvalue);
86 return ((18663 - (int32s)volts)*100)/1169;
91 configure(
int type,
int value)
116 SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR,
117 value, configure, status);