You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.4 KiB
C++

//
// ±êÖ¾ÎïͨÐÅ - LEDÏÔʾÆ÷ - ZigBee
//
#include "LEDDisplayCommand.h"
LEDDisplayCommand::LEDDisplayCommand()
{
SetDevice(CommandData::Devices::LED_Display);
}
byte* LEDDisplayCommand::CMD_StartTimer()
{
SetCommand(0x03, 0x01);
return GetCommandArray();
}
byte* LEDDisplayCommand::CMD_StopTimer()
{
SetCommand(0x03, 0x00);
return GetCommandArray();
}
byte* LEDDisplayCommand::CMD_ClearTimer()
{
SetCommand(0x03, 0x02);
return GetCommandArray();
}
byte* LEDDisplayCommand::CMD_FirstLineDisplay(uint32_t num)
{
if (num >= 0xFFFFFF)
SetCommand(0x01, 0xFF, 0xFF, 0xFF);
else
{
byte d1 = ((num > 0xFFFF) ? (num / 0x10000) : 0x00);
num -= (d1 * 0x10000);
byte d2 = ((num > 0xFF) ? (num / 0x100) : 0x00);
byte d3 = num % 0x100;
SetCommand(0x01, d1, d2, d3);
}
return GetCommandArray();
}
byte* LEDDisplayCommand::CMD_SecondLineDisplay(uint32_t num)
{
if (num >= 0xFFFFFF)
SetCommand(0x02, 0xFF, 0xFF, 0xFF);
else
{
byte d1 = ((num > 0xFFFF) ? (num / 0x10000) : 0x00);
num -= (d1 * 0x10000);
byte d2 = ((num > 0xFF) ? (num / 0x100) : 0x00);
byte d3 = num % 0x100;
SetCommand(0x02, d1, d2, d3);
}
return GetCommandArray();
}
byte* LEDDisplayCommand::CMD_DisplayDistence(uint16_t dis)
{
if (dis >= 0xFFF)
SetCommand(0x04, 0x00, 0x0F, 0xFF);
else
{
byte d1 = ((dis > 0xFF) ? (dis / 0x100) : 0x00);
dis -= (d1 * 0x100);
byte d2 = dis % 0x100;
SetCommand(0x04, 0x00, d1, d2);
}
return GetCommandArray();
}