123456789101112131415161718192021222324252627 |
- #include "all-headers.h"
- int ultimate_answer(42);
- bool clickHappened(false);
- void setup (USER_MODE) {
- // Enable interruption triggered by encoder clic
- PORTD_PCR (0) |= PORT_PCR_IRQC (10);
- NVIC_ENABLE_IRQ (ISRSlot::PORTD);
- }
- void loop (USER_MODE) {
- assertion (ultimate_answer == 42, 101, __FILE__, __LINE__) ;
- if (clickHappened) {
- printString(MODE_ "Clic! ");
- clickHappened = false;
- }
- }
- void clicInterruptSection(SECTION_MODE) {
- clickHappened = true;
- // Acquit interruption
- PORTD_PCR (0) |= PORT_PCR_ISF ;
- const uint32_t x __attribute__((unused)) = PORTD_PCR (0) ;
- }
|