void up_consoleinit(void) { #ifdef HAVE_SERIAL_CONSOLE # if defined(CONFIG_USART0_SERIAL_CONSOLE) usart0_configure(); # elif defined(CONFIG_USART1_SERIAL_CONSOLE) usart1_configure(); # endif #endif }
static int usart1_setup(struct uart_dev_s *dev) { #ifndef CONFIG_SUPPRESS_UART_CONFIG /* Configure the USART as an RS-232 UART */ usart1_configure(); #endif return OK; }
/** * @brief Main program * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f0xx.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file */ /* Enable GPIO clock */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); /* GPIOC Periph clock enable */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); // configure the UART and setup the interupt usart1_configure(); // configure PA0 as an interupts source (blue user button) and the PC9 and PC8 for Green and Blue LEDs others_configure(); /* Loop until the end of transmission */ /* The software must wait until TC=1. The TC flag remains cleared during all data transfers and it is set by hardware at the last frame’s end of transmission*/ while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET) {} uint32_t waitcount; printf("\n\rMain Loop Entry Point!\n\r"); while (1) { /*Just Wasting time in a loop and toggling a heartbeat LED, everything should be handled through ISRs */ GPIOC->BSRR = LED_BLUE; waitcount = 0; while (waitcount < 500000) { waitcount++; } GPIOC->BRR = LED_BLUE; waitcount = 0; while (waitcount < 500000) { waitcount++; } } }
void up_consoleinit(void) { #ifdef HAVE_SERIAL_CONSOLE usart1_configure(); #endif }