直接引用头文件,避免SmartOS上层需要包含太多的头部目录

This commit is contained in:
nnhy 2016-10-29 02:59:28 +00:00
parent 744b9d34bb
commit 7429f4ce2c
32 changed files with 65 additions and 75 deletions

View File

@ -1,7 +1,7 @@
#include "stddef.h"
#include "Config.h"
#include "Flash.h"
#include "Device\Flash.h"
#include "Security\Crc.h"
#define CFG_DEBUG DEBUG

View File

@ -1,7 +1,7 @@
#ifndef __ADC_H__
#define __ADC_H__
#include "Port.h"
#include "Device\Port.h"
/*
Analog-to-digital converter

View File

@ -1,5 +1,4 @@
#include "Type.h"
#include "Platform\Pin.h"
#include "Sys.h"
#include "Can.h"

View File

@ -1,6 +1,8 @@
#ifndef __CAN_H__
#define __CAN_H__
#include "Platform\Pin.h"
// CAN类
class Can
{

View File

@ -1,5 +1,5 @@
#include "Sys.h"
#include "Port.h"
#include "Device\Port.h"
#include "DAC.h"
//#include "Platform\stm32.h"

View File

@ -2,7 +2,7 @@
#define __Flash_H__
#include "Sys.h"
#include "Port.h"
#include "Device\Port.h"
#include "Storage\Storage.h"
// Flash类

View File

@ -2,8 +2,6 @@
#include "I2C.h"
//#include "Platform\Pin.h"
I2C::I2C()
{
Speed = 10000;

View File

@ -1,8 +1,7 @@
#ifndef _I2C_H_
#define _I2C_H_
#include "Buffer.h"
#include "Port.h"
#include "Device\Port.h"
//SCL 开漏复用输出
//SDA 开漏复用输出

View File

@ -1,5 +1,5 @@
#include "Sys.h"
#include "Port.h"
#include "Device\Port.h"
/******************************** Port ********************************/

View File

@ -1,4 +1,4 @@
#include "Power.h"
#include "Device\Power.h"
#include "WatchDog.h"

View File

@ -1,5 +1,5 @@
#include "RTC.h"
#include "TTime.h"
#include "Kernel\TTime.h"
/************************************************ HardRTC ************************************************/

View File

@ -2,7 +2,6 @@
#define __RTC_H__
#include "Sys.h"
#include "Interrupt.h"
// 实时时钟
class HardRTC

View File

@ -1,5 +1,5 @@
#include "Sys.h"
#include "Task.h"
#include "Kernel\Task.h"
#include "SerialPort.h"

View File

@ -1,11 +1,10 @@
#ifndef __SerialPort_H__
#define __SerialPort_H__
#include "Port.h"
#include "Queue.h"
#include "Power.h"
#include "Core\Queue.h"
#include "Device\Port.h"
#include "Device\Power.h"
#include "Net\ITransport.h"
// #include "Proxy.h"
#define SERIAL_BAUDRATE 1024000

View File

@ -1,5 +1,4 @@
#include "Sys.h"
#include "Buffer.h"
#include "Spi.h"

View File

@ -1,7 +1,7 @@
#ifndef __SPI_H__
#define __SPI_H__
#include "Port.h"
#include "Device\Port.h"
// Spi类
class Spi

View File

@ -1,8 +1,8 @@
#ifndef __Timer_H__
#define __Timer_H__
#include "Delegate.h"
#include "Port.h"
#include "Sys.h"
#include "Device\Port.h"
// 定时器
class Timer

View File

@ -1,4 +1,4 @@
#include "Type.h"
#include "Core\Type.h"
#include "Interrupt.h"
#include "Heap.h"

View File

@ -233,7 +233,7 @@ void TSys::Delay(uint us) const
/****************系统跟踪****************/
//#if DEBUG
#include "Port.h"
#include "Device\Port.h"
static OutputPort* _trace = nullptr;
//#endif
void TSys::InitTrace(void* port) const

View File

@ -1,6 +1,4 @@
#include "DateTime.h"
#include "Task.h"
#include "Task.h"
#include "TTime.h"
Task::Task()

View File

@ -1,6 +1,6 @@
#include "TTime.h"
#include "Environment.h"
#include "Core\Environment.h"
#if defined(__CC_ARM)
#include <time.h>

View File

