usart.h
usart.h
如下:
#ifndef __USART_H
#define __USART_H
#include "stdio.h"
extern u8 USART_RX_BUF[];
extern u8 USART_RX_STA;
void uart2_init ( u32 bound );
#endif
usart.c
usart.c
如下:
#include "sys.h"
#include "usart.h"
#if 1
#pragma import(__use_no_semihosting)
struct __FILE {
int handle;
};
FILE __stdout;
void _sys_exit ( int x ) {
x = x;
}
int fputc ( int ch, FILE *f ) {
while ( ( USART2->SR & 0X40 ) == 0 );
USART2->DR =