gpio/stm32: Move from the OPEN_DRAIN interface to the DRIVE_STRENGTH interface
The STM32 GPIO driver extended the generic GPIO driver interace with the concept of OPEN_DRAIN. There is previous discussion about representing such concepts in the GPIO interface in a more general fashion here: https://lists.zephyrproject.org/archives/list/devel@lists.zephyrproject.org/thread/6DCFUAKCOOOBHUO3ZK45ES6IQXOEOFWN/ The DRIVE STRENGTH interface supports the concepts of OPEN DRAIN and other variants supports by other vendors hardware. Adjust the STM32 GPIO driver to use the DRIVE STRENGTH interface. A following patch will address the simplication of gpio.h Change-Id: I56b0792ec2b21f1adc673dff019288dc8573d005 Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
This commit is contained in:
parent
8324e93812
commit
cf94f6144d
1 changed files with 15 additions and 11 deletions
|
@ -58,21 +58,25 @@ int stm32_gpio_flags_to_conf(int flags, int *pincfg)
|
|||
int pud = flags & GPIO_PUD_MASK;
|
||||
|
||||
if (direction == GPIO_DIR_OUT) {
|
||||
int type = flags & GPIO_PP_OD_MASK;
|
||||
int type = flags & GPIO_DS_HIGH_MASK;
|
||||
|
||||
if (type == GPIO_PUSH_PULL) {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_PUSH_PULL;
|
||||
if (pud == GPIO_PUD_PULL_UP) {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_PUSH_PULL_PU;
|
||||
} else if (pud == GPIO_PUD_PULL_DOWN) {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_PUSH_PULL_PD;
|
||||
}
|
||||
} else if (type == GPIO_OPEN_DRAIN) {
|
||||
if (type == GPIO_DS_DISCONNECT_HIGH) {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_OPEN_DRAIN;
|
||||
if (pud == GPIO_PUD_PULL_UP) {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_OPEN_DRAIN_PU;
|
||||
*pincfg =
|
||||
STM32F3X_PIN_CONFIG_DRIVE_OPEN_DRAIN_PU;
|
||||
} else if (pud == GPIO_PUD_PULL_DOWN) {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_OPEN_DRAIN_PD;
|
||||
*pincfg =
|
||||
STM32F3X_PIN_CONFIG_DRIVE_OPEN_DRAIN_PD;
|
||||
}
|
||||
} else {
|
||||
*pincfg = STM32F3X_PIN_CONFIG_DRIVE_PUSH_PULL;
|
||||
if (pud == GPIO_PUD_PULL_UP) {
|
||||
*pincfg =
|
||||
STM32F3X_PIN_CONFIG_DRIVE_PUSH_PULL_PU;
|
||||
} else if (pud == GPIO_PUD_PULL_DOWN) {
|
||||
*pincfg =
|
||||
STM32F3X_PIN_CONFIG_DRIVE_PUSH_PULL_PD;
|
||||
}
|
||||
}
|
||||
} else if (direction == GPIO_DIR_IN) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue