From ae28be55d3ede4b0a31ef47226460e6b88941418 Mon Sep 17 00:00:00 2001 From: Elp03 Date: Tue, 9 Apr 2024 14:36:11 +0200 Subject: [PATCH] Fix muxpos --- prosjekt.X/voltage.c | 5 +++-- prosjekt.X/voltage.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index 08a0251..4175c41 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -33,8 +33,9 @@ uint16_t ADC0_read(void) { return ADC0.RES; } -uint16_t photodiode_voltage_read() { +uint16_t thermistor_voltage_read() { /* Gets value for the diode */ + ADC0.MUXPOS = 0x03; uint8_t adcVal = ADC0_read(); return adcVal; @@ -43,5 +44,5 @@ uint16_t photodiode_voltage_read() { uint16_t internal_voltage_read() { /* Gets value for the internal voltage reffreance*/ - VREF.ADC0REF = VREF_REFSEL_VDD_gc; + return VREF.ADC0REF = VREF_REFSEL_VDD_gc; } diff --git a/prosjekt.X/voltage.h b/prosjekt.X/voltage.h index a001a19..dde41a5 100644 --- a/prosjekt.X/voltage.h +++ b/prosjekt.X/voltage.h @@ -54,7 +54,8 @@ extern "C" { uint16_t ADC0_read(void); // Gets the value from sensor and internal voltage uint16_t internal_voltage_read(); - uint16_t photodiode_voltage_read(); + uint16_t thermistor_voltage_read(); + uint16_t internal_voltage_read(); #ifdef __cplusplus } #endif /* __cplusplus */