📄 uart.c
字号:
/* * 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -