mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-29 15:46:46 +00:00
Format
This commit is contained in:
parent
6c932d51ec
commit
d427b477e3
@ -35,9 +35,7 @@ bool RotaryEncoderImpl::init()
|
|||||||
inputQueue = xQueueCreate(5, sizeof(input_broker_event));
|
inputQueue = xQueueCreate(5, sizeof(input_broker_event));
|
||||||
interruptFlag = xEventGroupCreate();
|
interruptFlag = xEventGroupCreate();
|
||||||
interruptInstance = this;
|
interruptInstance = this;
|
||||||
auto interruptHandler = []() {
|
auto interruptHandler = []() { xEventGroupSetBits(interruptInstance->interruptFlag, ROTARY_INTERRUPT_FLAG); };
|
||||||
xEventGroupSetBits(interruptInstance->interruptFlag, ROTARY_INTERRUPT_FLAG);
|
|
||||||
};
|
|
||||||
attachInterrupt(moduleConfig.canned_message.inputbroker_pin_a, interruptHandler, CHANGE);
|
attachInterrupt(moduleConfig.canned_message.inputbroker_pin_a, interruptHandler, CHANGE);
|
||||||
attachInterrupt(moduleConfig.canned_message.inputbroker_pin_b, interruptHandler, CHANGE);
|
attachInterrupt(moduleConfig.canned_message.inputbroker_pin_b, interruptHandler, CHANGE);
|
||||||
attachInterrupt(moduleConfig.canned_message.inputbroker_pin_press, interruptHandler, CHANGE);
|
attachInterrupt(moduleConfig.canned_message.inputbroker_pin_press, interruptHandler, CHANGE);
|
||||||
@ -78,7 +76,7 @@ void RotaryEncoderImpl::dispatchInputs()
|
|||||||
|
|
||||||
void RotaryEncoderImpl::inputWorker(void *p)
|
void RotaryEncoderImpl::inputWorker(void *p)
|
||||||
{
|
{
|
||||||
RotaryEncoderImpl* instance = (RotaryEncoderImpl*)p;
|
RotaryEncoderImpl *instance = (RotaryEncoderImpl *)p;
|
||||||
while (true) {
|
while (true) {
|
||||||
xEventGroupWaitBits(instance->interruptFlag, ROTARY_INTERRUPT_FLAG, pdTRUE, pdTRUE, portMAX_DELAY);
|
xEventGroupWaitBits(instance->interruptFlag, ROTARY_INTERRUPT_FLAG, pdTRUE, pdTRUE, portMAX_DELAY);
|
||||||
instance->dispatchInputs();
|
instance->dispatchInputs();
|
||||||
@ -86,12 +84,12 @@ void RotaryEncoderImpl::inputWorker(void *p)
|
|||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
RotaryEncoderImpl* RotaryEncoderImpl::interruptInstance;
|
RotaryEncoderImpl *RotaryEncoderImpl::interruptInstance;
|
||||||
|
|
||||||
int32_t RotaryEncoderImpl::runOnce()
|
int32_t RotaryEncoderImpl::runOnce()
|
||||||
{
|
{
|
||||||
InputEvent e{originName, INPUT_BROKER_NONE, 0, 0, 0};
|
InputEvent e{originName, INPUT_BROKER_NONE, 0, 0, 0};
|
||||||
while(xQueueReceive(inputQueue, &e.inputEvent, 0) == pdPASS) {
|
while (xQueueReceive(inputQueue, &e.inputEvent, 0) == pdPASS) {
|
||||||
this->notifyObservers(&e);
|
this->notifyObservers(&e);
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
|
|||||||
@ -23,8 +23,8 @@ class RotaryEncoderImpl : public Observable<const InputEvent *>, public concurre
|
|||||||
void dispatchInputs(void);
|
void dispatchInputs(void);
|
||||||
TaskHandle_t inputWorkerTask;
|
TaskHandle_t inputWorkerTask;
|
||||||
static void inputWorker(void *p);
|
static void inputWorker(void *p);
|
||||||
EventGroupHandle_t interruptFlag;
|
EventGroupHandle_t interruptFlag;
|
||||||
static RotaryEncoderImpl* interruptInstance;
|
static RotaryEncoderImpl *interruptInstance;
|
||||||
|
|
||||||
input_broker_event eventCw = INPUT_BROKER_NONE;
|
input_broker_event eventCw = INPUT_BROKER_NONE;
|
||||||
input_broker_event eventCcw = INPUT_BROKER_NONE;
|
input_broker_event eventCcw = INPUT_BROKER_NONE;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user