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

📄 驱动加载及evc程序设计.txt

📁 QQ2440V3开发板的LED控制
💻 TXT
字号:
///////////////////////////////////////////////////////////////////////////////

sources文件修改如下

!if 0
Copyright (c) Microsoft Corporation.  All rights reserved.
!endif
!if 0
Use of this source code is subject to the terms of the Microsoft end-user
license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
If you did not accept the terms of the EULA, you are not authorized to use
this source code. For a copy of the EULA, please see the LICENSE.RTF on your
install media.
!endif

SYNCHRONIZE_DRAIN=1

TARGETNAME=nleddrv
RELEASETYPE=PLATFORM
TARGETTYPE=LIBRARY
SOURCES=nleddrv.cpp
INCLUDES=..\..\inc


 

二、打开EVC,编写控制软件。

1、首先添加两个外部变量

extern "C" {
BOOL WINAPI NLedGetDeviceInfo( UINT nInfoId, void *pOutput ); 
BOOL WINAPI NLedSetDevice( UINT nDeviceId, void *pInput ); 
//BOOL NLedDriverInitialize();
}; 

2、在程序中添加下面两个函数。

//下面的函数可以取得设备上LED总数
int CCtLEDDlg::GetLedCount()
{
 NLED_COUNT_INFO nci;
 int wCount = 0;
    if(NLedGetDeviceInfo(NLED_COUNT_INFO_ID, (PVOID) &nci))
   wCount = (int) nci.cLeds; 
    return wCount;
}

//下面的函数设置LED状态
void CCtLEDDlg::SetLedStatus(int wLed, int wStatus)
{
 NLED_SETTINGS_INFO nsi;      
 nsi.LedNum = (INT) wLed;
 nsi.OffOnBlink = (INT) wStatus;
 NLedSetDevice(NLED_SETTINGS_INFO_ID, &nsi);
}

3. 获得LED的数量

void CCtLEDDlg::OnButton1() 
{
 // TODO: Add your control notification handler code here
 CString str;
 int cLED=GetLedCount();
 str.Format(L"%d",cLED);
 MessageBox(str);
}

4、打开和关闭LED

SetLedStatus(1, 1);//打开LED

SetLedStatus(1, 0);//关闭LED

⌨️ 快捷键说明

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