cleanup
This commit is contained in:
12
code/main.c
12
code/main.c
@@ -19,9 +19,6 @@ uint16_t ADC_read(uint8_t channel) {
|
||||
// Wait for conversion to complete
|
||||
while (!(ADC1.INTFLAGS & ADC_RESRDY_bm));
|
||||
|
||||
//// Clear the interrupt flag
|
||||
//ADC0.CH0.INTFLAGS = ADC_CH_CHIF_bm;
|
||||
|
||||
// Read the result
|
||||
return ADC1.RES; // Return the 12-bit result
|
||||
}
|
||||
@@ -32,13 +29,14 @@ int main(void){
|
||||
PORTB.DIRSET = 1 << 3;
|
||||
|
||||
PORTA.PIN4CTRL |= PORT_PULLUPEN_bm;
|
||||
PORTC.PIN1CTRL |= PORT_PULLUPEN_bm;
|
||||
ADC_init();
|
||||
|
||||
uint8_t suck = 0;
|
||||
uint16_t cooldown = 0;
|
||||
while(1){
|
||||
suck = !(PORTA.IN & (1<<4));
|
||||
if(suck){
|
||||
static uint16_t cooldown = 0;
|
||||
uint8_t suck = !(PORTA.IN & (1<<4));
|
||||
uint8_t mode = !(PORTC.IN & (1<<1));
|
||||
if(suck ^ mode){
|
||||
static uint8_t timer = 0;
|
||||
static uint16_t duty = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user