rotary: [#62] Changed interrupts behaviour.

* Button on the rotary is still inactive. Demands further investigation
  with logic analizer.
This commit is contained in:
RedHawk 2023-06-11 13:48:24 +03:00
parent 2b785e5b0c
commit 38b24f5998
3 changed files with 18 additions and 8 deletions

View File

@ -12,6 +12,8 @@
static QueueHandle_t * p_rotary_isr_q;
static DigitalIoPin * p_sigB;
extern "C"
{
void
@ -19,11 +21,17 @@ extern "C"
{
Chip_PININT_ClearIntStatus (LPC_PININT, PININTCH (PIN_INT0_IRQn));
portBASE_TYPE xHigherPriorityWoken = pdFALSE;
uint8_t data = ThreadCommon::RotaryAction::Right;
uint8_t data;
if (p_sigB->read())
data = ThreadCommon::RotaryAction::Left;
else
data = ThreadCommon::RotaryAction::Right;
xQueueSendFromISR (*p_rotary_isr_q, &data, &xHigherPriorityWoken);
portEND_SWITCHING_ISR(xHigherPriorityWoken);
}
/*
void
PIN_INT1_IRQHandler (void)
{
@ -33,11 +41,11 @@ extern "C"
xQueueSendFromISR (*p_rotary_isr_q, &data, &xHigherPriorityWoken);
portEND_SWITCHING_ISR(xHigherPriorityWoken);
}
*/
void
PIN_INT2_IRQHandler (void)
PIN_INT1_IRQHandler (void)
{
Chip_PININT_ClearIntStatus (LPC_PININT, PININTCH (PIN_INT2_IRQn));
Chip_PININT_ClearIntStatus (LPC_PININT, PININTCH (PIN_INT1_IRQn));
portBASE_TYPE xHigherPriorityWoken = pdFALSE;
uint8_t data = ThreadCommon::RotaryAction::Press;
xQueueSendFromISR (*p_rotary_isr_q, &data, &xHigherPriorityWoken);
@ -48,6 +56,7 @@ extern "C"
Rotary::Rotary(ThreadCommon::QueueManager* qm) : _qm(qm)
{
LOG_DEBUG("Creating Rotary");
p_sigB = &(this->signal[1]);
}
Rotary::~Rotary()

View File

@ -20,9 +20,9 @@ public:
private:
Event* message;
ThreadCommon::QueueManager* _qm;
DigitalIoPin signal[3] = { { 1, 18, true, true, false, true, PIN_INT0_IRQn}, //SW1 //Right //0 1
{ 2, 12, true, true, false, true, PIN_INT1_IRQn}, //SW2 //Left //0 16
{ 2, 11, true, false, false, true, PIN_INT2_IRQn} }; //Press //1 8
DigitalIoPin signal[3] = { { 1, 18, true, true, false, true, PIN_INT0_IRQn}, //sigA
{ 2, 12, true, true, false}, //sigB
{ 0, 1, true, true, false, true, PIN_INT1_IRQn} }; //Press, sw //2 11
};
void thread_rotary(void* pvParams);

View File

@ -27,6 +27,7 @@ void Temperature::taskFunction()
if(temp_value == -128)
{
LOG_ERROR("Failed to get temperature.");
vTaskDelay(10000);
continue;
}