Commit 8f37b129 authored by 何锐's avatar 何锐

feat:首版提交

parent 00f9196a
...@@ -55,5 +55,8 @@ ...@@ -55,5 +55,8 @@
"C_Cpp_Runner.useLeakSanitizer": false, "C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false, "C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false, "C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false "C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": {
"string.h": "c"
}
} }
\ No newline at end of file
...@@ -35,7 +35,7 @@ uint8_t timenum = 0; ...@@ -35,7 +35,7 @@ uint8_t timenum = 0;
uint8_t firstflag = 0; uint8_t firstflag = 0;
uint8_t RS485_data[64]; uint8_t RS485_data[64];
uint8_t checknumwrong = 3; uint8_t checknumwrong = 3;
uint8_t zhenduanflag = 0; uint8_t zhenduanflag = Data_Mode_Dot;
uint8_t clearOdoFlag = 0; uint8_t clearOdoFlag = 0;
uint8_t connectbleFlag = 0; uint8_t connectbleFlag = 0;
uint8_t Auto_ONOFF = 0; uint8_t Auto_ONOFF = 0;
...@@ -67,12 +67,12 @@ void get_key(void) ...@@ -67,12 +67,12 @@ void get_key(void)
uint8_t recvflag111 = 0; uint8_t recvflag111 = 0;
uint8_t xierucishu = 0; uint8_t xierucishu = 0;
uint8_t waittimer; uint8_t waittimer;
uint8_t saomafinish;; uint8_t saomafinish;
void datacheck(void) void datacheck(void)
{ {
uint16_t checksum = 0; uint16_t checksum = 0;
uint8_t arraynum = 0; uint8_t arraynum = 0;
if(zhenduanflag == 0) if(zhenduanflag == Data_Mode_Dot)
{ {
if(BarCode[0] == 0x59 && BarCode[1] == 0x44) if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
{ {
...@@ -203,7 +203,7 @@ void datacheck(void) ...@@ -203,7 +203,7 @@ void datacheck(void)
// RS485_TX_finish = 0; // RS485_TX_finish = 0;
} }
} }
else if(zhenduanflag == 1) else if(zhenduanflag == Data_Mode_Write)
{ {
if(BarCode[0] == 0x59 && BarCode[1] == 0x44) if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
{ {
...@@ -286,7 +286,6 @@ void datacheck(void) ...@@ -286,7 +286,6 @@ void datacheck(void)
{ {
zhenduansendStep++; zhenduansendStep++;
RS485_TX_finish = 0; RS485_TX_finish = 0;
// zhenduanflag = 0;
saomafinish = 1; saomafinish = 1;
waittimer = 0; waittimer = 0;
} }
...@@ -336,7 +335,7 @@ void datacheck(void) ...@@ -336,7 +335,7 @@ void datacheck(void)
} }
} }
} }
else if(zhenduanflag == 2) else if(zhenduanflag == Data_Mode_Read)
{ {
// if(BarCode[0] == 0x59 && BarCode[1] == 0x44) // if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
// { // {
...@@ -374,7 +373,7 @@ void BarCodeDataGet(void) ...@@ -374,7 +373,7 @@ void BarCodeDataGet(void)
{ {
// memcpy(barcode_Msg1,&mDataBufPtr1[6],34); // memcpy(barcode_Msg1,&mDataBufPtr1[6],34);
memset(barcode_Msg,0,34); memset(barcode_Msg,0,34);
General_Number_Disp(writefail, 3, 250); // General_Number_Disp(writefail, 3, 250);
} }
} }
uint8_t GetDataCompare(void) uint8_t GetDataCompare(void)
...@@ -484,15 +483,11 @@ void Recv_Byte(void) ...@@ -484,15 +483,11 @@ void Recv_Byte(void)
{ {
for(i = 0; i < mDataBufLen; i++) for(i = 0; i < mDataBufLen; i++)
{ {
// if(i > 5)
// {
if(mDataBufPtr[i - 1] == 0x59 && mDataBufPtr[i] == 0x44) if(mDataBufPtr[i - 1] == 0x59 && mDataBufPtr[i] == 0x44)
{ {
k = i - 1; k = i - 1;
} }
if((mDataBufPtr[k] == 0x59 && mDataBufPtr[k+1] == 0x44) && (mDataBufPtr[i] == 0x4A ) && (mDataBufPtr[i - 1] == 0x4B) && (i > mDataBufPtr[k + 3] - 3)) if((mDataBufPtr[k] == 0x59 && mDataBufPtr[k+1] == 0x44) && (mDataBufPtr[i] == 0x4A ) && (mDataBufPtr[i - 1] == 0x4B) && (i > mDataBufPtr[k + 3] - 3))
{ {
if( i < 1) if( i < 1)
...@@ -509,13 +504,8 @@ void Recv_Byte(void) ...@@ -509,13 +504,8 @@ void Recv_Byte(void)
} }
else else
{ {
testflag = 1; testflag = 1;
// break;
} }
// }
} }
if(testflag) if(testflag)
{ {
......
...@@ -62,4 +62,5 @@ void MENU_CHECK_Init(void); ...@@ -62,4 +62,5 @@ void MENU_CHECK_Init(void);
void Req_To_Secure(void); void Req_To_Secure(void);
void Read_IPK_Session_Type(void); void Read_IPK_Session_Type(void);
extern uint8_t TimeDelay_3s(void);
#endif #endif
...@@ -14,6 +14,7 @@ typedef enum ...@@ -14,6 +14,7 @@ typedef enum
KEY_11, KEY_11,
KEY_3, KEY_3,
KEY_1, KEY_1,
KEY_4,
KEY_NUM_MAX, KEY_NUM_MAX,
} Key_Num_en_t; } Key_Num_en_t;
...@@ -74,9 +75,14 @@ extern Key_Real_Status_en_t enKeyLeftRealStatus; ...@@ -74,9 +75,14 @@ extern Key_Real_Status_en_t enKeyLeftRealStatus;
extern Key_Real_Status_en_t enKeyRightRealStatus; extern Key_Real_Status_en_t enKeyRightRealStatus;
/*------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------*/
extern uint8_t KeyStep;
extern void Key_Init(void); extern void Key_Init(void);
extern void Key_Service(void); /*10ms*/ extern void Key_Service(void); /*10ms*/
extern void confirmkeyserve(void);
extern void upkeyserve(void);
extern void downkeyserve(void);
extern void PasswordUnlock(void);
extern Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time); extern Key_Set_en_t Key_Parameter_Set_Short_Press_Time(uint16_t u16Time);
extern Key_Set_en_t Key_Parameter_Set_Long_Press_Time(uint16_t u16Time); extern Key_Set_en_t Key_Parameter_Set_Long_Press_Time(uint16_t u16Time);
extern Key_Set_en_t Key_Parameter_Set_Super_Long_Press_Time(uint32_t u32Time); extern Key_Set_en_t Key_Parameter_Set_Super_Long_Press_Time(uint32_t u32Time);
......
...@@ -17,7 +17,7 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步 ...@@ -17,7 +17,7 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步
{ {
MENU_CHECK_STEP_ADD( ); MENU_CHECK_STEP_ADD( );
zhenduansendStep = 0; zhenduansendStep = 0;
zhenduanflag = 0; zhenduanflag = Data_Mode_Dot;
} }
} }
} }
...@@ -75,10 +75,9 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent) ...@@ -75,10 +75,9 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
// upkeyflag = 1; //按键加
if(firstpowerflag == 2) if(firstpowerflag == 2)
{ {
if(zhenduanflag == 1) if(zhenduanflag == Data_Mode_Write)
{ {
zhenduansendStep = 5; zhenduansendStep = 5;
} }
...@@ -98,7 +97,23 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent) ...@@ -98,7 +97,23 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
zhenduanflag = 1; zhenduanflag = Data_Mode_Write;
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{
}
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{
}
else
{
}
}
void Key_Operation_SW9(Key_Event_en_t enKeyEvent) //下移位
{
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
downkeyflag = 1;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
...@@ -114,20 +129,21 @@ void Key_Operation_SW2(Key_Event_en_t enKeyEvent) ...@@ -114,20 +129,21 @@ void Key_Operation_SW2(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
if(LINE_OUT_NEG_01 == 1U) //上下ACC电 if(LINE_OUT_NEG_04 == 1U) //上下ACC电
{ {
LINE_OUT_NEG_01 = 0U; LINE_OUT_NEG_04 = 0U;
Auto_ONOFF = 3; Auto_ONOFF = 3;
} }
else else
{ {
LINE_OUT_NEG_01 = 1U; LINE_OUT_NEG_04 = 1U;
Auto_ONOFF = 0; Auto_ONOFF = 0;
} }
// downkeyflag = 1; //数字减
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
Auto_ONOFF = 1; //自动断电
LINE_OUT_NEG_04 = 0U;
} }
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{ {
...@@ -140,22 +156,6 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent) ...@@ -140,22 +156,6 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
// if(MENU_CHECK_STEP == 14)
// {
// Confirmkeyflag = 1; //确认
// Confirmkeycount++;
// if(Confirmkeycount >= 5)
// {
// mimayanzhengjieguo = 1;
// Confirmkeycount = 0;
// MENU_CHECK_STEP_ADD();
// }
// }
// else
// {
// Confirmkeycount == 0;
// mimayanzhengjieguo = 0;
// }
if(firstpowerflag == 2) if(firstpowerflag == 2)
{ {
if(clearOdoFlag == 0) if(clearOdoFlag == 0)
...@@ -182,59 +182,151 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent) ...@@ -182,59 +182,151 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent)
{ {
} }
} }
void Key_Operation_SW1(Key_Event_en_t enKeyEvent) //自动下电模式切换 void Key_Operation_SW1(Key_Event_en_t enKeyEvent) //上移位
{ {
/*清零ODO*/
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
if(firstpowerflag == 2) upkeyflag = 1;
}
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
if(Auto_ONOFF != 0)
}
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{ {
Auto_ONOFF = 0;
} }
else else
{ {
Auto_ONOFF = 1;
}
} }
}
void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
{
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{
Confirmkeyflag = 1;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
{ {
} }
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS ) else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
{ {
if(Get_Display_Type( ) == 2)
}
else
{ {
MENU_CHECK_STEP_ADD( );
}
}
uint8_t upkeytime;
uint8_t downkeytime;
uint8_t Confirmkeytime;
uint8_t upkeyflag;
uint8_t downkeyflag;
uint8_t Confirmkeyflag;
void upkeyserve(void)
{
if(upkeyflag == 1)
{
if(upkeytime<=10)
{
upkeytime++;
Press_to_up = 1;
}
else
{
upkeytime = 0;
Press_to_up = 0;
upkeyflag = 0;
} }
} }
else else
{ {
upkeytime = 0;
Press_to_up = 0;
} }
} }
void Key_Operation_SW6(Key_Event_en_t enKeyEvent) void downkeyserve(void)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if(downkeyflag == 1)
{ {
if(downkeytime<=10)
{
downkeytime++;
Press_to_down = 1;
} }
else if ( enKeyEvent == KEY_EVENT_LONG_PRESS ) else
{ {
downkeytime = 0;
Press_to_down = 0;
downkeyflag = 0;
} }
else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS ) }
else
{ {
downkeytime = 0;
Press_to_down = 0;
}
}
void confirmkeyserve(void)
{
if(Confirmkeyflag == 1)
{
if(Confirmkeytime<=10)
{
Confirmkeytime++;
queren = 1;
} }
else else
{ {
Confirmkeytime = 0;
Confirmkeyflag = 0;
queren = 0;
}
}
else
{
Confirmkeytime = 0;
queren = 0;
}
}
uint8_t KeyStep = 0;
void PasswordUnlock(void)
{
if(MENU_CHECK_STEP == 7)
{
if(KeyStep == 0)
{
if(upkeyflag)
{
KeyStep = 1;
}
}
else if(KeyStep == 1)
{
if(downkeyflag)
{
KeyStep = 2;
}
}
else if(KeyStep == 2)
{
if(Confirmkeyflag)
{
KeyStep = 3;
}
}
}
else
{
KeyStep = 0;
} }
} }
/*-------------------------------------------------*/ /*-------------------------------------------------*/
Key_Real_Status_en_t Key_Real_sw5(void) Key_Real_Status_en_t Key_Real_sw5(void)
{ {
...@@ -287,6 +379,17 @@ Key_Real_Status_en_t Key_Real_sw8(void) ...@@ -287,6 +379,17 @@ Key_Real_Status_en_t Key_Real_sw8(void)
} }
return enKeyRealStatus; return enKeyRealStatus;
} }
Key_Real_Status_en_t Key_Real_sw9(void)
{
Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
if ( SW9 == 0U )
{
enKeyRealStatus = KEY_LINE_PRESS;
}
return enKeyRealStatus;
}
Key_Real_Status_en_t Key_Real_sw2(void) Key_Real_Status_en_t Key_Real_sw2(void)
{ {
...@@ -339,7 +442,7 @@ Key_Real_Status_en_t Key_Real_sw6(void) ...@@ -339,7 +442,7 @@ Key_Real_Status_en_t Key_Real_sw6(void)
Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN; Key_Real_Status_en_t enKeyRealStatus = KEY_LINE_LOOSEN;
if ( SW9 == 0U ) if ( SW6 == 0U )
{ {
enKeyRealStatus = KEY_LINE_PRESS; enKeyRealStatus = KEY_LINE_PRESS;
} }
...@@ -382,4 +485,5 @@ const Key_Attribute_st_t stKeyAttribute [ KEY_NUM_MAX ] = { ...@@ -382,4 +485,5 @@ const Key_Attribute_st_t stKeyAttribute [ KEY_NUM_MAX ] = {
{KEY_TYPE_LINE, Key_Real_sw10, Key_Operation_SW10}, {KEY_TYPE_LINE, Key_Real_sw10, Key_Operation_SW10},
{KEY_TYPE_LINE, Key_Real_sw3, Key_Operation_SW3}, //SW1+ {KEY_TYPE_LINE, Key_Real_sw3, Key_Operation_SW3}, //SW1+
{KEY_TYPE_LINE, Key_Real_sw6, Key_Operation_SW6}, //SW1+ {KEY_TYPE_LINE, Key_Real_sw6, Key_Operation_SW6}, //SW1+
{KEY_TYPE_LINE, Key_Real_sw9, Key_Operation_SW9}, //SW1+
}; };
...@@ -120,6 +120,34 @@ void RTE_GPIO_Init(void) ...@@ -120,6 +120,34 @@ void RTE_GPIO_Init(void)
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1; gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp); GPIO_Config(&gpio_temp);
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_0;
gpio_temp.enGPIOPIN = GPIO_PIN_5;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_0;
gpio_temp.enGPIOPIN = GPIO_PIN_12;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_10;
gpio_temp.enGPIOPIN = GPIO_PIN_7;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_IN;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_AP0;
gpio_temp.enGPIOPIN = GPIO_PIN_15;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_IN;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_8; gpio_temp.enGPIOPort = GPIO_PORT_GROUP_8;
gpio_temp.enGPIOPIN = GPIO_PIN_10; gpio_temp.enGPIOPIN = GPIO_PIN_10;
gpio_temp.enGPIOMode = GPIO_MODE_PORT; gpio_temp.enGPIOMode = GPIO_MODE_PORT;
......
...@@ -45,16 +45,11 @@ ...@@ -45,16 +45,11 @@
#define LINE_OUT_PARK GPIO_OUT_PORT10_PIN06 #define LINE_OUT_PARK GPIO_OUT_PORT10_PIN06
#define LINE_OUT_EPS GPIO_OUT_PORT10_PIN06 #define LINE_OUT_EPS GPIO_OUT_PORT10_PIN06
#define Light_Out GPIO_IN_PORT10_PIN09 #define Light_Out GPIO_IN_PORT10_PIN09
#define POWER_CTRL_KL30 GPIO_OUT_PORT10_PIN13
#define POWER_CTRL_KL15 GPIO_OUT_PORT10_PIN12 #define POWER_CTRL_KL15 GPIO_OUT_PORT10_PIN12
#define LINE_OUT_FANGDAO GPIO_OUT_PORT10_PIN06 #define LINE_OUT_FANGDAO GPIO_OUT_PORT10_PIN06
#define SD_FMQ GPIO_OUT_PORT10_PIN02
// #define PWM_FMQ GPIO_OUT_PORT10_PIN06
#define NEG_1_Ctrl GPIO_OUT_PORT09_PIN06 #define NEG_1_Ctrl GPIO_OUT_PORT09_PIN06
#define NEG_2_Ctrl GPIO_OUT_PORT09_PIN05 #define NEG_2_Ctrl GPIO_OUT_PORT09_PIN05
#define NEG_3_Ctrl GPIO_OUT_PORT09_PIN04 #define NEG_3_Ctrl GPIO_OUT_PORT09_PIN04
...@@ -86,7 +81,7 @@ ...@@ -86,7 +81,7 @@
#define LINE_OUT_POS_05 GPIO_OUT_APORT00_PIN06 #define LINE_OUT_POS_05 GPIO_OUT_APORT00_PIN06
// #define LINE_OUT_POS_08 GPIO_OUT_PORT08_PIN09 // #define LINE_OUT_POS_08 GPIO_OUT_PORT08_PIN09
// #define LINE_OUT_POS_09 GPIO_OUT_PORT08_PIN08 // #define LINE_OUT_POS_09 GPIO_OUT_PORT08_PIN08
// #define LINE_OUT_POS_10 GPIO_OUT_PORT00_PIN07 #define LINE_OUT_POS_10 GPIO_OUT_PORT00_PIN07
#define LINE_OUT_NEG_01 GPIO_OUT_PORT09_PIN06 //12V #define LINE_OUT_NEG_01 GPIO_OUT_PORT09_PIN06 //12V
#define LINE_OUT_NEG_02 GPIO_OUT_PORT09_PIN05 //BAT #define LINE_OUT_NEG_02 GPIO_OUT_PORT09_PIN05 //BAT
...@@ -96,7 +91,6 @@ ...@@ -96,7 +91,6 @@
#define LINE_OUT_NEG_07 GPIO_OUT_PORT10_PIN07 #define LINE_OUT_NEG_07 GPIO_OUT_PORT10_PIN07
#define LINE_OUT_NEG_08 GPIO_OUT_PORT10_PIN03 #define LINE_OUT_NEG_08 GPIO_OUT_PORT10_PIN03
#define LINE_OUT_NEG_09 GPIO_OUT_PORT10_PIN04 #define LINE_OUT_NEG_09 GPIO_OUT_PORT10_PIN04
#define LINE_OUT_NEG_10 GPIO_OUT_PORT00_PIN08
// #define LINE_FUEL_RES01 GPIO_OUT_PORT00_PIN13 // #define LINE_FUEL_RES01 GPIO_OUT_PORT00_PIN13
...@@ -115,12 +109,21 @@ ...@@ -115,12 +109,21 @@
#define LeftturnSignal GPIO_OUT_APORT00_PIN11 //左转灯 #define LeftturnSignal GPIO_OUT_APORT00_PIN11 //左转灯
#define RightturnSignal GPIO_OUT_APORT00_PIN10 //右转灯 #define RightturnSignal GPIO_OUT_APORT00_PIN10 //右转灯
#define highbeam GPIO_OUT_PORT10_PIN13 //远光灯 #define highbeam GPIO_OUT_PORT10_PIN01 //远光灯
#define Lowbeam GPIO_OUT_PORT10_PIN10 //近光 #define Lowbeam GPIO_OUT_PORT10_PIN02 //近光
#define Bluetoothlight GPIO_OUT_PORT10_PIN14 //蓝牙灯 #define Bluetoothlight GPIO_OUT_PORT10_PIN14 //蓝牙灯
#define oldhighlight GPIO_OUT_PORT10_PIN13 //old远光输出
#define oldlowlight GPIO_OUT_PORT10_PIN10 //old近光输出
#define Press_to_up GPIO_OUT_PORT00_PIN00 #define Press_to_up GPIO_OUT_PORT00_PIN00
#define Press_to_down GPIO_OUT_PORT00_PIN01 #define Press_to_down GPIO_OUT_PORT00_PIN01
#define Positionlight GPIO_OUT_PORT00_PIN05
#define EN_5V_CUT_ENABLE GPIO_OUT_PORT00_PIN12
#define zuozhuanaaa GPIO_IN_PORT10_PIN07
#define youzhuanaaa GPIO_IN_APORT00_PIN15 //左转灯
//zh: //zh:
/****************************************************************************** /******************************************************************************
......
...@@ -5,10 +5,6 @@ ...@@ -5,10 +5,6 @@
extern uint8_t AutoFlag; extern uint8_t AutoFlag;
extern uint32_t devicename; extern uint32_t devicename;
extern uint32_t send0x42time;
extern uint32_t bleOFFtoONtime;
extern uint8_t startONfalg;
extern uint32_t startIGONtime;
extern uint8_t upkeyflag; extern uint8_t upkeyflag;
extern uint8_t downkeyflag; extern uint8_t downkeyflag;
extern uint8_t Confirmkeyflag; extern uint8_t Confirmkeyflag;
......
...@@ -34,6 +34,8 @@ uint8_t RS485_TX_finish = 0; ...@@ -34,6 +34,8 @@ uint8_t RS485_TX_finish = 0;
#define END_LEN 2 #define END_LEN 2
#define DATA_FRAME_TX_PERIOD_COUNT 10 #define DATA_FRAME_TX_PERIOD_COUNT 10
#define UDS485SendTime 10
#define Dot485SendTime 1
_ID0X40h_Data R485_ID40h; _ID0X40h_Data R485_ID40h;
_ID0X48h_Data R485_ID48h; _ID0X48h_Data R485_ID48h;
_ID0X41h_Data R485_ID41h; _ID0X41h_Data R485_ID41h;
...@@ -348,8 +350,18 @@ static void RS485_Receive_Data_Analysis(void) ...@@ -348,8 +350,18 @@ static void RS485_Receive_Data_Analysis(void)
// } // }
// } // }
} }
uint32_t devicename = 0;
void Bluetoothname(void)
{
if(devicename<0xFFFF)
{
devicename++;
}
else
{
devicename = 0;
}
}
uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len) uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len)
{ {
uint8_t dataBuf[256]; uint8_t dataBuf[256];
...@@ -386,7 +398,6 @@ uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len) ...@@ -386,7 +398,6 @@ uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len)
} }
uint8_t sendmsgAll[8]; uint8_t sendmsgAll[8];
uint32_t sendnum = 1;
uint8_t getbanbenhaoflag = 0; uint8_t getbanbenhaoflag = 0;
uint32_t send80time = 0; uint32_t send80time = 0;
uint8_t BlueTooth = 0; uint8_t BlueTooth = 0;
...@@ -396,70 +407,34 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -396,70 +407,34 @@ uint8_t RS485_User_Tx_Data(void)
uint32_t sendfinishflag = 0; uint32_t sendfinishflag = 0;
switch (RS485_TxControl.sendIndex) switch (RS485_TxControl.sendIndex)
{ {
// case RS485_Tx_ID04_Idx: case RS485_Tx_IDA4_Idx:
// if(MENU_CHECK_STEP != 16) // if(MENU_CHECK_STEP == 0)
// { // {
// sendfinishflag = R485_Send_0x04(); // sendfinishflag = R485_Send_0xA4();
// RS485_TX_finish = 1; // RS485_TX_finish = 1;
// if(sendfinishflag == 0) // if(sendfinishflag == 0)
// { // {
// if(RS485_TX_finish == 1)
// {
// RS485_send_time = 0; // RS485_send_time = 0;
// RS485_TxControl.sendIndex ++; // RS485_TxControl.sendIndex ++;
// } // }
// } // }
// }
// else // else
// { // {
// RS485_TxControl.sendIndex ++;
// }
// break;
case RS485_Tx_IDA4_Idx:
if((MENU_CHECK_STEP == 0)&&(clearOdoFlag == 0))
{
sendfinishflag = R485_Send_0xA4();
RS485_TX_finish = 1;
if(sendfinishflag == 0)
{
if(RS485_TX_finish == 1)
{
RS485_send_time = 0;
RS485_TxControl.sendIndex ++; RS485_TxControl.sendIndex ++;
} // }
}
}
else
{
RS485_TxControl.sendIndex ++;
}
break; break;
case RS485_Tx_IDD0_Idx: case RS485_Tx_IDD0_Idx:
if((MENU_CHECK_STEP != 16)&&(clearOdoFlag == 0))
{
sendfinishflag = R485_Send_0xD0(); sendfinishflag = R485_Send_0xD0();
RS485_TX_finish = 1; RS485_TX_finish = 1;
if(sendfinishflag == 0) if(sendfinishflag == 0)
{
if(RS485_TX_finish == 1)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TxControl.sendIndex ++; RS485_TxControl.sendIndex ++;
} }
}
}
else
{
RS485_TxControl.sendIndex ++;
}
break; break;
case RS485_Tx_IDD1_Idx: case RS485_Tx_IDD1_Idx:
if((MENU_CHECK_STEP != 16)&&(clearOdoFlag == 0))
{
if(dianliangflag == 0) if(dianliangflag == 0)
{ {
sendfinishflag = R485_Send_0xD1(); sendfinishflag = R485_Send_0xD1();
...@@ -472,28 +447,17 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -472,28 +447,17 @@ uint8_t RS485_User_Tx_Data(void)
RS485_TX_finish = 1; RS485_TX_finish = 1;
dianliangflag = 0; dianliangflag = 0;
} }
}
else
{
RS485_TxControl.sendIndex ++;
}
break; break;
case RS485_Tx_IDD2_Idx: case RS485_Tx_IDD2_Idx:
if(MENU_CHECK_STEP != 16)
{
sendfinishflag = R485_Send_0xD2(); sendfinishflag = R485_Send_0xD2();
RS485_TX_finish = 1; RS485_TX_finish = 1;
if(sendfinishflag == 0) if(sendfinishflag == 0)
{
if(RS485_TX_finish == 1)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TxControl.sendIndex ++; RS485_TxControl.sendIndex ++;
} }
}
}
else else
{ {
RS485_TxControl.sendIndex ++; RS485_TxControl.sendIndex ++;
...@@ -501,31 +465,16 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -501,31 +465,16 @@ uint8_t RS485_User_Tx_Data(void)
break; break;
case RS485_Tx_IDD3_Idx: case RS485_Tx_IDD3_Idx:
// if(MENU_CHECK_STEP != 20)
// {
if(clearOdoFlag == 0)
{
sendfinishflag = R485_Send_0xD3(); sendfinishflag = R485_Send_0xD3();
RS485_TX_finish = 1; RS485_TX_finish = 1;
if(sendfinishflag == 0) if(sendfinishflag == 0)
{
if(RS485_TX_finish == 1)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TxControl.sendIndex ++; RS485_TxControl.sendIndex ++;
} }
}
}
// }
else
{
RS485_TxControl.sendIndex ++;
}
break; break;
case RS485_Tx_ID80_Idx: case RS485_Tx_ID80_Idx:
if(clearOdoFlag == 0)
{
if(MENU_CHECK_STEP == 16) if(MENU_CHECK_STEP == 16)
{ {
BlueTooth = 1; BlueTooth = 1;
...@@ -554,17 +503,10 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -554,17 +503,10 @@ uint8_t RS485_User_Tx_Data(void)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TX_finish = 1; RS485_TX_finish = 1;
if(RS485_TX_finish == 1)
{
RS485_TxControl.sendIndex++;
}
}
}
else
{
RS485_TxControl.sendIndex++; RS485_TxControl.sendIndex++;
} }
break; break;
default: default:
...@@ -575,30 +517,61 @@ uint8_t RS485_User_Tx_Data(void) ...@@ -575,30 +517,61 @@ uint8_t RS485_User_Tx_Data(void)
} }
} }
uint8_t backtime = 0; uint8_t SendTime = 0;
void backsend(void) void backsend(void)
{ {
if(clearOdoFlag == 0) if(zhenduanflag == Data_Mode_Write)
{ {
backtime = 1; SendTime = UDS485SendTime;
} }
else else
{ {
backtime = 1; SendTime = Dot485SendTime;
}
if(zhenduanflag == 1)
{
backtime = 10;
} }
if(RS485_send_time>=backtime) if(RS485_send_time >= SendTime)
{ {
RS485_send_time = 0; RS485_send_time = 0;
RS485_TX_finish = 0; RS485_TX_finish = 0;
sendnum--;
// RS485_send_num--;
} }
} }
void TX_RX_485_service(void)
{
uint32_t sendfinishflag;
// if(clearOdoFlag == 0)
// {
if(RS485_TX_finish == 0)
{
LINE_OUT_NEG_09 = 1;
if(zhenduanflag == Data_Mode_Dot)
{
RS485_User_Tx_Data();
}
else if((zhenduanflag == Data_Mode_Write) || (zhenduanflag == Data_Mode_Read))
{
R485_Send_0x04();
R485_Send_0x80();
}
}
else
{
LINE_OUT_NEG_09 = 0;
Recv_Byte();
}
// }
// else
// {
// if(RS485_TX_finish == 0)
// {
// LINE_OUT_NEG_09 = 1;
// sendfinishflag = R485_Send_0xD2();
// RS485_TX_finish = 1;
// if(sendfinishflag == 0)
// {
// RS485_send_time = 0;
// }
// }
// }
}
/** /**
* @brief R485状态计时函数 * @brief R485状态计时函数
*/ */
......
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
#define RS485_RECEIVE_ID_0X4A 0X4A #define RS485_RECEIVE_ID_0X4A 0X4A
#define RS485_RECEIVE_ID_0X45 0X45 #define RS485_RECEIVE_ID_0X45 0X45
typedef enum
{
Data_Mode_Dot, // 打点模式
Data_Mode_Write, // 写入模式
Data_Mode_Read, // 读取模式
Data_Mode_Max,
} DEV_Data_Mode_t;
typedef enum typedef enum
{ {
// RS485_Tx_ID04_Idx = 0, // RS485_Tx_ID04_Idx = 0,
...@@ -69,11 +77,11 @@ extern uint32_t RS485_send_time; ...@@ -69,11 +77,11 @@ extern uint32_t RS485_send_time;
extern uint8_t RS485_TX_finish; extern uint8_t RS485_TX_finish;
extern uint8_t BlueTooth; extern uint8_t BlueTooth;
extern uint8_t dianliangflag; extern uint8_t dianliangflag;
// extern uint32_t RS485_send_num;
extern uint32_t sendnum;
extern uint8_t sendmsgAll[8]; extern uint8_t sendmsgAll[8];
extern uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len); extern uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len);
extern uint16_t Yadi_CAL_Data_Sum(uint8_t* pu8LinData, uint8_t u8LinLen); extern uint16_t Yadi_CAL_Data_Sum(uint8_t* pu8LinData, uint8_t u8LinLen);
extern uint8_t RS485_User_Tx_Data(void); extern uint8_t RS485_User_Tx_Data(void);
void backsend(void); void backsend(void);
extern void TX_RX_485_service(void);
extern void Bluetoothname(void);
#endif /* API_ADC_H_ */ #endif /* API_ADC_H_ */
...@@ -64,7 +64,6 @@ void Sys_Startup_Pre_Init(void) ...@@ -64,7 +64,6 @@ void Sys_Startup_Pre_Init(void)
* \attention * \attention
* \retval None * \retval None
******************************************************************************/ ******************************************************************************/
uint8_t firstIGON = 0xFF;
void Sys_Startup_Init(void) void Sys_Startup_Init(void)
{ {
RTC_Pre_Init( ); //首次上电 RTC_Pre_Init( ); //首次上电
...@@ -93,7 +92,6 @@ void Sys_Startup_Init(void) ...@@ -93,7 +92,6 @@ void Sys_Startup_Init(void)
loc_config.pfnUARTConfirmCallBack = 0; loc_config.pfnUARTConfirmCallBack = 0;
loc_config.pfnUARTErrHandleCallBack = 0; loc_config.pfnUARTErrHandleCallBack = 0;
loc_config.pfnUARTReadMsgCallBack = UART_Put; loc_config.pfnUARTReadMsgCallBack = UART_Put;
firstIGON = 1;
UART_Init(UART_RLIN30, &loc_config); UART_Init(UART_RLIN30, &loc_config);
loc_config.enUARTLINMode = MODE_UART; loc_config.enUARTLINMode = MODE_UART;
loc_config.u32UARTbps = 9600; loc_config.u32UARTbps = 9600;
...@@ -118,11 +116,21 @@ void Sys_Startup_Init(void) ...@@ -118,11 +116,21 @@ void Sys_Startup_Init(void)
LINE_OUT_NEG_03 = 1; LINE_OUT_NEG_03 = 1;
LINE_OUT_NEG_04 = 1; LINE_OUT_NEG_04 = 1;
Display_TFT_Clear(); //关闭正控,电路不支持防止烧坏电路
GUI_Display_Version_Code_Service(25, 20, "Please Scan The Code ", Letter_Num_11, PCodeText_Space_size); NEG_10_Ctrl = 0; //左转向输出
LINE_OUT_POS_10 = 0; //右转向输出
LINE_OUT_NEG_06 = 0; //位置灯输出
oldhighlight = 0; //old远光输出
oldlowlight = 0; //old近光输出
/*上电扫码校验功能如果需要扫码校验注释掉firstpowerflag = 2,打开上面两行的注释即可*/ EN_5V_CUT_ENABLE = 1;
// firstpowerflag = 2;
// Display_TFT_Clear();
// GUI_Display_Version_Code_Service(25, 20, "Please Scan The Code ", Letter_Num_11, PCodeText_Space_size);
/*上电扫码校验功能如果需要扫码校验注释掉firstpowerflag = 2,saomafinish = 3;打开上面两行的注释即可*/
firstpowerflag = 2;
saomafinish = 3;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -29,7 +29,6 @@ extern void Sys_Startup_Pre_Init(void); ...@@ -29,7 +29,6 @@ extern void Sys_Startup_Pre_Init(void);
extern void Sys_Startup_Init(void); extern void Sys_Startup_Init(void);
extern void Sys_Sleep_Init(void); extern void Sys_Sleep_Init(void);
extern void System_Wakeup_Init(void); extern void System_Wakeup_Init(void);
extern uint8_t firstIGON;
#ifdef __cplusplus #ifdef __cplusplus
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment