diff options
| -rw-r--r-- | lock/bend.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lock/bend.c b/lock/bend.c index f4323b7..823fddd 100644 --- a/lock/bend.c +++ b/lock/bend.c @@ -21,13 +21,14 @@ #define LOCK_PIN PD2 #define UNLOCK_PIN PD3 -#define RX_PIN PD7 -#define RX_DDR DDRD -#define RX_PORT PORTD -#define RX_PCIE PCIE2 -#define RX_PCINT PCINT23 -#define RX_PCMSK PCMSK2 -#define RX_PCINTVEC PCINT2_vect +#define RX_IRQ_PIN PC1 +#define RX_DDR DDRC +#define RX_PIN PINC +#define RX_ICR PCICR +#define RX_IE PCIE1 +#define RX_INT PCINT9 +#define RX_MSK PCMSK1 +#define RX_INTVEC PCINT1_vect #define VCC_MIN 4900 @@ -84,10 +85,9 @@ static inline void init_wdt(void) static inline void init_rx(void) { - RX_DDR &= ~(1 << RX_PIN); - RX_PORT |= (1 << RX_PIN); - PCICR |= (1 << RX_PCIE); - RX_PCMSK |= (1 << RX_PCINT); + RX_DDR &= ~(1 << RX_IRQ_PIN); + RX_ICR |= (1 << RX_IE); + RX_MSK |= (1 << RX_INT); } static inline void init_btns(void) @@ -185,9 +185,10 @@ int main(void) return 0; } -ISR(RX_PCINTVEC) +ISR(RX_INTVEC) { - rxd = 1; + if (!(RX_PIN & (1 << RX_IRQ_PIN))) + rxd = 1; } ISR(INT0_vect) |
