mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-12 16:12:07 +00:00
Configure pin modes of selected pins before attempting to write to them (#4385)
This commit is contained in:
parent
5453c495e2
commit
5bbafdfd31
@ -60,13 +60,13 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r
|
|||||||
// Print notification to LCD screen
|
// Print notification to LCD screen
|
||||||
screen->print("Write GPIOs\n");
|
screen->print("Write GPIOs\n");
|
||||||
|
|
||||||
|
pinModes(p.gpio_mask, OUTPUT);
|
||||||
for (uint8_t i = 0; i < NUM_GPIOS; i++) {
|
for (uint8_t i = 0; i < NUM_GPIOS; i++) {
|
||||||
uint64_t mask = 1ULL << i;
|
uint64_t mask = 1ULL << i;
|
||||||
if (p.gpio_mask & mask) {
|
if (p.gpio_mask & mask) {
|
||||||
digitalWrite(i, (p.gpio_value & mask) ? 1 : 0);
|
digitalWrite(i, (p.gpio_value & mask) ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pinModes(p.gpio_mask, OUTPUT);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user