Skip to content

Input button sensing fix #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ inline static void gpio_set_mode(uint32_t gpiodev, uint16_t gpion, uint8_t mode)
}

#define gpio_set_output(a,b) gpio_set_mode(a,b,0x2)
#define gpio_set_input(a,b) gpio_set_mode(a,b,0x0)
#define gpio_set_input(a,b) gpio_set_mode(a,b,0x4)
#define gpio_set_input_pp(a,b) gpio_set_mode(a,b,0x8)

#define gpio_clear(gpiodev, gpion) \
Expand All @@ -300,8 +300,12 @@ inline static void gpio_set_mode(uint32_t gpiodev, uint16_t gpion, uint8_t mode)
#ifdef ENABLE_GPIO_DFU_BOOT
int force_dfu_gpio() {
rcc_gpio_enable(GPIO_DFU_BOOT_PORT);
#ifdef GPIO_DFU_BOOT_PIN_NOPD
gpio_set_input(GPIO_DFU_BOOT_PORT, GPIO_DFU_BOOT_PIN);
#else
gpio_set_input_pp(GPIO_DFU_BOOT_PORT, GPIO_DFU_BOOT_PIN);
gpio_clear(GPIO_DFU_BOOT_PORT, GPIO_DFU_BOOT_PIN);
#endif
for (unsigned int i = 0; i < 512; i++)
__asm__("nop");
uint16_t val = gpio_read(GPIO_DFU_BOOT_PORT, GPIO_DFU_BOOT_PIN);
Expand Down