1 /*
2  * Copyright (c) 2024 STMicroelectronics
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_STM32_GPIO_H_
8 #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_STM32_GPIO_H_
9 
10 /**
11  * @brief STM32 GPIO specific flags
12  *
13  * The driver flags are encoded in the 8 upper bits of @ref gpio_dt_flags_t as
14  * follows:
15  *
16  * - Bit 8: Configure a GPIO pin to power on the system after Poweroff.
17  * - Bit 10..9: Configure the output speed of a GPIO pin.
18  *
19  * @ingroup gpio_interface
20  * @{
21  */
22 
23 /**
24  * Configures a GPIO pin to power on the system after Poweroff.
25  * This flag is reserved to GPIO pins that are associated with wake-up pins
26  * in STM32 PWR devicetree node, through the property "wkup-gpios".
27  */
28 #define STM32_GPIO_WKUP (1 << 8)
29 
30 /** @cond INTERNAL_HIDDEN */
31 #define STM32_GPIO_SPEED_SHIFT 9
32 #define STM32_GPIO_SPEED_MASK  0x3
33 /** @endcond */
34 
35 /** Configure the GPIO pin output speed to be low */
36 #define STM32_GPIO_LOW_SPEED (0x0 << STM32_GPIO_SPEED_SHIFT)
37 
38 /** Configure the GPIO pin output speed to be medium */
39 #define STM32_GPIO_MEDIUM_SPEED (0x1 << STM32_GPIO_SPEED_SHIFT)
40 
41 /** Configure the GPIO pin output speed to be high */
42 #define STM32_GPIO_HIGH_SPEED (0x2 << STM32_GPIO_SPEED_SHIFT)
43 
44 /** Configure the GPIO pin output speed to be very high */
45 #define STM32_GPIO_VERY_HIGH_SPEED (0x3 << STM32_GPIO_SPEED_SHIFT)
46 
47 /** @} */
48 
49 #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_STM32_GPIO_H_ */
50