Hi Christer,


The above pin definition would look like this:

#define STM32F4_PINMUX_FUNC_PA9_USART1_TX (STM32F4X_PIN_FUNC_AF |
STM32F4X_PIN_PULL_UP | STM32_PINMUX_FUNC_ALT_7)

It's a bit more verbose, but it's obvious what it does, especially if
you look at the corresponding definitions in the data sheet since this
is how the hardware registers look.

I agree this might be clearer for users. Since pinmux is something users might
have to play with, the easier to read, the better.

If we do this we can rip out stm32_get_pin_config completely and also
simplify the __func_to_foo functions in soc_gpio.c

It might also be a good idea to unify these defines between STM32
families.  If I recall correctly many STM32F1xx, STM32F2xx and STMF4xx
packages are mostly pin compatible.  The same PCB could have a STM32Fxx
or STM32F4xx MCU mounted on it (with a zero ohm resistor or capacitor to
account for any differences between them) and it would be nice if they
could use the same board file.

I can only agree here. It will help a lot on maintenance and porting of new families.
There could be unexpected differences between quite similar boards, but these could
be handled easily.

Some functions might not be supported on all families, for example, I
don't think the STM32F1xx can have a pull-up/pull-down at the same tie
as a pin is an output or alternate function, but that shouldn't be problem.

> Btw, I think that you could submit your RFC as a patch in Gerrit, so we can
> better appreciate the differences and comment easily.

I'll see if I can clean up my ideas and push a few patches for review in
gerrit.

Thanks a lot for your contribution!
 
  /Christer