From 84065e09e1301da3eb3b38cc2f22c4957630d067 Mon Sep 17 00:00:00 2001 From: Eggert Jung Date: Sun, 2 Nov 2025 19:18:29 +0100 Subject: [PATCH] cleanup --- code/main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/main.c b/code/main.c index 85794f3..ad524d9 100644 --- a/code/main.c +++ b/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;