⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ledtest_app.c

📁 Linux device driver sample code
💻 C
字号:
#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/fcntl.h>#include "led_drv.h"char str[20]="hello";int main(void){	int device_handle;	int ledval;	printf("\nLDD test \n");	device_handle = open("/dev/LED", O_RDWR);		read(device_handle, &str[0], 5);	printf("\nstring %s\n", str);		write(device_handle, "Howdy", 5);	ledval = 0xFC0;	ioctl(device_handle, LEDON_WDATA, ledval);	sleep(1);	ioctl(device_handle, LEDOFF_WDATA, ledval);	ledval = 0x550;	ioctl(device_handle, LEDON_WDATA, ledval);	sleep(1);	ioctl(device_handle, LEDOFF_WDATA, ledval);	ledval = 0xAA0;	ioctl(device_handle, LEDON_WDATA, ledval);	sleep(1);	ioctl(device_handle, LEDOFF_WDATA, ledval);	close(device_handle);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -