My project is using the comparator within a T_3.2 or T_3.5 and CMP1 interrupts.
The functions for comparator configuration and handling are located in COMP1.h and COMP1.cpp.
COMP1.h is included in the sketch.
The function CMP1_init() is
Code:
void CMP1_Init(void) {
NVIC_SET_PRIORITY(IRQ_CMP1, 130); // 0 = highest priority, 255 = lowest
NVIC_ENABLE_IRQ(IRQ_CMP1); // handler is now cmp1_isr()
// CMP1_IN0 (pin23), sicherheitshalber:
CORE_PIN23_CONFIG = PORT_PCR_MUX(0); // set pin23 function to ALT0
}
The statement NVIC_ENABLE_IRQ(IRQ_CMP1); defines that cmp1_isr() will be called by every comparator interrupt.
My question now is: where is the best place to locate this interrupt routine?
Shall it be within COMP1.cpp or within the sketch?
Are there differences in functionality where it is located?
P.S.: if there is no definition of cmp1_isr() at all, not within COMP1.cpp and not within the sketch, then neither the compiler nor the linker is reporting an error or a warning!
But of course the programm crashes.