int main(void) { application__init(); application__start(); #if !defined(__AVR_ARCH__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmissing-noreturn" #endif for(;;) { led1__set(button1__get()); led2__set(button2__get()); led3__set(button3__get()); led4__set(button4__get()); led5__set(button5__get()); led6__set(button6__get()); } #if !defined(__AVR_ARCH__) #pragma clang diagnostic pop #endif #if !defined(__AVR_ARCH__) #pragma clang diagnostic push #pragma ide diagnostic ignored "OCDFAInspection" #endif return 0; #if !defined(__AVR_ARCH__) #pragma clang diagnostic pop #endif }
int main(void) { ENABLE_PULLUP(IN__BUTTON1); ENABLE_PULLUP(IN__BUTTON2); ENABLE_PULLUP(IN__BUTTON3); ENABLE_PULLUP(IN__BUTTON4); ENABLE_PULLUP(IN__BUTTON5); ENABLE_PULLUP(IN__BUTTON6); ENABLE_PULLUP(UNUSED_D0); ENABLE_PULLUP(UNUSED_D1); led1__init(); led2__init(); led3__init(); while(1) { uint8_t state = IN(IN__BUTTONS) & (_BV(IN__BUTTON1__PIN) | _BV(IN__BUTTON2__PIN) | _BV(IN__BUTTON3__PIN) | _BV(IN__BUTTON4__PIN) | _BV(IN__BUTTON5__PIN) | _BV(IN__BUTTON6__PIN)); if (!(state & _BV(IN__BUTTON1__PIN))) { led1__set(1); led2__set(0); led3__set(0); } else if (!(state & _BV(IN__BUTTON2__PIN))) { led1__set(0); led2__set(1); led3__set(0); } else if (!(state & _BV(IN__BUTTON3__PIN))) { led1__set(1); led2__set(1); led3__set(0); } else if (!(state & _BV(IN__BUTTON4__PIN))) { led1__set(0); led2__set(0); led3__set(1); } else if (!(state & _BV(IN__BUTTON5__PIN))) { led1__set(1); led2__set(0); led3__set(1); } else if (!(state & _BV(IN__BUTTON6__PIN))) { led1__set(0); led2__set(1); led3__set(1); } else { led1__set(0); led2__set(0); led3__set(0); } _delay_ms(50); } }