📄 switch.c
字号:
#include <unistd.h>#include <stdio.h>#include <fcntl.h>#include <sys/mman.h>#include <sys/ioctl.h>#include "switch.h"#include "sw_val.h"static int swfd;int sw_init(){ if((swfd = open("/dev/switch", O_RDWR)) >= 0) return swfd; else return -1;}int reset_sw(){ int sw_val; do { ioctl(swfd, FPGA_SW_READ, &sw_val); } while (!(sw_val == SW_OFF));}int chk_sw(){ int sw_val; reset_sw(); do { ioctl(swfd, FPGA_SW_READ, &sw_val); } while (sw_val == SW_OFF); return(sw_val);}int chk_sw_now(){ int sw_val; ioctl(swfd, FPGA_SW_READ, &sw_val); return(sw_val);}int chk_led_now(){ int sw_val; ioctl(swfd,FPGA_SW_READ,&sw_val); // to be checked!!! return(sw_val);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -