📄 led_test.c
字号:
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#include <termios.h>#include <errno.h>#include "at91_gpio.h"#include "at91_ioctl.h"#define SYS_LED AT91_PIN_PC10int fd;at91_gpio_arg arg;void sysled_on(){ int fd; arg.pin= SYS_LED; arg.data = 1; ioctl(fd, IOCTL_GPIO_SETOUTPUT, &arg);}void sysled_off(){ arg.pin= SYS_LED; arg.data = 0; ioctl(fd, IOCTL_GPIO_SETOUTPUT, &arg);}int main(int argc, char *argv[]){ fd = open ("/dev/gpio", O_RDWR); while (1){ sysled_on(); sleep(1); sysled_off(); } close(fd); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -