添加SetLed函数
This commit is contained in:
parent
39ba816570
commit
26b797c9b9
|
@ -1059,3 +1059,20 @@ void NRF24L01::ReceiveTask(void* param)
|
|||
// 需要判断锁,如果有别的线程正在读写,则定时器无条件退出。
|
||||
if(nrf->Opened) nrf->OnIRQ();
|
||||
}
|
||||
|
||||
void NRF24L01::SetLed(Pin led)
|
||||
{
|
||||
if (led != P0)
|
||||
{
|
||||
auto port = new OutputPort(led);
|
||||
SetLed(*port);
|
||||
}
|
||||
}
|
||||
|
||||
void NRF24L01::SetLed(OutputPort& led)
|
||||
{
|
||||
auto fp = new FlushPort();
|
||||
fp->Port = &led;
|
||||
fp->Start();
|
||||
Led = fp;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "Net\ITransport.h"
|
||||
#include "Power.h"
|
||||
#include "Message\DataStore.h"
|
||||
#include "APP\FlushPort.h"
|
||||
|
||||
// NRF24L01类
|
||||
class NRF24L01 : public ITransport, public Power
|
||||
|
@ -40,16 +41,20 @@ public:
|
|||
|
||||
typedef int (*FuncBufInt)(const Buffer&);
|
||||
FuncBufInt FixData;// 修正数据的委托
|
||||
IDataPort* Led; // 数据灯
|
||||
|
||||
byte Status;
|
||||
byte FifoStatus;
|
||||
void ShowStatus();
|
||||
|
||||
IDataPort* Led; // 数据灯
|
||||
void SetLed(OutputPort& led);
|
||||
void SetLed(Pin led);
|
||||
|
||||
//virtual String ToString() const { return String("R24"); }
|
||||
virtual String& ToStr(String& str) const { return str + "R24"; }
|
||||
|
||||
private:
|
||||
|
||||
virtual bool OnOpen();
|
||||
virtual void OnClose();
|
||||
|
||||
|
|
Loading…
Reference in New Issue