Przeglądaj źródła

sun_usb: Fix serial recv intrrupt trriger edge #228

master
tmk 9 lat temu
rodzic
commit
37af88217d
1 zmienionych plików z 8 dodań i 2 usunięć
  1. 8
    2
      converter/sun_usb/config.h

+ 8
- 2
converter/sun_usb/config.h Wyświetl plik

#define SERIAL_SOFT_RXD_BIT 2 #define SERIAL_SOFT_RXD_BIT 2
#define SERIAL_SOFT_RXD_VECT INT2_vect #define SERIAL_SOFT_RXD_VECT INT2_vect
/* RXD Interupt */ /* RXD Interupt */
#ifdef SERIAL_SOFT_LOGIC_NEGATIVE
/* enable interrupt: INT2(rising edge) */
#define INTR_TRIG_EDGE ((1<<ISC21)|(1<<ISC20))
#else
/* enable interrupt: INT2(falling edge) */
#define INTR_TRIG_EDGE ((1<<ISC21)|(0<<ISC20))
#endif
#define SERIAL_SOFT_RXD_INIT() do { \ #define SERIAL_SOFT_RXD_INIT() do { \
/* pin configuration: input with pull-up */ \ /* pin configuration: input with pull-up */ \
SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \ SERIAL_SOFT_RXD_DDR &= ~(1<<SERIAL_SOFT_RXD_BIT); \
SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \ SERIAL_SOFT_RXD_PORT |= (1<<SERIAL_SOFT_RXD_BIT); \
/* enable interrupt: INT2(rising edge) */ \
EICRA |= ((1<<ISC21)|(1<<ISC20)); \
EICRA |= INTR_TRIG_EDGE; \
EIMSK |= (1<<INT2); \ EIMSK |= (1<<INT2); \
sei(); \ sei(); \
} while (0) } while (0)