/** * This function is used by rt_kprintf to display a string on console. * * @param str the displayed string */ void rt_hw_console_output(const char* str) { while (*str) { rt_hw_console_putc (*str++); } }
/** * This function is used by rt_kprintf to display a string on console. * * @param str the displayed string */ void rt_hw_console_output(const char* str) { #if STM32_CONSOLE_USART == 0 /* no console */ #else while (*str) { rt_hw_console_putc (*str++); } #endif }
/* write one character to serial, must not trigger interrupt */ static void rt_hw_console_putc(const char c) { /* to be polite with serial console add a line feed to the carriage return character */ if (c=='\n')rt_hw_console_putc('\r'); while (!(CONSOLE_USART->SR & USART_FLAG_TXE)); CONSOLE_USART->DR = (c & 0x1FF); }