uart.c
来自「The source code example of ARM9 developm」· C语言 代码 · 共 28 行
C
28 行
/* * Description: * example for set serial interface: RS-485. * */ #include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int main(void){ int type, dip_sw, i; int fd = open("/dev/ttyS4",O_RDWR); /*get serial interface*/ if(ioctl(fd, 0xe001, &type) == 0) printf("UART Type:%d\n",type); /*set serial interface to RS-485*/ type = 485; if(ioctl(fd, 0xe002, &type) == 0) printf("set UART type:%d\n", type); close(fd); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?