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
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 [])
...
@@ -334,7 +334,11 @@ void Can_Set_Buff_021(uint8_t CopyData [])
pCANMsg
->
Sig
.
Battery_temp
=
1
;
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
[])
void
Can_Set_Buff_284
(
uint8_t
CopyData
[])
{
{
uint8_t
i
=
0u
;
uint8_t
i
=
0u
;
...
@@ -359,7 +363,100 @@ void Can_Set_Buff_284(uint8_t CopyData [])
...
@@ -359,7 +363,100 @@ void Can_Set_Buff_284(uint8_t CopyData [])
{
{
pCANMsg
->
Sig
.
NFC_C_card
=
2
;
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
};
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};
...
@@ -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_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
};
extern
uint8_t
Data_786_4
[
8
]
=
{
0x30
,
0x00
,
0x00
,
0xAA
,
0xAA
,
0xAA
,
0xAA
,
0xAA
};
void
Can_Set_Buff_786
(
uint8_t
CopyData
[])
void
Can_Set_Buff_786
(
uint8_t
CopyData
[])
{
{
uint8_t
i
=
0u
;
uint8_t
i
=
0u
;
...
...
YueJin_test_bench/source/Appliciation/CAN_APP.h
View file @
ec5b69ef
...
@@ -263,6 +263,7 @@ typedef union
...
@@ -263,6 +263,7 @@ typedef union
void
CAN_MSG_COUNTER_PLUS
(
void
);
void
CAN_MSG_COUNTER_PLUS
(
void
);
uint8_t
CrcCheckSum
(
uint8_t
*
data
,
uint8_t
len
);
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_200
(
uint8_t
CopyData
[]);
void
Can_Set_Buff_481
(
uint8_t
CopyData
[]);
void
Can_Set_Buff_481
(
uint8_t
CopyData
[]);
...
@@ -282,4 +283,6 @@ extern void Get_CAN_CH4_ID_750_Diagnosis_return2();
...
@@ -282,4 +283,6 @@ extern void Get_CAN_CH4_ID_750_Diagnosis_return2();
extern
uint8_t
VSpeed
;
extern
uint8_t
VSpeed
;
extern
uint8_t
Student_Card
;
// uint8_t Student_Card_Last;
#endif
#endif
YueJin_test_bench/source/Appliciation/Display_Info.c
View file @
ec5b69ef
...
@@ -30,9 +30,22 @@ Learning_Card learning_card = {
...
@@ -30,9 +30,22 @@ Learning_Card learning_card = {
uint8_t
canData_banben
[
14
];
uint8_t
canData_banben
[
14
];
uint16_t
decimal_candata
[
14
];
uint16_t
decimal_candata
[
14
];
uint8_t
canData1
[
8
];
//暂存软件版本号数据用
uint8_t
canData1
[
8
];
//暂存软件版本号数据用
uint8_t
canData4
[
8
];
//暂存硬件版本号数据用
uint8_t
canData2
[
14
];
uint8_t
canData2
[
14
];
uint8_t
canData3
[
10
];
uint8_t
canData3
[
10
];
uint8_t
canData4
[
8
];
//暂存硬件版本号数据用
uint8_t
can_car_Data
[
8
];
uint8_t
canData_card
[
8
];
//暂存NFC查卡数据用
uint8_t
can_car_return_Data
[
8
];
static
uint32_t
VoltageADC_CH_9_value_
=
0
;
static
uint32_t
VoltageADC_CH_9_value_
=
0
;
static
uint32_t
VoltageADC_CH_9_value
=
0
;
static
uint32_t
VoltageADC_CH_9_value
=
0
;
...
@@ -3104,9 +3117,21 @@ void Display_PageNum(void)
...
@@ -3104,9 +3117,21 @@ void Display_PageNum(void)
}
}
}
}
uint16_t
Display_Time
=
0
;
uint16_t
Display_Time
=
0
;
/**
* @brief 在TFT液晶屏上显示数字
*
* 该函数在指定的起始位置(StartX, StartY)显示一个数字m_NUM。
* 数字将以千位、百位、十位和个位的顺序显示,并根据CbkCycle的值决定循环显示的周期。
*
* @param StartX 数字显示的起始X坐标
* @param StartY 数字显示的起始Y坐标
* @param m_NUM 要显示的数字
* @param CbkCycle 回调循环周期(未在当前代码中使用)
*/
void
Display_Num
(
uint16_t
StartX
,
uint16_t
StartY
,
uint16_t
m_NUM
,
uint8_t
CbkCycle
)
void
Display_Num
(
uint16_t
StartX
,
uint16_t
StartY
,
uint16_t
m_NUM
,
uint8_t
CbkCycle
)
{
{
uint16_t
Num
=
0
;
uint16_t
Num
=
0
;
...
@@ -4476,30 +4501,53 @@ void Display_Send_ODO(uint8_t fuel)
...
@@ -4476,30 +4501,53 @@ void Display_Send_ODO(uint8_t fuel)
extern
uint8_t
test2
[]
=
{
0x01
,
0x02
,
0x03
,
0x04
,
0xE1
,
0xF2
,
0xA3
,
0xB4
};
extern
uint8_t
test2
[]
=
{
0x01
,
0x02
,
0x03
,
0x04
,
0xE1
,
0xF2
,
0xA3
,
0xB4
};
void
Display_Chaka_Model
(
void
)
void
Display_Chaka_Model
(
void
)
{
{
// TFT_LCD_Draw_Box(20, 40, 140, 160, TFT_LCD_FILL_FULL, TFT_LCD_TYPE_CLR);
Display_buffer_ID
(
20
,
80
);
Display_buffer_ID
(
20
,
110
);
Display_buffer_ID
(
20
,
140
);
if
(
Require_card_flag
==
1
)
Display_buffer_ID
(
20
,
170
);
{
Display_buffer_ID
(
20
,
200
);
Display_Num
(
0
,
0
,
can_car_return_Data
[
6
],
1
);
Display_buffer_ID
(
20
,
230
);
Display_buffer_Data
(
test2
,
60
,
80
);
Display_buffer_Data
(
test2
,
60
,
110
);
Display_buffer_Data
(
test2
,
60
,
140
);
Display_buffer_Data
(
test2
,
60
,
170
);
Display_buffer_Data
(
test2
,
60
,
200
);
Display_buffer_Data
(
test2
,
60
,
230
);
// Display_buffer_Data(test2,60,80);
// Display_buffer_Data(test2,60,110);
// Display_buffer_Data(test2,60,140);
// Display_buffer_ID(20,80);
// Display_buffer_ID(20,110);
// Display_buffer_ID(20,140);
Display_buffer_ID
(
20
,
150
);
Display_buffer_ID
(
20
,
170
);
Display_buffer_ID
(
20
,
190
);
Display_buffer_ID
(
20
,
210
);
Display_buffer_ID
(
20
,
230
);
Display_buffer_ID
(
20
,
250
);
if
(
can_car_return_Data
[
1
]
==
1
)
{
Display_buffer_Data
(
can_car_return_Data
,
60
,
150
);
}
else
if
(
can_car_return_Data
[
1
]
==
2
)
{
Display_buffer_Data
(
can_car_return_Data
,
60
,
170
);
}
else
if
(
can_car_return_Data
[
1
]
==
3
)
{
Display_buffer_Data
(
can_car_return_Data
,
60
,
190
);
}
else
if
(
can_car_return_Data
[
1
]
==
4
)
{
Display_buffer_Data
(
can_car_return_Data
,
60
,
210
);
}
else
if
(
can_car_return_Data
[
1
]
==
5
)
{
Display_buffer_Data
(
can_car_return_Data
,
60
,
230
);
}
else
if
(
can_car_return_Data
[
1
]
==
6
)
{
Display_buffer_Data
(
can_car_return_Data
,
60
,
250
);
Require_card_flag
=
0
;
}
}
if
(
can_car_return_Data
[
1
]
==
6
)
{
Require_card_flag
=
0
;
memset
(
can_car_return_Data
,
0
,
sizeof
(
can_car_return_Data
));
}
}
}
void
Display_buffer_ID
(
uint16_t
X
,
uint8_t
Y
)
void
Display_buffer_ID
(
uint16_t
X
,
uint8_t
Y
)
{
{
...
@@ -4510,54 +4558,152 @@ void Display_interface_learning_card(uint16_t X,uint8_t Y)
...
@@ -4510,54 +4558,152 @@ void Display_interface_learning_card(uint16_t X,uint8_t Y)
{
{
Learning_Card
*
ptr
=
&
learning_card
;
Learning_Card
*
ptr
=
&
learning_card
;
for
(
uint8_t
i
=
0
;
i
<
5
;
i
++
)
if
(
Study_Flag
==
1
)
{
{
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
going
[
i
]]);
/*对号显示*/
}
if
(
can_car_Data
[
1
]
==
0x10
)
/*进行中*/
for
(
uint8_t
i
=
0
;
i
<
7
;
i
++
)
{
{
for
(
uint8_t
i
=
0
;
i
<
5
;
i
++
)
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
+
50
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
succeed
[
i
]]);
{
}
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
going
[
i
]]);
for
(
uint8_t
i
=
0
;
i
<
4
;
i
++
)
}
{
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
+
100
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
fail
[
i
]]);
}
else
if
(
can_car_Data
[
2
]
==
0x20
)
/*成功*/
}
{
for
(
uint8_t
i
=
0
;
i
<
7
;
i
++
)
Study_Flag
=
0
;
{
for
(
uint8_t
i
=
0
;
i
<
7
;
i
++
)
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
+
150
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
sameID
[
i
]]);
{
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
succeed
[
i
]]);
}
}
else
if
(
can_car_Data
[
3
]
==
0x30
)
/*失败*/
{
Study_Flag
=
0
;
for
(
uint8_t
i
=
0
;
i
<
4
;
i
++
)
{
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
fail
[
i
]]);
}
}
else
if
(
can_car_Data
[
4
]
==
0x40
)
/*卡已存在*/
{
Study_Flag
=
0
;
for
(
uint8_t
i
=
0
;
i
<
7
;
i
++
)
{
TFT_LCD_Draw_Bmp
(
X
+
i
*
10
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
ptr
->
sameID
[
i
]]);
}
}
}
}
memset
(
can_car_Data
,
0
,
sizeof
(
can_car_Data
));
}
}
//uint8_t test1[] = {0x01,0x02,0x03,0x0F,0x0A,0x0C,0x0D,0x0E};//原始
//uint8_t test1[] = {0x01,0x02,0x03,0x0F,0x0A,0x0C,0x0D,0x0E};//原始
//0101EF87FFCB02FF//屏幕显示
//0101EF87FFCB02FF//屏幕显示
void
Display_buffer_Data
(
uint8_t
buffer
[]
,
uint16_t
X
,
uint8_t
Y
)
void
Display_buffer_Data
(
uint8_t
buffer
[]
,
uint16_t
X
,
uint8_t
Y
)
{
{
// uint8_t high[8] = {};
// uint8_t low[8] = {};
// uint8_t x_offset = 10;
// for (uint8_t i = 0; i < 8; i++)
// {
// high[i] = (buffer[i] >> 4) & 0x0F;
// low[i] = buffer[i] & 0x0F;
// TFT_LCD_Draw_Box(X, Y, (X + i * 20), Y+2, TFT_LCD_FILL_FULL, TFT_LCD_TYPE_CLR);
// if ( high[i] >= 10 && high[i] <= 36 )
// {
// TFT_LCD_Draw_Bmp(X + i * 20, Y, (uint8_t *)FONT_TABLE_15[high[i]+1]);
// }
// if( low[i] >= 10 && low[i] <= 36 )
// {
// TFT_LCD_Draw_Bmp((X+10) + i * 20, Y, (uint8_t *)FONT_TABLE_15[low[i]+1]);
// }
// if( high[i] >= 0 && high[i] <=9 )
// {
// TFT_LCD_Draw_Bmp((X+2) + i * 20, (Y+2), (uint8_t *)FONT_TABLE_15[high[i]]);
// }
// if( low[i] >= 0 && low [i] <=9 )
// {
// TFT_LCD_Draw_Bmp((X+12) + i * 20, (Y+2), (uint8_t *)FONT_TABLE_15[low[i]]);
// }
// }
uint8_t
high
[
8
]
=
{};
uint8_t
high
[
8
]
=
{};
uint8_t
low
[
8
]
=
{};
uint8_t
low
[
8
]
=
{};
uint8_t
x_offset
=
10
;
uint16_t
start_x
=
X
;
// 保存起始X坐标
for
(
uint8_t
i
=
0
;
i
<
8
;
i
++
)
for
(
uint8_t
i
=
0
;
i
<
8
;
i
++
)
{
{
high
[
i
]
=
(
buffer
[
i
]
>>
4
)
&
0x0F
;
high
[
i
]
=
(
buffer
[
i
]
>>
4
)
&
0x0F
;
low
[
i
]
=
buffer
[
i
]
&
0x0F
;
low
[
i
]
=
buffer
[
i
]
&
0x0F
;
TFT_LCD_Draw_Box
(
X
,
Y
,
(
X
+
i
*
20
),
Y
+
2
,
TFT_LCD_FILL_FULL
,
TFT_LCD_TYPE_CLR
);
if
(
high
[
i
]
>=
10
&&
high
[
i
]
<=
36
)
// 绘制背景框 - 调整大小以容纳两个字符
TFT_LCD_Draw_Box
(
start_x
+
i
*
20
,
Y
,
start_x
+
i
*
20
+
18
,
Y
+
18
,
TFT_LCD_FILL_FULL
,
TFT_LCD_TYPE_CLR
);
// 绘制高4位 - 保持FONT_TABLE_15参数不变
if
(
high
[
i
]
>=
10
&&
high
[
i
]
<=
36
)
// 保持原始范围检查
{
{
TFT_LCD_Draw_Bmp
(
X
+
i
*
20
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
high
[
i
]
+
1
]);
TFT_LCD_Draw_Bmp
(
start_x
+
i
*
20
+
1
,
Y
+
1
,
(
uint8_t
*
)
FONT_TABLE_15
[
high
[
i
]
+
1
]);
}
}
if
(
low
[
i
]
>=
10
&&
low
[
i
]
<=
36
)
else
if
(
high
[
i
]
>=
0
&&
high
[
i
]
<=
9
)
{
{
TFT_LCD_Draw_Bmp
(
(
X
+
10
)
+
i
*
20
,
Y
,
(
uint8_t
*
)
FONT_TABLE_15
[
low
[
i
]
+
1
]);
TFT_LCD_Draw_Bmp
(
start_x
+
i
*
20
+
1
,
Y
+
1
,
(
uint8_t
*
)
FONT_TABLE_15
[
high
[
i
]
]);
}
}
if
(
high
[
i
]
>=
0
&&
high
[
i
]
<=
9
)
// 绘制低4位 - 保持FONT_TABLE_15参数不变
if
(
low
[
i
]
>=
10
&&
low
[
i
]
<=
36
)
// 保持原始范围检查
{
{
TFT_LCD_Draw_Bmp
(
(
X
+
2
)
+
i
*
20
,
(
Y
+
2
),
(
uint8_t
*
)
FONT_TABLE_15
[
high
[
i
]
]);
TFT_LCD_Draw_Bmp
(
start_x
+
i
*
20
+
10
,
Y
+
1
,
(
uint8_t
*
)
FONT_TABLE_15
[
low
[
i
]
+
1
]);
}
}
if
(
low
[
i
]
>=
0
&&
low
[
i
]
<=
9
)
else
if
(
low
[
i
]
>=
0
&&
low
[
i
]
<=
9
)
{
{
TFT_LCD_Draw_Bmp
(
(
X
+
12
)
+
i
*
20
,
(
Y
+
2
)
,
(
uint8_t
*
)
FONT_TABLE_15
[
low
[
i
]]);
TFT_LCD_Draw_Bmp
(
start_x
+
i
*
20
+
10
,
Y
+
1
,
(
uint8_t
*
)
FONT_TABLE_15
[
low
[
i
]]);
}
}
}
}
// uint8_t high[8] = {};
// uint8_t low[8] = {};
// uint16_t start_x = X; // 保存起始X坐标
// uint8_t letter_width = 9; // 假设一个字母的宽度为9像素
// for (uint8_t i = 0; i < 8; i++)
// {
// high[i] = (buffer[i] >> 4) & 0x0F;
// low[i] = buffer[i] & 0x0F;
// // 计算当前字节的X坐标,在第0个和第6个字节之间增加间隔
// uint16_t current_x = start_x + i * 20;
// if (i > 0) {
// current_x += (i - 1) / 6 * letter_width; // 在第0和第6字节之间增加间隔
// }
// // 绘制背景框
// TFT_LCD_Draw_Box(current_x, Y, current_x + 18, Y + 18, TFT_LCD_FILL_FULL, TFT_LCD_TYPE_CLR);
// // 绘制高4位
// if (high[i] >= 10 && high[i] <= 36)
// {
// TFT_LCD_Draw_Bmp(current_x + 1, Y + 1, (uint8_t *)FONT_TABLE_15[high[i] + 1]);
// }
// else if (high[i] >= 0 && high[i] <= 9)
// {
// TFT_LCD_Draw_Bmp(current_x + 1, Y + 1, (uint8_t *)FONT_TABLE_15[high[i]]);
// }
// // 绘制低4位
// if (low[i] >= 10 && low[i] <= 36)
// {
// TFT_LCD_Draw_Bmp(current_x + 10, Y + 1, (uint8_t *)FONT_TABLE_15[low[i] + 1]);
// }
// else if (low[i] >= 0 && low[i] <= 9)
// {
// TFT_LCD_Draw_Bmp(current_x + 10, Y + 1, (uint8_t *)FONT_TABLE_15[low[i]]);
// }
// }
}
}
//测试用
//测试用
...
@@ -4594,7 +4740,7 @@ void Display_Can_Data(uint8_t Data , uint16_t X,uint8_t Y)
...
@@ -4594,7 +4740,7 @@ void Display_Can_Data(uint8_t Data , uint16_t X,uint8_t Y)
const
uint16_t
CurrentDigitNum15PosX_1
[]
=
{
75
};
const
uint16_t
CurrentDigitNum15PosX_1
[]
=
{
75
};
const
uint16_t
CurrentDigitNum15PosX_2
[]
=
{
108
,
98
};
const
uint16_t
CurrentDigitNum15PosX_2
[]
=
{
108
,
98
};
uint8_t
banbenhao
[
5
]
=
{
0x56
,
0x31
,
0x30
,
0x3
1
,
0xff
};
uint8_t
banbenhao
[
5
]
=
{
0x56
,
0x31
,
0x30
,
0x3
2
,
0xff
};
void
Display_Can_Receive_Data
(
uint16_t
X
,
uint8_t
Y
)
void
Display_Can_Receive_Data
(
uint16_t
X
,
uint8_t
Y
)
{
{
if
(
canData3
[
9
]
==
0XFF
&&
canData2
[
13
]
==
0XFF
&&
All_Flag
.
u8flag
[
8
]
==
1
)
if
(
canData3
[
9
]
==
0XFF
&&
canData2
[
13
]
==
0XFF
&&
All_Flag
.
u8flag
[
8
]
==
1
)
...
@@ -4731,6 +4877,26 @@ void Display_flag(uint8_t Check_Steps)
...
@@ -4731,6 +4877,26 @@ void Display_flag(uint8_t Check_Steps)
}
}
}
}
void
Page_Num_Display
(
uint8_t
page
)
{
// switch (page)
// {
// case 1:
// break;
// case 2:
// break;
// case 3:
// break;
// case 4:
// break;
// default:
// break;
// }
}
void
Buzzer_Start
(
void
)
void
Buzzer_Start
(
void
)
...
...
YueJin_test_bench/source/Appliciation/Display_Info.h
View file @
ec5b69ef
...
@@ -68,16 +68,16 @@ void Display_Init(void);
...
@@ -68,16 +68,16 @@ void Display_Init(void);
extern
void
Send_ODO_Init
(
void
);
extern
void
Send_ODO_Init
(
void
);
void
Display_Send_ODO
(
uint8_t
fuel
);
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_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_Can_Data
(
uint8_t
Data
,
uint16_t
X
,
uint8_t
Y
);
void
Display_buffer_ID
(
uint16_t
X
,
uint8_t
Y
);
void
Display_buffer_ID
(
uint16_t
X
,
uint8_t
Y
);
void
Display_Chaka_Model
(
void
);
extern
void
Display_Chaka_Model
(
void
);
void
Display_interface_learning_card
(
uint16_t
X
,
uint8_t
Y
);
extern
void
Display_interface_learning_card
(
uint16_t
X
,
uint8_t
Y
);
void
Display_Can_Receive_Data
(
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
);
void
Display_Set_Buff
(
void
);
extern
void
Send_Init
(
void
);
extern
void
Send_Init
(
void
);
...
@@ -119,8 +119,6 @@ extern uint8_t canData2[14];
...
@@ -119,8 +119,6 @@ extern uint8_t canData2[14];
extern
uint8_t
canData3
[
10
];
extern
uint8_t
canData3
[
10
];
extern
uint8_t
canData4
[
8
];
extern
uint8_t
canData4
[
8
];
//uint8_t VoltageADC_CH_9_value;
extern
uint8_t
can_car_return_Data
[
8
];
//extern u8_All_Flag_t All_Flag;
#define PCodeText_Space_size 2//故障文字 英文空格的像素数
#define PCodeText_Space_size 2//故障文字 英文空格的像素数
#endif
#endif
YueJin_test_bench/source/Appliciation/Key.h
View file @
ec5b69ef
...
@@ -148,12 +148,12 @@ extern uint8_t canData4[8];
...
@@ -148,12 +148,12 @@ extern uint8_t canData4[8];
extern
uint32_t
text5
[
5
];
extern
uint32_t
text5
[
5
];
extern
uint8_t
banbenhao
[
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_1X6_Y16
[];
extern
const
unsigned
char
gImage_Dyy_words_2X6_Y46
[];
extern
const
unsigned
char
gImage_Dyy_words_2X6_Y46
[];
extern
const
unsigned
char
gImage_Dyy_words_5X6_Y137
[];
extern
const
unsigned
char
gImage_Dyy_words_5X6_Y137
[];
extern
uint8_t
Study_Flag
;
extern
uint8_t
Require_card_flag
;
#endif
#endif
YueJin_test_bench/source/Appliciation/Key_user.c
View file @
ec5b69ef
...
@@ -30,6 +30,10 @@ uint8_t NFC_C_card = 0;
...
@@ -30,6 +30,10 @@ uint8_t NFC_C_card = 0;
uint8_t
Side_bracket
=
0
;
uint8_t
Side_bracket
=
0
;
uint8_t
Hill_Descent_control
=
0
;
uint8_t
Hill_Descent_control
=
0
;
uint8_t
bluetooth_phone
=
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
;
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)
...
@@ -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
)
void
Key_Operation_SW2
(
Key_Event_en_t
enKeyEvent
)
{
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
{
{
// memset(can_car_Data, 0, sizeof(can_car_Data));
memset
(
&
All_Flag
,
0
,
sizeof
(
All_Flag
));
memset
(
&
All_Flag
,
0
,
sizeof
(
All_Flag
));
All_Flag
.
u8flag
[
2
]
=
1
;
All_Flag
.
u8flag
[
2
]
=
1
;
Student_Card_can_command
=
1
;
Display_TFT_Clear
();
Display_TFT_Clear
();
Display_Chaka_Model
();
//查卡模式
Study_Flag
=
1
;
}
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
{
...
@@ -143,6 +151,7 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
...
@@ -143,6 +151,7 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
All_Flag
.
u8flag
[
6
]
=
1
;
All_Flag
.
u8flag
[
6
]
=
1
;
Check_Steps
=
0
;
Check_Steps
=
0
;
Display_TFT_Clear
();
Display_TFT_Clear
();
//General_Number_Disp(Flag_SW6_Dis, 200, 20);
//General_Number_Disp(Flag_SW6_Dis, 200, 20);
...
@@ -155,6 +164,7 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
...
@@ -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
)
void
Key_Operation_SW7
(
Key_Event_en_t
enKeyEvent
)
{
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
...
@@ -162,9 +172,11 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
...
@@ -162,9 +172,11 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
memset
(
&
All_Flag
,
0
,
sizeof
(
All_Flag
));
memset
(
&
All_Flag
,
0
,
sizeof
(
All_Flag
));
All_Flag
.
u8flag
[
7
]
=
1
;
All_Flag
.
u8flag
[
7
]
=
1
;
Check_Steps
=
0
;
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
)
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)
...
@@ -139,32 +139,33 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
// POWER_CTRL_KL30_B = 1;
// POWER_CTRL_KL30_B = 1;
//POWER_CTRL_KL15 = 1;
//POWER_CTRL_KL15 = 1;
if
(
Student_Card_can_command
==
1
)
// testtime++;
{
Student_Card
++
;
// if((testtime > 50)&&(testtime < 70))
// {
}
// can_flag=1;
else
// }
{
// else if((testtime > 80)&&(testtime < 100))
Student_Card
=
0
;
// {
}
// can_flag=2;
// if(Student_Card>=6)
// }
// else if((testtime > 120)&&(testtime < 140))
// {
// can_flag=3;
// }
// else if((testtime > 160)&&(testtime < 180))
// {
// can_flag=4;
// }
// if(testtime > 200)
// {
// {
//
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];
...
@@ -14,7 +14,9 @@ extern uint8_t Openble[11];
extern
uint8_t
canData_banben
[
14
];
extern
uint8_t
canData_banben
[
14
];
extern
uint16_t
decimal_candata
[
14
];
extern
uint16_t
decimal_candata
[
14
];
extern
uint8_t
can_flag
;
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
);
void
Sys_Run_Mode_Pseudo_Real_Time_Tasks
(
void
);
...
...
YueJin_test_bench/source/Driver/CAN/RSCAN.c
View file @
ec5b69ef
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#include "RSCAN.h"
#include "RSCAN.h"
#include "RSCAN_Table.h"
#include "RSCAN_Table.h"
#include "string.h"
#include "string.h"
#include "Key.h"
#define RSCAN_CKSCLK_IPERI2_CLKC 40000000UL
/*PPLLCLK2*/
#define RSCAN_CKSCLK_IPERI2_CLKC 40000000UL
/*PPLLCLK2*/
#define RSCAN_CKSCLK_ICANOSC_CLK_XIN_CAN 8000000UL
/*MainOSC*/
#define RSCAN_CKSCLK_ICANOSC_CLK_XIN_CAN 8000000UL
/*MainOSC*/
#define RSCAN_F_CAN RSCAN_CKSCLK_IPERI2_CLKC
#define RSCAN_F_CAN RSCAN_CKSCLK_IPERI2_CLKC
...
@@ -132,7 +132,7 @@ extern uint8_t Diagnosis_banbenhao_flag;
...
@@ -132,7 +132,7 @@ extern uint8_t Diagnosis_banbenhao_flag;
extern
uint8_t
canData1
[
8
];
extern
uint8_t
canData1
[
8
];
extern
uint8_t
canData2
[
14
];
extern
uint8_t
canData2
[
14
];
extern
uint8_t
canData3
[
9
];
extern
uint8_t
canData3
[
10
];
typedef
struct
typedef
struct
{
{
...
@@ -874,6 +874,55 @@ void RSCAN0_CH4_Receive(CAN_Frame_st_t *pstCANFrame)
...
@@ -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);
...
@@ -207,5 +207,10 @@ extern void RSCAN0_CH5_TX_ISR(void);
extern
unsigned
long
Get_RSCAN_Err_St
(
void
);
extern
unsigned
long
Get_RSCAN_Err_St
(
void
);
extern
uint8_t
canData4
[
8
];
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
#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