removed unused code

This commit is contained in:
jakeg00dwin 2024-07-28 17:02:03 -07:00
parent 25cb285fd9
commit f484e625af
1 changed files with 0 additions and 49 deletions

View File

@ -30,55 +30,6 @@
//Set the function pointer for the delay func
void (*Delay_MicroSeconds)(double us) = _delay_us;
static void setup_adc0(void)
{
//Set the bits used.
ADC0.CTRLA = 0x0;
//Set the sample accumulation number to 32
ADC0.CTRLB = 0x5;
//Set the Voltage Reference point to VCC.
ADC0.CTRLC |= (1<<4);
//Set the Prescaler to divide the F_PER by 32
ADC0.CTRLC |= (1<<2);
//Setup a initialization delay
ADC0.CTRLD |= (2<<5);
//Add ADC variation for cleaner readings
ADC0.CTRLD |= (1<<4);
//Enable the ADC
ADC0.CTRLA |= (1<<0);
}
static void setup_pa4_adc(void)
{
//Set the PA4 pin as an input pin.
PORTA.DIR ^= ~(1<<4);
//Configure the MUXPOS or which pin gets connected to ADC0 periph.
ADC0.MUXPOS = 0x04; //AIN4
}
static uint16_t read_adc0(void)
{
ADC0.COMMAND = ADC_STCONV_bm;
//Wait until the sampling/conversion is done.
while (!(ADC0.INTFLAGS & ADC_RESRDY_bm))
{
;
}
//Bit Shift to account for the accumulated samples.
//AKA we divide by 32
uint16_t value = ADC0.RES >> 5;
return value;
}
int main(int argc, char **argv)
{