From d49e2ab232de89511d042f38e1fbff48fb4aff02 Mon Sep 17 00:00:00 2001 From: Volodymyr Medvid Date: Wed, 20 Feb 2019 12:29:23 +0200 Subject: [PATCH] PSOC6: fix port_write API Fix port_write API to correctly shift the passed value. This allows the reference application provided in PortOut docs to work corectly with arbitrary LED_MASK. https://os.mbed.com/docs/mbed-os/v5.11/apis/portout.html The fix applies to both PSOC6 and PSOC6_FUTURE HAL implementations. --- targets/TARGET_Cypress/TARGET_PSOC6/port_api.c | 2 +- targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/port_api.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/port_api.c b/targets/TARGET_Cypress/TARGET_PSOC6/port_api.c index b1d849fd9c..ddcc0bc5d5 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/port_api.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/port_api.c @@ -109,8 +109,8 @@ void port_write(port_t *obj, int value) for (pin = 0; pin < 8; ++pin) { if (obj->mask & (1 << pin)) { Cy_GPIO_Write(obj->port, pin, value & 0x1); - value >>= 1; } + value >>= 1; } } } diff --git a/targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/port_api.c b/targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/port_api.c index 5e124dd5b4..9fce69a494 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/port_api.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/port_api.c @@ -105,8 +105,8 @@ void port_write(port_t *obj, int value) for (pin = 0; pin < 8; ++pin) { if (obj->mask & (1 << pin)) { Cy_GPIO_Write(obj->port, pin, value & 0x1); - value >>= 1; } + value >>= 1; } } }