@ -1,7 +1,4 @@
#include "Core\ByteArray.h"
#include "Core\List.h"
#include "Sys.h"
#include "Sys.h"
#include "DataStore.h"

View File

@ -75,7 +75,7 @@ protected:
virtual byte OnRead() { return Size(); };
};
#include "Port.h"
#include "Device\Port.h"
// 数据输出口
class DataOutputPort : public ByteDataPort, public Object

View File

@ -1,10 +1,10 @@
#ifndef __Json_H__
#define __Json_H__
#include "Type.h"
#include "SString.h"
#include "List.h"
#include "Dictionary.h"
#include "Core\Type.h"
#include "Core\SString.h"
#include "Core\List.h"
#include "Core\Dictionary.h"
/*
Json对象内部包含有一个字符串Json对象

View File

@ -5,7 +5,6 @@
#include "Message\Pair.h"
#include "TokenNet\TokenClient.h"
#include "Device\Proxy.h"
#include "Core\Dictionary.h"
class ProxyFactory
{

View File

@ -1,5 +1,8 @@

#include "Blu40.h"
#include "Device\SerialPort.h"
// 思卡乐 CC2540
/*
@ -69,10 +72,10 @@ Blu40::Blu40()
Init();
}
Blu40::Blu40(SerialPort *port,Pin rts ,/*Pin cts,*/ Pin sleep, OutputPort * rst )
Blu40::Blu40(Pin rts ,/*Pin cts,*/ Pin sleep, OutputPort* rst )
{
Init();
Init(port,rts,/*cts,*/sleep,rst);
Init(rts,/*cts,*/sleep,rst);
}
void Blu40::Init()
@ -83,9 +86,8 @@ void Blu40::Init()
_sleep = nullptr;
}
void Blu40::Init(SerialPort *port ,Pin rts,/*Pin cts,*/Pin sleep, OutputPort * rst)
void Blu40::Init(Pin rts,/*Pin cts,*/Pin sleep, OutputPort* rst)
{
if(port) _port = port;
if(rts != P0)_rts = new OutputPort(rts); // 低电平有效
if(sleep!=P0)_sleep = new OutputPort(sleep);
if(_rts==nullptr)debug_printf("关键引脚_rts不可忽略");
@ -100,7 +102,6 @@ void Blu40::Init(SerialPort *port ,Pin rts,/*Pin cts,*/Pin sleep, OutputPort * r
Blu40::~Blu40()
{
if(_port)delete _port;
if(_rts)delete _rts;
//if(_cts)delete _cts;
if(_rst)delete _rst;
@ -132,24 +133,25 @@ bool Blu40::SetBP(int BP)
ByteArray ds;
//byte BPSOK[] = "AT:BPS SET AFTER 2S \r\n\0"; // 坑人的需要ASIIC
byte const BPSOK[] = {0x41,0x54,0x3A,0x42,0x50,0x53,0x20,0x45,0x54,0x20,0x41,0x46,0x54,0x45,0x52,0x20,0x32,0x53,0x0D,0x0A,0x00};
auto sp = dynamic_cast<SerialPort*>(Port);
if(_baudRate != 0)
{
// 设置串口波特率
_port->SetBaudRate(_baudRate);
sp->SetBaudRate(_baudRate);
// 启用新波特率
_port->Close();
_port->Open();
Port->Close();
Port->Open();
*_rts = false;
Sys.Delay(150);
_port->Write(bs);
_port->Write(Buffer(&bpnumIndex, 1)); // 晕死AT指令里面放非字符
//_port->Write("\r\n",sizeof("\r\n")); // 无需回车
Port->Write(bs);
Port->Write(Buffer(&bpnumIndex, 1)); // 晕死AT指令里面放非字符
//Port->Write("\r\n",sizeof("\r\n")); // 无需回车
*_rts = true;
Sys.Delay(500);
_port->Read(ds);
Port->Read(ds);
for(int j=0;j<sizeof(BPSOK);j++)
{
@ -170,20 +172,20 @@ bool Blu40::SetBP(int BP)
for(int i = 0;i<8;i++)
{
// 设置串口波特率
_port->SetBaudRate( portBaudRateTemp);
sp->SetBaudRate(portBaudRateTemp);
// 启用新波特率
_port->Close();
_port->Open();
Port->Close();
Port->Open();
*_rts = false;
Sys.Delay(170);
_port->Write(bs);
_port->Write(Buffer(&bpnumIndex, 1));
//_port->Write("\r\n",sizeof("\r\n")); // 无需回车
Port->Write(bs);
Port->Write(Buffer(&bpnumIndex, 1));
//Port->Write("\r\n",sizeof("\r\n")); // 无需回车
*_rts = true;
Sys.Delay(500);
_port->Read(ds);
Port->Read(ds);
//"AT:BPS SET AFTER 2S \r\n\0"
//"AT:ERR\r\n\0"
for(int j=0;j<sizeof(BPSOK);j++)
@ -212,7 +214,7 @@ bool Blu40::CheckSet()
{
//byte buf[40];
ByteArray bs;
_port->Read(bs);
Port->Read(bs);
for(int i=0;i<sizeof(ATOK);i++)
{
if(bs[i] != ATOK[i])
@ -229,8 +231,8 @@ bool Blu40::SetName(cstring name)
{
*_rts = false;
Sys.Delay(170);
_port->Write(Buffer((void*)AT_REN, sizeof(AT_REN)));
_port->Write(String(name));
Port->Write(Buffer((void*)AT_REN, sizeof(AT_REN)));
Port->Write(String(name));
bool ret = CheckSet();
*_rts = true;
return ret;
@ -240,8 +242,8 @@ bool Blu40::SetPID(ushort pid)
{
*_rts = false;
Sys.Delay(170);
_port->Write(Buffer((void*)AT_PID, sizeof(AT_PID)));
_port->Write(Buffer(&pid, 2));
Port->Write(Buffer((void*)AT_PID, sizeof(AT_PID)));
Port->Write(Buffer(&pid, 2));
bool ret = CheckSet();
*_rts = true;
return ret;
@ -257,9 +259,9 @@ bool Blu40::SetTPL(int TPLDB)
}
*_rts = false;
Sys.Delay(170);
_port->Write(Buffer((void*)AT_TPL, sizeof(AT_TPL)));
Port->Write(Buffer((void*)AT_TPL, sizeof(AT_TPL)));
//byte temp = TPLNumIndex+'0';// 又是坑人的 非字符
_port->Write(Buffer(&TPLNumIndex, 1));
Port->Write(Buffer(&TPLNumIndex, 1));
bool ret = CheckSet();
*_rts = true;
return ret;

View File

@ -2,15 +2,13 @@
#define __BLU40_H__
#include "Sys.h"
#include "Port.h"
#include "Device\Port.h"
#include "Net\ITransport.h"
#include "SerialPort.h"
// 思卡乐 CC2540
class Blu40 : public PackPort
{
private:
SerialPort *_port;
OutputPort *_rts;
// InputPort *_cts;
OutputPort *_rst;
@ -19,10 +17,10 @@ private:
public:
Blu40();
Blu40(SerialPort *port,Pin rts = P0 ,/*Pin cts = P0,*/Pin sleep=P0, OutputPort * rst = nullptr);
Blu40(Pin rts,/*Pin cts = P0,*/Pin sleep=P0, OutputPort* rst = nullptr);
virtual ~Blu40();
void Init();
void Init(SerialPort *port ,Pin rts = P0,/*Pin cts = P0,*/Pin sleep=P0, OutputPort * rst = nullptr);
void Init(Pin rts,/*Pin cts = P0,*/Pin sleep=P0, OutputPort* rst = nullptr);
virtual void Register(TransportHandler handler, void* param = nullptr);
virtual void Reset(void);

View File

@ -1,5 +1,5 @@
#include "Sys.h"
#include "TTime.h"
#include "Kernel\TTime.h"
#include "ITransport.h"
#include "Socket.h"

View File

@ -1,4 +1,4 @@
#include "Core\_Core.h"
#include "Sys.h"
#include "IPAddress.h"

View File

@ -1,7 +1,7 @@
#ifndef _MacAddress_H_
#define _MacAddress_H_
#include "Core\Buffer.h"
class Buffer;
// Mac地址
class MacAddress : public Object

View File

@ -5,7 +5,8 @@
#include "IPEndPoint.h"
#include "MacAddress.h"
#include "NetUri.h"
#include "Delegate.h"
#include "Core\Delegate.h"
class ISocket;

View File

@ -2,7 +2,7 @@
#define __Zigbee_H__
#include "Sys.h"
#include "Port.h"
#include "Device\Port.h"
#include "Net\ITransport.h"
// Zigbee协议