2015-05-04 11:43 AM
Hi,
I'm trying to write a custom initialization for GPIO of F1 and F3/F4 series. I've defined most of the MODE and IO types but stuct at alternate input mode. F1 series puts the pin to input mode while F3/F4 just sets AF mode. So I've come up with the following pseudocode.
// alternate function input
&sharpif defined(__F3) || defined(__F4)
// F3 series (later F4 as well)
AF_INPUT_PN => .GPIO_Mode = GPIO_Mode_AF, .GPIO_PuPd = GPIO_PuPd_NOPULL//omit .GPIO_OType
AF_INPUT_PU => .GPIO_Mode = GPIO_Mode_AF, .GPIO_PuPd = GPIO_PuPd_UP//omit .GPIO_OType
AF_INPUT_PD => .GPIO_Mode = GPIO_Mode_AF, .GPIO_PuPd = GPIO_PuPd_DOWN//
omit
.GPIO_OType + GPIO_PinAFConfig(...)&sharpelse
// __F1 series
// F1 series
AF_INPUT_PN => .GPIO_Mode = GPIO_Mode_IN_FLOATING AF_INPUT_PU => .GPIO_Mode = GPIO_Mode_IPU AF_INPUT_PD => .GPIO_Mode = GPIO_Mode_IPD + GPIO_PinRemapConfig(...)&sharpendif
Do you think it is correct? #gpio-alternate-input