From ca28e23b70411d5cd75c5e03527847b123f3b4b9 Mon Sep 17 00:00:00 2001 From: Elp03 Date: Tue, 9 Apr 2024 16:13:04 +0200 Subject: [PATCH] Fixed header, comments and Muxpos --- prosjekt.X/voltage.c | 6 +++--- prosjekt.X/voltage.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/prosjekt.X/voltage.c b/prosjekt.X/voltage.c index c7ed16e..b06fa06 100644 --- a/prosjekt.X/voltage.c +++ b/prosjekt.X/voltage.c @@ -35,14 +35,14 @@ uint16_t ADC0_read(void) { uint16_t thermistor_voltage_read() { /* Gets value for the diode */ - ADC0.MUXPOS = 0x03; + ADC0.MUXPOS = 0x03; // Read PD3 uint16_t adc_val = ADC0_read(); return adc_val; } - +// Gets the value over thermistor uint16_t external_voltage_read(){ - ADC0.MUXPOS = 0x02; + ADC0.MUXPOS = 0x06; // Read PD6 uint16_t adc_val = ADC0_read(); return adc_val; diff --git a/prosjekt.X/voltage.h b/prosjekt.X/voltage.h index af2e76d..4f88758 100644 --- a/prosjekt.X/voltage.h +++ b/prosjekt.X/voltage.h @@ -54,7 +54,13 @@ extern "C" { uint16_t ADC0_read(void); // Gets the value from sensor and internal voltage uint16_t internal_voltage_read(); + // Gets the value over thermistor uint16_t thermistor_voltage_read(); + // Gets internal voltage + uint16_t external_voltage_read(); + // Converts value to voltage + uint16_t convert_to_voltage(uint16_t adc_val); + #ifdef __cplusplus } #endif /* __cplusplus */