MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / driverThreadMain

Method driverThreadMain

Drivers/ButtonControl/Source/ButtonControl.cpp:128–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void ButtonControl::driverThreadMain() {
129 ButtonEvent event;
130 while (buttonQueue.get(&event, portMAX_DELAY)) {
131 if (event.pin == GPIO_NUM_NC) {
132 break; // shutdown sentinel
133 }
134 LOGGER.info("Pin {} {}", static_cast<int>(event.pin), event.pressed ? "down" : "up");
135 if (mutex.lock(portMAX_DELAY)) {
136 // Update ALL PinConfiguration entries that share this physical pin.
137 for (size_t i = 0; i < pinConfigurations.size(); i++) {
138 if (static_cast<gpio_num_t>(pinConfigurations[i].pin) == event.pin) {
139 updatePin(pinConfigurations[i], pinStates[i], event.pressed);
140 }
141 }
142 mutex.unlock();
143 }
144 }
145}
146
147bool ButtonControl::startThread() {
148 LOGGER.info("Start");

Callers

nothing calls this directly

Calls 4

infoMethod · 0.80
getMethod · 0.45
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected