added a feature common to all interrupts
This commit is contained in:
parent
979a5ea9ae
commit
6b87753674
@ -1,5 +1,5 @@
|
|||||||
#include "mik32_hal_irq.h"
|
#include "mik32_hal_irq.h"
|
||||||
#include "wiring_LL.h"
|
#include "wiring_LL.h"
|
||||||
|
|
||||||
// isr functions
|
// isr functions
|
||||||
extern void serial_interrupt_handler(uint8_t uartNumInt);
|
extern void serial_interrupt_handler(uint8_t uartNumInt);
|
||||||
@ -11,12 +11,34 @@ void __attribute__((weak)) wire_interrupt_handler(void)
|
|||||||
}
|
}
|
||||||
void __attribute__((weak)) servo_interrupt_handler(void)
|
void __attribute__((weak)) servo_interrupt_handler(void)
|
||||||
{
|
{
|
||||||
// dummy function for case when wire library is not in use
|
// dummy function for case when servo library is not in use
|
||||||
|
}
|
||||||
|
void __attribute__((weak)) ISR(void)
|
||||||
|
{
|
||||||
|
/* A dummy function for the case when additional interrupts are not used in the project.
|
||||||
|
In the project, you need to create a function of the form:
|
||||||
|
extern "C" void ISR(void)
|
||||||
|
{
|
||||||
|
// timer16 is taken as an example
|
||||||
|
if (TIM16_GET_ARRM_INT_STATUS(htimer16_1_))
|
||||||
|
{
|
||||||
|
// necessary actions
|
||||||
|
}
|
||||||
|
// reset timer interrupt flags
|
||||||
|
TIM16_CLEAR_INT_MASK(htimer16_1_, 0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
before that, be sure to connect the libraries:
|
||||||
|
#include "mik32_hal_timer16.h"
|
||||||
|
#include "mik32_hal_irq.h"
|
||||||
|
#include "wiring_LL.h" */
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------- //
|
// ---------------------------------------------- //
|
||||||
void __attribute__((noinline, section(".ram_text"), optimize("O3"))) trap_handler (void)
|
void __attribute__((noinline, section(".ram_text"), optimize("O3"))) trap_handler (void)
|
||||||
{
|
{
|
||||||
|
// all interrupts
|
||||||
|
ISR();
|
||||||
|
|
||||||
// gpio interrupt
|
// gpio interrupt
|
||||||
if (EPIC_CHECK_GPIO_IRQ())
|
if (EPIC_CHECK_GPIO_IRQ())
|
||||||
gpio_interrupt_handler();
|
gpio_interrupt_handler();
|
||||||
@ -36,7 +58,7 @@ void __attribute__((noinline, section(".ram_text"), optimize("O3"))) trap_handle
|
|||||||
// uart1 interrupt
|
// uart1 interrupt
|
||||||
if (EPIC_CHECK_UART_1())
|
if (EPIC_CHECK_UART_1())
|
||||||
serial_interrupt_handler(1);
|
serial_interrupt_handler(1);
|
||||||
|
|
||||||
// i2c interrupt
|
// i2c interrupt
|
||||||
if (EPIC_CHECK_I2C_1())
|
if (EPIC_CHECK_I2C_1())
|
||||||
wire_interrupt_handler();
|
wire_interrupt_handler();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user