diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-23 00:03:29 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-28 21:37:03 -0700 |
commit | 6337b5f522be11926a6490d7bb27a4f7795da569 (patch) | |
tree | 7b7a7540c3d88dcc8993b9b243f6ba5a018eea74 /src | |
parent | c9e61a4f1f0ce5e5177a2252e8b7a02a578e77f1 (diff) |
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 <keithp@keithp.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/stm/stm32l.h | 4 |
1 files changed, 4 insertions, 0 deletions
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))) | |