Skip to content

Commit d49e2ab

Browse files
committed
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.
1 parent 4b83fe1 commit d49e2ab

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/port_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ void port_write(port_t *obj, int value)
109109
for (pin = 0; pin < 8; ++pin) {
110110
if (obj->mask & (1 << pin)) {
111111
Cy_GPIO_Write(obj->port, pin, value & 0x1);
112-
value >>= 1;
113112
}
113+
value >>= 1;
114114
}
115115
}
116116
}

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/port_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ void port_write(port_t *obj, int value)
105105
for (pin = 0; pin < 8; ++pin) {
106106
if (obj->mask & (1 << pin)) {
107107
Cy_GPIO_Write(obj->port, pin, value & 0x1);
108-
value >>= 1;
109108
}
109+
value >>= 1;
110110
}
111111
}
112112
}

0 commit comments

Comments
 (0)