From 3cef13e6f65c902d8d093f51e5117a0bc86ad72c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Thu, 30 Mar 2017 15:01:25 +0100 Subject: [PATCH] Correct issue when checking for user button pressed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - the user button in these boards has a pull-up resistor so the check has to be inverted - fix #268 - fix #269 - add comment to Discover44 target to make it clear Signed-off-by: José Simões --- targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/nanoBooter/main.c | 3 ++- .../CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c | 3 ++- .../CMSIS-OS/ChibiOS/ST_STM32F4_DISCOVERY/nanoBooter/main.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/nanoBooter/main.c b/targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/nanoBooter/main.c index b4f854f286..ca98b8c289 100644 --- a/targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/nanoBooter/main.c +++ b/targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/nanoBooter/main.c @@ -58,7 +58,8 @@ int main(void) { // the board to remain in nanoBooter and not launching nanoCLR // if the USER button (blue one) is pressed, skip the check for a valid CLR image and remain in booter - if (palReadPad(GPIOC, GPIOC_BUTTON)) + // the user button in this board has a pull-up resistor so the check has to be inverted + if (!palReadPad(GPIOC, GPIOC_BUTTON)) { // check for valid CLR image if(CheckValidCLRImage((uint32_t)&__nanoImage_end__)) diff --git a/targets/CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c b/targets/CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c index fbf9bc7b0c..04ca32e4c7 100644 --- a/targets/CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c +++ b/targets/CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY/nanoBooter/main.c @@ -49,7 +49,8 @@ int main(void) { // the board to remain in nanoBooter and not launching nanoCLR // if the USER button (blue one) is pressed, skip the check for a valid CLR image and remain in booter - if (palReadPad(GPIOA, GPIOA_BUTTON)) + // the user button in this board has a pull-up resistor so the check has to be inverted + if (!palReadPad(GPIOA, GPIOA_BUTTON)) { // check for valid CLR image if(CheckValidCLRImage((uint32_t)&__nanoImage_end__)) diff --git a/targets/CMSIS-OS/ChibiOS/ST_STM32F4_DISCOVERY/nanoBooter/main.c b/targets/CMSIS-OS/ChibiOS/ST_STM32F4_DISCOVERY/nanoBooter/main.c index 67dfc8285f..1a18dc95cd 100644 --- a/targets/CMSIS-OS/ChibiOS/ST_STM32F4_DISCOVERY/nanoBooter/main.c +++ b/targets/CMSIS-OS/ChibiOS/ST_STM32F4_DISCOVERY/nanoBooter/main.c @@ -57,6 +57,7 @@ int main(void) { // the board to remain in nanoBooter and not launching nanoCLR // if the USER button (blue one) is pressed, skip the check for a valid CLR image and remain in booter + // the user button in this board has a pull-up resistor so the check has to be inverted if (!palReadPad(GPIOA, GPIOA_BUTTON)) { // check for valid CLR image