File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
components/drivers/serial Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 2222 * 2017-11-15 JasonJia fix poll rx issue when data is full.
2323 * add TCFLSH and FIONREAD support.
2424 * 2018-12-08 Ernest Chen add DMA choice
25+ * 2020-09-14 WillianChan add a line feed to the carriage return character
26+ * when using interrupt tx
2527 */
2628
2729#include <rthw.h>
@@ -315,6 +317,19 @@ rt_inline int _serial_int_tx(struct rt_serial_device *serial, const rt_uint8_t *
315317
316318 while (length )
317319 {
320+ /*
321+ * to be polite with serial console add a line feed
322+ * to the carriage return character
323+ */
324+ if (* data == '\n' && (serial -> parent .open_flag & RT_DEVICE_FLAG_STREAM ))
325+ {
326+ if (serial -> ops -> putc (serial , '\r' ) == -1 )
327+ {
328+ rt_completion_wait (& (tx -> completion ), RT_WAITING_FOREVER );
329+ continue ;
330+ }
331+ }
332+
318333 if (serial -> ops -> putc (serial , * (char * )data ) == -1 )
319334 {
320335 rt_completion_wait (& (tx -> completion ), RT_WAITING_FOREVER );
You can’t perform that action at this time.
0 commit comments