Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈家乐
jiancetai
Commits
ec5b69ef
Commit
ec5b69ef
authored
Jun 13, 2025
by
huangguoqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:增加NFC添卡和查卡功能
parent
6d8ad57d
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
426 additions
and
92 deletions
+426
-92
CAN_APP.c
YueJin_test_bench/source/Appliciation/CAN_APP.c
+99
-1
CAN_APP.h
YueJin_test_bench/source/Appliciation/CAN_APP.h
+3
-0
Display_Info.c
YueJin_test_bench/source/Appliciation/Display_Info.c
+217
-51
Display_Info.h
YueJin_test_bench/source/Appliciation/Display_Info.h
+5
-7
Key.h
YueJin_test_bench/source/Appliciation/Key.h
+3
-3
Key_user.c
YueJin_test_bench/source/Appliciation/Key_user.c
+16
-4
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+24
-23
Task.h
YueJin_test_bench/source/Appliciation/Task.h
+3
-1
RSCAN.c
YueJin_test_bench/source/Driver/CAN/RSCAN.c
+51
-2
RSCAN.h
YueJin_test_bench/source/Driver/CAN/RSCAN.h
+5
-0
No files found.
YueJin_test_bench/source/Appliciation/CAN_APP.c
View file @
ec5b69ef
...
...
@@ -334,7 +334,11 @@ void Can_Set_Buff_021(uint8_t CopyData [])
pCANMsg
->
Sig
.
Battery_temp
=
1
;
}
}
//NFC
/*学卡请求*/
uint8_t
Data_284_chacard
[
8
]
=
{
0x01
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
/*查卡*/
uint8_t
Data_284_tiancard
[
8
]
=
{
0x02
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
/*添卡*/
uint8_t
Data_284_shancard
[
8
]
=
{
0x03
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
/*删卡*/
void
Can_Set_Buff_284
(
uint8_t
CopyData
[])
{
uint8_t
i
=
0u
;
...
...
@@ -359,7 +363,100 @@ void Can_Set_Buff_284(uint8_t CopyData [])
{
pCANMsg
->
Sig
.
NFC_C_card
=
2
;
}
//添卡请求
if
(
Student_Card
==
1
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_tiancard
[
i
];
}
}
else
if
(
Student_Card
==
2
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_tiancard
[
i
];
}
}
else
if
(
Student_Card
==
3
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_tiancard
[
i
];
}
}
else
if
(
Student_Card
==
4
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_tiancard
[
i
];
}
}
else
if
(
Student_Card
==
5
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_tiancard
[
i
];
}
Student_Card_can_command
=
0
;
Student_Card
=
0
;
}
/*查卡指令发送*/
if
(
Query_Card
==
1
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_chacard
[
i
];
}
}
else
if
(
Query_Card
==
2
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_chacard
[
i
];
}
}
else
if
(
Query_Card
==
3
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_chacard
[
i
];
}
}
else
if
(
Query_Card
==
4
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_chacard
[
i
];
}
}
else
if
(
Query_Card
==
5
)
{
for
(
i
=
0u
;
i
<
8u
;
i
++
)
{
pCANMsg
->
Msg
[
i
]
=
Data_284_chacard
[
i
];
}
Query_Card_can_command
=
2
;
Query_Card
=
0
;
}
}
void
Student_Card_Triggers
(
void
)
{
// switch(Student_Card)
// {
// case 1:
// break;
// case 2:
// break;
// }
}
/*软件版本号*/
extern
uint8_t
Data_786_1
[
8
]
=
{
0x03
,
0x22
,
0x10
,
0x24
,
0xAA
,
0xAA
,
0xAA
,
0xAA
};
...
...
@@ -368,6 +465,7 @@ extern uint8_t Data_786_2[8]= {0x30,0x00,0x00,0xAA,0xAA,0xAA,0xAA,0xAA};
extern
uint8_t
Data_786_3
[
8
]
=
{
0x03
,
0x22
,
0xF1
,
0x93
,
0xAA
,
0xAA
,
0xAA
,
0xAA
};
extern
uint8_t
Data_786_4
[
8
]
=
{
0x30
,
0x00
,
0x00
,
0xAA
,
0xAA
,
0xAA
,
0xAA
,
0xAA
};
void
Can_Set_Buff_786
(
uint8_t
CopyData
[])
{
uint8_t
i
=
0u
;
...
...
YueJin_test_bench/source/Appliciation/CAN_APP.h
View file @
ec5b69ef
...
...
@@ -263,6 +263,7 @@ typedef union
void
CAN_MSG_COUNTER_PLUS
(
void
);
uint8_t
CrcCheckSum
(
uint8_t
*
data
,
uint8_t
len
);
void
Student_Card_Triggers
(
void
);
void
Can_Set_Buff_200
(
uint8_t
CopyData
[]);
void
Can_Set_Buff_481
(
uint8_t
CopyData
[]);
...
...
@@ -282,4 +283,6 @@ extern void Get_CAN_CH4_ID_750_Diagnosis_return2();
extern
uint8_t
VSpeed
;
extern
uint8_t
Student_Card
;
// uint8_t Student_Card_Last;
#endif
YueJin_test_bench/source/Appliciation/Display_Info.c
View file @
ec5b69ef
This diff is collapsed.
Click to expand it.
YueJin_test_bench/source/Appliciation/Display_Info.h
View file @
ec5b69ef
...
...
@@ -68,16 +68,16 @@ void Display_Init(void);
extern
void
Send_ODO_Init
(
void
);
void
Display_Send_ODO
(
uint8_t
fuel
);
void
Display_flag
(
uint8_t
Check_Steps
);
void
Display_flag
(
uint8_t
Check_Steps
);
void
Display_buffer_Data
(
uint8_t
buffer
[]
,
uint16_t
X
,
uint8_t
Y
);
void
Display_Can_Data
(
uint8_t
Data
,
uint16_t
X
,
uint8_t
Y
);
void
Display_buffer_ID
(
uint16_t
X
,
uint8_t
Y
);
void
Display_Chaka_Model
(
void
);
void
Display_interface_learning_card
(
uint16_t
X
,
uint8_t
Y
);
extern
void
Display_Chaka_Model
(
void
);
extern
void
Display_interface_learning_card
(
uint16_t
X
,
uint8_t
Y
);
void
Display_Can_Receive_Data
(
uint16_t
X
,
uint8_t
Y
);
void
Page_Num_Display
(
uint8_t
page
);
/*显示界面重构*/
void
Display_Set_Buff
(
void
);
extern
void
Send_Init
(
void
);
...
...
@@ -119,8 +119,6 @@ extern uint8_t canData2[14];
extern
uint8_t
canData3
[
10
];
extern
uint8_t
canData4
[
8
];
//uint8_t VoltageADC_CH_9_value;
//extern u8_All_Flag_t All_Flag;
extern
uint8_t
can_car_return_Data
[
8
];
#define PCodeText_Space_size 2//故障文字 英文空格的像素数
#endif
YueJin_test_bench/source/Appliciation/Key.h
View file @
ec5b69ef
...
...
@@ -148,12 +148,12 @@ extern uint8_t canData4[8];
extern
uint32_t
text5
[
5
];
extern
uint8_t
banbenhao
[
5
];
extern
uint8_t
can_car_Data
[
8
];
extern
const
unsigned
char
gImage_Dyy_words_1X6_Y16
[];
extern
const
unsigned
char
gImage_Dyy_words_2X6_Y46
[];
extern
const
unsigned
char
gImage_Dyy_words_5X6_Y137
[];
extern
uint8_t
Study_Flag
;
extern
uint8_t
Require_card_flag
;
#endif
YueJin_test_bench/source/Appliciation/Key_user.c
View file @
ec5b69ef
...
...
@@ -30,6 +30,10 @@ uint8_t NFC_C_card = 0;
uint8_t
Side_bracket
=
0
;
uint8_t
Hill_Descent_control
=
0
;
uint8_t
bluetooth_phone
=
0
;
uint8_t
Student_Card
=
0
;
uint8_t
Student_Card_can_command
=
0
;
uint8_t
Query_Card
=
0
;
uint8_t
Query_Card_can_command
=
0
;
uint8_t
Diagnosis_banbenhao_flag
=
0
;
uint8_t
Diagnosis_banbenhao_flag_
=
0
;
...
...
@@ -70,15 +74,19 @@ void Key_Operation_SW1(Key_Event_en_t enKeyEvent)
{
}
}
uint8_t
Study_Flag
=
0
;
void
Key_Operation_SW2
(
Key_Event_en_t
enKeyEvent
)
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
{
// memset(can_car_Data, 0, sizeof(can_car_Data));
memset
(
&
All_Flag
,
0
,
sizeof
(
All_Flag
));
All_Flag
.
u8flag
[
2
]
=
1
;
Student_Card_can_command
=
1
;
Display_TFT_Clear
();
Display_Chaka_Model
();
//查卡模式
Study_Flag
=
1
;
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
...
...
@@ -143,6 +151,7 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
All_Flag
.
u8flag
[
6
]
=
1
;
Check_Steps
=
0
;
Display_TFT_Clear
();
//General_Number_Disp(Flag_SW6_Dis, 200, 20);
...
...
@@ -155,6 +164,7 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
{
}
}
uint8_t
Require_card_flag
=
0
;
void
Key_Operation_SW7
(
Key_Event_en_t
enKeyEvent
)
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
...
...
@@ -162,9 +172,11 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
memset
(
&
All_Flag
,
0
,
sizeof
(
All_Flag
));
All_Flag
.
u8flag
[
7
]
=
1
;
Check_Steps
=
0
;
Display_TFT_Clear
();
Query_Card_can_command
=
1
;
Require_card_flag
=
1
;
//Display_TFT_Clear();
//界面学卡:
Display_interface_learning_card
(
20
,
80
);
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
...
...
YueJin_test_bench/source/Appliciation/Task.c
View file @
ec5b69ef
...
...
@@ -139,32 +139,33 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
// POWER_CTRL_KL30_B = 1;
//POWER_CTRL_KL15 = 1;
// testtime++;
// if((testtime > 50)&&(testtime < 70))
// {
// can_flag=1;
// }
// else if((testtime > 80)&&(testtime < 100))
// {
// can_flag=2;
// }
// else if((testtime > 120)&&(testtime < 140))
// {
// can_flag=3;
// }
// else if((testtime > 160)&&(testtime < 180))
// {
// can_flag=4;
// }
// if(testtime > 200)
if
(
Student_Card_can_command
==
1
)
{
Student_Card
++
;
}
else
{
Student_Card
=
0
;
}
// if(Student_Card>=6)
// {
//
testtime =
0;
//
Student_Card=
0;
// }
// General_Number_Disp(test, 100 , 100 );
if
(
Query_Card_can_command
==
1
)
{
Query_Card
++
;
}
else
{
Query_Card
=
0
;
}
Display_interface_learning_card
(
0
,
50
);
Display_Chaka_Model
();
//查卡模式
}
/*=================================================================*/
...
...
YueJin_test_bench/source/Appliciation/Task.h
View file @
ec5b69ef
...
...
@@ -14,7 +14,9 @@ extern uint8_t Openble[11];
extern
uint8_t
canData_banben
[
14
];
extern
uint16_t
decimal_candata
[
14
];
extern
uint8_t
can_flag
;
extern
uint8_t
Student_Card_can_command
;
extern
uint8_t
Query_Card
;
extern
uint8_t
Query_Card_can_command
;
void
Sys_Run_Mode_Pseudo_Real_Time_Tasks
(
void
);
...
...
YueJin_test_bench/source/Driver/CAN/RSCAN.c
View file @
ec5b69ef
...
...
@@ -8,7 +8,7 @@
#include "RSCAN.h"
#include "RSCAN_Table.h"
#include "string.h"
#include "Key.h"
#define RSCAN_CKSCLK_IPERI2_CLKC 40000000UL
/*PPLLCLK2*/
#define RSCAN_CKSCLK_ICANOSC_CLK_XIN_CAN 8000000UL
/*MainOSC*/
#define RSCAN_F_CAN RSCAN_CKSCLK_IPERI2_CLKC
...
...
@@ -132,7 +132,7 @@ extern uint8_t Diagnosis_banbenhao_flag;
extern
uint8_t
canData1
[
8
];
extern
uint8_t
canData2
[
14
];
extern
uint8_t
canData3
[
9
];
extern
uint8_t
canData3
[
10
];
typedef
struct
{
...
...
@@ -874,6 +874,55 @@ void RSCAN0_CH4_Receive(CAN_Frame_st_t *pstCANFrame)
}
}
/*学卡信息回传*/
if
(
pstCANFrame
->
u32CANID
==
0x453u
)
{
if
(
Student_Card_can_command
==
0
)
{
if
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0x00
)
{
//默认值
can_car_Data
[
0
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
}
else
if
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0x10
)
{
//进行中
can_car_Data
[
1
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
}
if
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0x20
)
{
//成功
can_car_Data
[
2
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
}
if
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0x30
)
{
//失败
can_car_Data
[
3
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
}
if
(
pstCANFrame
->
unCANData
.
u8CANData
[
7
]
==
0x40
)
{
//已经有相同卡存在
can_car_Data
[
4
]
=
pstCANFrame
->
unCANData
.
u8CANData
[
7
];
}
}
if
(
Query_Card_can_command
==
2
)
{
memcpy
(
canData_card
,
pstCANFrame
->
unCANData
.
u8CANData
,
pstCANFrame
->
u8CANLEN
);
for
(
uint8_t
i
=
0
;
i
<
8
;
i
++
)
{
if
(
Require_card_flag
==
1
)
{
can_car_return_Data
[
i
]
=
canData_card
[
i
];
}
}
}
}
}
}
...
...
YueJin_test_bench/source/Driver/CAN/RSCAN.h
View file @
ec5b69ef
...
...
@@ -207,5 +207,10 @@ extern void RSCAN0_CH5_TX_ISR(void);
extern
unsigned
long
Get_RSCAN_Err_St
(
void
);
extern
uint8_t
canData4
[
8
];
extern
uint8_t
can_car_Data
[
8
];
extern
uint8_t
Student_Card_can_command
;
extern
uint8_t
Query_Card_can_command
;
extern
uint8_t
can_car_return_Data
[
8
];
extern
uint8_t
canData_card
[
8
];
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment