1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| #include "uart.h"
| #include "stm8s_uart2.h"
|
| void InitUart()
| {
| UART2_DeInit();
| UART2_Init(9600u, UART2_WORDLENGTH_8D, UART2_STOPBITS_1, UART2_PARITY_NO, UART2_SYNCMODE_CLOCK_ENABLE, UART2_MODE_TXRX_ENABLE);
| UART2_Cmd(ENABLE);
| }
|
| int putchar(int ch)
| {
| while (SET != UART2_GetFlagStatus(UART2_FLAG_TC))
| ;
| UART2_SendData8(ch);
| return ch;
| }
|
|