更新1短按逻辑2旋钮发送方式3快速发送周期
This commit is contained in:
parent
aff1e8d868
commit
86656b109c
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,26 @@
|
||||
QualityReport
|
||||
2023年5月11日 14:39:08
|
||||
2023年5月24日 15:25:41
|
||||
|
||||
------ Start build(ECU_APP, DefaultBuild) ------
|
||||
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe user\appTask.c -cpu=S3 -obj_path=DefaultBuild "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10BGG.DVF" -g -g_line -I diagnose\DTC -I diagnose\CanTrcv -I sys -I . -I rscan_driver -I diagnose -I DataFlash -I CanNw -I diagnose\CanTp -I diagnose\CanIf -I user -D DEBUG1 -c -msg_lang=english
|
||||
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe user\appTask.c user\hwCtrl.c -cpu=S3 -obj_path=DefaultBuild "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10BGG.DVF" -g -g_line -I diagnose\DTC -I diagnose\CanTrcv -I sys -I . -I rscan_driver -I diagnose -I DataFlash -I CanNw -I diagnose\CanTp -I diagnose\CanIf -I user -D DEBUG1 -c -msg_lang=english
|
||||
user\appTask.c(40):W0520172:External/internal linkage conflict with previous declaration
|
||||
user\appTask.c(258):W0520177:Variable "num" was declared but never referenced
|
||||
user\appTask.c(357):W0523082:Pointer to the object of even alignment holds the odd address
|
||||
user\appTask.c(361):W0520513:A value of type "MotorStateEE_Type __near *" cannot be assigned to an entity of type "uint8_t *"
|
||||
user\appTask.c(399):W0520513:A value of type "MotorStateEE_Type __near *" cannot be assigned to an entity of type "uint8_t *"
|
||||
user\appTask.c(635):W0523077:Called function should have prototype
|
||||
user\appTask.c(689):W0523077:Called function should have prototype
|
||||
user\appTask.c(257):W0520177:Variable "num" was declared but never referenced
|
||||
user\appTask.c(258):W0520177:Variable "keyPressCounter" was declared but never referenced
|
||||
user\appTask.c(259):W0520177:Variable "LastKey" was declared but never referenced
|
||||
user\appTask.c(398):W0523082:Pointer to the object of even alignment holds the odd address
|
||||
user\appTask.c(402):W0520513:A value of type "MotorStateEE_Type __near *" cannot be assigned to an entity of type "uint8_t *"
|
||||
user\appTask.c(440):W0520513:A value of type "MotorStateEE_Type __near *" cannot be assigned to an entity of type "uint8_t *"
|
||||
user\appTask.c(676):W0523077:Called function should have prototype
|
||||
user\appTask.c(730):W0523077:Called function should have prototype
|
||||
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\rlink.exe -subcommand=DefaultBuild\ECU_APP.clnk
|
||||
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
|
||||
RAMDATA SECTION: 00000c41 Byte(s)
|
||||
ROMDATA SECTION: 000005fb Byte(s)
|
||||
PROGRAM SECTION: 0000500e Byte(s)
|
||||
ROMDATA SECTION: 000005ff Byte(s)
|
||||
PROGRAM SECTION: 0000508e Byte(s)
|
||||
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
|
||||
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
|
||||
Renesas Optimizing Linker Completed
|
||||
------ Build ended(Error:0, Warning:10)(ECU_APP, DefaultBuild) ------
|
||||
------ Build ended(Error:0, Warning:12)(ECU_APP, DefaultBuild) ------
|
||||
|
||||
--- CommandFile 1 ---
|
||||
DefaultBuild\ECU_APP.clnk :
|
||||
@ -104,9 +106,9 @@ DefaultBuild\ECU_APP.clnk :
|
||||
|
||||
|
||||
--- SHA1 hash value of output files ---
|
||||
F:\FCB_project\temp\CFMOTOR\code\ECU_APP\DefaultBuild\ECU_APP.abs: c92b9106c5e2eb9ead2df3ee2bf79af46924df90
|
||||
F:\FCB_project\temp\CFMOTOR\code\ECU_APP\DefaultBuild\ECU_APP.mot: 04d51a8a3aa71d442231002b233c2555022bf6d4
|
||||
F:\FCB_project\temp\CFMOTOR\code\ECU_APP\output\ECU_APP.S19: dcf2004cef427616d284b2e208c0734ba6ec244d
|
||||
F:\FCB_project\temp\CFMOTOR\code\ECU_APP\DefaultBuild\ECU_APP.abs: 2c876bef4378507f1344b6949df629603ea6e1b9
|
||||
F:\FCB_project\temp\CFMOTOR\code\ECU_APP\DefaultBuild\ECU_APP.mot: cc5db19a2d3fa3735ae01166f425461068b15b65
|
||||
F:\FCB_project\temp\CFMOTOR\code\ECU_APP\output\ECU_APP.S19: c6227c465999927bb78f8aa449155cbe3b092ae5
|
||||
|
||||
|
||||
--- System Information ---
|
||||
@ -134,13 +136,13 @@ F:\FCB_project\temp\CFMOTOR\code\ECU_APP\output\ECU_APP.S19: dcf2004cef427616d28
|
||||
E:\Program Files (x86)\renesas\CS+\CC
|
||||
*Memory Usage
|
||||
*Private Working Set
|
||||
238 MB
|
||||
280 MB
|
||||
*Number of GDI Objects
|
||||
2109
|
||||
2083
|
||||
*Number of USER Objects
|
||||
1184
|
||||
1130
|
||||
*Opened Files
|
||||
5 editors, 5 files, 62 KB
|
||||
2 editors, 2 files, 24 KB
|
||||
|
||||
--- Build Tool Plug-in Information ---
|
||||
RH850 Build tool CC-RH Plug-in
|
||||
|
@ -31,7 +31,7 @@ __far const unsigned char SW_VERSION[]={
|
||||
'1' , //AC_SW_VERSION_04
|
||||
'.' , //AC_SW_VERSION_05
|
||||
'0' , //AC_SW_VERSION_06
|
||||
'1' , //AC_SW_VERSION_07
|
||||
'2' , //AC_SW_VERSION_07
|
||||
' ' , //AC_SW_VERSION_08
|
||||
' ' , //AC_SW_VERSION_09
|
||||
' ' , //AC_SW_VERSION_10
|
||||
|
@ -79,7 +79,7 @@ void Apply_task(void)
|
||||
{
|
||||
EEL_SAVE_CNT_DOWN_TIMER--;
|
||||
}
|
||||
|
||||
Can_Msg_Change();
|
||||
//IGN_Detect();
|
||||
//CanNwHandle();
|
||||
}
|
||||
@ -101,7 +101,7 @@ void Apply_task(void)
|
||||
{
|
||||
Timer_10ms_flag = 0;
|
||||
XN_Pro();
|
||||
Can_Msg_Change();
|
||||
|
||||
// BAT_Voltage_Detect();
|
||||
// CanNwHandle();
|
||||
}
|
||||
@ -120,8 +120,8 @@ void Apply_task(void)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t xnp_counter,xnm_counter;
|
||||
uint8_t keyPressState = 0;
|
||||
uint8_t xn_counter,xn_tx_num;
|
||||
uint8_t keyPressState = 0,keyLongPressState=0;
|
||||
uint8_t btn_req,toggle_req,rotation_req;
|
||||
uint8_t xn_state;
|
||||
#define XN_STATE_INIT 0
|
||||
@ -185,13 +185,13 @@ void XN_StateMachine(void)
|
||||
if (GetIOState(KEYID_XNM) == 1 && GetIOState(KEYID_XNP) == 1)
|
||||
{
|
||||
xn_state = XN_STATE_IDLE;
|
||||
if (xn_dir == 2)
|
||||
if (xn_dir == 1)
|
||||
{
|
||||
xnm_counter++;
|
||||
xn_counter++;
|
||||
}
|
||||
else if (xn_dir == 1)
|
||||
else if (xn_dir == 2)
|
||||
{
|
||||
xnp_counter++;
|
||||
xn_counter--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -199,52 +199,51 @@ void XN_StateMachine(void)
|
||||
xn_state = 0;
|
||||
break;
|
||||
}
|
||||
//rotation_req = xn_state;
|
||||
//CAN_212.Msg_Part.Reserve_5 = xn_state;
|
||||
//CAN_212.Msg_Part.Reserve_6 = xnp_counter;
|
||||
//CAN_212.Msg_Part.Reserve_7 = xnm_counter;
|
||||
}
|
||||
|
||||
void XN_Scan(void)
|
||||
{
|
||||
if (keyPressState == KEY_NOPRESSED)
|
||||
if (keyPressState == KEY_NOPRESSED && keyLongPressState == KEY_NOPRESSED)
|
||||
{
|
||||
XN_StateMachine();
|
||||
}
|
||||
else
|
||||
{
|
||||
xnp_counter = 0;
|
||||
xnm_counter = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void XN_Pro(void)
|
||||
{
|
||||
static uint8_t xn_txstate=0;
|
||||
static uint8_t xn_txstate = 0;
|
||||
static uint8_t tx_counter = 0;
|
||||
switch (xn_txstate)
|
||||
{
|
||||
case 0:
|
||||
if (xnp_counter>0)
|
||||
if (xn_counter != xn_tx_num)
|
||||
{
|
||||
rotation_req = 1;
|
||||
xn_tx_num = xn_counter;
|
||||
xn_txstate++;
|
||||
ClearTxCounter();
|
||||
xnp_counter--;
|
||||
}
|
||||
else if (xnm_counter>0)
|
||||
{
|
||||
rotation_req = 2;
|
||||
xn_txstate++;
|
||||
ClearTxCounter();
|
||||
xnm_counter--;
|
||||
tx_counter = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
rotation_req = 0;
|
||||
ClearTxCounter();
|
||||
xn_txstate = 0;
|
||||
tx_counter++;
|
||||
if (tx_counter > 2)
|
||||
{
|
||||
xn_txstate++;
|
||||
ClearTxCounter();
|
||||
tx_counter = 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
tx_counter++;
|
||||
if (tx_counter > 2)
|
||||
{
|
||||
xn_txstate = 0;
|
||||
ClearTxCounter();
|
||||
tx_counter = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
xn_txstate = 0;
|
||||
break;
|
||||
@ -258,94 +257,136 @@ void KeyPro(void)//5ms
|
||||
uint8_t i,num,key;
|
||||
static uint16_t keyPressCounter;
|
||||
static uint8_t LastKey;
|
||||
if (keyPressState == KEY_NOPRESSED)
|
||||
static uint8_t KeyProState = 0,KeyProCounter=0;
|
||||
switch (KeyProState)
|
||||
{
|
||||
keyPressCounter = 0;
|
||||
case 0:
|
||||
keyLongPressState = 0;
|
||||
keyPressState = 0;
|
||||
for (i = 1; i < 6; i++)
|
||||
{
|
||||
key = GetKeyState(i);
|
||||
if (key == KEY_Long_PRESSED)
|
||||
{
|
||||
keyLongPressState = i;
|
||||
KeyProState = 1;
|
||||
break;
|
||||
}
|
||||
key = getKeyReleaseFlag(i);
|
||||
if (key == KEY_PRESSED)
|
||||
{
|
||||
keyPressState = i;
|
||||
KeyProState = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
break;
|
||||
case 1://长按
|
||||
if (keyLongPressState == KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 2;
|
||||
toggle_req = 0;
|
||||
}
|
||||
else if (keyLongPressState > KEY_NOPRESSED && keyLongPressState < KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 0;
|
||||
toggle_req = keyLongPressState+4;
|
||||
}
|
||||
ClearTxCounter();
|
||||
KeyProState++;
|
||||
KeyProCounter = 0;
|
||||
break;
|
||||
case 2://
|
||||
KeyProCounter++;
|
||||
if (KeyProCounter >= 4)
|
||||
{
|
||||
KeyProCounter = 0;
|
||||
ClearTxCounter();
|
||||
KeyProState++;
|
||||
}
|
||||
break;
|
||||
case 3://
|
||||
KeyProCounter++;
|
||||
if (KeyProCounter >= 4)
|
||||
{
|
||||
KeyProCounter = 0;
|
||||
ClearTxCounter();
|
||||
KeyProState++;
|
||||
}
|
||||
break;
|
||||
case 4://
|
||||
for (i = 1; i < 6; i++)
|
||||
{
|
||||
key = GetKeyState(i);
|
||||
if (key == KEY_PRESSED)
|
||||
if (key != KEY_NOPRESSED)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == 6)
|
||||
{
|
||||
keyPressState = KEY_NOPRESSED;
|
||||
}
|
||||
}
|
||||
|
||||
if (LastKey == keyPressState )
|
||||
{
|
||||
if (keyPressState == KEY_NOPRESSED)
|
||||
{
|
||||
KeyProState = 0;
|
||||
btn_req = 0;
|
||||
toggle_req = 0;
|
||||
return;
|
||||
keyLongPressState = 0;
|
||||
keyPressState = 0;
|
||||
ClearKeyState();
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (keyPressState == KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 1;
|
||||
toggle_req = 0;
|
||||
}
|
||||
else if (keyPressState > KEY_NOPRESSED && keyPressState < KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 0;
|
||||
toggle_req = keyPressState;
|
||||
}
|
||||
ClearTxCounter();
|
||||
KeyProState++;
|
||||
KeyProCounter = 0;
|
||||
|
||||
if (keyPressCounter > KEY_LONGPRESS_500MS)//长按
|
||||
{
|
||||
keyPressCounter = KEY_LONGPRESS_500MS;
|
||||
if (keyPressState == KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 2;
|
||||
toggle_req = 0;
|
||||
}
|
||||
else if (keyPressState > KEY_NOPRESSED && keyPressState < KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 0;
|
||||
toggle_req = keyPressState+4;
|
||||
}
|
||||
}
|
||||
else//短按
|
||||
{
|
||||
if (keyPressState == KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 1;
|
||||
toggle_req = 0;
|
||||
}
|
||||
else if (keyPressState > KEY_NOPRESSED && keyPressState < KEYID_MIDDLE)
|
||||
{
|
||||
btn_req = 0;
|
||||
toggle_req = keyPressState;
|
||||
}
|
||||
}
|
||||
if (keyPressCounter == 0)
|
||||
break;
|
||||
case 6://
|
||||
KeyProCounter++;
|
||||
if (KeyProCounter >= 4)
|
||||
{
|
||||
KeyProCounter = 0;
|
||||
ClearTxCounter();
|
||||
KeyProState++;
|
||||
}
|
||||
|
||||
keyPressCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyPressCounter = 0;
|
||||
LastKey = keyPressState;
|
||||
break;
|
||||
case 7://
|
||||
KeyProCounter++;
|
||||
if (KeyProCounter >= 4)
|
||||
{
|
||||
KeyProCounter = 0;
|
||||
ClearTxCounter();
|
||||
KeyProState++;
|
||||
}
|
||||
break;
|
||||
case 8://
|
||||
btn_req = 0;
|
||||
toggle_req = 0;
|
||||
KeyProState = 0;
|
||||
ClearKeyState();
|
||||
break;
|
||||
default:
|
||||
KeyProState = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Can_Msg_Change(void)
|
||||
{
|
||||
//CAN_45A.Msg_Part.SCM_PsngrSeatBeltWarnSts = sbrWarnState;
|
||||
CAN_212.Msg_Part.MSW_PsdBtnReq = btn_req;
|
||||
CAN_212.Msg_Part.MSW_RotReq = rotation_req;
|
||||
CAN_212.Msg_Part.MSW_TogReq = toggle_req;
|
||||
CAN_212.Msg_Part.MSW_BtnFltSts = 0;
|
||||
CAN_212.Msg_Part.MSW_RotStep = xn_tx_num;
|
||||
}
|
||||
|
||||
static uint8_t EEL_BUF[50];
|
||||
|
@ -13,7 +13,7 @@ typedef union{
|
||||
unsigned char MSW_TogReq:4;
|
||||
unsigned char MSW_BtnFltSts:1;//byte2
|
||||
unsigned char Reserve_1:7;
|
||||
unsigned char Reserve_2:8;//byte3
|
||||
unsigned char MSW_RotStep:8;//byte3
|
||||
unsigned char Reserve_3:8;//byte4
|
||||
unsigned char Reserve_4:8;//byte5
|
||||
unsigned char Reserve_5:8;//byte6
|
||||
|
@ -11,12 +11,15 @@ static uint16_t keydelay[KEY_NUM] = {0,0,0,0,0,};
|
||||
uint16_t g_adval[12];
|
||||
|
||||
#define KEY_DELAY_TIMES 20 //20Ms
|
||||
#define KEY_LONG_TIMES 500 //500Ms
|
||||
void ClearKeyState(void)
|
||||
{
|
||||
uint8_t i;
|
||||
for (i = 0; i < KEY_NUM; i++)
|
||||
{
|
||||
keystate[i] = 0;
|
||||
keyPressFlag[i] = 0;
|
||||
keyReleaseFlag[i] = 0;
|
||||
}
|
||||
}
|
||||
void setKeyPressFlag(uint8_t id)
|
||||
@ -57,24 +60,31 @@ uint8_t getKeyReleaseFlag(uint8_t id)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void KeyScan(void)
|
||||
void KeyScan(void)//1ms
|
||||
{
|
||||
uint8_t i,key,key_nopress;
|
||||
key_nopress = 0;
|
||||
uint8_t i,key;
|
||||
for (i = 0; i < KEY_NUM; i++)
|
||||
{
|
||||
key = GetIOState(i+1);
|
||||
if (key == KEY_PRESSED && keystate[i] == KEY_NOPRESSED)
|
||||
if (key == KEY_PRESSED)
|
||||
{
|
||||
keydelay[i]++;
|
||||
if (keydelay[i] >= KEY_DELAY_TIMES)
|
||||
{
|
||||
keystate[i] = KEY_PRESSED;
|
||||
setKeyPressFlag(i);
|
||||
|
||||
}
|
||||
if (keydelay[i] >= KEY_LONG_TIMES && keystate[i] != KEY_Long_PRESSED)
|
||||
{
|
||||
keydelay[i] = KEY_LONG_TIMES;
|
||||
setKeyPressFlag(i);//long press
|
||||
keystate[i] = KEY_Long_PRESSED;
|
||||
}
|
||||
|
||||
}
|
||||
else if(key == KEY_NOPRESSED)
|
||||
{
|
||||
if(keydelay[i] > 5)keydelay[i] = 5;
|
||||
if (keydelay[i] > 0)
|
||||
{
|
||||
keydelay[i]--;
|
||||
@ -86,14 +96,9 @@ void KeyScan(void)
|
||||
setKeyReleaseFlag(i);
|
||||
}
|
||||
keystate[i] = KEY_NOPRESSED;
|
||||
key_nopress++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (key_nopress == 6)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#define KEY_Long_PRESSED 2
|
||||
#define KEY_PRESSED 1
|
||||
#define KEY_NOPRESSED 0
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user