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

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

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

30
Plx/src/LowLevel/HonaLowLevelAPI.cpp

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

Loading…
Cancel
Save