mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-29 07:36:46 +00:00
More flexible InputPollable paradigm
This commit is contained in:
parent
f4bdf2f248
commit
696a391cb8
@ -18,14 +18,22 @@ void InputBroker::registerSource(Observable<const InputEvent *> *source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_FREE_RTOS
|
#ifdef HAS_FREE_RTOS
|
||||||
void InputBroker::pollSoonRequestFromIsr(InputPollable *pollable)
|
void InputBroker::requestPollSoon(InputPollable *pollable)
|
||||||
{
|
{
|
||||||
|
if (xPortInIsrContext() == pdTRUE) {
|
||||||
xQueueSendFromISR(pollSoonQueue, &pollable, NULL);
|
xQueueSendFromISR(pollSoonQueue, &pollable, NULL);
|
||||||
|
} else {
|
||||||
|
xQueueSend(pollSoonQueue, &pollable, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputBroker::queueInputEvent(const InputEvent *event)
|
void InputBroker::queueInputEvent(const InputEvent *event)
|
||||||
{
|
{
|
||||||
|
if (xPortInIsrContext() == pdTRUE) {
|
||||||
|
xQueueSendFromISR(inputEventQueue, event, NULL);
|
||||||
|
} else {
|
||||||
xQueueSend(inputEventQueue, event, portMAX_DELAY);
|
xQueueSend(inputEventQueue, event, portMAX_DELAY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputBroker::processInputEventQueue()
|
void InputBroker::processInputEventQueue()
|
||||||
|
|||||||
@ -60,7 +60,7 @@ class InputBroker : public Observable<const InputEvent *>
|
|||||||
void registerSource(Observable<const InputEvent *> *source);
|
void registerSource(Observable<const InputEvent *> *source);
|
||||||
void injectInputEvent(const InputEvent *event) { handleInputEvent(event); }
|
void injectInputEvent(const InputEvent *event) { handleInputEvent(event); }
|
||||||
#ifdef HAS_FREE_RTOS
|
#ifdef HAS_FREE_RTOS
|
||||||
void pollSoonRequestFromIsr(InputPollable *pollable);
|
void requestPollSoon(InputPollable *pollable);
|
||||||
void queueInputEvent(const InputEvent *event);
|
void queueInputEvent(const InputEvent *event);
|
||||||
void processInputEventQueue();
|
void processInputEventQueue();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -641,6 +641,6 @@ void KbI2cBase::toggleBacklight(bool on)
|
|||||||
int KbI2cBase::onNotify(KbInterruptObservable *src)
|
int KbI2cBase::onNotify(KbInterruptObservable *src)
|
||||||
{
|
{
|
||||||
// Called from interrupt context, request polling after exiting the ISR
|
// Called from interrupt context, request polling after exiting the ISR
|
||||||
inputBroker->pollSoonRequestFromIsr(this);
|
inputBroker->requestPollSoon(this);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user