all item finished
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
#include "AlarmTowerCommand.h"
|
||||
#include "VoiceRepotCommand.h"
|
||||
#include "GarageCommand.h"
|
||||
#include "LEDDisplayCommand.h"
|
||||
#include "CommandDecoder.h"
|
||||
#include "ZigBeeOperator.h"
|
||||
#include "BarrierCommand.h"
|
||||
#include "CommandEncoder.h"
|
||||
#include "ZigBeeOperator.h"
|
||||
#include "AccurateMotor.h"
|
||||
#include "CommandDecoder.h"
|
||||
#include "AccurateMotor.h"
|
||||
#include <Ultrasonic.h>
|
||||
#include <BKRC_Voice.h>
|
||||
#include "GlobalDatas.h"
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<PreprocessorDefinitions>__AVR_atmega2560__;__AVR_ATmega2560__;F_CPU=16000000L;ARDUINO=108010;ARDUINO_AVR_MEGA2560;ARDUINO_ARCH_AVR;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Arduino;G:\Users\15819\Documents\Arduino\libraries\ExtSRAMInterface;G:\Users\15819\Documents\Arduino\libraries\DCMotor;G:\Users\15819\Documents\Arduino\libraries\MsTimer2;G:\Users\15819\Documents\Arduino\libraries\Ultrasonic;G:\Users\15819\Documents\Arduino\libraries\BKRC_Voice;G:\Users\15819\Documents\Arduino\libraries\CoreBeep;G:\Users\15819\Documents\Arduino\libraries\CoreKEY;G:\Users\15819\Documents\Arduino\libraries\CoreLED;G:\Users\15819\Documents\Arduino\libraries\Command;G:\Users\15819\Documents\Arduino\libraries\Infrares;G:\Users\15819\Documents\Arduino\libraries\BEEP;G:\Users\15819\Documents\Arduino\libraries\LED;G:\Users\15819\Documents\Arduino\libraries\BH1750;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src;G:\Users\15819\Documents\Arduino\libraries\Metro;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\\lib\gcc\avr\7.3.0\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\\lib\gcc\avr\7.3.0\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include-fixed;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.2\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.2\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Arduino;G:\Users\15819\Documents\Arduino\libraries\ExtSRAMInterface;G:\Users\15819\Documents\Arduino\libraries\DCMotor;G:\Users\15819\Documents\Arduino\libraries\MsTimer2;G:\Users\15819\Documents\Arduino\libraries\Ultrasonic;G:\Users\15819\Documents\Arduino\libraries\BKRC_Voice;G:\Users\15819\Documents\Arduino\libraries\CoreBeep;G:\Users\15819\Documents\Arduino\libraries\CoreKEY;G:\Users\15819\Documents\Arduino\libraries\CoreLED;G:\Users\15819\Documents\Arduino\libraries\BH1750;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src;G:\Users\15819\Documents\Arduino\libraries\Infrares;G:\Users\15819\Documents\Arduino\libraries\Command;G:\Users\15819\Documents\Arduino\libraries\BEEP;G:\Users\15819\Documents\Arduino\libraries\LED;G:\Users\15819\Documents\Arduino\libraries\Metro;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega;C:\Users\15819\AppData\Local\arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino;$(ProjectDir)..\..\..\RACECA~1\SUBCAR~1\Arduino;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\\lib\gcc\avr\7.3.0\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\\lib\gcc\avr\7.3.0\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include-fixed;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\avr\include\avr;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.2\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.2\include;C:\Users\15819\AppData\Local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -106,33 +106,51 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="AccurateMotor.h" />
|
||||
<ClInclude Include="AlarmTowerCommand.h" />
|
||||
<ClInclude Include="BarrierCommand.h" />
|
||||
<ClInclude Include="CommandDecoder.h" />
|
||||
<ClInclude Include="CommandEncoder.h" />
|
||||
<ClInclude Include="DebugOpt.h" />
|
||||
<ClInclude Include="ETCCommand.h" />
|
||||
<ClInclude Include="GarageCommand.h" />
|
||||
<ClInclude Include="GlobalDatas.h" />
|
||||
<ClInclude Include="Handler.h" />
|
||||
<ClInclude Include="LEDDisplayCommand.h" />
|
||||
<ClInclude Include="OpenMVOpt.h" />
|
||||
<ClInclude Include="RodeLightCommand.h" />
|
||||
<ClInclude Include="SpecTerrainCommand.h" />
|
||||
<ClInclude Include="TextEncoder.h" />
|
||||
<ClInclude Include="TFTCommand.h" />
|
||||
<ClInclude Include="TrafficLightCommand.h" />
|
||||
<ClInclude Include="VoiceRepotCommand.h" />
|
||||
<ClInclude Include="WirelessChargerCommand.h" />
|
||||
<ClInclude Include="ZigBeeOperator.h" />
|
||||
<ClInclude Include="3DDisplayCommand.h" />
|
||||
<ClInclude Include="__vm\.2021_Arduino_Demo.vsarduino.h" />
|
||||
<ClInclude Include="__vm\.Arduino.vsarduino.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AccurateMotor.cpp" />
|
||||
<ClCompile Include="AlarmTowerCommand.cpp" />
|
||||
<ClCompile Include="BarrierCommand.cpp" />
|
||||
<ClCompile Include="CommandDecoder.cpp" />
|
||||
<ClCompile Include="CommandEncoder.cpp" />
|
||||
<ClCompile Include="DebugOpt.cpp" />
|
||||
<ClCompile Include="ETCCommand.cpp" />
|
||||
<ClCompile Include="GarageCommand.cpp" />
|
||||
<ClCompile Include="GlobalDatas.cpp" />
|
||||
<ClCompile Include="Handler.cpp" />
|
||||
<ClCompile Include="LEDDisplayCommand.cpp" />
|
||||
<ClCompile Include="OpenMVOpt.cpp" />
|
||||
<ClCompile Include="RodeLightCommand.cpp" />
|
||||
<ClCompile Include="SpecTerrainCommand.cpp" />
|
||||
<ClCompile Include="TextEncoder.cpp" />
|
||||
<ClCompile Include="TFTCommand.cpp" />
|
||||
<ClCompile Include="TrafficLightCommand.cpp" />
|
||||
<ClCompile Include="VoiceRepotCommand.cpp" />
|
||||
<ClCompile Include="WirelessChargerCommand.cpp" />
|
||||
<ClCompile Include="ZigBeeOperator.cpp" />
|
||||
<ClCompile Include="3DDisplayCommand.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<DebuggerFlavor>VisualMicroDebugger</DebuggerFlavor>
|
||||
|
||||
@@ -60,6 +60,33 @@
|
||||
<ClInclude Include="VoiceRepotCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AlarmTowerCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TFTCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RodeLightCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WirelessChargerCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ETCCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TrafficLightCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SpecTerrainCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="3DDisplayCommand.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TextEncoder.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="OpenMVOpt.cpp">
|
||||
@@ -98,5 +125,32 @@
|
||||
<ClCompile Include="VoiceRepotCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AlarmTowerCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TFTCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RodeLightCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WirelessChargerCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ETCCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TrafficLightCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SpecTerrainCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="3DDisplayCommand.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TextEncoder.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// ±êÖ¾ÎïͨÐÅ - Á¢ÌåÏÔʾ - ZigBee/IR
|
||||
//
|
||||
|
||||
#include "3DDisplayCommand.h"
|
||||
|
||||
_3DDisplayCommand::_3DDisplayCommand()
|
||||
{
|
||||
SetDevice(CommandData::Devices::_3D_Display);
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_CarLicenseMode_1to4(byte d1, byte d2, byte d3, byte d4)
|
||||
{
|
||||
SetCommand(0xFF, 0x20, d1, d2, d3, d4);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_CarLicenseMode_5to6_XY(byte d5, byte d6, byte x, byte y)
|
||||
{
|
||||
SetCommand(0xFF, 0x10, d5, d6, x, y);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_DisplayDestence(byte dis)
|
||||
{
|
||||
if (dis >= 99)
|
||||
SetCommand(0xFF, 0x11, 0x09, 0x09, 0x00, 0x00);
|
||||
else
|
||||
SetCommand(0xFF, 0x11, (dis / 10), (dis % 10), 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_DisplayShape(Shape shape)
|
||||
{
|
||||
SetCommand(0xFF, 0x12, (byte)shape, 0x00, 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_DisplayColor(Color color)
|
||||
{
|
||||
SetCommand(0xFF, 0x13, (byte)color, 0x00, 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_DisplayAlarmSign(AlarmSign sign)
|
||||
{
|
||||
SetCommand(0xFF, 0x14, (byte)sign, 0x00, 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_DisplayTrafficSign(TrafficSign sign)
|
||||
{
|
||||
SetCommand(0xFF, 0x15, (byte)sign, 0x00, 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_DisplayDefaultInfo()
|
||||
{
|
||||
SetCommand(0xFF, 0x16, 0x01, 0x00, 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_SetTextColor(byte r, byte g, byte b)
|
||||
{
|
||||
SetCommand(0xFF, 0x17, 0x01, r, g, b);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_CustomTextAdd(byte text1, byte text2, bool last_char)
|
||||
{
|
||||
SetCommand(0xFF, 0x31, text1, text2, (last_char ? 0x55 : 0x00), 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_IR_CustomTextStop(bool clear_display)
|
||||
{
|
||||
SetCommand(0xFF, 0x32, (clear_display ? 0x02 : 0x01), 0x00, 0x00, 0x00);
|
||||
return GetIRCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_ZIGBEE_CustomTextAdd(byte text1, byte text2, bool last_char)
|
||||
{
|
||||
SetCommand(0x31, text1, text2, (last_char ? 0x55 : 0x00));
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* _3DDisplayCommand::CMD_ZIGBEE_CustomTextStop(bool clear_display)
|
||||
{
|
||||
SetCommand(0x32, (clear_display ? 0x02 : 0x01));
|
||||
return GetCommandArray();
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// 3DDisplayCommand.h
|
||||
|
||||
#ifndef _3DDISPLAYCOMMAND_h
|
||||
#define _3DDISPLAYCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include "CommandEncoder.h"
|
||||
|
||||
class _3DDisplayCommand : private CommandEncoder
|
||||
{
|
||||
public:
|
||||
enum class Shape
|
||||
{
|
||||
Rectangle = 0x01,
|
||||
Round = 0x02,
|
||||
Triangle = 0x03,
|
||||
Rhombus = 0x04,
|
||||
Star = 0x05
|
||||
};
|
||||
enum class Color
|
||||
{
|
||||
Red = 0x01,
|
||||
Green = 0x02,
|
||||
Blue = 0x03,
|
||||
Yellow = 0x04,
|
||||
Pink = 0x05,
|
||||
Cyan = 0x06,
|
||||
Black = 0x07,
|
||||
White = 0x08
|
||||
};
|
||||
enum class AlarmSign
|
||||
{
|
||||
School = 0x01,
|
||||
UnderConstruction = 0x02,
|
||||
RodeFallsDown = 0x03,
|
||||
KeepDistence = 0x04,
|
||||
NoDrinkDrive = 0x05,
|
||||
NoThrowRubbish = 0x06
|
||||
};
|
||||
enum class TrafficSign
|
||||
{
|
||||
GoStraight = 0x01,
|
||||
TurnLeft = 0x02,
|
||||
TurnRight = 0x03,
|
||||
TurnAround = 0x04,
|
||||
NoStraight = 0x05,
|
||||
DoNotEnter = 0x06
|
||||
};
|
||||
public:
|
||||
_3DDisplayCommand();
|
||||
public:
|
||||
byte* CMD_IR_CarLicenseMode_1to4(byte d1, byte d2, byte d3, byte d4);
|
||||
byte* CMD_IR_CarLicenseMode_5to6_XY(byte d5, byte d6, byte x, byte y);
|
||||
byte* CMD_IR_DisplayDestence(byte dis);
|
||||
byte* CMD_IR_DisplayShape(Shape shape);
|
||||
byte* CMD_IR_DisplayColor(Color color);
|
||||
byte* CMD_IR_DisplayAlarmSign(AlarmSign sign);
|
||||
byte* CMD_IR_DisplayTrafficSign(TrafficSign sign);
|
||||
byte* CMD_IR_DisplayDefaultInfo();
|
||||
byte* CMD_IR_SetTextColor(byte r, byte g, byte b);
|
||||
byte* CMD_IR_CustomTextAdd(byte text1, byte text2, bool last_char = false);
|
||||
byte* CMD_IR_CustomTextStop(bool clear_display);
|
||||
byte* CMD_ZIGBEE_CustomTextAdd(byte text1, byte text2, bool last_char = false);
|
||||
byte* CMD_ZIGBEE_CustomTextStop(bool clear_display);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
#ifndef __DEBUG_OPT__
|
||||
#define __DEBUG_OPT_
|
||||
|
||||
#include "WirelessChargerCommand.h"
|
||||
#include "TrafficLightCommand.h"
|
||||
#include "SpecTerrainCommand.h"
|
||||
#include "VoiceRepotCommand.h"
|
||||
#include "LEDDisplayCommand.h"
|
||||
#include "AlarmTowerCommand.h"
|
||||
#include "3DDisplayCommand.h"
|
||||
#include "RodeLightCommand.h"
|
||||
#include "BarrierCommand.h"
|
||||
#include "ZigBeeOperator.h"
|
||||
#include "GarageCommand.h"
|
||||
#include "AccurateMotor.h"
|
||||
#include "TextEncoder.h"
|
||||
#include "GlobalDatas.h"
|
||||
#include "ETCCommand.h"
|
||||
#include "TFTCommand.h"
|
||||
#include <BKRC_Voice.h>
|
||||
#include "OpenMVOpt.h"
|
||||
#include <Infrare.h>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// ±êÖ¾ÎïͨÐÅ - ETC - ZigBee
|
||||
//
|
||||
|
||||
#include "ETCCommand.h"
|
||||
|
||||
ETCCommand::ETCCommand()
|
||||
{
|
||||
SetDevice(CommandData::Devices::ETC);
|
||||
}
|
||||
|
||||
byte* ETCCommand::CMD_GateUp()
|
||||
{
|
||||
SetCommand(0x08, 0x01, 0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* ETCCommand::CMD_GateDown()
|
||||
{
|
||||
SetCommand(0x08, 0x02, 0x02);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* ETCCommand::CMD_LeftUpRightDown()
|
||||
{
|
||||
SetCommand(0x08, 0x01, 0x02);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* ETCCommand::CMD_LeftDownRightUp()
|
||||
{
|
||||
SetCommand(0x08, 0x02, 0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// ETCCommand.h
|
||||
|
||||
#ifndef _ETCCOMMAND_h
|
||||
#define _ETCCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include "CommandEncoder.h"
|
||||
|
||||
class ETCCommand : private CommandEncoder
|
||||
{
|
||||
public:
|
||||
ETCCommand();
|
||||
public:
|
||||
byte* CMD_GateUp();
|
||||
byte* CMD_GateDown();
|
||||
byte* CMD_LeftUpRightDown();
|
||||
byte* CMD_LeftDownRightUp();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+1
-14
@@ -19,17 +19,4 @@ unsigned long Tcount;
|
||||
uint8_t Data_Type;
|
||||
uint8_t Data_Flag;
|
||||
uint8_t Data_Length;
|
||||
uint8_t Data_OTABuf[40];
|
||||
|
||||
void DataTool::PrintDataArray(uint8_t* arr, uint8_t len)
|
||||
{
|
||||
Serial.println("------Data Array------");
|
||||
for (uint8_t i = 0; i < len; i++)
|
||||
{
|
||||
Serial.print("arr[");
|
||||
Serial.print(i);
|
||||
Serial.print("] = 0x");
|
||||
Serial.println(arr[i], HEX);
|
||||
}
|
||||
Serial.println("------Array End------");
|
||||
}
|
||||
uint8_t Data_OTABuf[40];
|
||||
+12
-1
@@ -40,7 +40,18 @@ namespace CommandData
|
||||
|
||||
namespace DataTool
|
||||
{
|
||||
void PrintDataArray(uint8_t* arr, uint8_t len);
|
||||
template<typename T = uint8_t> void PrintDataArray(T* arr, uint8_t len)
|
||||
{
|
||||
Serial.println("------Data Array------");
|
||||
for (uint8_t i = 0; i < len; i++)
|
||||
{
|
||||
Serial.print("arr[");
|
||||
Serial.print(i);
|
||||
Serial.print("] = 0x");
|
||||
Serial.println(arr[i], HEX);
|
||||
}
|
||||
Serial.println("------Array End------");
|
||||
}
|
||||
};
|
||||
|
||||
extern uint8_t ZigBee_back[16];
|
||||
|
||||
+45
-9
@@ -78,9 +78,38 @@ void Handler::ZigBeeRx_Handler(uint8_t* mar)
|
||||
case CommandData::Devices::Garage_A: //立体车库标志物A
|
||||
break;
|
||||
case CommandData::Devices::TrafficLight_A: //交通灯标注物A
|
||||
{
|
||||
TrafficLightCommand cmd;
|
||||
if (cmd.ModeChangeSuccess(mar))
|
||||
Serial.println("Enter Identify Mode");
|
||||
else
|
||||
Serial.println("Mode Change Failure");
|
||||
break;
|
||||
}
|
||||
case CommandData::Devices::TrafficLight_B: //交通灯标志物B
|
||||
break;
|
||||
case CommandData::Devices::SpecTerrain:
|
||||
{
|
||||
SpecTerrainCommand cmd;
|
||||
if(cmd.IsSpecTerrainCommand(mar))
|
||||
{
|
||||
switch (cmd.ReadStatus(mar))
|
||||
{
|
||||
case SpecTerrainCommand::Status::Passed_AtoB:
|
||||
case SpecTerrainCommand::Status::Passed_BtoA:
|
||||
Serial.println("Passed");
|
||||
break;
|
||||
case SpecTerrainCommand::Status::NotPass:
|
||||
Serial.println("Not Pass");
|
||||
break;
|
||||
default:
|
||||
Serial.println("Data Invalidate");
|
||||
}
|
||||
}
|
||||
else
|
||||
Serial.println("Command Invalidate");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -207,28 +236,35 @@ void Handler::MainCarRx_Handler(uint8_t* com)
|
||||
|
||||
void Handler::Key_0()
|
||||
{
|
||||
AlarmTowerCommand cmd;
|
||||
ZigBeeOperator.SendCommand(cmd.CMD_QueryRescuePosition());
|
||||
OpenMVOpt::Servo_Control(-60);
|
||||
OpenMVOpt::OpenMV_Track(1);
|
||||
}
|
||||
|
||||
void Handler::Key_1()
|
||||
{
|
||||
AlarmTowerCommand cmd;
|
||||
Infrare.Transmition(cmd.CMD_DefaultIRAlarm(), 6);
|
||||
_3DDisplayCommand cmd;
|
||||
Infrare.Transmition(cmd.CMD_IR_DisplayAlarmSign(_3DDisplayCommand::AlarmSign::NoDrinkDrive), 6);
|
||||
}
|
||||
|
||||
void Handler::Key_2()
|
||||
{
|
||||
LEDDisplayCommand cmd;
|
||||
ZigBeeOperator.SendCommand(cmd.CMD_FirstLineDisplay(0x123456));
|
||||
delay(1000);
|
||||
ZigBeeOperator.SendCommand(cmd.CMD_SecondLineDisplay(0x7890AB));
|
||||
_3DDisplayCommand cmd;
|
||||
Infrare.Transmition(cmd.CMD_IR_SetTextColor(0x00, 0xFF, 0x00), 6);
|
||||
}
|
||||
|
||||
void Handler::Key_3()
|
||||
{
|
||||
_3DDisplayCommand cmd;
|
||||
TextEncoder encoder("主车不动安如山,从车乱飞墙撞翻。");
|
||||
while(encoder.HasNextChar())
|
||||
{
|
||||
byte b1, b2;
|
||||
encoder.GetNextChar(b1, b2);
|
||||
ZigBeeOperator.SendCommand(cmd.CMD_ZIGBEE_CustomTextAdd(b1, b2, encoder.IsLastChar()));
|
||||
delay(200);
|
||||
}
|
||||
/*OpenMVOpt::Servo_Control(-60);
|
||||
OpenMVOpt::OpenMV_Track(10);*/
|
||||
OpenMVOpt::OpenMV_Track(1);*/
|
||||
}
|
||||
|
||||
void Handler::KEY_Handler(uint8_t k_value)
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ void OpenMVOpt::OpenMVTrack_Disc_CloseUp()
|
||||
void OpenMVOpt::OpenMV_Track(uint8_t Car_Speed)
|
||||
{
|
||||
uint32_t num = 0;
|
||||
Car_Speed = 50;
|
||||
//Car_Speed = 50;
|
||||
// 清空串口缓存
|
||||
while (ExtSRAMInterface.ExMem_Read(0x6038) != 0x00)
|
||||
ExtSRAMInterface.ExMem_Read_Bytes(0x6038, Data_OpenMVBuf, 1);
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ±êÖ¾ÎïͨÐÅ - ·µÆ - IR
|
||||
//
|
||||
|
||||
#include "RodeLightCommand.h"
|
||||
|
||||
void RodeLightCommand::Swap(uint16_t& a, uint16_t& b)
|
||||
{
|
||||
uint16_t c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
|
||||
byte RodeLightCommand::CalcLevel(uint16_t* sorted_arr, uint16_t curr)
|
||||
{
|
||||
if (curr >= sorted_arr[3])
|
||||
return 4;
|
||||
else if (curr >= sorted_arr[2])
|
||||
return 3;
|
||||
else if (curr >= sorted_arr[1])
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
RodeLightCommand::RodeLightCommand()
|
||||
{
|
||||
ir_cmd[0] = 0x00;
|
||||
ir_cmd[1] = 0xFF;
|
||||
ir_cmd[2] = 0x00;
|
||||
ir_cmd[3] = 0x00;
|
||||
}
|
||||
|
||||
byte* RodeLightCommand::CMD_LightPlusOne()
|
||||
{
|
||||
ir_cmd[2] = 0x0C;
|
||||
ir_cmd[3] = 0xF3;
|
||||
return ir_cmd;
|
||||
}
|
||||
|
||||
byte* RodeLightCommand::CMD_LightPlusTwo()
|
||||
{
|
||||
ir_cmd[2] = 0x18;
|
||||
ir_cmd[3] = 0xE7;
|
||||
return ir_cmd;
|
||||
}
|
||||
|
||||
byte* RodeLightCommand::CMD_LightPlusThree()
|
||||
{
|
||||
ir_cmd[2] = 0x5E;
|
||||
ir_cmd[3] = 0xA1;
|
||||
return ir_cmd;
|
||||
}
|
||||
|
||||
byte RodeLightCommand::GetCurrentLevel()
|
||||
{
|
||||
RodeLightCommand cmd;
|
||||
uint16_t light_arr[4] = { 0 };
|
||||
uint16_t current = BH1750.ReadLightLevel(), last = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Infrare.Transmition(cmd.CMD_LightPlusOne(), 4);
|
||||
light_arr[i] = BH1750.ReadLightLevel(true);
|
||||
while(abs(last - light_arr[i]) <= 200)
|
||||
{
|
||||
Infrare.Transmition(cmd.CMD_LightPlusOne(), 4);
|
||||
light_arr[i] = BH1750.ReadLightLevel(true);
|
||||
delay(1500);
|
||||
}
|
||||
last = light_arr[i];
|
||||
delay(1500);
|
||||
}
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int j = 0; j < 4; j++)
|
||||
if (light_arr[i] < light_arr[j])
|
||||
Swap(light_arr[i], light_arr[j]);
|
||||
/*DataTool::PrintDataArray(light_arr, 4);
|
||||
Serial.print("Current: ");
|
||||
Serial.println(current, HEX);*/
|
||||
return CalcLevel(light_arr, current);
|
||||
}
|
||||
|
||||
void RodeLightCommand::SetToSpeclevel(byte target_lv, byte current_lv)
|
||||
{
|
||||
uint8_t times = 0;
|
||||
RodeLightCommand cmd;
|
||||
if (target_lv > current_lv)
|
||||
times = target_lv - current_lv;
|
||||
else
|
||||
times = 4 - (current_lv - target_lv);
|
||||
switch (times)
|
||||
{
|
||||
case 1:
|
||||
Infrare.Transmition(cmd.CMD_LightPlusOne(), 4);
|
||||
break;
|
||||
case 2:
|
||||
Infrare.Transmition(cmd.CMD_LightPlusTwo(), 4);
|
||||
break;
|
||||
case 3:
|
||||
Infrare.Transmition(cmd.CMD_LightPlusThree(), 4);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// RodeLightCommand.h
|
||||
|
||||
#ifndef _RODELIGHTCOMMAND_h
|
||||
#define _RODELIGHTCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include <BH1750.h>
|
||||
#include <Infrare.h>
|
||||
#include "GlobalDatas.h"
|
||||
|
||||
class RodeLightCommand
|
||||
{
|
||||
private:
|
||||
byte ir_cmd[4];
|
||||
private:
|
||||
static void Swap(uint16_t& a, uint16_t& b);
|
||||
static byte CalcLevel(uint16_t* sorted_arr, uint16_t curr);
|
||||
public:
|
||||
RodeLightCommand();
|
||||
public:
|
||||
byte* CMD_LightPlusOne();
|
||||
byte* CMD_LightPlusTwo();
|
||||
byte* CMD_LightPlusThree();
|
||||
public:
|
||||
static byte GetCurrentLevel();
|
||||
static void SetToSpeclevel(byte target_lv, byte current_lv);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// ±êÖ¾ÎïͨÐÅ - ÌØÊâµØÐÎ - ZigBee
|
||||
//
|
||||
|
||||
#include "SpecTerrainCommand.h"
|
||||
|
||||
SpecTerrainCommand::SpecTerrainCommand()
|
||||
{
|
||||
SetDevice(CommandData::Devices::SpecTerrain);
|
||||
}
|
||||
|
||||
byte* SpecTerrainCommand::CMD_QueryStatus()
|
||||
{
|
||||
SetCommand(0x10, 0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
bool SpecTerrainCommand::IsSpecTerrainCommand(byte* cmd)
|
||||
{
|
||||
return ((cmd[1] == CommandData::Devices::SpecTerrain) && (cmd[2] == 0x10) && (cmd[3] == 0x01));
|
||||
}
|
||||
|
||||
SpecTerrainCommand::Status SpecTerrainCommand::ReadStatus(byte* cmd)
|
||||
{
|
||||
if (!IsSpecTerrainCommand(cmd))
|
||||
return Status::Unknown;
|
||||
return ((Status)cmd[4]);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// SpecTerrainCommand.h
|
||||
|
||||
#ifndef _SPECTERRAINCOMMAND_h
|
||||
#define _SPECTERRAINCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include "CommandEncoder.h"
|
||||
|
||||
class SpecTerrainCommand : private CommandEncoder
|
||||
{
|
||||
public:
|
||||
enum class Status
|
||||
{
|
||||
Passed_AtoB = 0x31,
|
||||
Passed_BtoA = 0x32,
|
||||
NotPass = 0x33,
|
||||
Unknown = 0xFF
|
||||
};
|
||||
public:
|
||||
SpecTerrainCommand();
|
||||
public:
|
||||
byte* CMD_QueryStatus();
|
||||
public:
|
||||
bool IsSpecTerrainCommand(byte* cmd);
|
||||
Status ReadStatus(byte* cmd);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+102
@@ -4,4 +4,106 @@
|
||||
|
||||
#include "TFTCommand.h"
|
||||
|
||||
TFTCommand::TFTCommand()
|
||||
{
|
||||
SetDevice(CommandData::Devices::TFT_A);
|
||||
}
|
||||
|
||||
void TFTCommand::UsingA()
|
||||
{
|
||||
SetDevice(CommandData::Devices::TFT_A);
|
||||
}
|
||||
|
||||
void TFTCommand::UsingB()
|
||||
{
|
||||
SetDevice(CommandData::Devices::TFT_B);
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_DisplaySpecPicture(byte no)
|
||||
{
|
||||
SetCommand(0x10, 0x00, no);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_PageUp()
|
||||
{
|
||||
SetCommand(0x10, 0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_PageDown()
|
||||
{
|
||||
SetCommand(0x10, 0x02);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_AutoPaging()
|
||||
{
|
||||
SetCommand(0x10, 0x03);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_CarLicenseMode_1to3(byte d1, byte d2, byte d3)
|
||||
{
|
||||
SetCommand(0x20, d1, d2, d3);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_CarLicenseMode_4to6(byte d4, byte d5, byte d6)
|
||||
{
|
||||
SetCommand(0x21, d4, d5, d6);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_TimerOn()
|
||||
{
|
||||
SetCommand(0x30, 0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_TimerOff()
|
||||
{
|
||||
SetCommand(0x30);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_TimerClear()
|
||||
{
|
||||
SetCommand(0x30, 0x02);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_DisplayHex(uint32_t hex)
|
||||
{
|
||||
if (hex >= 0xFFFFFF)
|
||||
SetCommand(0x40, 0xFF, 0xFF, 0xFF);
|
||||
else
|
||||
{
|
||||
byte d1 = ((hex > 0xFFFF) ? (hex / 0x10000) : 0x00);
|
||||
hex -= (d1 * 0x10000);
|
||||
byte d2 = ((hex > 0xFF) ? (hex / 0x100) : 0x00);
|
||||
byte d3 = hex % 0x100;
|
||||
SetCommand(0x40, d1, d2, d3);
|
||||
}
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_DisplayDistence(uint16_t dis)
|
||||
{
|
||||
if (dis >= 0x999)
|
||||
SetCommand(0x50, 0x00, 0x09, 0x99);
|
||||
else
|
||||
{
|
||||
byte d1 = ((dis > 0x99) ? (dis / 0x100) : 0);
|
||||
dis -= (d1 * 0x100);
|
||||
byte d2 = dis % 0x100;
|
||||
SetCommand(0x50, 0x00, d1, d2);
|
||||
}
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TFTCommand::CMD_DisplayTrafficSign(TrafficSign sign)
|
||||
{
|
||||
SetCommand(0x60, (byte)sign);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
+28
-1
@@ -13,13 +13,40 @@
|
||||
|
||||
class TFTCommand : private CommandEncoder
|
||||
{
|
||||
public:
|
||||
enum class TrafficSign
|
||||
{
|
||||
GoStraight = 0x01,
|
||||
TurnLeft = 0x02,
|
||||
TurnRight = 0x03,
|
||||
TurnAround = 0x04,
|
||||
NoStraight = 0x05,
|
||||
DoNotEnter = 0x06
|
||||
};
|
||||
public:
|
||||
TFTCommand();
|
||||
public:
|
||||
void UsingA();
|
||||
void UsingB();
|
||||
public:
|
||||
|
||||
//Picture Mode
|
||||
byte* CMD_DisplaySpecPicture(byte no); //Range: 0x01~0x20
|
||||
byte* CMD_PageUp();
|
||||
byte* CMD_PageDown();
|
||||
byte* CMD_AutoPaging();
|
||||
//Car License Mode
|
||||
byte* CMD_CarLicenseMode_1to3(byte d1, byte d2, byte d3);
|
||||
byte* CMD_CarLicenseMode_4to6(byte d4, byte d5, byte d6);
|
||||
//Timer Mode
|
||||
byte* CMD_TimerOn();
|
||||
byte* CMD_TimerOff();
|
||||
byte* CMD_TimerClear();
|
||||
//HEX Mode
|
||||
byte* CMD_DisplayHex(uint32_t hex);
|
||||
//Distence Mode
|
||||
byte* CMD_DisplayDistence(uint16_t dis);
|
||||
//Traffic Sign Mode
|
||||
byte* CMD_DisplayTrafficSign(TrafficSign sign);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// GBKÎı¾±àÂëÆ÷
|
||||
//
|
||||
|
||||
#include "TextEncoder.h"
|
||||
|
||||
TextEncoder::TextEncoder()
|
||||
{
|
||||
size = 0;
|
||||
data = nullptr;
|
||||
current_index = 0;
|
||||
}
|
||||
|
||||
TextEncoder::TextEncoder(String text)
|
||||
{
|
||||
current_index = 0;
|
||||
size = text.length();
|
||||
data = new byte[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
data[i] = text[i];
|
||||
}
|
||||
|
||||
TextEncoder::~TextEncoder()
|
||||
{
|
||||
if (data != nullptr)
|
||||
{
|
||||
delete[] data;
|
||||
data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void TextEncoder::EncodeText(String text)
|
||||
{
|
||||
if (data != nullptr)
|
||||
{
|
||||
delete[] data;
|
||||
data = nullptr;
|
||||
}
|
||||
current_index = 0;
|
||||
size = text.length();
|
||||
data = new byte[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
data[i] = text[i];
|
||||
}
|
||||
|
||||
bool TextEncoder::HasNextChar()
|
||||
{
|
||||
return (current_index < size);
|
||||
}
|
||||
|
||||
bool TextEncoder::IsLastChar()
|
||||
{
|
||||
return ((current_index + 1) >= size);
|
||||
}
|
||||
|
||||
void TextEncoder::GetNextChar(byte& bit1, byte& bit2)
|
||||
{
|
||||
if (data[current_index] >= 0x7F) //ÖÐÎÄ
|
||||
{
|
||||
bit1 = data[current_index];
|
||||
bit2 = data[current_index + 1];
|
||||
current_index += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
bit1 = data[current_index];
|
||||
bit2 = 0x00;
|
||||
current_index++;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// TextEncoder.h
|
||||
|
||||
#ifndef _TEXTENCODER_h
|
||||
#define _TEXTENCODER_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
class TextEncoder
|
||||
{
|
||||
private:
|
||||
uint16_t size;
|
||||
uint16_t current_index;
|
||||
byte* data = nullptr;
|
||||
public:
|
||||
TextEncoder();
|
||||
TextEncoder(String text);
|
||||
~TextEncoder();
|
||||
public:
|
||||
void EncodeText(String text);
|
||||
public:
|
||||
bool HasNextChar();
|
||||
bool IsLastChar();
|
||||
void GetNextChar(byte& bit1, byte& bit2);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// ±êÖ¾ÎïͨÐÅ - ½»Í¨µÆ£¨A/B£© - ZigBee
|
||||
//
|
||||
|
||||
#include "TrafficLightCommand.h"
|
||||
|
||||
TrafficLightCommand::TrafficLightCommand()
|
||||
{
|
||||
SetDevice(CommandData::Devices::TrafficLight_A);
|
||||
}
|
||||
|
||||
void TrafficLightCommand::UsingA()
|
||||
{
|
||||
SetDevice(CommandData::Devices::TrafficLight_A);
|
||||
}
|
||||
|
||||
void TrafficLightCommand::UsingB()
|
||||
{
|
||||
SetDevice(CommandData::Devices::TrafficLight_B);
|
||||
}
|
||||
|
||||
byte* TrafficLightCommand::CMD_EnterIdentifyMode()
|
||||
{
|
||||
SetCommand(0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* TrafficLightCommand::CMD_CheckResult(Color color)
|
||||
{
|
||||
SetCommand(0x02, (byte)color);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
bool TrafficLightCommand::IsTrafficLightCommand(byte* cmd)
|
||||
{
|
||||
if ((cmd[1] == CommandData::Devices::TrafficLight_A) || (cmd[1] == CommandData::Devices::TrafficLight_B))
|
||||
return (cmd[2] == 0x01);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TrafficLightCommand::ModeChangeSuccess(byte* cmd)
|
||||
{
|
||||
if (!IsTrafficLightCommand(cmd))
|
||||
return false;
|
||||
return ((cmd[3] == 0x01) && (cmd[4] == 0x07));
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// TrafficLightCommand.h
|
||||
|
||||
#ifndef _TRAFFICLIGHTCOMMAND_h
|
||||
#define _TRAFFICLIGHTCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include "CommandEncoder.h"
|
||||
|
||||
class TrafficLightCommand : private CommandEncoder
|
||||
{
|
||||
public:
|
||||
enum class Color
|
||||
{
|
||||
Red = 0x01,
|
||||
Green = 0x02,
|
||||
Yellow = 0x03
|
||||
};
|
||||
public:
|
||||
TrafficLightCommand();
|
||||
public:
|
||||
void UsingA();
|
||||
void UsingB();
|
||||
public:
|
||||
byte* CMD_EnterIdentifyMode();
|
||||
byte* CMD_CheckResult(Color color);
|
||||
public:
|
||||
bool IsTrafficLightCommand(byte* cmd);
|
||||
bool ModeChangeSuccess(byte* cmd);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// 标志物通信 - 无线充电 - ZigBee
|
||||
//
|
||||
|
||||
#include "WirelessChargerCommand.h"
|
||||
|
||||
WirelessChargerCommand::WirelessChargerCommand()
|
||||
{
|
||||
SetDevice(CommandData::Devices::WirelessCharger);
|
||||
}
|
||||
|
||||
byte* WirelessChargerCommand::CMD_TurnOn()
|
||||
{
|
||||
SetCommand(0x01, 0x01);
|
||||
return GetCommandArray();
|
||||
}
|
||||
|
||||
byte* WirelessChargerCommand::CMD_TurnOff()
|
||||
{
|
||||
SetCommand(0x01, 0x02);
|
||||
return GetCommandArray();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// WirelessChargerCommand.h
|
||||
|
||||
#ifndef _WIRELESSCHARGERCOMMAND_h
|
||||
#define _WIRELESSCHARGERCOMMAND_h
|
||||
|
||||
#if defined(ARDUINO) && ARDUINO >= 100
|
||||
#include "arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
|
||||
#include "CommandEncoder.h"
|
||||
|
||||
class WirelessChargerCommand : private CommandEncoder
|
||||
{
|
||||
public:
|
||||
WirelessChargerCommand();
|
||||
public:
|
||||
byte* CMD_TurnOn();
|
||||
byte* CMD_TurnOff();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user