Miscellany
public c v1 · immutable#include <avr/io.h>#include <avr/interrupt.h>#include <stdint.h>int8_t prevState;SIGNAL(SIG_INTERRUPT0){uint8_t port = PORTA;uint8_t pressed = port & ~prevState;prevState=port; if(pressed == 0) PORTD ^=(1<<PD6); if(pressed==1) PORTD ^=(1<<PD5);}int main(void){ GICR=0xC0; MCUCR=0x01; sei(); DDRD |= (1<<PD6)|(1<<PD5); PORTD |= (1 << PD2); PORTA |=(1<<PA0)|(1<<PA1)|(1<<PA2)|(1<<PA3)|(1<<PA4)|(1<<PA5)|(1<<PA6)|(1<<PA7); while (1) { } return 0;}