Merge pull request #11151 from kyle-cypress/pr/gpio-inout-fix

Fix PSoC 6 inout pins
pull/11180/head
Seppo Takalo 2019-08-06 12:37:08 +03:00 committed by GitHub
commit 644f79592c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -60,9 +60,16 @@ void gpio_mode(gpio_t *obj, PinMode mode)
}
}
void gpio_dir(MBED_UNUSED gpio_t *obj, MBED_UNUSED PinDirection direction)
void gpio_dir(gpio_t *obj, PinDirection direction)
{
// mbed reads from input buffer instead of DR even for output pins so always leave input buffer enabled
if (direction == PIN_INPUT) {
cyhal_gpio_direction(obj->pin, CYHAL_GPIO_DIR_INPUT);
gpio_mode(obj, CYHAL_GPIO_DRIVE_ANALOG);
} else if (direction == PIN_OUTPUT) {
// mbed reads from input buffer instead of DR even for output pins so always leave input buffer enabled
cyhal_gpio_direction(obj->pin, CYHAL_GPIO_DIR_BIDIRECTIONAL);
gpio_mode(obj, CYHAL_GPIO_DRIVE_STRONG);
}
}
#ifdef __cplusplus