?? uart_rxd.c
字號:
#include<stdio.h>
#include<string.h>
#include<fcntl.h>
#include"system.h"
#include"unistd.h"
#define BUFFER_SIZE 10
/* the green font is use ANSIC C function;*/
/* and black font is use HAL API function,*/
/* it likes UNIX command */
int main(void)
{
char *msg;
char *message="you have recive from uart:";
char *message2="open uart successfully,input 10 characters";
FILE*fp;
//fp=fopen("/dev/uart","r+");
fp=open(UART_NAME,O_RDWR,0666);
if(fp!=NULL)
{
//fprintf(fp,"open uart successfully,input 10 characters\n")
write(fp,message2,strlen(message2));
while(fp)
{
//fread(msg,BUFFER_SIZE,1,fp);
read(fp,msg,BUFFER_SIZE);
//fprintf(fp,"you have recive from uart:");
write(fp,message,strlen(message));
//fprintf(fp,"%s\n",msg);
write(fp,msg,BUFFER_SIZE);
}
}
else
printf("open uart failed\n");
fclose(fp);
return 0;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -