struct serial_dev * serial_open(void) { stm32_gpio_clk_en(STM32_GPIOC); /* UART TX */ stm32_gpio_mode(UART_TX, ALT_FUNC, PUSH_PULL | SPEED_LOW); stm32_gpio_af(UART_TX, GPIO_AF8); /* UART RX */ stm32_gpio_mode(UART_RX, ALT_FUNC, PULL_UP); stm32_gpio_af(UART_RX, GPIO_AF8); return stm32f_uart6_serial_init(115200, SERIAL_8N1); }
void stm32f_mco2_init(void) { struct stm32_gpio * gpio = MCO2_GPIO; int pin = MCO2_PIN; #ifdef STM32F_SYSCFG struct stm32f_syscfg * syscfg = STM32F_SYSCFG; /* enable I/O compensation cell */ syscfg->cmpcr |= SYSCFG_CMP_EN; #endif /* initial state is disabled */ stm32_gpio_mode(gpio, pin, OUTPUT, PUSH_PULL | SPEED_HIGH); stm32_gpio_clk_en(gpio); stm32_gpio_af(gpio, pin, GPIO_AF0); }
/*********************************************************** I/O pin configuration ***********************************************************/ static void adc_gpio_init(void) { /* ADC Input pins */ stm32_gpio_clk_en(ADC6_GPIO); stm32_gpio_mode(ADC6_GPIO, ADC6_PORT, ANALOG, 0); }