forked from Elron_dev/elbear_arduino_bsp
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
#include "mik32_hal_irq.h"
|
|
#include "wiring_LL.h"
|
|
|
|
// isr functions
|
|
extern void serial_interrupt_handler(uint8_t uartNumInt);
|
|
extern void gpio_interrupt_handler(void);
|
|
extern void tone_interrupt_handler(void);
|
|
void __attribute__((weak)) wire_interrupt_handler(void)
|
|
{
|
|
// dummy function for case when wire library is not in use
|
|
}
|
|
void __attribute__((weak)) servo_interrupt_handler(void)
|
|
{
|
|
// dummy function for case when wire library is not in use
|
|
}
|
|
|
|
// ---------------------------------------------- //
|
|
void __attribute__((noinline, section(".ram_text"), optimize("O3"))) trap_handler (void)
|
|
{
|
|
// gpio interrupt
|
|
if (EPIC_CHECK_GPIO_IRQ())
|
|
gpio_interrupt_handler();
|
|
|
|
// tone timer interrupt
|
|
if (EPIC_CHECK_TIMER16_1())
|
|
tone_interrupt_handler();
|
|
|
|
// servo timer interrupt
|
|
if (EPIC_CHECK_TIMER16_2())
|
|
servo_interrupt_handler();
|
|
|
|
// uart0 interrupt
|
|
if (EPIC_CHECK_UART_0())
|
|
serial_interrupt_handler(0);
|
|
|
|
// uart1 interrupt
|
|
if (EPIC_CHECK_UART_1())
|
|
serial_interrupt_handler(1);
|
|
|
|
// i2c interrupt
|
|
if (EPIC_CHECK_I2C_1())
|
|
wire_interrupt_handler();
|
|
|
|
// reset all interrupts
|
|
EPIC_CLEAR_ALL();
|
|
}
|