mbed library sources
Dependents: Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more
Superseded
This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Diff: targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/port_api.c
- Revision:
- 150:49699a7d7064
- Parent:
- 149:1fb5f62b92bd
- Child:
- 267:8673334f2cbe
diff -r 1fb5f62b92bd -r 49699a7d7064 targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/port_api.c --- a/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/port_api.c Thu Apr 03 11:45:06 2014 +0100 +++ b/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/port_api.c Fri Apr 04 10:45:08 2014 +0100 @@ -46,18 +46,22 @@ } void port_dir(port_t *obj, PinDirection dir) { + uint32_t direction = gpio_hal_get_port_direction((uint32_t)obj->port); switch (dir) { case PIN_INPUT : - gpio_hal_set_port_direction((uint32_t)obj->port, kGpioDigitalInput); + direction &= ~obj->mask; + gpio_hal_set_port_direction((uint32_t)obj->port, direction); break; case PIN_OUTPUT: - gpio_hal_set_port_direction((uint32_t)obj->port, kGpioDigitalOutput); + direction |= obj->mask; + gpio_hal_set_port_direction((uint32_t)obj->port, direction); break; } } void port_write(port_t *obj, int value) { - gpio_hal_write_port_output((uint32_t)obj->port, (uint32_t)(value & obj->mask)); + uint32_t input = gpio_hal_read_port_input((uint32_t)obj->port) & ~obj->mask; + gpio_hal_write_port_output((uint32_t)obj->port, input | (uint32_t)(value & obj->mask)); } int port_read(port_t *obj) {