Skip to content

Commit

Permalink
GPIO pull-downs instead of pull-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
jfedor2 committed Jun 28, 2024
1 parent f3c61ad commit 5147ce8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firmware/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void set_gpio_dir() {
for (uint8_t i = 0; i <= 29; i++) {
uint32_t bit = 1 << i;
if (gpio_valid_pins_mask & bit) {
gpio_set_pulls(i, gpio_in_mask & bit, false);
gpio_set_pulls(i, false, gpio_in_mask & bit);
}
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ bool read_gpio(uint64_t now) {
if (changed & bit) {
if (last_gpio_change[i] + gpio_debounce_time <= now) {
uint32_t usage = GPIO_USAGE_PAGE | i;
int32_t state = !(gpio_state & bit); // active low
int32_t state = !!(gpio_state & bit);
set_input_state(usage, state);
if (monitor_enabled) {
monitor_usage(usage, state, 0);
Expand Down

0 comments on commit 5147ce8

Please sign in to comment.