@@ -62,11 +62,12 @@ typedef uint32_t gpio_t;
62
62
* @brief Generate GPIO mode bitfields
63
63
*
64
64
* We use 4 bit to determine the pin functions:
65
+ * - bit 4: ODR value
65
66
* - bit 2+3: in/out
66
67
* - bit 1: PU enable
67
68
* - bit 2: OD enable
68
69
*/
69
- #define GPIO_MODE (mode , cnf ) (mode | (cnf << 2))
70
+ #define GPIO_MODE (mode , cnf , odr ) (mode | (cnf << 2) | (odr << 4 ))
70
71
71
72
/**
72
73
* @brief Override GPIO mode options
@@ -76,12 +77,12 @@ typedef uint32_t gpio_t;
76
77
*/
77
78
#define HAVE_GPIO_MODE_T
78
79
typedef enum {
79
- GPIO_IN = GPIO_MODE (0 , 1 ), /**< input w/o pull R */
80
- GPIO_IN_PD = GPIO_MODE (0 , 2 ), /**< input with pull-down */
81
- GPIO_IN_PU = GPIO_MODE (0 , 2 ), /**< input with pull-up */
82
- GPIO_OUT = GPIO_MODE (3 , 0 ), /**< push-pull output */
83
- GPIO_OD = GPIO_MODE (3 , 1 ), /**< open-drain w/o pull R */
84
- GPIO_OD_PU = (0xff ) /**< not supported by HW */
80
+ GPIO_IN = GPIO_MODE (0 , 1 , 0 ), /**< input w/o pull R */
81
+ GPIO_IN_PD = GPIO_MODE (0 , 2 , 0 ), /**< input with pull-down */
82
+ GPIO_IN_PU = GPIO_MODE (0 , 2 , 1 ), /**< input with pull-up */
83
+ GPIO_OUT = GPIO_MODE (3 , 0 , 0 ), /**< push-pull output */
84
+ GPIO_OD = GPIO_MODE (3 , 1 , 0 ), /**< open-drain w/o pull R */
85
+ GPIO_OD_PU = (0xff ) /**< not supported by HW */
85
86
} gpio_mode_t ;
86
87
/** @} */
87
88
0 commit comments