/** * @brief Retargets the C library printf function to the UART. * @param c Character to send * @retval char Character sent */ PUTCHAR_PROTOTYPE { /* Write a character to the UART2 */ UART2_SendData8(c); /* Loop until the end of transmission */ while (UART2_GetFlagStatus(UART2_FLAG_TXE) == RESET); return (c); }
/** * @brief Retargets the C library scanf function to the USART. * @param None * @retval char Character to Read */ GETCHAR_PROTOTYPE { #ifdef _COSMIC_ char c = 0; #else int c = 0; #endif /* Loop until the Read data register flag is SET */ while (UART2_GetFlagStatus(UART2_FLAG_RXNE) == RESET); c = UART2_ReceiveData8(); return (c); }