diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 4175c41..c62d872 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -36,13 +36,18 @@ uint16_t ADC0_read(void) { uint16_t thermistor_voltage_read() { /* Gets value for the diode */ ADC0.MUXPOS = 0x03; - uint8_t adcVal = ADC0_read(); + uint8_t adc_val = ADC0_read(); - return adcVal; + return adc_val; } uint16_t internal_voltage_read() { /* Gets value for the internal voltage reffreance*/ - return VREF.ADC0REF = VREF_REFSEL_VDD_gc; + VREF.ADC0REF = VREF_REFSEL_VDD_gc; + + ADC0.MUXPOS = 0x44; + uint8_t adc_val = ADC0_read(); + + return adc_val*10; } diff --git a/prosjekt.X/voltage.h b/prosjekt.X/voltage.h index dde41a5..af2e76d 100644 --- a/prosjekt.X/voltage.h +++ b/prosjekt.X/voltage.h @@ -55,7 +55,6 @@ extern "C" { // Gets the value from sensor and internal voltage uint16_t internal_voltage_read(); uint16_t thermistor_voltage_read(); - uint16_t internal_voltage_read(); #ifdef __cplusplus } #endif /* __cplusplus */