/* * Copyright (c) 2016 Open-RnD Sp. z o.o. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_STM32_H_ #define ZEPHYR_DRIVERS_GPIO_GPIO_STM32_H_ /** * @file header for STM32 GPIO */ #include #include #include #include #ifdef CONFIG_SOC_SERIES_STM32F1X #define STM32_PINCFG_MODE_OUTPUT (STM32_MODE_OUT_MAX_SPEED_50MHZ | \ STM32_CNF_OUT_GENERAL_PURPOSE) #define STM32_PINCFG_MODE_INPUT_FLOAT STM32_CNFMODE_INPUT_FLOAT #define STM32_PINCFG_MODE_INPUT_PUPD STM32_CNFMODE_INPUT_PUPD #define STM32_PINCFG_MODE_ANALOG STM32_CNFMODE_ANALOG #define STM32_PINCFG_PUSH_PULL STM32_CNF_OUT_PUSH_PULL #define STM32_PINCFG_OPEN_DRAIN STM32_CNF_OUT_OPEN_DRAIN #define STM32_PINCFG_PULL_UP STM32_PUPD_PULL_UP #define STM32_PINCFG_PULL_DOWN STM32_PUPD_PULL_DOWN #else #define STM32_PINCFG_MODE_OUTPUT STM32_MODER_OUTPUT_MODE #define STM32_PINCFG_MODE_INPUT_FLOAT STM32_MODER_INPUT_MODE #define STM32_PINCFG_MODE_INPUT_PUPD STM32_MODER_INPUT_MODE #define STM32_PINCFG_MODE_ANALOG STM32_MODER_ANALOG_MODE #define STM32_PINCFG_PUSH_PULL STM32_OTYPER_PUSH_PULL #define STM32_PINCFG_OPEN_DRAIN STM32_OTYPER_OPEN_DRAIN #define STM32_PINCFG_PULL_UP STM32_PUPDR_PULL_UP #define STM32_PINCFG_PULL_DOWN STM32_PUPDR_PULL_DOWN #endif /* CONFIG_SOC_SERIES_STM32F1X */ #if defined(CONFIG_GPIO_GET_CONFIG) && !defined(CONFIG_SOC_SERIES_STM32F1X) /** * @brief structure of a GPIO pin (stm32 LL values) use to get the configuration */ struct gpio_stm32_pin { unsigned int type; /* LL_GPIO_OUTPUT_PUSHPULL or LL_GPIO_OUTPUT_OPENDRAIN */ unsigned int pupd; /* LL_GPIO_PULL_NO or LL_GPIO_PULL_UP or LL_GPIO_PULL_DOWN */ unsigned int mode; /* LL_GPIO_MODE_INPUT or LL_GPIO_MODE_OUTPUT or other */ unsigned int out_state; /* 1 (high level) or 0 (low level) */ }; #endif /* CONFIG_GPIO_GET_CONFIG */ #endif /* ZEPHYR_DRIVERS_GPIO_GPIO_STM32_H_ */