I copied:
Code: Select all
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) |
PAL_STM32_OSPEED_HIGHEST); /* SCK. */
So, I would like to write:
Code: Select all
palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(AF_SPI2));
Possibly we'd need the define to read "AF_GPIOB_SPI2" if the define needs to be different for the higher ports. Hmm. The defines are (on STM32F0) specific for the PIN. Then maybe I'd prefer to write something like make_PB13_SPI2_SCK().
Any other suggestions to make it possible to catch errors like this at compile-time instead of after a deep debugging session?