diff --git a/source/shoh/src/threads/rotary/Rotary.cpp b/source/shoh/src/threads/rotary/Rotary.cpp index fcdce48..4ea786d 100644 --- a/source/shoh/src/threads/rotary/Rotary.cpp +++ b/source/shoh/src/threads/rotary/Rotary.cpp @@ -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() diff --git a/source/shoh/src/threads/rotary/Rotary.h b/source/shoh/src/threads/rotary/Rotary.h index 61ccdc0..79a4201 100644 --- a/source/shoh/src/threads/rotary/Rotary.h +++ b/source/shoh/src/threads/rotary/Rotary.h @@ -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); diff --git a/source/shoh/src/threads/temperature/Temperature.cpp b/source/shoh/src/threads/temperature/Temperature.cpp index 7929184..877e583 100644 --- a/source/shoh/src/threads/temperature/Temperature.cpp +++ b/source/shoh/src/threads/temperature/Temperature.cpp @@ -27,6 +27,7 @@ void Temperature::taskFunction() if(temp_value == -128) { LOG_ERROR("Failed to get temperature."); + vTaskDelay(10000); continue; }