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.
pull/9775/head
Volodymyr Medvid 2019-02-20 12:29:23 +02:00
parent 4b83fe1103
commit d49e2ab232
2 changed files with 2 additions and 2 deletions

View File

@ -109,8 +109,8 @@ void port_write(port_t *obj, int value)
for (pin = 0; pin < 8; ++pin) { for (pin = 0; pin < 8; ++pin) {
if (obj->mask & (1 << pin)) { if (obj->mask & (1 << pin)) {
Cy_GPIO_Write(obj->port, pin, value & 0x1); Cy_GPIO_Write(obj->port, pin, value & 0x1);
value >>= 1;
} }
value >>= 1;
} }
} }
} }

View File

@ -105,8 +105,8 @@ void port_write(port_t *obj, int value)
for (pin = 0; pin < 8; ++pin) { for (pin = 0; pin < 8; ++pin) {
if (obj->mask & (1 << pin)) { if (obj->mask & (1 << pin)) {
Cy_GPIO_Write(obj->port, pin, value & 0x1); Cy_GPIO_Write(obj->port, pin, value & 0x1);
value >>= 1;
} }
value >>= 1;
} }
} }
} }