forked from Elron_dev/elbear_arduino_bsp
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
#include "mik32_hal_irq.h"
|
|
|
|
// isr functions
|
|
extern void serial_handler_wrapper(uint8_t uartNumInt);
|
|
extern void gpio_interrupts_handler(void);
|
|
extern void tone_interrupt_handler(void);
|
|
void __attribute__((weak)) wire_handler_wrapper(void)
|
|
{
|
|
// dummy function for case when wire library is not in use
|
|
}
|
|
void __attribute__((weak)) servo_handler_wrapper(void)
|
|
{
|
|
// dummy function for case when wire library is not in use
|
|
}
|
|
|
|
// ---------------------------------------------- //
|
|
void trap_handler(void)
|
|
{
|
|
// tone timer interrupt
|
|
if (EPIC_CHECK_TIMER16_1())
|
|
tone_interrupt_handler();
|
|
|
|
// servo timer interrupt
|
|
if (EPIC_CHECK_TIMER16_2())
|
|
servo_handler_wrapper();
|
|
|
|
// uart0 interrupt
|
|
if (EPIC_CHECK_UART_0())
|
|
serial_handler_wrapper(0);
|
|
|
|
// uart1 interrupt
|
|
if (EPIC_CHECK_UART_1())
|
|
serial_handler_wrapper(1);
|
|
|
|
// gpio interrupt
|
|
if (EPIC_CHECK_GPIO_IRQ())
|
|
gpio_interrupts_handler();
|
|
|
|
// i2c interrupt
|
|
if (EPIC_CHECK_I2C_1())
|
|
wire_handler_wrapper();
|
|
|
|
// reset all interrupts
|
|
HAL_EPIC_Clear(0xFFFFFFFF);
|
|
}
|