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

📄 frmtest.cpp

📁 在PXA270开发平台上
💻 CPP
字号:
#include "frmtest.h"#include <stdio.h>#include <fcntl.h>#include <unistd.h>#define LED_DEV		"/dev/emdoor_8led"/*  *  Constructs a frmtest which is a child of 'parent', with the  *  name 'name' and widget flags set to 'f'  * *  The dialog will by default be modeless, unless you set 'modal' to *  TRUE to construct a modal dialog. */frmtest::frmtest( QWidget* parent,  const char* name, bool modal, WFlags fl )    : Formtest( parent, name, modal, fl ){    DispTimer=new QTimer(this);    connect ( btnOpen, SIGNAL(clicked()), this, SLOT(OpenDevice()));    connect ( btnClose,SIGNAL(clicked()), this, SLOT(CloseDevice()));    connect ( btnExit,SIGNAL(clicked()), this, SLOT(close()));    connect (btnDisplay, SIGNAL(clicked()), this,SLOT(Display()));    connect (btnStop, SIGNAL(clicked()), this,SLOT(StopDisplay()));    connect ( DispTimer, SIGNAL(timeout()),this,SLOT(DisplayTimer()));    fd=-1;    led=0xff;    flag=FALSE;    }/*   *  Destroys the object and frees any allocated resources */frmtest::~frmtest(){    if(fd>0)    {	::close(fd);	fd=-1;    }    // no need to delete child widgets, Qt does it all for us}void frmtest::OpenDevice(){    if(fd<0)	fd = ::open(LED_DEV, O_RDWR);    else	qDebug("The Device is opened!!");    }void frmtest::CloseDevice(){    if(fd>0)    {	::close(fd);	fd=-1;    }    	}void frmtest::Display(){    DispTimer->start(500);}void frmtest::StopDisplay(){    DispTimer->stop();}void frmtest::DisplayTimer(){    flag=!flag;    if(flag==TRUE)	led=0xff;    else	led=0x0;    if(fd>0)	write(fd, &led, 1);}

⌨️ 快捷键说明

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