Fix esp-idf pinmask bit-shift overflow (#2380)

This commit is contained in:
Christian Taedcke 2021-09-23 18:24:29 +02:00 committed by GitHub
parent a27a884191
commit 210a9a4162
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ class IDFInternalGPIOPin : public InternalGPIOPin {
}
void pin_mode(gpio::Flags flags) override {
gpio_config_t conf{};
conf.pin_bit_mask = 1 << static_cast<uint32_t>(pin_);
conf.pin_bit_mask = 1ULL << static_cast<uint32_t>(pin_);
conf.mode = flags_to_mode_(flags);
conf.pull_up_en = flags & gpio::FLAG_PULLUP ? GPIO_PULLUP_ENABLE : GPIO_PULLUP_DISABLE;
conf.pull_down_en = flags & gpio::FLAG_PULLDOWN ? GPIO_PULLDOWN_ENABLE : GPIO_PULLDOWN_DISABLE;