Made it into its own func
This commit is contained in:
parent
4105c1ff04
commit
efe623936a
@ -23,8 +23,7 @@ int main() {
|
||||
stdout = &USART_stream;
|
||||
|
||||
while (1) {
|
||||
uint16_t adcVal = ADC0_read();
|
||||
VREF.ADC0REF = VREF_REFSEL_VDD_gc;
|
||||
printf("The values: \n%u , %u\n",VREF_REFSEL_VDD_gc , adcVal);
|
||||
voltage_values();
|
||||
//printf("The values: \n%u , %u\n",VREF_REFSEL_VDD_gc , adcVal);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
#include "voltage.h"
|
||||
|
||||
void sensor_init(void) {
|
||||
/* Disable digital input buffer */
|
||||
}
|
||||
@ -27,3 +28,9 @@ uint16_t ADC0_read(void) {
|
||||
ADC0.INTFLAGS = ADC_RESRDY_bm;
|
||||
return ADC0.RES;
|
||||
}
|
||||
|
||||
uint8_t voltage_values(void) {
|
||||
uint8_t adcVal = ADC0_read();
|
||||
VREF.ADC0REF = VREF_REFSEL_VDD_gc;
|
||||
return adcVal;
|
||||
}
|
||||
@ -47,7 +47,8 @@ extern "C" {
|
||||
void sensor_init(void);
|
||||
void ADC0_init(void);
|
||||
void ADC0_start(void);
|
||||
uint16_t ADC0_read(void);
|
||||
uint8_t ADC0_read(void);
|
||||
void voltage_values(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user