static int stm32_pin_configure(int pin, int func, int altf) { /* determine IO port registers location */ u32_t offset = STM32_PORT(pin) * GPIO_REG_SIZE; u8_t *port_base = (u8_t *)(GPIO_PORTS_BASE + offset); /* not much here, on STM32F10x the alternate function is * controller by setting up GPIO pins in specific mode. */ return stm32_gpio_configure((u32_t *)port_base, STM32_PIN(pin), func, altf); }
* limitations under the License. */ #include "stm32_uart_internal.h" #include "stm32_gpio.h" struct stm32_uart_def const s_uart_defs[MGOS_MAX_NUM_UARTS] = { {.regs = NULL}, { .regs = USART1, .default_pins = { .tx = STM32_PIN('B', 6, 7), .rx = STM32_PIN('B', 7, 7), .ck = STM32_PIN('B', 5, 7), .cts = STM32_PIN('B', 4, 7), .rts = STM32_PIN('B', 3, 7), }, }, { .regs = USART2, .default_pins = { .tx = STM32_PIN('A', 2, 7), .rx = STM32_PIN('A', 3, 7), .ck = STM32_PIN('A', 4, 7), .cts = STM32_PIN('A', 0, 7), .rts = STM32_PIN('A', 1, 7),