Debian Codegraph @

examples/emcu-firmware/uart-retarget.c-src

raw
1 /*
2 * *****************************************************************************************
3 *
4 * Copyright (C) 2014-2021 Gowin Semiconductor Technology Co.,Ltd.
5 *
6 * @file retarget.c
7 * @author Embedded Development Team
8 * @version V1.x.x
9 * @date 2021-01-01 09:00:00
10 * @brief UART printf and scanf retarget function.
11 ******************************************************************************************
12 */
13
14 /* Includes ------------------------------------------------------------------*/
15 #include "gw1ns4c.h"
16 #include <stdio.h>
17 #include <sys/stat.h>
18
19 __attribute__ ((used)) int _write (int fd, char *ptr, int len)
20 {
21 size_t i;
22
23 for (i=0; i<len; i++)
24 {
25 UART_SendChar(UART0,ptr[i]); // call character output function
26 }
27
28 return len;
29 }
30