Re_For_ControlTerminal/Rasp/gpiodetect.cpp
Teademia 543afc9ff9 Implement of Rasp GPIO Input read
Import libwringpi and read handbutton input
2023-11-21 21:22:47 +08:00

37 lines
485 B
C++

#include "gpiodetect.h"
gpiodetect::gpiodetect(QObject *parent)
: QThread{parent}
{
}
void gpiodetect::run()
{
while(1)
{
QThread::sleep(2);
if(Status==true)
{
if(digitalRead(3)==1)
{
emit Pin_High(3);
}
else
{
emit Pin_Low(3);
}
}
}
}
void gpiodetect::Stop()
{
Status=false;
}
void gpiodetect::Start()
{
Status=true;
}