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
8f37b129
Commit
8f37b129
authored
Sep 19, 2025
by
何锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:首版提交
parent
00f9196a
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1447 additions
and
1144 deletions
+1447
-1144
settings.json
.vscode/settings.json
+4
-1
Barcode_Scanner.c
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
+24
-34
Check_Ctrl.c
YueJin_test_bench/source/Appliciation/Check_Ctrl.c
+175
-170
Check_Ctrl.h
YueJin_test_bench/source/Appliciation/Check_Ctrl.h
+1
-0
Display_Info.c
YueJin_test_bench/source/Appliciation/Display_Info.c
+538
-155
Key.h
YueJin_test_bench/source/Appliciation/Key.h
+7
-1
Key_user.c
YueJin_test_bench/source/Appliciation/Key_user.c
+148
-44
R485_Communication_Matrix.c
...est_bench/source/Appliciation/R485_Communication_Matrix.c
+375
-297
RTE_GPIO.c
YueJin_test_bench/source/Appliciation/RTE_GPIO.c
+28
-0
RTE_GPIO.h
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
+12
-9
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+37
-319
Task.h
YueJin_test_bench/source/Appliciation/Task.h
+0
-4
api_RS485.c
YueJin_test_bench/source/Appliciation/api_RS485.c
+74
-101
api_RS485.h
YueJin_test_bench/source/Appliciation/api_RS485.h
+10
-2
init.c
YueJin_test_bench/source/System/init.c
+14
-6
init.h
YueJin_test_bench/source/System/init.h
+0
-1
No files found.
.vscode/settings.json
View file @
8f37b129
...
...
@@ -55,5 +55,8 @@
"C_Cpp_Runner.useLeakSanitizer"
:
false
,
"C_Cpp_Runner.showCompilationTime"
:
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
YueJin_test_bench/source/Appliciation/Barcode_Scanner.c
View file @
8f37b129
...
...
@@ -35,7 +35,7 @@ uint8_t timenum = 0;
uint8_t
firstflag
=
0
;
uint8_t
RS485_data
[
64
];
uint8_t
checknumwrong
=
3
;
uint8_t
zhenduanflag
=
0
;
uint8_t
zhenduanflag
=
Data_Mode_Dot
;
uint8_t
clearOdoFlag
=
0
;
uint8_t
connectbleFlag
=
0
;
uint8_t
Auto_ONOFF
=
0
;
...
...
@@ -67,12 +67,12 @@ void get_key(void)
uint8_t
recvflag111
=
0
;
uint8_t
xierucishu
=
0
;
uint8_t
waittimer
;
uint8_t
saomafinish
;
;
uint8_t
saomafinish
;
void
datacheck
(
void
)
{
uint16_t
checksum
=
0
;
uint8_t
arraynum
=
0
;
if
(
zhenduanflag
==
0
)
if
(
zhenduanflag
==
Data_Mode_Dot
)
{
if
(
BarCode
[
0
]
==
0x59
&&
BarCode
[
1
]
==
0x44
)
{
...
...
@@ -203,7 +203,7 @@ void datacheck(void)
// RS485_TX_finish = 0;
}
}
else
if
(
zhenduanflag
==
1
)
else
if
(
zhenduanflag
==
Data_Mode_Write
)
{
if
(
BarCode
[
0
]
==
0x59
&&
BarCode
[
1
]
==
0x44
)
{
...
...
@@ -286,7 +286,6 @@ void datacheck(void)
{
zhenduansendStep
++
;
RS485_TX_finish
=
0
;
// zhenduanflag = 0;
saomafinish
=
1
;
waittimer
=
0
;
}
...
...
@@ -336,7 +335,7 @@ void datacheck(void)
}
}
}
else
if
(
zhenduanflag
==
2
)
else
if
(
zhenduanflag
==
Data_Mode_Read
)
{
// if(BarCode[0] == 0x59 && BarCode[1] == 0x44)
// {
...
...
@@ -374,7 +373,7 @@ void BarCodeDataGet(void)
{
// memcpy(barcode_Msg1,&mDataBufPtr1[6],34);
memset
(
barcode_Msg
,
0
,
34
);
General_Number_Disp
(
writefail
,
3
,
250
);
//
General_Number_Disp(writefail, 3, 250);
}
}
uint8_t
GetDataCompare
(
void
)
...
...
@@ -484,38 +483,29 @@ void Recv_Byte(void)
{
for
(
i
=
0
;
i
<
mDataBufLen
;
i
++
)
{
// if(i > 5)
// {
if
(
mDataBufPtr
[
i
-
1
]
==
0x59
&&
mDataBufPtr
[
i
]
==
0x44
)
{
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
[
i
-
1
]
==
0x59
&&
mDataBufPtr
[
i
]
==
0x44
)
{
k
=
i
-
1
;
}
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
)
{
break
;
}
memset
(
BarCode
,
0
,
sizeof
(
BarCode
));
for
(
j
=
0
;
j
<
i
+
1
;
j
++
)
{
BarCode
[
j
]
=
mDataBufPtr
[
j
];
}
testflag
=
0
;
break
;
}
else
memset
(
BarCode
,
0
,
sizeof
(
BarCode
));
for
(
j
=
0
;
j
<
i
+
1
;
j
++
)
{
testflag
=
1
;
// break;
BarCode
[
j
]
=
mDataBufPtr
[
j
];
}
// }
testflag
=
0
;
break
;
}
else
{
testflag
=
1
;
}
}
if
(
testflag
)
{
...
...
YueJin_test_bench/source/Appliciation/Check_Ctrl.c
View file @
8f37b129
This diff is collapsed.
Click to expand it.
YueJin_test_bench/source/Appliciation/Check_Ctrl.h
View file @
8f37b129
...
...
@@ -62,4 +62,5 @@ void MENU_CHECK_Init(void);
void
Req_To_Secure
(
void
);
void
Read_IPK_Session_Type
(
void
);
extern
uint8_t
TimeDelay_3s
(
void
);
#endif
YueJin_test_bench/source/Appliciation/Display_Info.c
View file @
8f37b129
This diff is collapsed.
Click to expand it.
YueJin_test_bench/source/Appliciation/Key.h
View file @
8f37b129
...
...
@@ -14,6 +14,7 @@ typedef enum
KEY_11
,
KEY_3
,
KEY_1
,
KEY_4
,
KEY_NUM_MAX
,
}
Key_Num_en_t
;
...
...
@@ -74,9 +75,14 @@ extern Key_Real_Status_en_t enKeyLeftRealStatus;
extern
Key_Real_Status_en_t
enKeyRightRealStatus
;
/*------------------------------------------------------------------------------------*/
extern
uint8_t
KeyStep
;
extern
void
Key_Init
(
void
);
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_Long_Press_Time
(
uint16_t
u16Time
);
extern
Key_Set_en_t
Key_Parameter_Set_Super_Long_Press_Time
(
uint32_t
u32Time
);
...
...
YueJin_test_bench/source/Appliciation/Key_user.c
View file @
8f37b129
...
...
@@ -17,7 +17,7 @@ void Key_Operation_SW5(Key_Event_en_t enKeyEvent) //下一步
{
MENU_CHECK_STEP_ADD
(
);
zhenduansendStep
=
0
;
zhenduanflag
=
0
;
zhenduanflag
=
Data_Mode_Dot
;
}
}
}
...
...
@@ -75,10 +75,9 @@ void Key_Operation_SW7(Key_Event_en_t enKeyEvent)
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
{
// upkeyflag = 1; //按键加
if
(
firstpowerflag
==
2
)
{
if
(
zhenduanflag
==
1
)
if
(
zhenduanflag
==
Data_Mode_Write
)
{
zhenduansendStep
=
5
;
}
...
...
@@ -98,7 +97,23 @@ void Key_Operation_SW8(Key_Event_en_t enKeyEvent)
{
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
)
{
...
...
@@ -114,20 +129,21 @@ void Key_Operation_SW2(Key_Event_en_t enKeyEvent)
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
{
if
(
LINE_OUT_NEG_0
1
==
1U
)
//上下ACC电
if
(
LINE_OUT_NEG_0
4
==
1U
)
//上下ACC电
{
LINE_OUT_NEG_0
1
=
0U
;
LINE_OUT_NEG_0
4
=
0U
;
Auto_ONOFF
=
3
;
}
else
{
LINE_OUT_NEG_0
1
=
1U
;
LINE_OUT_NEG_0
4
=
1U
;
Auto_ONOFF
=
0
;
}
// downkeyflag = 1; //数字减
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
Auto_ONOFF
=
1
;
//自动断电
LINE_OUT_NEG_04
=
0U
;
}
else
if
(
enKeyEvent
==
KEY_EVENT_SUPER_LONG_PRESS
)
{
...
...
@@ -140,22 +156,6 @@ void Key_Operation_SW3(Key_Event_en_t enKeyEvent)
{
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
(
clearOdoFlag
==
0
)
...
...
@@ -182,36 +182,23 @@ 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
(
firstpowerflag
==
2
)
{
if
(
Auto_ONOFF
!=
0
)
{
Auto_ONOFF
=
0
;
}
else
{
Auto_ONOFF
=
1
;
}
}
upkeyflag
=
1
;
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
}
else
if
(
enKeyEvent
==
KEY_EVENT_SUPER_LONG_PRESS
)
{
if
(
Get_Display_Type
(
)
==
2
)
{
MENU_CHECK_STEP_ADD
(
);
}
}
else
{
}
}
...
...
@@ -219,7 +206,7 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
{
if
(
enKeyEvent
==
KEY_EVENT_SHORT_PRESS
)
{
Confirmkeyflag
=
1
;
}
else
if
(
enKeyEvent
==
KEY_EVENT_LONG_PRESS
)
{
...
...
@@ -234,7 +221,112 @@ void Key_Operation_SW6(Key_Event_en_t enKeyEvent)
}
}
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
{
upkeytime
=
0
;
Press_to_up
=
0
;
}
}
void
downkeyserve
(
void
)
{
if
(
downkeyflag
==
1
)
{
if
(
downkeytime
<=
10
)
{
downkeytime
++
;
Press_to_down
=
1
;
}
else
{
downkeytime
=
0
;
Press_to_down
=
0
;
downkeyflag
=
0
;
}
}
else
{
downkeytime
=
0
;
Press_to_down
=
0
;
}
}
void
confirmkeyserve
(
void
)
{
if
(
Confirmkeyflag
==
1
)
{
if
(
Confirmkeytime
<=
10
)
{
Confirmkeytime
++
;
queren
=
1
;
}
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
)
{
...
...
@@ -287,6 +379,17 @@ Key_Real_Status_en_t Key_Real_sw8(void)
}
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
)
{
...
...
@@ -339,7 +442,7 @@ Key_Real_Status_en_t Key_Real_sw6(void)
Key_Real_Status_en_t
enKeyRealStatus
=
KEY_LINE_LOOSEN
;
if
(
SW
9
==
0U
)
if
(
SW
6
==
0U
)
{
enKeyRealStatus
=
KEY_LINE_PRESS
;
}
...
...
@@ -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_sw3
,
Key_Operation_SW3
},
//SW1+
{
KEY_TYPE_LINE
,
Key_Real_sw6
,
Key_Operation_SW6
},
//SW1+
{
KEY_TYPE_LINE
,
Key_Real_sw9
,
Key_Operation_SW9
},
//SW1+
};
YueJin_test_bench/source/Appliciation/R485_Communication_Matrix.c
View file @
8f37b129
This diff is collapsed.
Click to expand it.
YueJin_test_bench/source/Appliciation/RTE_GPIO.c
View file @
8f37b129
...
...
@@ -120,6 +120,34 @@ void RTE_GPIO_Init(void)
gpio_temp
.
enGPIOAltFun
=
GPIO_ALTER_FUN_1
;
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
.
enGPIOPIN
=
GPIO_PIN_10
;
gpio_temp
.
enGPIOMode
=
GPIO_MODE_PORT
;
...
...
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
View file @
8f37b129
...
...
@@ -45,16 +45,11 @@
#define LINE_OUT_PARK GPIO_OUT_PORT10_PIN06
#define LINE_OUT_EPS GPIO_OUT_PORT10_PIN06
#define Light_Out GPIO_IN_PORT10_PIN09
#define POWER_CTRL_KL30 GPIO_OUT_PORT10_PIN13
#define POWER_CTRL_KL15 GPIO_OUT_PORT10_PIN12
#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_2_Ctrl GPIO_OUT_PORT09_PIN05
#define NEG_3_Ctrl GPIO_OUT_PORT09_PIN04
...
...
@@ -86,7 +81,7 @@
#define LINE_OUT_POS_05 GPIO_OUT_APORT00_PIN06
// #define LINE_OUT_POS_08 GPIO_OUT_PORT08_PIN09
// #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_02 GPIO_OUT_PORT09_PIN05 //BAT
...
...
@@ -96,7 +91,6 @@
#define LINE_OUT_NEG_07 GPIO_OUT_PORT10_PIN07
#define LINE_OUT_NEG_08 GPIO_OUT_PORT10_PIN03
#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
...
...
@@ -115,12 +109,21 @@
#define LeftturnSignal GPIO_OUT_APORT00_PIN11 //左转灯
#define RightturnSignal GPIO_OUT_APORT00_PIN10 //右转灯
#define highbeam GPIO_OUT_PORT10_PIN
13
//远光灯
#define Lowbeam
GPIO_OUT_PORT10_PIN10
//近光
#define highbeam GPIO_OUT_PORT10_PIN
01
//远光灯
#define Lowbeam
GPIO_OUT_PORT10_PIN02
//近光
#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_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:
/******************************************************************************
...
...
YueJin_test_bench/source/Appliciation/Task.c
View file @
8f37b129
This diff is collapsed.
Click to expand it.
YueJin_test_bench/source/Appliciation/Task.h
View file @
8f37b129
...
...
@@ -5,10 +5,6 @@
extern
uint8_t
AutoFlag
;
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
downkeyflag
;
extern
uint8_t
Confirmkeyflag
;
...
...
YueJin_test_bench/source/Appliciation/api_RS485.c
View file @
8f37b129
...
...
@@ -34,6 +34,8 @@ uint8_t RS485_TX_finish = 0;
#define END_LEN 2
#define DATA_FRAME_TX_PERIOD_COUNT 10
#define UDS485SendTime 10
#define Dot485SendTime 1
_ID0X40h_Data
R485_ID40h
;
_ID0X48h_Data
R485_ID48h
;
_ID0X41h_Data
R485_ID41h
;
...
...
@@ -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
)
{
uint8_t
dataBuf
[
256
];
...
...
@@ -386,7 +398,6 @@ uint32_t R485_Send(const uint16_t cmdID, const uint8_t* pData, uint8_t len)
}
uint8_t
sendmsgAll
[
8
];
uint32_t
sendnum
=
1
;
uint8_t
getbanbenhaoflag
=
0
;
uint32_t
send80time
=
0
;
uint8_t
BlueTooth
=
0
;
...
...
@@ -396,70 +407,34 @@ uint8_t RS485_User_Tx_Data(void)
uint32_t
sendfinishflag
=
0
;
switch
(
RS485_TxControl
.
sendIndex
)
{
// case RS485_Tx_ID0
4_Idx:
// if(MENU_CHECK_STEP
!= 16
)
case
RS485_Tx_IDA
4_Idx
:
// if(MENU_CHECK_STEP
== 0
)
// {
// sendfinishflag = R485_Send_0x
04();
// sendfinishflag = R485_Send_0x
A4();
// RS485_TX_finish = 1;
// if(sendfinishflag == 0)
// {
// if(RS485_TX_finish == 1)
// {
// RS485_send_time = 0;
// RS485_TxControl.sendIndex ++;
// }
// RS485_send_time = 0;
// RS485_TxControl.sendIndex ++;
// }
// }
// 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
++
;
}
}
}
else
{
RS485_TxControl
.
sendIndex
++
;
}
//
}
break
;
case
RS485_Tx_IDD0_Idx
:
if
((
MENU_CHECK_STEP
!=
16
)
&&
(
clearOdoFlag
==
0
))
{
sendfinishflag
=
R485_Send_0xD0
();
RS485_TX_finish
=
1
;
if
(
sendfinishflag
==
0
)
{
if
(
RS485_TX_finish
==
1
)
{
RS485_send_time
=
0
;
RS485_TxControl
.
sendIndex
++
;
}
RS485_send_time
=
0
;
RS485_TxControl
.
sendIndex
++
;
}
}
else
{
RS485_TxControl
.
sendIndex
++
;
}
break
;
case
RS485_Tx_IDD1_Idx
:
if
((
MENU_CHECK_STEP
!=
16
)
&&
(
clearOdoFlag
==
0
))
{
if
(
dianliangflag
==
0
)
{
sendfinishflag
=
R485_Send_0xD1
();
...
...
@@ -472,27 +447,16 @@ uint8_t RS485_User_Tx_Data(void)
RS485_TX_finish
=
1
;
dianliangflag
=
0
;
}
}
else
{
RS485_TxControl
.
sendIndex
++
;
}
break
;
case
RS485_Tx_IDD2_Idx
:
if
(
MENU_CHECK_STEP
!=
16
)
sendfinishflag
=
R485_Send_0xD2
();
RS485_TX_finish
=
1
;
if
(
sendfinishflag
==
0
)
{
sendfinishflag
=
R485_Send_0xD2
();
RS485_TX_finish
=
1
;
if
(
sendfinishflag
==
0
)
{
if
(
RS485_TX_finish
==
1
)
{
RS485_send_time
=
0
;
RS485_TxControl
.
sendIndex
++
;
}
}
RS485_send_time
=
0
;
RS485_TxControl
.
sendIndex
++
;
}
else
{
...
...
@@ -501,31 +465,16 @@ uint8_t RS485_User_Tx_Data(void)
break
;
case
RS485_Tx_IDD3_Idx
:
// if(MENU_CHECK_STEP != 20)
// {
if
(
clearOdoFlag
==
0
)
{
sendfinishflag
=
R485_Send_0xD3
();
RS485_TX_finish
=
1
;
if
(
sendfinishflag
==
0
)
{
if
(
RS485_TX_finish
==
1
)
{
RS485_send_time
=
0
;
RS485_TxControl
.
sendIndex
++
;
}
RS485_send_time
=
0
;
RS485_TxControl
.
sendIndex
++
;
}
}
// }
else
{
RS485_TxControl
.
sendIndex
++
;
}
break
;
case
RS485_Tx_ID80_Idx
:
if
(
clearOdoFlag
==
0
)
{
if
(
MENU_CHECK_STEP
==
16
)
{
BlueTooth
=
1
;
...
...
@@ -554,16 +503,9 @@ uint8_t RS485_User_Tx_Data(void)
{
RS485_send_time
=
0
;
RS485_TX_finish
=
1
;
if
(
RS485_TX_finish
==
1
)
{
RS485_TxControl
.
sendIndex
++
;
}
RS485_TxControl
.
sendIndex
++
;
}
}
else
{
RS485_TxControl
.
sendIndex
++
;
}
break
;
...
...
@@ -575,30 +517,61 @@ uint8_t RS485_User_Tx_Data(void)
}
}
uint8_t
backt
ime
=
0
;
uint8_t
SendT
ime
=
0
;
void
backsend
(
void
)
{
if
(
clearOdoFlag
==
0
)
if
(
zhenduanflag
==
Data_Mode_Write
)
{
backtime
=
1
;
SendTime
=
UDS485SendTime
;
}
else
{
backtime
=
1
;
}
if
(
zhenduanflag
==
1
)
{
backtime
=
10
;
SendTime
=
Dot485SendTime
;
}
if
(
RS485_send_time
>=
backt
ime
)
if
(
RS485_send_time
>=
SendT
ime
)
{
RS485_send_time
=
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状态计时函数
*/
...
...
YueJin_test_bench/source/Appliciation/api_RS485.h
View file @
8f37b129
...
...
@@ -13,6 +13,14 @@
#define RS485_RECEIVE_ID_0X4A 0X4A
#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
{
// RS485_Tx_ID04_Idx = 0,
...
...
@@ -69,11 +77,11 @@ extern uint32_t RS485_send_time;
extern
uint8_t
RS485_TX_finish
;
extern
uint8_t
BlueTooth
;
extern
uint8_t
dianliangflag
;
// extern uint32_t RS485_send_num;
extern
uint32_t
sendnum
;
extern
uint8_t
sendmsgAll
[
8
];
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
uint8_t
RS485_User_Tx_Data
(
void
);
void
backsend
(
void
);
extern
void
TX_RX_485_service
(
void
);
extern
void
Bluetoothname
(
void
);
#endif
/* API_ADC_H_ */
YueJin_test_bench/source/System/init.c
View file @
8f37b129
...
...
@@ -64,7 +64,6 @@ void Sys_Startup_Pre_Init(void)
* \attention
* \retval None
******************************************************************************/
uint8_t
firstIGON
=
0xFF
;
void
Sys_Startup_Init
(
void
)
{
RTC_Pre_Init
(
);
//首次上电
...
...
@@ -93,7 +92,6 @@ void Sys_Startup_Init(void)
loc_config
.
pfnUARTConfirmCallBack
=
0
;
loc_config
.
pfnUARTErrHandleCallBack
=
0
;
loc_config
.
pfnUARTReadMsgCallBack
=
UART_Put
;
firstIGON
=
1
;
UART_Init
(
UART_RLIN30
,
&
loc_config
);
loc_config
.
enUARTLINMode
=
MODE_UART
;
loc_config
.
u32UARTbps
=
9600
;
...
...
@@ -118,11 +116,21 @@ void Sys_Startup_Init(void)
LINE_OUT_NEG_03
=
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,打开上面两行的注释即可*/
// firstpowerflag = 2;
EN_5V_CUT_ENABLE
=
1
;
// 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
;
}
/***********************************************************************
...
...
YueJin_test_bench/source/System/init.h
View file @
8f37b129
...
...
@@ -29,7 +29,6 @@ extern void Sys_Startup_Pre_Init(void);
extern
void
Sys_Startup_Init
(
void
);
extern
void
Sys_Sleep_Init
(
void
);
extern
void
System_Wakeup_Init
(
void
);
extern
uint8_t
firstIGON
;
#ifdef __cplusplus
...
...
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