Browse Source

nothing

heydari
Alireza 3 years ago
parent
commit
07a5f24ece
  1. 10
      Plx/include/LowLevel/HonaLowLevelAPI.h
  2. 7
      Plx/include/LowLevel/Setting/Setting.h
  3. 30
      Plx/src/LowLevel/HonaLowLevelAPI.cpp

10
Plx/include/LowLevel/HonaLowLevelAPI.h

@ -5,7 +5,6 @@
#include "include/LowLevel/Setting/Setting.h"
#include "include/LowLevel/HonaPacket.h"
#include "LowLevel/Setting/Setting.h"
#include "HonaPacket.h"
#include "QWaitCondition"
@ -17,19 +16,16 @@ class HonaLowLevelAPI : public QObject
Q_OBJECT
private:
bool _hsruIsStarted;
bool _hiruIsStarted;
HonaSetting _honaSetting;
QWaitCondition HsruReadDone, HsruUpdateAck, HsruStopEvent;
QWaitCondition _hsruReadDone, _hsruUpdateAck, _hsruStopEvent;
QMutex _mutex;
int _threadSforValue = 0;
bool _isReaderThreadFree = false;
bool _isUpdateThreadFree = false;
quint32 honaRegisterBuffer[8];
public:
explicit HonaLowLevelAPI(QObject* parent = nullptr);
bool isHsruStarted();
@ -52,15 +48,13 @@ public:
void setHiruIsStarted(bool hiruIsStarted);
private:
void writeSettingToRegisters(honaSettings& settings);
void writeSettingToRegisters(HonaSetting& settings);
void setConfig();
void hsruMainThread();
void hsruReadThread();
void hsruUpdateThread();
int hiruGetDOA();
signals:
void signalToTop(QList<HonaPacket*> honaPacketList, int i, int j);
//uncrustify off

7
Plx/include/LowLevel/Setting/Setting.h

@ -16,8 +16,8 @@
quint32 threshold = 0;
quint32 timeout = 1000;
quint32 count = 5;
};
/***********************************************************************************************/
struct hsruSettings_t
{
@ -30,13 +30,14 @@
quint32 intM4_THR = 20; //mode4
quint32 resM4_THR = 20; //mode4
};
/***********************************************************************************************/
struct honaSettings
struct HonaSetting
{
hiruSettings_t hiruSettings;
hsruSettings_t hsruSettings;
};
/***********************************************************************************************/
#endif //SETTING_H

30
Plx/src/LowLevel/HonaLowLevelAPI.cpp

@ -1,5 +1,3 @@
<<<<<<< HEAD
#include <include/LowLevel/Utils/Utils.h>
#include "include/LowLevel/HonaLowLevelAPI.h"
#include "include/Wrapper/PlxWrapper.h"
@ -52,11 +50,10 @@ bool HonaLowLevelAPI::isHiruStarted()
/*************************************************************************************************/
void HonaLowLevelAPI::deviceReset()
{
ApiResult status;
if(ApiResult::success)
{
}
//ApiResult status;
//if(ApiResult::success)
//{
//}
/*
QTime t;
t.elapsed()
@ -105,24 +102,20 @@ QString HonaLowLevelAPI::getSwVersion()
/*************************************************************************************************/
QString HonaLowLevelAPI::getDeviceId()
{
}
/*************************************************************************************************/
void HonaLowLevelAPI::hsruStart()
{
}
/*************************************************************************************************/
void HonaLowLevelAPI::hiruStart()
{
if(isHiruStarted())
//exceptiom
QtConcurrent::run(this, &HonaLowLevelAPI::hsruMainThread);
}
/*************************************************************************************************/
@ -131,7 +124,7 @@ void HonaLowLevelAPI::init()
}
/*************************************************************************************************/
void HonaLowLevelAPI::writeSettingToRegisters(honaSettings& settings)
void HonaLowLevelAPI::writeSettingToRegisters(HonaSetting& settings)
{
honaRegisterBuffer[0] = 0x00000000;
/************************************************************************/
@ -160,7 +153,6 @@ void HonaLowLevelAPI::writeSettingToRegisters(honaSettings& settings)
honaRegisterBuffer[5] = settings.hsruSettings.honaSPTHR;
honaRegisterBuffer[6] = settings.hsruSettings.intM4_THR;
honaRegisterBuffer[7] = settings.hsruSettings.resM4_THR;
}
/*************************************************************************************************/
@ -175,7 +167,7 @@ void HonaLowLevelAPI::hsruMainThread()
QtConcurrent::run(this, &HonaLowLevelAPI::hsruUpdateThread);
_mutex.lock();
HsruStopEvent.wait(&_mutex);
_hsruStopEvent.wait(&_mutex);
_mutex.unlock();
_isReaderThreadFree = true;
@ -191,8 +183,8 @@ void HonaLowLevelAPI::hsruReadThread()
break;
//dosth
_mutex.lock();
HsruReadDone.wakeAll();
HsruUpdateAck.wait(&_mutex);
_hsruReadDone.wakeAll();
_hsruUpdateAck.wait(&_mutex);
_mutex.unlock();
}
}
@ -203,15 +195,13 @@ void HonaLowLevelAPI::hsruUpdateThread()
while(true)
{
_mutex.lock();
HsruReadDone.wait(&_mutex);
_hsruReadDone.wait(&_mutex);
_mutex.unlock();
if(_isUpdateThreadFree)
break;
//dosth
HsruUpdateAck.wakeAll();
_hsruUpdateAck.wakeAll();
}
}
/*************************************************************************************************/

Loading…
Cancel
Save