изменила название дефайна про кол-во прерываний. В wiring_private.h подтягиваю дефайн из pins_arduino
This commit is contained in:
1 parent
65d07edece
commit
a8b2cf3b0c
7 files changed
+40
-38
No files matched your search
+12
-12
@@ -27,24 +27,24 @@ void noInterrupts(void)
|
||||
}
|
||||
|
||||
// we can provide no more than 8 interrupts on gpio at the same time
|
||||
static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS] =
|
||||
static volatile voidFuncPtr intFunc[EXTERNAL_INTERRUPTS_QTY] =
|
||||
{
|
||||
#if EXTERNAL_NUM_INTERRUPTS > 7
|
||||
#if EXTERNAL_INTERRUPTS_QTY > 7
|
||||
nothing,
|
||||
#endif
|
||||
#if EXTERNAL_NUM_INTERRUPTS > 6
|
||||
#if EXTERNAL_INTERRUPTS_QTY > 6
|
||||
nothing,
|
||||
#endif
|
||||
#if EXTERNAL_NUM_INTERRUPTS > 5
|
||||
#if EXTERNAL_INTERRUPTS_QTY > 5
|
||||
nothing,
|
||||
#endif
|
||||
#if EXTERNAL_NUM_INTERRUPTS > 4
|
||||
#if EXTERNAL_INTERRUPTS_QTY > 4
|
||||
nothing,
|
||||
#endif
|
||||
#if EXTERNAL_NUM_INTERRUPTS > 3
|
||||
#if EXTERNAL_INTERRUPTS_QTY > 3
|
||||
nothing,
|
||||
#endif
|
||||
#if EXTERNAL_NUM_INTERRUPTS > 2
|
||||
#if EXTERNAL_INTERRUPTS_QTY > 2
|
||||
nothing,
|
||||
#endif
|
||||
nothing,
|
||||
@@ -54,7 +54,7 @@ static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS] =
|
||||
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode)
|
||||
{
|
||||
// if the interrupt number does not exceed the total number
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
if(interruptNum < EXTERNAL_INTERRUPTS_QTY)
|
||||
{
|
||||
intFunc[interruptNum] = userFunc; // save pointer to irq handler
|
||||
|
||||
@@ -85,7 +85,7 @@ void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode)
|
||||
|
||||
void detachInterrupt(uint8_t interruptNum)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
if(interruptNum < EXTERNAL_INTERRUPTS_QTY)
|
||||
{
|
||||
// disable the interrupt in line
|
||||
HAL_GPIO_DeInitInterruptLine(interruptToGpioIntLine(interruptNum));
|
||||
@@ -98,7 +98,7 @@ void detachInterrupt(uint8_t interruptNum)
|
||||
// disable single interrupt
|
||||
void disableInterrupt(uint8_t interruptNum)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
if(interruptNum < EXTERNAL_INTERRUPTS_QTY)
|
||||
// disable gpio interrupt line
|
||||
GPIO_IRQ_LINE_DISABLE(interruptToGpioIntLine(interruptNum));
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void disableInterrupt(uint8_t interruptNum)
|
||||
// enable single interrupt
|
||||
void enableInterrupt(uint8_t interruptNum)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
if(interruptNum < EXTERNAL_INTERRUPTS_QTY)
|
||||
// enable gpio interrupt line
|
||||
GPIO_IRQ_LINE_ENABLE(interruptToGpioIntLine(interruptNum));
|
||||
}
|
||||
@@ -115,7 +115,7 @@ void enableInterrupt(uint8_t interruptNum)
|
||||
void __attribute__((noinline, section(".ram_text"), optimize("O3"))) gpio_interrupt_handler(void)
|
||||
{
|
||||
// go through all the interrupts and call the handler for the triggered line
|
||||
for (uint8_t i = 0; i < EXTERNAL_NUM_INTERRUPTS; i++)
|
||||
for (uint8_t i = 0; i < EXTERNAL_INTERRUPTS_QTY; i++)
|
||||
{
|
||||
if (GPIO_IRQ_LINE_STATE(interruptToGpioIntLine(i)))
|
||||
intFunc[i]();
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C"{
|
||||
#endif
|
||||
|
||||
// available interrupts number
|
||||
#define EXTERNAL_NUM_INTERRUPTS 7
|
||||
#define EXTERNAL_NUM_INTERRUPTS EXTERNAL_INTERRUPTS_QTY
|
||||
|
||||
typedef void (*voidFuncPtr)(void);
|
||||
|
||||
|
||||
Reference in new issue
Block a user