bootloader: fix DFU_FORCE_PIN code
This commit is contained in:
parent
9d1a4006af
commit
d208297aa3
|
@ -37,9 +37,8 @@ void main(void)
|
||||||
__dfu_magic[2] = 0;
|
__dfu_magic[2] = 0;
|
||||||
__dfu_magic[3] = 0;
|
__dfu_magic[3] = 0;
|
||||||
} else { // check if the force DFU mode input is set
|
} else { // check if the force DFU mode input is set
|
||||||
// disable SWJ pin to use as GPIO
|
|
||||||
#if (defined(DFU_FORCE_PIN) && defined(DFU_FORCE_VALUE))
|
#if (defined(DFU_FORCE_PIN) && defined(DFU_FORCE_VALUE))
|
||||||
rcc_periph_clock_enable(GPIO_RCC(DFU_FORCE_PIN)); // enable clock for button
|
rcc_periph_clock_enable(GPIO_RCC(DFU_FORCE_PIN)); // enable clock for button
|
||||||
#if (DFU_FORCE_VALUE == 1)
|
#if (DFU_FORCE_VALUE == 1)
|
||||||
gpio_mode_setup(GPIO_PORT(DFU_FORCE_PIN), GPIO_MODE_INPUT, GPIO_PUPD_PULLDOWN, GPIO_PIN(DFU_FORCE_PIN)); // set GPIO to input
|
gpio_mode_setup(GPIO_PORT(DFU_FORCE_PIN), GPIO_MODE_INPUT, GPIO_PUPD_PULLDOWN, GPIO_PIN(DFU_FORCE_PIN)); // set GPIO to input
|
||||||
if (gpio_get(GPIO_PORT(DFU_FORCE_PIN), GPIO_PIN(DFU_FORCE_PIN))) { // check if output is set to the value to force DFU mode
|
if (gpio_get(GPIO_PORT(DFU_FORCE_PIN), GPIO_PIN(DFU_FORCE_PIN))) { // check if output is set to the value to force DFU mode
|
||||||
|
@ -49,9 +48,9 @@ void main(void)
|
||||||
#endif // DFU_FORCE_VALUE
|
#endif // DFU_FORCE_VALUE
|
||||||
dfu_force = true; // DFU mode forced
|
dfu_force = true; // DFU mode forced
|
||||||
}
|
}
|
||||||
#endif // defined(DFU_FORCE_PIN)
|
|
||||||
rcc_periph_reset_pulse(GPIO_RST(DFU_FORCE_PIN)); // reset pin GPIO domain
|
rcc_periph_reset_pulse(GPIO_RST(DFU_FORCE_PIN)); // reset pin GPIO domain
|
||||||
rcc_periph_clock_disable(GPIO_RCC(DFU_FORCE_PIN)); // disable pin GPIO domain
|
rcc_periph_clock_disable(GPIO_RCC(DFU_FORCE_PIN)); // disable pin GPIO domain
|
||||||
|
#endif // defined(DFU_FORCE_PIN)
|
||||||
}
|
}
|
||||||
|
|
||||||
// start application if valid
|
// start application if valid
|
||||||
|
|
Loading…
Reference in New Issue