网关D 使用 AP0104

This commit is contained in:
WangQiang 2016-06-16 07:44:38 +00:00
parent 5e12d2d2f6
commit 65dbc4debc
2 changed files with 11 additions and 6 deletions

View File

@ -13,6 +13,7 @@
#include "Net\Dhcp.h" #include "Net\Dhcp.h"
#include "Net\DNS.h" #include "Net\DNS.h"
#include "TinyNet\TinyConfig.h"
#include "TokenNet\TokenController.h" #include "TokenNet\TokenController.h"
#include "App\FlushPort.h" #include "App\FlushPort.h"
@ -231,9 +232,10 @@ TokenClient* AP0104::CreateClient()
return client; return client;
} }
/******************************** 2401 ********************************/ /******************************** 2401 ********************************/
/*int Fix2401(const Buffer& bs) int AP0104::Fix2401(const Buffer& bs)
{ {
//auto& bs = *(Buffer*)param; //auto& bs = *(Buffer*)param;
// 微网指令特殊处理长度 // 微网指令特殊处理长度
@ -246,13 +248,13 @@ TokenClient* AP0104::CreateClient()
return rs; return rs;
} }
ITransport* AP0104::Create2401(SPI spi_, Pin ce, Pin irq, Pin power, bool powerInvert, IDataPort* led) ITransport* AP0104::Create2401()//(SPI spi_, Pin ce, Pin irq, Pin power, bool powerInvert, IDataPort* led)
{ {
debug_printf("\r\n Create2401 \r\n"); debug_printf("\r\n Create2401 \r\n");
static Spi spi(spi_, 10000000, true); static Spi spi(Spi2, 10000000, true);
static NRF24L01 nrf; static NRF24L01 nrf;
nrf.Init(&spi, ce, irq, power); nrf.Init(&spi, PD9, PD8, PE4);
auto tc = TinyConfig::Create(); auto tc = TinyConfig::Create();
if(tc->Channel == 0) if(tc->Channel == 0)
@ -274,12 +276,12 @@ ITransport* AP0104::Create2401(SPI spi_, Pin ce, Pin irq, Pin power, bool powerI
nrf.FixData = Fix2401; nrf.FixData = Fix2401;
if(WirelessLed) net->Led = CreateFlushPort(WirelessLed); if(WirelessLed) nrf.Led = CreateFlushPort(WirelessLed);
nrf.Master = true; nrf.Master = true;
return &nrf; return &nrf;
}*/ }
/* /*
NRF24L01+ (SPI2) | W5500 (SPI1) | NRF24L01+ (SPI2) | W5500 (SPI1) |

View File

@ -31,6 +31,9 @@ public:
void InitDHCP(Action onNetReady = nullptr); void InitDHCP(Action onNetReady = nullptr);
bool QueryDNS(TokenConfig& tk); bool QueryDNS(TokenConfig& tk);
private:
static int Fix2401(const Buffer& bs);
}; };
#endif #endif