Commit 9b35ab09 authored by 何锐's avatar 何锐

feat:增加按键与米字段显示

parent 0fe81466
...@@ -74,4 +74,5 @@ extern uint8_t writebeing; ...@@ -74,4 +74,5 @@ extern uint8_t writebeing;
extern uint8_t u8get714msg[8]; extern uint8_t u8get714msg[8];
extern uint8_t UIDdelay; extern uint8_t UIDdelay;
extern uint8_t UDSStep; extern uint8_t UDSStep;
extern uint8_t Meterfieldstep;
#endif #endif
...@@ -557,7 +557,7 @@ void Read_IPK_Session_Type(void)//请求仪表发送 软硬件版本号 等数 ...@@ -557,7 +557,7 @@ void Read_IPK_Session_Type(void)//请求仪表发送 软硬件版本号 等数
} }
} }
uint8_t LED_Waring = 0; uint8_t LED_Waring = 0;
extern uint8_t resetflag;
void Function_Check_Ctrl(uint32_t cmd) void Function_Check_Ctrl(uint32_t cmd)
{ {
uint8_t p [ 20 ]; uint8_t p [ 20 ];
...@@ -598,11 +598,11 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -598,11 +598,11 @@ void Function_Check_Ctrl(uint32_t cmd)
POWER_CTRL_KL30 = 1u; //B+ POWER_CTRL_KL30 = 1u; //B+
POWER_CTRL_KL15 = 1u; //KL15 POWER_CTRL_KL15 = 1u; //KL15
/*正控*/ /*正控*/
LINE_OUT_POS_02 = 1; //远光 LINE_OUT_POS_02 = 0; //远光
LINE_OUT_POS_04 = 1; //左转 LINE_OUT_POS_04 = 0; //左转
LINE_OUT_POS_01 = 1; //右转 LINE_OUT_POS_01 = 0; //右转
LINE_OUT_POS_11 = 1; //防盗 LINE_OUT_POS_11 = 0; //防盗
LINE_OUT_POS_12 = 1; //机油压力 LINE_OUT_POS_12 = 0; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 0; FUEL_RES_1 = 0;
FUEL_RES_2 = 0; FUEL_RES_2 = 0;
...@@ -635,7 +635,7 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -635,7 +635,7 @@ void Function_Check_Ctrl(uint32_t cmd)
FUEL_RES_1 = 0; //开路0格 FUEL_RES_1 = 0; //开路0格
FUEL_RES_2 = 0; FUEL_RES_2 = 0;
FUEL_RES_3 = 0; FUEL_RES_3 = 0;
FUEL_RES_4 = 0; FUEL_RES_4 = 1;
break; break;
} }
...@@ -663,8 +663,8 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -663,8 +663,8 @@ void Function_Check_Ctrl(uint32_t cmd)
/*燃油*/ /*燃油*/
FUEL_RES_1 = 0; //1格 FUEL_RES_1 = 0; //1格
FUEL_RES_2 = 0; FUEL_RES_2 = 0;
FUEL_RES_3 = 0; FUEL_RES_3 = 1;
FUEL_RES_4 = 1; FUEL_RES_4 = 0;
break; break;
} }
...@@ -691,8 +691,8 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -691,8 +691,8 @@ void Function_Check_Ctrl(uint32_t cmd)
// /*燃油*/ // /*燃油*/
FUEL_RES_1 = 0; //2格 FUEL_RES_1 = 0; //2格
FUEL_RES_2 = 0; FUEL_RES_2 = 1;
FUEL_RES_3 = 1; FUEL_RES_3 = 0;
FUEL_RES_4 = 0; FUEL_RES_4 = 0;
break; break;
} }
...@@ -717,10 +717,14 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -717,10 +717,14 @@ void Function_Check_Ctrl(uint32_t cmd)
// LINE_OUT_POS_04 = 0; // LINE_OUT_POS_04 = 0;
// LINE_OUT_POS_04 = 1; //左转 // LINE_OUT_POS_04 = 1; //左转
LINE_OUT_POS_02 = 0; //远光 LINE_OUT_POS_02 = 0; //远光
LINE_OUT_POS_04 = 0; //左转
LINE_OUT_POS_01 = 0; //右转
LINE_OUT_POS_11 = 0; //防盗
LINE_OUT_POS_12 = 0; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 0; //3格 FUEL_RES_1 = 0; //3格
FUEL_RES_2 = 1; FUEL_RES_2 = 1;
FUEL_RES_3 = 0; FUEL_RES_3 = 1;
FUEL_RES_4 = 0; FUEL_RES_4 = 0;
break; break;
...@@ -744,6 +748,11 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -744,6 +748,11 @@ void Function_Check_Ctrl(uint32_t cmd)
// LINE_OUT_POS_02 = 0; // LINE_OUT_POS_02 = 0;
// LINE_OUT_POS_03 = 0; // LINE_OUT_POS_03 = 0;
// LINE_OUT_POS_04 = 0; // LINE_OUT_POS_04 = 0;
LINE_OUT_POS_02 = 0; //远光
LINE_OUT_POS_04 = 0; //左转
LINE_OUT_POS_01 = 0; //右转
LINE_OUT_POS_11 = 0; //防盗
LINE_OUT_POS_12 = 0; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 1; //4格 FUEL_RES_1 = 1; //4格
FUEL_RES_2 = 0; FUEL_RES_2 = 0;
...@@ -771,10 +780,15 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -771,10 +780,15 @@ void Function_Check_Ctrl(uint32_t cmd)
// LINE_OUT_POS_02 = 0; // LINE_OUT_POS_02 = 0;
// LINE_OUT_POS_03 = 0; // LINE_OUT_POS_03 = 0;
// LINE_OUT_POS_04 = 0; // LINE_OUT_POS_04 = 0;
LINE_OUT_POS_02 = 0; //远光
LINE_OUT_POS_04 = 0; //左转
LINE_OUT_POS_01 = 0; //右转
LINE_OUT_POS_11 = 0; //防盗
LINE_OUT_POS_12 = 0; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 1; //5格 FUEL_RES_1 = 1; //5格
FUEL_RES_2 = 1; FUEL_RES_2 = 0;
FUEL_RES_3 = 1; FUEL_RES_3 = 0;
FUEL_RES_4 = 1; FUEL_RES_4 = 1;
break; break;
} }
...@@ -797,11 +811,15 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -797,11 +811,15 @@ void Function_Check_Ctrl(uint32_t cmd)
// LINE_OUT_POS_02 = 0; // LINE_OUT_POS_02 = 0;
// LINE_OUT_POS_03 = 0; // LINE_OUT_POS_03 = 0;
// LINE_OUT_POS_04 = 0; // LINE_OUT_POS_04 = 0;
LINE_OUT_NEG_01 = 1; LINE_OUT_POS_02 = 0; //远光
LINE_OUT_POS_04 = 0; //左转
LINE_OUT_POS_01 = 0; //右转
LINE_OUT_POS_11 = 0; //防盗
LINE_OUT_POS_12 = 0; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 1; //5格 FUEL_RES_1 = 1; //5格
FUEL_RES_2 = 1; FUEL_RES_2 = 0;
FUEL_RES_3 = 1; FUEL_RES_3 = 0;
FUEL_RES_4 = 1; FUEL_RES_4 = 1;
break; break;
} }
...@@ -824,11 +842,15 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -824,11 +842,15 @@ void Function_Check_Ctrl(uint32_t cmd)
// LINE_OUT_POS_02 = 0; // LINE_OUT_POS_02 = 0;
// LINE_OUT_POS_03 = 0; // LINE_OUT_POS_03 = 0;
// LINE_OUT_POS_04 = 0; // LINE_OUT_POS_04 = 0;
LINE_OUT_NEG_01 = 0; LINE_OUT_POS_02 = 0; //远光
LINE_OUT_POS_04 = 0; //左转
LINE_OUT_POS_01 = 0; //右转
LINE_OUT_POS_11 = 0; //防盗
LINE_OUT_POS_12 = 0; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 1; //5格 FUEL_RES_1 = 1; //5格
FUEL_RES_2 = 1; FUEL_RES_2 = 0;
FUEL_RES_3 = 1; FUEL_RES_3 = 0;
FUEL_RES_4 = 1; FUEL_RES_4 = 1;
break; break;
} }
...@@ -847,11 +869,15 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -847,11 +869,15 @@ void Function_Check_Ctrl(uint32_t cmd)
// LINE_OUT_NEG_09 = 0; // LINE_OUT_NEG_09 = 0;
// LINE_OUT_NEG_10 = 0; // LINE_OUT_NEG_10 = 0;
/*正控*/ /*正控*/
LINE_OUT_POS_02 = 1; //远光
LINE_OUT_POS_04 = 1; //左转
LINE_OUT_POS_01 = 1; //右转 LINE_OUT_POS_01 = 1; //右转
LINE_OUT_POS_11 = 1; //防盗
LINE_OUT_POS_12 = 1; //机油压力
/*燃油*/ /*燃油*/
FUEL_RES_1 = 1; //5格 FUEL_RES_1 = 1; //5格
FUEL_RES_2 = 1; FUEL_RES_2 = 0;
FUEL_RES_3 = 1; FUEL_RES_3 = 0;
FUEL_RES_4 = 1; FUEL_RES_4 = 1;
break; break;
} }
......
...@@ -72,6 +72,12 @@ extern Key_Real_Status_en_t enKeyLeftRealStatus; ...@@ -72,6 +72,12 @@ extern Key_Real_Status_en_t enKeyLeftRealStatus;
extern Key_Real_Status_en_t enKeyRightRealStatus; extern Key_Real_Status_en_t enKeyRightRealStatus;
/*------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------*/
extern uint8_t leftkey;
extern uint8_t leftkeytime;
extern uint8_t rightkey;
extern uint8_t rightkeytime;
extern uint8_t middlekey;
extern uint8_t middlekeytime;
extern void Key_Init(void); extern void Key_Init(void);
extern void Key_Service(void); /*10ms*/ extern void Key_Service(void); /*10ms*/
......
...@@ -3,90 +3,79 @@ ...@@ -3,90 +3,79 @@
#include "Display_Info.h" #include "Display_Info.h"
#include "Check_Ctrl.h" #include "Check_Ctrl.h"
#include "CAN_APP.h" #include "CAN_APP.h"
extern uint8_t resetflag;
uint8_t rightkey;
uint8_t rightkeytime;
void Key_Operation_SW5(Key_Event_en_t enKeyEvent) void Key_Operation_SW5(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
// Display_Add( ); key_right = 1;
// Display_TFT_Clear( ); rightkey = 1;
Display_TFT_Clear_UID();
if(change > 0)
{
change--;
UUIDX -= 10;
}
else
{
change = 13;
UUIDX = 197;
}
// Display_TFT_Clear();
} }
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 ( (LED_Waring == 1) || (UDS_Warning_Voltage ==1))
}
else
{
if(rightkey)
{ {
; if(rightkeytime < 10)
{
;
}
else
{
rightkey = 0;
rightkeytime = 0;
}
} }
else else
{ {
// Display_Add( ); key_right = 0;
// Display_TFT_Clear( ); }
}
}
else
{
} }
} }
uint8_t leftkey;
uint8_t leftkeytime;
void Key_Operation_SW4(Key_Event_en_t enKeyEvent) void Key_Operation_SW4(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
key_left = 1;
if(UIDNumber2[change] < 9) leftkey = 1;
{
UIDNumber2[change]++;
}
else
{
UIDNumber2[change] = 0;
}
// if ( (LED_Waring == 1) || (UDS_Warning_Voltage ==1))
// {
// ;
// }
// else
// {
// // Display_Sub( );
// // Display_TFT_Clear( );
// }
} }
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 ( (LED_Waring == 1) || (UDS_Warning_Voltage == 1))
}
else
{
if(leftkey)
{ {
; if(leftkeytime < 10)
{
;
}
else
{
leftkey = 0;
leftkeytime = 0;
}
} }
else else
{ {
// Display_Sub( ); key_left = 0;
// Display_TFT_Clear( ); }
}
}
else
{
} }
} }
void Key_Operation_SW7(Key_Event_en_t enKeyEvent) void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
...@@ -122,52 +111,61 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent) ...@@ -122,52 +111,61 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
{ {
} }
} }
uint8_t middlekey;
uint8_t middlekeytime;
void Key_Operation_SW2(Key_Event_en_t enKeyEvent) void Key_Operation_SW2(Key_Event_en_t enKeyEvent)
{ {
/*清零ODO*/
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
MENU_CHECK_STEP_ADD( ); key_middle = 1;
middlekey = 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 ( LED_Waring == 1 || (UDS_Warning_Voltage ==1))
}
else
{
if(middlekey)
{ {
; if(middlekeytime < 10)
{
;
}
else
{
middlekey = 0;
middlekeytime = 0;
}
} }
else else
{ {
MENU_CHECK_STEP_ADD( ); key_middle = 0;
} }
}
else
{
} }
} }
void Key_Operation_SW1(Key_Event_en_t enKeyEvent) void Key_Operation_SW1(Key_Event_en_t enKeyEvent)
{ {
if ( enKeyEvent == KEY_EVENT_SHORT_PRESS ) if ( enKeyEvent == KEY_EVENT_SHORT_PRESS )
{ {
writeflag = 1; Meterfieldstep = 0;
zhenduanstep = 11; MENU_CHECK_STEP_ADD( );
UIDStep = 0; }
writebeing = 1; else if ( enKeyEvent == KEY_EVENT_LONG_PRESS )
// if(UIDNumber2[change] < 9) {
// {
// UIDNumber2[change]++; }
// } else if ( enKeyEvent == KEY_EVENT_SUPER_LONG_PRESS )
// else {
// {
// UIDNumber2[change] = 0; }
// } else
Display_TFT_Clear_UID2(); {
}
else if (( enKeyEvent == KEY_EVENT_LONG_PRESS ) && (MENU_CHECK_STEP == 10))
{
LINE_OUT_NEG_02 = 1;
} }
} }
......
...@@ -283,4 +283,53 @@ void RTE_GPIO_Init(void) ...@@ -283,4 +283,53 @@ void RTE_GPIO_Init(void)
gpio_temp.enGPIODir = GPIO_DIR_OUT; gpio_temp.enGPIODir = GPIO_DIR_OUT;
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_AP0;
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_AP0;
gpio_temp.enGPIOPIN = GPIO_PIN_10;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);//--正控5
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_0;
gpio_temp.enGPIOPIN = GPIO_PIN_6;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);//pin85
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_10;
gpio_temp.enGPIOPIN = GPIO_PIN_13;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);//pin85
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_AP0;
gpio_temp.enGPIOPIN = GPIO_PIN_8;
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_AP0;
gpio_temp.enGPIOPIN = GPIO_PIN_7;
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_6;
gpio_temp.enGPIOMode = GPIO_MODE_PORT;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_1;
GPIO_Config(&gpio_temp);//钥匙确认
} }
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
// #define LINE_OUT_FANGDAO GPIO_OUT_PORT10_PIN06 // #define LINE_OUT_FANGDAO GPIO_OUT_PORT10_PIN06
#define CAN_STB GPIO_OUT_PORT00_PIN04 #define CAN_STB GPIO_OUT_PORT00_PIN04
#define key_left GPIO_OUT_APORT00_PIN08
#define key_right GPIO_OUT_APORT00_PIN07
#define key_middle GPIO_OUT_PORT00_PIN06
#define SD_FMQ GPIO_OUT_PORT10_PIN02 #define SD_FMQ GPIO_OUT_PORT10_PIN02
#define PWM_FMQ GPIO_OUT_PORT10_PIN11 #define PWM_FMQ GPIO_OUT_PORT10_PIN11
...@@ -86,9 +89,9 @@ ...@@ -86,9 +89,9 @@
//右转 //右转
#define LINE_OUT_POS_01 GPIO_OUT_PORT10_PIN14 #define LINE_OUT_POS_01 GPIO_OUT_PORT10_PIN14
//机油压力 //机油压力
#define LINE_OUT_POS_12 GPIO_OUT_PORT00_PIN10 #define LINE_OUT_POS_12 GPIO_OUT_APORT00_PIN10
//防盗 //防盗
#define LINE_OUT_POS_11 GPIO_OUT_PORT00_PIN12 #define LINE_OUT_POS_11 GPIO_OUT_APORT00_PIN12
//远光 //远光
#define LINE_OUT_POS_02 GPIO_OUT_PORT10_PIN13 #define LINE_OUT_POS_02 GPIO_OUT_PORT10_PIN13
//位置灯 //位置灯
......
...@@ -63,7 +63,6 @@ uint8_t getmsgfinish = 0; ...@@ -63,7 +63,6 @@ uint8_t getmsgfinish = 0;
extern uint8_t SWtestresult; extern uint8_t SWtestresult;
extern uint8_t HWtestresult; extern uint8_t HWtestresult;
extern uint8_t PNtestresult; extern uint8_t PNtestresult;
extern uint8_t resetflag;
extern uint8_t fuelreset1; extern uint8_t fuelreset1;
extern uint8_t fuelreset2; extern uint8_t fuelreset2;
extern uint8_t fuelreset3; extern uint8_t fuelreset3;
...@@ -195,6 +194,20 @@ void Sys_Run_Mode_50ms_Tasks_Group(void) ...@@ -195,6 +194,20 @@ void Sys_Run_Mode_50ms_Tasks_Group(void)
timer_100ms = 0; timer_100ms = 0;
} }
// Get_UID_msg(); // Get_UID_msg();
if(leftkey)
{
leftkeytime++;
}
if(rightkey)
{
rightkeytime++;
}
if(middlekey)
{
middlekeytime++;
}
} }
/*============================================================================== /*==============================================================================
......
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