From 50b0847003e06cf5b98fb56b0bf5e63b87bf3186 Mon Sep 17 00:00:00 2001 From: yarb Date: Thu, 24 Oct 2019 13:52:41 +0300 Subject: [PATCH] Cypress: fix gpio mode none --- targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h | 2 +- .../TARGET_PSOC6/psoc6csp/hal/include/cyhal_gpio.h | 1 + .../TARGET_PSOC6/psoc6csp/hal/src/cyhal_gpio.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h b/targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h index 548c47eda7..cc46ac2a04 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/PinNamesTypes.h @@ -23,7 +23,7 @@ #include "cybsp_types.h" // Pin Modes -#define PullNone CYHAL_GPIO_DRIVE_STRONG +#define PullNone CYHAL_GPIO_DRIVE_PULL_NONE #define PullDefault CYHAL_GPIO_DRIVE_NONE #define PullDown CYHAL_GPIO_DRIVE_PULLDOWN #define PullUp CYHAL_GPIO_DRIVE_PULLUP diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/include/cyhal_gpio.h b/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/include/cyhal_gpio.h index 1aed43162c..eea6697e24 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/include/cyhal_gpio.h +++ b/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/include/cyhal_gpio.h @@ -79,6 +79,7 @@ typedef enum { CYHAL_GPIO_DRIVE_OPENDRAINDRIVESHIGH, /**< Open-drain, Drives High */ CYHAL_GPIO_DRIVE_STRONG, /**< Strong output */ CYHAL_GPIO_DRIVE_PULLUPDOWN, /**< Pull-up and pull-down resistors */ + CYHAL_GPIO_DRIVE_PULL_NONE, /**< No Pull-up or pull-down resistors */ } cyhal_gpio_drive_mode_t; /** GPIO callback function type */ diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/src/cyhal_gpio.c b/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/src/cyhal_gpio.c index ede264f359..0be8107e40 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/src/cyhal_gpio.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/hal/src/cyhal_gpio.c @@ -105,6 +105,16 @@ static uint32_t cyhal_gpio_convert_drive_mode(cyhal_gpio_drive_mode_t drive_mode case CYHAL_GPIO_DRIVE_PULLUPDOWN: drvMode = CY_GPIO_DM_PULLUP_DOWN; break; + case CYHAL_GPIO_DRIVE_PULL_NONE: + if (direction == CYHAL_GPIO_DIR_OUTPUT || direction == CYHAL_GPIO_DIR_BIDIRECTIONAL) + { + drvMode = CY_GPIO_DM_STRONG; + } + else + { + drvMode = CY_GPIO_DM_HIGHZ; + } + break; default: CY_ASSERT(false); drvMode = CY_GPIO_DM_HIGHZ;