F1全部编译通过,未测试是否可用
This commit is contained in:
parent
d1a0606879
commit
483dfe82f0
6
ADC.cpp
6
ADC.cpp
|
@ -6,13 +6,13 @@ Pin ADC_Pins[] = ADC1_PINS;
|
|||
|
||||
ADConverter::ADConverter(byte line, uint channel)
|
||||
{
|
||||
assert_param(line >= 1 && line <= 3);
|
||||
assert_param2(line >= 1 && line <= 3, "ADC Line");
|
||||
|
||||
Line = line;
|
||||
Channel = channel;
|
||||
|
||||
uint dat = 1;
|
||||
Count = 0;
|
||||
uint dat = 1;
|
||||
Count = 0;
|
||||
for(int i=0; i<ArrayLength(Data); i++, dat <<= 1)
|
||||
{
|
||||
if(Channel & dat) Count++;
|
||||
|
|
|
@ -25,9 +25,6 @@ void Button::Set(Pin key, Pin led, Pin relay)
|
|||
|
||||
void Button::Set(Pin key, Pin led, bool ledInvert, Pin relay, bool relayInvert)
|
||||
{
|
||||
assert_param(key != P0);
|
||||
|
||||
//Key.HardEvent = true;
|
||||
Key.Set(key);
|
||||
Key.Register(OnPress, this);
|
||||
Key.Open();
|
||||
|
@ -131,10 +128,7 @@ void Button::SetValue(bool value)
|
|||
|
||||
bool Button::SetACZeroPin(Pin aczero)
|
||||
{
|
||||
// 检查参数
|
||||
assert_param(aczero != P0);
|
||||
|
||||
InputPort& port = ACZero;
|
||||
auto& port = ACZero;
|
||||
|
||||
// 该方法可能被初级工程师多次调用,需要检查并释放旧的,避免内存泄漏
|
||||
if(!port.Empty()) port.Close();
|
||||
|
|
|
@ -36,8 +36,6 @@ Button_GrayLevel::Button_GrayLevel() : ByteDataPort()
|
|||
|
||||
void Button_GrayLevel::Set(Pin key, Pin relay, bool relayInvert)
|
||||
{
|
||||
assert_param(key != P0);
|
||||
|
||||
Key.Set(key);
|
||||
|
||||
// 中断过滤模式
|
||||
|
@ -152,9 +150,6 @@ void Button_GrayLevel::SetValue(bool value)
|
|||
|
||||
bool Button_GrayLevel::SetACZeroPin(Pin aczero)
|
||||
{
|
||||
// 检查参数
|
||||
assert_param(aczero != P0);
|
||||
|
||||
// 该方法需要检查并释放旧的,避免内存泄漏
|
||||
if(!ACZero) ACZero = new InputPort(aczero);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ Button_magnetic::Button_magnetic(Pin key, Pin led, Pin relay_pin1, Pin relay_pin
|
|||
{
|
||||
Init();
|
||||
|
||||
assert_param(key != P0);
|
||||
Key = new InputPort(key);
|
||||
Key->Register(OnPress, this);
|
||||
|
||||
|
@ -31,7 +30,6 @@ Button_magnetic::Button_magnetic(Pin key, Pin led, bool ledInvert, Pin relay_pin
|
|||
{
|
||||
Init();
|
||||
|
||||
assert_param(key != P0);
|
||||
Key = new InputPort(key);
|
||||
Key->Register(OnPress, this);
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ Sensor::Sensor(Pin key, Pin led, Pin buzzer)
|
|||
{
|
||||
Init();
|
||||
|
||||
assert_param(key != P0);
|
||||
Key = new InputPort(key);
|
||||
Key->Register(OnPress, this);
|
||||
|
||||
|
@ -31,7 +30,6 @@ Sensor::Sensor(Pin key, Pin led, bool ledInvert, Pin buzzer, bool buzzerInvert)
|
|||
{
|
||||
Init();
|
||||
|
||||
assert_param(key != P0);
|
||||
Key = new InputPort(key);
|
||||
Key->Register(OnPress, this);
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ void* operator new(uint size)
|
|||
if((uint)p + size + 0x40 >= end)
|
||||
mem_printf(" + %d near HeapEnd=0x%08x", size, end);
|
||||
}
|
||||
assert_param(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -81,7 +80,6 @@ void* operator new[](uint size)
|
|||
uint end = __get_MSP();
|
||||
if((uint)p + size + 0x40 >= end) mem_printf(" + %d near HeapEnd=0x%08x", size, end);
|
||||
}
|
||||
assert_param(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ bool AT45DB::WaitForEnd()
|
|||
and put the value of the status register in FLASH_Status variable */
|
||||
status = _spi->Write(Dummy_Byte);
|
||||
}
|
||||
while ((status & 0x80) == RESET && --retry); /* Busy in progress */
|
||||
while ((status & 0x80) == 0 && --retry); /* Busy in progress */
|
||||
|
||||
// 重试次数没有用完,才返回成功
|
||||
return retry > 0;
|
||||
|
|
|
@ -840,8 +840,6 @@ bool NRF24L01::SendTo(const Array& bs, const Array& addr)
|
|||
// 检查要发送数据的长度
|
||||
uint len = bs.Length();
|
||||
byte pw = 32;
|
||||
if(pw && len > pw) debug_printf("%d > %d \r\n", len, pw);
|
||||
assert_param(pw == 0 || len <= pw);
|
||||
if(pw > 0) len = pw;
|
||||
Array bs2(bs.GetBuffer(), len);
|
||||
WriteBuf(cmd, bs2);
|
||||
|
|
2
I2C.cpp
2
I2C.cpp
|
@ -208,7 +208,7 @@ void HardI2C::Init(byte index, uint speedHz)
|
|||
_index = index;
|
||||
|
||||
I2C_TypeDef* g_I2Cs[] = I2CS;
|
||||
assert_param(_index < ArrayLength(g_I2Cs));
|
||||
assert_param2(_index < ArrayLength(g_I2Cs), "I2C::Init");
|
||||
_IIC = g_I2Cs[_index];
|
||||
|
||||
SCL.OpenDrain = true;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
ESP8266::ESP8266(ITransport* port, Pin rst)
|
||||
{
|
||||
assert_param(port);
|
||||
|
||||
Set(port);
|
||||
|
||||
if(rst != P0) _rst.Set(rst);
|
||||
|
|
|
@ -60,8 +60,6 @@ IPAddress& IPAddress::operator=(const Array& arr)
|
|||
// 重载索引运算符[],让它可以像数组一样使用下标索引。
|
||||
byte& IPAddress::operator[](int i)
|
||||
{
|
||||
assert_param(i >= 0 && i < 4);
|
||||
|
||||
return ((byte*)&Value)[i];
|
||||
}
|
||||
|
||||
|
@ -234,8 +232,6 @@ MacAddress& MacAddress::operator=(const Array& arr)
|
|||
// 重载索引运算符[],让它可以像数组一样使用下标索引。
|
||||
byte& MacAddress::operator[](int i)
|
||||
{
|
||||
assert_param(i >= 0 && i < 6);
|
||||
|
||||
return ((byte*)&Value)[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void Fix2401(void* param)
|
|||
}
|
||||
}
|
||||
|
||||
ITransport* Create2401(SPI_TypeDef* spi_, Pin ce, Pin irq, Pin power, bool powerInvert, IDataPort* led)
|
||||
ITransport* Create2401(byte spi_, Pin ce, Pin irq, Pin power, bool powerInvert, IDataPort* led)
|
||||
{
|
||||
auto spi = new Spi(spi_, 10000000, true);
|
||||
auto nrf = new NRF24L01();
|
||||
|
|
|
@ -14,7 +14,7 @@ void Setup(ushort code, const char* name, COM_Def message = COM1, int baudRate =
|
|||
void* InitConfig(void* data, uint size);
|
||||
void ClearConfig();
|
||||
|
||||
ITransport* Create2401(SPI_TypeDef* spi_, Pin ce, Pin irq, Pin power = P0, bool powerInvert = false, IDataPort* led = NULL);
|
||||
ITransport* Create2401(byte spi, Pin ce, Pin irq, Pin power = P0, bool powerInvert = false, IDataPort* led = NULL);
|
||||
ITransport* CreateShunCom(COM_Def index, int baudRate, Pin rst, Pin power, Pin slp, Pin cfg, IDataPort* led = NULL);
|
||||
|
||||
TinyClient* CreateTinyClient(ITransport* port);
|
||||
|
|
|
@ -42,7 +42,7 @@ static void OnDhcpStop5500(void* sender, void* param)
|
|||
if(dhcp->Times <= 1) Sys.AddTask(StartGateway, net, 0, -1, "启动网关");
|
||||
}
|
||||
|
||||
ISocketHost* Token::CreateW5500(SPI_TypeDef* spi_, Pin irq, Pin rst, Pin power, IDataPort* led)
|
||||
ISocketHost* Token::CreateW5500(byte spi_, Pin irq, Pin rst, Pin power, IDataPort* led)
|
||||
{
|
||||
debug_printf("\r\nW5500::Create \r\n");
|
||||
|
||||
|
@ -205,7 +205,7 @@ void Fix2401(void* param)
|
|||
}
|
||||
}
|
||||
|
||||
ITransport* Token::Create2401(SPI_TypeDef* spi_, Pin ce, Pin irq, Pin power, bool powerInvert, IDataPort* led)
|
||||
ITransport* Token::Create2401(byte spi_, Pin ce, Pin irq, Pin power, bool powerInvert, IDataPort* led)
|
||||
{
|
||||
static Spi spi(spi_, 10000000, true);
|
||||
static NRF24L01 nrf;
|
||||
|
|
|
@ -18,10 +18,10 @@ class Token
|
|||
public:
|
||||
static void Setup(ushort code, const char* name, COM_Def message = COM1, int baudRate = 0);
|
||||
|
||||
static ISocketHost* CreateW5500(SPI_TypeDef* spi, Pin irq, Pin rst = P0, Pin power = P0, IDataPort* led = NULL);
|
||||
static ISocketHost* Create2860(SPI_TypeDef* spi_, Pin irq, Pin rst);
|
||||
static ISocketHost* CreateW5500(byte spi, Pin irq, Pin rst = P0, Pin power = P0, IDataPort* led = NULL);
|
||||
static ISocketHost* Create2860(byte spi, Pin irq, Pin rst);
|
||||
|
||||
static ITransport* Create2401(SPI_TypeDef* spi_, Pin ce, Pin irq, Pin power = P0, bool powerInvert = false, IDataPort* led = NULL);
|
||||
static ITransport* Create2401(byte spi, Pin ce, Pin irq, Pin power = P0, bool powerInvert = false, IDataPort* led = NULL);
|
||||
static ITransport* CreateShunCom(COM_Def index, int baudRate, Pin rst, Pin power, Pin slp, Pin cfg, IDataPort* led = NULL);
|
||||
|
||||
static TokenClient* CreateClient(ISocketHost* host);
|
||||
|
|
|
@ -44,7 +44,7 @@ static void OnDhcpStop(void* sender, void* param)
|
|||
if(dhcp->Times <= 1) Sys.AddTask(StartGateway, tip, 0, -1, "启动网关");
|
||||
}
|
||||
|
||||
ISocketHost* Token::Create2860(SPI_TypeDef* spi_, Pin irq, Pin rst)
|
||||
ISocketHost* Token::Create2860(byte spi_, Pin irq, Pin rst)
|
||||
{
|
||||
debug_printf("\r\nENC2860::Create \r\n");
|
||||
|
||||
|
|
Loading…
Reference in New Issue