91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-15
  • 語言: 其他
  • 標簽: qt程序??

資源簡介

里面有針對ok6410的led、蜂鳴器、ad的qt程序,很適合qt及arm初學者自己學

資源截圖

代碼片段和文件信息

#include?“frmmain.h“
#include?“ui_frmmain.h“
#include?“unistd.h“
#include?“stdlib.h“
#include?“sys/types.h“
#include?“sys/stat.h“
#include?“sys/ioctl.h“
#include?“fcntl.h“
#include?“myARMLinuxHelper.h“

frmMain::frmMain(QWidget?*parent)?:
????????QMainWindow(parent)
????????ui(new?Ui::frmMain)
{
????ui->setupUi(this);

????::FormHelper::FormOnlyCloseButton(this);
????::FormHelper::FormInCenter(this);

????//LED控制處理
????::system(“kill?-s?STOP?‘pidof?led-player‘“);
????ledHand=::open(“/dev/leds0“?O_RDONLY);

????if?(ledHand<0)
????{
????????ledHand=::open(“/dev/leds“?O_RDONLY);
????}????

????ledIndex=0;

????this->setWindowtitle(tr(“TE6410驅動演示“));
????myTimer=new?QTimer(this);
????myTimer->setInterval(100);
????connect(myTimerSIGNAL(timeout())thisSLOT(DoLED()));

????//蜂鳴器控制處理
????beepHand=::open(“/dev/pwm“?O_RDONLY);
????::ioctl(beepHand?0);

????beepValue=100;

????//AD采樣
????adHand=::open(“/dev/adc“?O_RDONLY);

????timerAD=new?QTimer(this);
????timerAD->setInterval(500);
????connect(timerADSIGNAL(timeout())thisSLOT(GetADValue()));


????//按鍵識別處理
????keyHand=::open(“/dev/input/event0“?O_RDONLY?|?O_NONBLOCK);

????key=new?QSocketNotifier(keyHandQSocketNotifier::Readthis);
????connect(keySIGNAL(activated(int))thisSLOT(keyEvent()));

}

frmMain::~frmMain()
{
????delete?ui;
}

void?frmMain::closeEvent(QCloseEvent?*)
{
????//關閉LED
????::close(ledHand);

????//關閉蜂鳴器
????::ioctl(beepHand0);
????::close(beepHand);

????//關閉AD
????::close(adHand);

????//關閉按鍵
????::close(keyHand);
}

void?frmMain::DoLED()
{
????ioctl(ledHand0ledIndex);
????ledIndex++;
????if?(ledIndex>3){ledIndex=0;}
????ioctl(ledHand1ledIndex);????
}

void?frmMain::on_btnLed0_clicked()
{
????if?(ui->btnLed0->text()==tr(“LED0亮“))
????{
????????ioctl(ledHand10);
????????ui->btnLed0->setText(tr(“LED0滅“));
????}
????else
????{
????????ioctl(ledHand00);
????????ui->btnLed0->setText(tr(“LED0亮“));
????}
}

void?frmMain::on_btnLed1_clicked()
{
????if?(ui->btnLed1->text()==tr(“LED1亮“))
????{
????????ioctl(ledHand11);
????????ui->btnLed1->setText(tr(“LED1滅“));
????}
????else
????{
????????ioctl(ledHand01);
????????ui->btnLed1->setText(tr(“LED1亮“));
????}
}

void?frmMain::on_btnLed2_clicked()
{
????if?(ui->btnLed2->text()==tr(“LED2亮“))
????{
????????ioctl(ledHand12);
????????ui->btnLed2->setText(tr(“LED2滅“));
????}
????else
????{
????????ioctl(ledHand02);
????????ui->btnLed2->setText(tr(“LED2亮“));
????}
}

void?frmMain::on_btnLed3_clicked()
{
????if?(ui->btnLed3->text()==tr(“LED3亮“))
????{
????????ioctl(ledHand13);
????????ui->btnLed3->setText(tr(“LED3滅“));
????}
????else
????{
????????ioctl(ledHand03);
????????ui->btnLed3->setText(tr(“LED3亮“));
????}
}

void?frmMain::on_btnStart_clicked()
{
????if?(ui->btnStart->text()==tr(“開始“))
????{
????????myTimer->start();
????????ui->btnStart->setText(tr(“停止“));
????}
????else
????{
????????myTimer->stop();
????????ui->btnStart->setText(tr(“開始“));
????}
}

void?frmMain::on_btnOpen_clicked()
{
????if?(ui->btnOpen->text(

評論

共有 條評論