mirror of https://github.com/ARMmbed/mbed-os.git
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
parent
4b83fe1103
commit
d49e2ab232
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue