Add muxpos to internal voltage

This commit is contained in:
Elp03 2024-04-09 14:56:14 +02:00
parent ae28be55d3
commit 91ee8b1af8
2 changed files with 8 additions and 4 deletions

View File

@ -36,13 +36,18 @@ uint16_t ADC0_read(void) {
uint16_t thermistor_voltage_read() { uint16_t thermistor_voltage_read() {
/* Gets value for the diode */ /* Gets value for the diode */
ADC0.MUXPOS = 0x03; ADC0.MUXPOS = 0x03;
uint8_t adcVal = ADC0_read(); uint8_t adc_val = ADC0_read();
return adcVal; return adc_val;
} }
uint16_t internal_voltage_read() { uint16_t internal_voltage_read() {
/* Gets value for the internal voltage reffreance*/ /* 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;
} }

View File

@ -55,7 +55,6 @@ extern "C" {
// Gets the value from sensor and internal voltage // Gets the value from sensor and internal voltage
uint16_t internal_voltage_read(); uint16_t internal_voltage_read();
uint16_t thermistor_voltage_read(); uint16_t thermistor_voltage_read();
uint16_t internal_voltage_read();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */