diff --git a/include/gpio.h b/include/gpio.h index e6075dc130e..36bf84be7ac 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -134,6 +134,74 @@ extern "C" { #define GPIO_PP_OD_MASK (1 << GPIO_PP_OD_POS) /** @endcond */ +/* GPIO_DS_* are for pin drive strength configuration. + * + * The drive strength of individual pins can be configured + * independently for when the pin output is low and high. + * + * The GPIO_DS_*_LOW enumerations define the drive strength of a pin + * when output is low. + + * The GPIO_DS_*_HIGH enumerations define the drive strength of a pin + * when output is high. + * + * The DISCONNECT drive strength indicates that the pin is placed in a + * high impediance state and not driven, this option is used to + * configure hardware that supports a open collector drive mode. + * + * The interface supports two different drive strengths: + * DFLT - The lowest drive strength supported by the HW + * ALT - The highest drive strength supported by the HW + * + * On hardware that supports only one standard drive strength, both + * DFLT and ALT have the same behaviour. + * + * On hardware that does not support a disconnect mode, DISCONNECT + * will behave the same as DFLT. + */ + +/** @cond INTERNAL_HIDDEN */ +#define GPIO_DS_LOW_POS 13 +#define GPIO_DS_LOW_MASK (0x3 << GPIO_DS_LOW_POS) +/** @endcond */ + +/** Default drive strength standard when GPIO pin output is low. + */ +#define GPIO_DS_DFLT_LOW (0x0 << GPIO_DS_LOW_POS) + +/** Alternative drive strength when GPIO pin output is low. + * For hardware that does not support configurable drive strength + * use the default drive strength. + */ +#define GPIO_DS_ALT_LOW (0x1 << GPIO_DS_LOW_POS) + +/** Disconnect pin when GPIO pin output is low. + * For hardware that does not support disconnect use the default + * drive strength. + */ +#define GPIO_DS_DISCONNECT_LOW (0x3 << GPIO_DS_LOW_POS) + +/** @cond INTERNAL_HIDDEN */ +#define GPIO_DS_HIGH_POS 15 +#define GPIO_DS_HIGH_MASK (0x3 << GPIO_DS_HIGH_POS) +/** @endcond */ + +/** Default drive strength when GPIO pin output is high. + */ +#define GPIO_DS_DFLT_HIGH (0x0 << GPIO_DS_HIGH_POS) + +/** Alternative drive strength when GPIO pin output is high. + * For hardware that does not support configurable drive strengths + * use the default drive strength. + */ +#define GPIO_DS_ALT_HIGH (0x1 << GPIO_DS_HIGH_POS) + +/** Disconnect pin when GPIO pin output is high. + * For hardware that does not support disconnect use the default + * drive strength. + */ +#define GPIO_DS_DISCONNECT_HIGH (0x3 << GPIO_DS_HIGH_POS) + struct gpio_callback; /**