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

📄 seg7_driver.c

📁 嵌入式开发试验:七段数码管实验
💻 C
字号:
/*
 *	seg7_driver.c - seg7 driver ( low-level )
 *	
 *	Author: 	li ming <admin@lumit.org>
 *	Date:		2005-6-11
 *	Copyleft:	http://www.lumit.org
 */

#include "seg7_driver.h"

/* set seg7 related gpio */
int seg7_open( void )
{
	// do nothing
	return 0;
}

int seg7_read( char * buf, int count )
{	
	// do nothing	
	return count;
}

int seg7_write( char * buf, int count )
{	
	int i = 0;
	int seg7_value = 0;
	
	// the count has exceeds the count of seg7
	if( count > SEG7_NUM )
		return -1;
	
	for( i = 0; i < count; i++ )
		seg7_value = seg7_value | (buf[i]? ( 1 << i ) : 0) ;
	
	// write the value to 7 segment leds
	SEG7 = seg7_value;
	
	return count;
}

int seg7_ioctl( unsigned int cmd, unsigned long arg )
{
	// do nothing 	
	return 0;
}

int seg7_release( void )
{
	// do nothing 
	return 0;	
}

⌨️ 快捷键说明

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