rotary:[#9] enable interrupts on three pins
This commit is contained in:
parent
a57f814875
commit
da50fa4de1
@ -75,16 +75,16 @@ DigitalIoPin::setIsr ()
|
|||||||
Chip_Clock_SetIOCONFiltClockDiv(0, 64);
|
Chip_Clock_SetIOCONFiltClockDiv(0, 64);
|
||||||
|
|
||||||
Chip_IOCON_PinMuxSet (LPC_IOCON, _io._port, _io._pin,
|
Chip_IOCON_PinMuxSet (LPC_IOCON, _io._port, _io._pin,
|
||||||
(_io.IOCON_mode | _io.DigitalEn
|
(_io.IOCON_mode | _io.DigitalEn
|
||||||
| _io.IOCON_inv | IOCON_CLKDIV(0)
|
| _io.IOCON_inv | IOCON_CLKDIV(0)
|
||||||
| IOCON_S_MODE(3)));
|
| IOCON_S_MODE(3)));
|
||||||
/** False direction equals input */
|
/** False direction equals input */
|
||||||
Chip_GPIO_SetPinDIR (LPC_GPIO, _io._port, _io._pin, direction);
|
Chip_GPIO_SetPinDIR (LPC_GPIO, _io._port, _io._pin, direction);
|
||||||
|
|
||||||
/* Enable PININT clock if it was not enabled before */
|
/* Enable PININT clock if it was not enabled before */
|
||||||
if ((LPC_SYSCTL->SYSAHBCLKCTRL & (1 << SYSCTL_CLOCK_PINT)) == 0)
|
if ((LPC_SYSCTL->SYSAHBCLKCTRL & (1 << SYSCTL_CLOCK_PINT)) == 0)
|
||||||
{
|
{
|
||||||
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);
|
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_PINT);
|
||||||
}
|
}
|
||||||
/* Configure interrupt channel for the GPIO pin in SysCon block */
|
/* Configure interrupt channel for the GPIO pin in SysCon block */
|
||||||
Chip_SYSCTL_SetPinInterrupt(_io.isr_i, _io._port, _io._pin);
|
Chip_SYSCTL_SetPinInterrupt(_io.isr_i, _io._port, _io._pin);
|
||||||
|
|||||||
@ -13,24 +13,21 @@ extern "C"
|
|||||||
void
|
void
|
||||||
PIN_INT0_IRQHandler (void)
|
PIN_INT0_IRQHandler (void)
|
||||||
{
|
{
|
||||||
//portEND_SWITCHING_ISR ();
|
Chip_PININT_ClearIntStatus (LPC_PININT, PININTCH (PIN_INT0_IRQn));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PIN_INT1_IRQHandler (void)
|
PIN_INT1_IRQHandler (void)
|
||||||
{
|
{
|
||||||
//portEND_SWITCHING_ISR ();
|
Chip_PININT_ClearIntStatus (LPC_PININT, PININTCH (PIN_INT1_IRQn));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PIN_INT2_IRQHandler (void)
|
PIN_INT2_IRQHandler (void)
|
||||||
{
|
{
|
||||||
//portEND_SWITCHING_ISR ();
|
Chip_PININT_ClearIntStatus (LPC_PININT, PININTCH (PIN_INT2_IRQn));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For example
|
|
||||||
#define GPIO_PININT_PIN 1 /* GPIO pin number mapped to PININT */
|
|
||||||
#define GPIO_PININT_PORT 0 /* GPIO port number mapped to PININT */
|
|
||||||
|
|
||||||
Rotary::Rotary(ThreadCommon::QueueManager* qm) : _qm(qm)
|
Rotary::Rotary(ThreadCommon::QueueManager* qm) : _qm(qm)
|
||||||
{
|
{
|
||||||
@ -44,7 +41,10 @@ void Rotary::taskFunction()
|
|||||||
Event data(Event::Null, 0);
|
Event data(Event::Null, 0);
|
||||||
Event* e = new Event(Event::Rotary, ThreadCommon::RotaryAction::Idle);
|
Event* e = new Event(Event::Rotary, ThreadCommon::RotaryAction::Idle);
|
||||||
_qm->send<Event>(ThreadCommon::QueueManager::master_event_all, e, 10);
|
_qm->send<Event>(ThreadCommon::QueueManager::master_event_all, e, 10);
|
||||||
for (;;) {}
|
for (;;)
|
||||||
|
{
|
||||||
|
vTaskDelay(500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rotary_thread(void* pvParams)
|
void rotary_thread(void* pvParams)
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Event* message;
|
Event* message;
|
||||||
ThreadCommon::QueueManager* _qm;
|
ThreadCommon::QueueManager* _qm;
|
||||||
DigitalIoPin signal[3] = { { 0, 6, true, false, false, true, PIN_INT0_IRQn},
|
DigitalIoPin signal[3] = { { 0, 1, true, true, false, true, PIN_INT0_IRQn},
|
||||||
{ 0, 5, true, false, false, true, PIN_INT1_IRQn},
|
{ 0, 5, true, false, false, true, PIN_INT1_IRQn},
|
||||||
{ 1, 8, true, false, false, true, PIN_INT2_IRQn} };
|
{ 1, 8, true, false, false, true, PIN_INT2_IRQn} };
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user