/* * Ext_Interrupt.c */ #include #include "Ext_Interrupt.h" #include "IRsensor.h" static volatile unsigned int stats1_counted = 0; static volatile unsigned int stats2_counted = 0; void reset_stats_counted(void) { stats1_counted = 0; stats2_counted = 0; } unsigned int get_stats1_counted(void) { return stats1_counted; } unsigned int get_stats2_counted(void) { return stats2_counted; } void reset_external_interrupt(void) { SET_FALLING_EDGE_INT0(); SET_FALLING_EDGE_INT1(); ENABLE_INT0(); ENABLE_INT1(); } void init_external_interrupt_0(void) { Config_IRsensor_1(); SET_FALLING_EDGE_INT0(); ENABLE_INT0(); } ISR(INT0_vect) { stats1_counted++; } void init_external_interrupt_1(void) { Config_IRsensor_2(); SET_FALLING_EDGE_INT1(); ENABLE_INT1(); } ISR(INT1_vect) { stats2_counted++; } void enable_global_interrupt(void) { sei(); } void disable_global_interrupt(void) { cli(); }