From: Keith Packard Date: Fri, 23 Mar 2012 07:03:29 +0000 (-0700) Subject: Automatically set ALTERNATE pin mode when setting alternate function X-Git-Tag: 1.0.9.4~13 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=6337b5f522be11926a6490d7bb27a4f7795da569 Automatically set ALTERNATE pin mode when setting alternate function When selecting an alternate function, set the pin to alternate mode as well; there's no sense requiring two separate calls everywhere. Signed-off-by: Keith Packard --- diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h index 50e5cc34..531a4fb9 100644 --- a/src/stm/stm32l.h +++ b/src/stm/stm32l.h @@ -133,6 +133,10 @@ stm_pupdr_get(struct stm_gpio *gpio, int pin) { static inline void stm_afr_set(struct stm_gpio *gpio, int pin, uint32_t value) { + /* + * Set alternate pin mode too + */ + stm_moder_set(gpio, pin, STM_MODER_ALTERNATE); if (pin < 8) gpio->afrl = ((gpio->afrl & ~(STM_AFR_MASK << STM_AFR_SHIFT(pin))) |