Subversion Repositories Code-Repo

Compare Revisions

Ignore whitespace Rev 211 → Rev 212

/PIC Stuff/Cerebot_32MX7_LED_Cube/BTN.c
19,11 → 19,15
INTDisableInterrupts();
CNCONSET = 0x8000; // Turn on change notice interrupt
#if defined CEREBOT_32MX7
CNENSET = 0x80300; // Set interrupt on CN8/9/19
#elif defined CEREBOT_MX7CK
CNENSET = 0x00300; // Set interrupt on CN8/9
#endif
int tmp = BTN1_PORT;
tmp = BTN2_PORT;
tmp = BTN3_PORT;
IPC6SET = 0x50000; // Set priority level = 1, sub-priority level = 1
IPC6SET = 0xD0000; // Set priority level = 3, sub-priority level = 1
IFS1CLR = 0x1; // Clear interrupt flag
IEC1SET = 0x1; // Enable interrupt
 
30,7 → 34,7
INTEnableInterrupts();
}
 
void __ISR(_CHANGE_NOTICE_VECTOR, ipl1) __CN_Interrupt_Handler(void) {
void __ISR(_CHANGE_NOTICE_VECTOR, ipl3) __CN_Interrupt_Handler(void) {
// Upon interrupt, debounce input and call saved function
if (BTN1_PORT == 1) {
Delay_MS(BTN_DEBOUNCE_MS);
46,6 → 50,7
(*btn_data_ptr->callback_function_2)();
}
}
#ifdef CEREBOT_32MX7
if (BTN3_PORT == 1) {
Delay_MS(BTN_DEBOUNCE_MS);
if (BTN3_PORT == 1) {
53,5 → 58,6
(*btn_data_ptr->callback_function_3)();
}
}
#endif
IFS1CLR = 0x1; // Clear interrupt flag
}