#include "qsspt.h" qsspt::qsspt(port * info,bool debug):qssp(info,debug),endthread(false),datapending(false),debug(debug) { } void qsspt::run() { while(!endthread) { receivestatus=this->ssp_ReceiveProcess(); sendstatus=this->ssp_SendProcess(); msleep(1); sendbufmutex.lock(); if(datapending && receivestatus==SSP_TX_IDLE) { this->ssp_SendData(mbuf,msize); datapending=false; } sendbufmutex.unlock(); if(sendstatus==SSP_TX_ACKED) sendwait.wakeAll(); } } bool qsspt::sendData(uint8_t * buf,uint16_t size) { if(datapending) return false; sendbufmutex.lock(); datapending=true; mbuf=buf; msize=size; sendbufmutex.unlock(); msendwait.lock(); sendwait.wait(&msendwait,10000); msendwait.unlock(); return true; } void qsspt::pfCallBack( uint8_t * buf, uint16_t size) { if (debug) qDebug()<<"receive callback"<