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
fcc380c4
Commit
fcc380c4
authored
Dec 05, 2024
by
梁百峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:雅迪检测台写入
parent
c6cad5b7
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
341 additions
and
121 deletions
+341
-121
R485_Communication_Matrix.c
source/R485_Communication_Matrix.c
+86
-10
R485_Communication_Matrix.h
source/R485_Communication_Matrix.h
+2
-0
io_config.c
source/app/api_gpio/io_config.c
+56
-18
api_timer.c
source/app/api_timer/api_timer.c
+4
-2
app_tft.c
source/app/app_tft/app_tft.c
+31
-4
bsp_app_led_output.c
source/bsp_source/bsp_button/bsp_app_led_output.c
+1
-1
bsp_button.c
source/bsp_source/bsp_button/bsp_button.c
+9
-5
bsp_motor.c
source/bsp_source/bsp_motor/bsp_motor.c
+1
-1
mfs_uart.c
source/bsp_source/mfs_uart/mfs_uart.c
+1
-1
main.c
source/main.c
+146
-77
main.h
source/main.h
+2
-0
CAN_CFG.C
source/nm_osek/CAN_CFG.C
+2
-2
No files found.
source/R485_Communication_Matrix.c
View file @
fcc380c4
...
...
@@ -14,6 +14,7 @@ uint32_t R485_Send_0x40(void)
case
2
:
break
;
case
3
:
// memset(R485_ID40h.Msg, 0, 64);
break
;
case
4
:
break
;
...
...
@@ -69,8 +70,8 @@ uint32_t R485_Send_0x41(void)
R485_ID41h
.
Sig
.
CruiseMode
=
0x0
;
//巡航
R485_ID41h
.
Sig
.
ICMCalculatesVehicleSpeed
=
0
;
//速度 = (X * 0.512 * 3.14 * 1.05) / 30
//
R485_ID41h.Sig.TotalBatterySOC = 0x0; //电量
// R485_ID41h.Sig.VehicleStatus = 0x
0
; //整车状态
R485_ID41h
.
Sig
.
TotalBatterySOC
=
0x0
;
//电量
// R485_ID41h.Sig.VehicleStatus = 0x
3
; //整车状态
// R485_ID41h.Sig.SpeedGear = 0x2; //挡位
...
...
@@ -197,7 +198,56 @@ uint32_t R485_Send_0x41(void)
R485_ID41h
.
Sig
.
RotorLocked
=
0
;
break
;
case
3
:
R485_ID41h
.
Sig
.
EleHeadlightFunctionSettings
=
0x1
;
// 自动大灯
if
(
clearodoflag
==
1
)
{
R485_ID41h
.
Sig
.
EleHeadlightFunctionSettings
=
0x1
;
// 自动大灯
R485_ID41h
.
Sig
.
ChargeState
=
0x0
;
//充电状态
R485_ID41h
.
Sig
.
SlopePattern
=
0x0
;
//跛行
R485_ID41h
.
Sig
.
CushionSensorStatus
=
0x1
;
//坐垫压力
R485_ID41h
.
Sig
.
SlopeDescentFunctionStatus
=
0x0
;
//陡坡缓降
R485_ID41h
.
Sig
.
TCSActivation
=
0x1
;
//TCS激活
R485_ID41h
.
Sig
.
TCSFunctionalStatus
=
0x0
;
//TCS状态
R485_ID41h
.
Sig
.
ElectronicCushionStatus
=
0x1
;
//座桶开关
R485_ID41h
.
Sig
.
SupportSwitchSignalFeedback
=
0x0
;
//边撑
R485_ID41h
.
Sig
.
CruiseMode
=
0x0
;
//巡航
R485_ID41h
.
Sig
.
ICMCalculatesVehicleSpeed
=
0x300
;
//速度 = (X * 0.512 * 3.14 * 1.05) / 30 22km
R485_ID41h
.
Sig
.
TotalBatterySOC
=
0x2C
;
//电量
R485_ID41h
.
Sig
.
VehicleStatus
=
0x3
;
//整车状态
R485_ID41h
.
Sig
.
SpeedGear
=
0x1
;
//挡位
R485_ID41h
.
Sig
.
TotalBatteryVoltage
=
0x4B
;
//总电池电压
R485_ID41h
.
Sig
.
IOTRealTime_Hour
=
0x16
;
//时间:时
R485_ID41h
.
Sig
.
IOTRealTime_Minute
=
0x16
;
//时间:分
R485_ID41h
.
Sig
.
IOTRealTime_Second
=
0
;
//时间:秒
R485_ID41h
.
Sig
.
HandlebarFaultIndicator
=
0
;
R485_ID41h
.
Sig
.
UUpBridgeArmMosFault
=
0
;
R485_ID41h
.
Sig
.
UDownBridgeArmMosFault
=
0
;
R485_ID41h
.
Sig
.
VUpBridgeArmMosFault
=
0
;
R485_ID41h
.
Sig
.
VDownBridgeArmMosFault
=
0
;
R485_ID41h
.
Sig
.
WUpBridgeArmMosFault
=
0
;
R485_ID41h
.
Sig
.
WDownBridgeArmMosFault
=
0
;
R485_ID41h
.
Sig
.
MCUFaultStateU_PhaseHallFault
=
0
;
R485_ID41h
.
Sig
.
MCUFaultStateV_PhaseHallFault
=
0
;
R485_ID41h
.
Sig
.
MCUFaultStateW_PhaseHallFault
=
0
;
R485_ID41h
.
Sig
.
MCUFaultStatus_HandlebarFault
=
0
;
R485_ID41h
.
Sig
.
BMS_0CommunicationStatus
=
0
;
R485_ID41h
.
Sig
.
MCUCommunicationStatus
=
0
;
R485_ID41h
.
Sig
.
ALMCommunicationStatus
=
0
;
R485_ID41h
.
Sig
.
ICMCommunicationStatus
=
0
;
R485_ID41h
.
Sig
.
BrakeLeverFault
=
0
;
R485_ID41h
.
Sig
.
PhaseLossFault
=
0
;
R485_ID41h
.
Sig
.
MCUOverTempProtection
=
0
;
R485_ID41h
.
Sig
.
MotorOvertempProtection
=
0
;
R485_ID41h
.
Sig
.
RotorLocked
=
0
;
}
else
{
R485_ID41h
.
Sig
.
EleHeadlightFunctionSettings
=
0x1
;
// 自动大灯
R485_ID41h
.
Sig
.
ChargeState
=
0x0
;
//充电状态
R485_ID41h
.
Sig
.
SlopePattern
=
0x0
;
//跛行
R485_ID41h
.
Sig
.
CushionSensorStatus
=
0x1
;
//坐垫压力
...
...
@@ -241,6 +291,8 @@ uint32_t R485_Send_0x41(void)
R485_ID41h
.
Sig
.
MCUOverTempProtection
=
0
;
R485_ID41h
.
Sig
.
MotorOvertempProtection
=
0
;
R485_ID41h
.
Sig
.
RotorLocked
=
0
;
}
break
;
case
4
:
R485_ID41h
.
Sig
.
EleHeadlightFunctionSettings
=
0x0
;
// 自动大灯
...
...
@@ -530,7 +582,7 @@ uint32_t R485_Send_0x41(void)
break
;
case
10
:
R485_ID41h
.
Sig
.
ICMCalculatesVehicleSpeed
=
0x300
;
//速度 = (X * 0.512 * 3.14 * 1.05) / 30 88km
R485_ID41h
.
Sig
.
TotalBatterySOC
=
0xC
6
;
//电量
R485_ID41h
.
Sig
.
TotalBatterySOC
=
0xC
8
;
//电量
R485_ID41h
.
Sig
.
VehicleStatus
=
0x3
;
//整车状态
R485_ID41h
.
Sig
.
SpeedGear
=
0
;
//挡位
//功率暂空一会做
...
...
@@ -716,16 +768,12 @@ uint32_t R485_Send_0x47(void)
break
;
case
4
:
// zhenduanflag = 0;
// Port_SetPinConfig(1, 19, &stc_OUT_pin_config); // VBAT~
// Port_SetPinConfig(1, 20, &stc_OUT_pin_config); // VBAT
// Port_SetPinConfig(1, 21, &stc_OUT_pin_config); //DC12V
// Port_SetPinConfig(1, 15, &stc_OUT_pin_config); // ACC1
Port_SetPortPinLevel
(
1
,
19
,
PortGpioLow
);
Port_SetPortPinLevel
(
1
,
20
,
PortGpioLow
);
Port_SetPortPinLevel
(
1
,
21
,
PortGpioLow
);
Port_SetPortPinLevel
(
1
,
15
,
PortGpioLow
);
g_Stage
=
1
;
// zhenduansendStep = 0;
// zhenduanflag = 0;
break
;
...
...
@@ -733,7 +781,11 @@ uint32_t R485_Send_0x47(void)
break
;
}
RS485_TX_finish
=
1
;
u32sendendflag
=
R485_Send
(
0x47
,
R485_zhenduan_Msg
,
length
);
if
(
zhenduansendStep
!=
4
)
{
u32sendendflag
=
R485_Send
(
0x47
,
R485_zhenduan_Msg
,
length
);
}
RS485_send_time
=
0
;
Delay
(
10
);
Port_SetPortPinLevel
(
1
,
4
,
PortGpioLow
);
...
...
@@ -817,3 +869,27 @@ uint32_t R485_Send_Line_0x47(uint8_t n)
return
u32sendendflag
;
}
uint32_t
R485_Send_clear
(
void
)
{
uint8_t
length
;
HJ_OtherKeyCurrent
.
count
=
3
;
uint32_t
u32sendendflag
=
0
;
if
(
RS485_TX_finish
==
0
)
{
if
(
RS485_send_time
>
3000
)
{
Port_SetPortPinLevel
(
1
,
4
,
PortGpioHigh
);
Delay
(
10
);
RS485_TX_finish
=
1
;
u32sendendflag
=
R485_Send
(
0x41
,
R485_ID41h
.
Msg
,
sizeof
(
R485_ID41h
.
Msg
));
RS485_send_time
=
0
;
Delay
(
10
);
Port_SetPortPinLevel
(
1
,
4
,
PortGpioLow
);
Delay
(
10
);
RS485_TX_finish
=
1
;
}
}
RS485_TX_finish
=
1
;
Port_SetPortPinLevel
(
1
,
4
,
PortGpioLow
);
return
u32sendendflag
;
}
\ No newline at end of file
source/R485_Communication_Matrix.h
View file @
fcc380c4
...
...
@@ -1129,4 +1129,6 @@ extern uint32_t R485_Send_0x42(void);
extern
uint32_t
R485_Send_0x47
(
void
);
extern
uint32_t
R485_Send_Line_0x47
(
uint8_t
n
);
extern
uint32_t
R485_Send_clear
(
void
);
#endif
source/app/api_gpio/io_config.c
View file @
fcc380c4
...
...
@@ -76,6 +76,8 @@ void Api_GPIO_Init(void)
// Port_SetPinConfig(1, 7, &stc_IN_pin_config); //不知道什么功能连着5V电源
Port_SetPinConfig
(
1
,
10
,
&
stc_IN_pin_config
);
// 左转向输出采AD
// Port_SetPinConfig(1, 19, &stc_IN_pin_config); // VBAT~
Port_EnableInput
();
//-----------------------OUT---------------------------//
...
...
@@ -101,6 +103,7 @@ void Api_GPIO_Init(void)
Port_SetPinConfig
(
2
,
21
,
&
stc_OUT_pin_config
);
//双闪按键
Port_SetPinConfig
(
2
,
14
,
&
stc_OUT_pin_config
);
//按键+
Port_SetPinConfig
(
2
,
13
,
&
stc_OUT_pin_config
);
//按键-
Port_SetPinConfig
(
2
,
9
,
&
stc_OUT_pin_config
);
//确认键
Port_SetPinConfig
(
0
,
30
,
&
stc_OUT_pin_config
);
//蓝牙指示灯
Port_SetPinConfig
(
2
,
0
,
&
stc_OUT_pin_config
);
//远光
...
...
@@ -154,6 +157,7 @@ void Api_GPIO_Init(void)
.
enGpioDirection
=
PortGpioOutput
,
.
enGpioInitOutputLevel
=
PortGpioHigh
,
};
// Port_SetPinConfig(2, 28, &stc_OUT_pin_high_config); //AIRBAG_OFF_OUT
}
...
...
@@ -177,7 +181,10 @@ void Line_Temp(void)
LINE_TurnRightOFF
;
LINE_ABSON
;
LINE_BLEOFF
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
case
1
:
...
...
@@ -189,7 +196,7 @@ void Line_Temp(void)
LINE_ABSOFF
;
LINE_BLEOFF
;
lineNum
=
5
;
if
(
zhenduanflag
!=
2
)
if
(
zhenduanflag
!=
1
)
{
if
(
LineGetSta
.
lowlight1
!=
1
)
{
...
...
@@ -206,7 +213,7 @@ void Line_Temp(void)
LINE_ABSOFF
;
LINE_BLEOFF
;
lineNum
=
6
;
if
(
zhenduanflag
!=
2
)
if
(
zhenduanflag
!=
1
)
{
if
(
LineGetSta
.
highlight1
!=
1
)
{
...
...
@@ -223,7 +230,7 @@ void Line_Temp(void)
LINE_ABSOFF
;
LINE_BLEOFF
;
lineNum
=
7
;
if
(
zhenduanflag
!=
2
)
if
(
zhenduanflag
!=
1
)
{
if
(
LineGetSta
.
weizhilight1
!=
1
)
{
...
...
@@ -239,7 +246,10 @@ void Line_Temp(void)
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEOFF
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
case
5
:
LINE_LampLowOFF
;
...
...
@@ -249,7 +259,10 @@ void Line_Temp(void)
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEOFF
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
case
6
:
LINE_LampLowOFF
;
...
...
@@ -259,7 +272,10 @@ void Line_Temp(void)
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEOFF
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
case
7
:
LINE_LampLowOFF
;
...
...
@@ -270,7 +286,7 @@ void Line_Temp(void)
LINE_ABSON
;
LINE_BLEOFF
;
lineNum
=
4
;
if
(
zhenduanflag
!=
2
)
if
(
zhenduanflag
!=
1
)
{
if
(
LineGetSta
.
ABSlight1
!=
1
)
{
...
...
@@ -287,7 +303,7 @@ void Line_Temp(void)
LINE_ABSOFF
;
LINE_BLEON
;
lineNum
=
1
;
if
(
zhenduanflag
!=
2
)
if
(
zhenduanflag
!=
1
)
{
if
(
LineGetSta
.
ble1
!=
1
)
{
...
...
@@ -303,17 +319,36 @@ void Line_Temp(void)
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEOFF
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
case
10
:
LINE_LampLowON
;
LINE_LampHighON
;
LINE_weizhiON
;
LINE_TurnLeftON
;
LINE_TurnRightON
;
LINE_ABSON
;
LINE_LampLowOFF
;
LINE_LampHighOFF
;
LINE_weizhiOFF
;
LINE_TurnLeftOFF
;
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEOFF
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
case
11
:
LINE_LampLowOFF
;
LINE_LampHighOFF
;
LINE_weizhiOFF
;
LINE_TurnLeftOFF
;
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEON
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
default:
LINE_LampLowOFF
;
...
...
@@ -323,7 +358,10 @@ void Line_Temp(void)
LINE_TurnRightOFF
;
LINE_ABSOFF
;
LINE_BLEOFF
;
zhenduanflag
=
0
;
if
(
zhenduanflag
!=
1
)
{
zhenduanflag
=
0
;
}
break
;
}
}
...
...
source/app/api_timer/api_timer.c
View file @
fcc380c4
...
...
@@ -505,11 +505,13 @@ extern uint32_t Time_100us_Uart9;
static
void
TIMER4_50US_ISR
(
void
)
{
if
(
Time_100us
<
0xffffffff
)
if
(
Time_100us
<
0xffffffff
)
Time_100us
++
;
if
(
RS485_send_time
<
0xffffffff
)
RS485_send_time
++
;
if
(
Time_100us_Uart9
<
0xffffffff
)
if
(
Time_100us_Uart9
<
0xffffffff
)
Time_100us_Uart9
++
;
//TFT �����õ�
if
(
UP_VSYNC
)
...
...
source/app/app_tft/app_tft.c
View file @
fcc380c4
...
...
@@ -103,7 +103,7 @@ unsigned int g_RPM_Val;
uint8_t
corenum
[
100
];
uint8_t
corenum1
[
100
];
uint8_t
corenum2
[
100
];
uint8_t
SCnum
=
0
;
...
...
@@ -1516,6 +1516,7 @@ void CompilationDate_S(uint16_t uiStartX,uint16_t uiDspLine)
DspOneLineDynamicStr
(
uiDspInfo
,
uiStartX
,
uiDspLine
);
}
void
DisplayStaticCurrent_S
(
uint16_t
uiStartX
,
uint16_t
uiDspLine
)
{
uint8_t
uiDspInfo
[
16
+
1
];
...
...
@@ -3033,6 +3034,16 @@ void HJ_OtherDisplay()
{
case
0
:
AUTO_Display
();
if
(
SCnum
==
1
)
{
SCnum
=
0
;
}
else
{
SCnum
=
1
;
}
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
//stb
Port_SetPortPinLevel
(
1
,
15
,
PortGpioHigh
);
//stb
break
;
case
1
:
//SetDisplayStaticItemW2(HJ_rightlight , 90, 225, DRAW_LUMIN_ICOM_WINDOW);
...
...
@@ -3044,6 +3055,8 @@ void HJ_OtherDisplay()
SetDisplayStaticItemW2
(
YD_dianliangdi
,
20
,
240
,
DRAW_LUMIN_ICOM_WINDOW
);
//灯全灭
SetDisplayStaticItemW2
(
YD_READY
,
70
,
240
,
DRAW_LUMIN_ICOM_WINDOW
);
//灯全灭
SetDisplayStaticItemW2
(
YD_jinguang
,
150
,
240
,
DRAW_LUMIN_ICOM_WINDOW
);
//灯全灭
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
//stb
Port_SetPortPinLevel
(
1
,
15
,
PortGpioHigh
);
//stb
// sprintf(uiDspInfoled,"POWERlow;READY;",HJ_CurFuelNum);
// DspOneLineDynamicStr(uiDspInfoled, 20, 240);
// sprintf(uiDspInfoled,"Lowbeam",HJ_CurFuelNum);
...
...
@@ -3150,6 +3163,16 @@ void HJ_OtherDisplay()
case
10
:
sprintf
(
uiDspInfoTime
,
"Time: 19:09"
,
HJ_CurFuelNum
);
SetDisplayStaticItemW2
(
HJ_Alllight
,
20
,
240
,
DRAW_LUMIN_ICOM_WINDOW
);
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
//stb
Port_SetPortPinLevel
(
1
,
15
,
PortGpioHigh
);
//stb
if
(
SCnum
==
1
)
{
SCnum
=
0
;
}
else
{
SCnum
=
1
;
}
// SetDisplayStaticItemW2(, 90, 225, DRAW_LUMIN_ICOM_WINDOW);
break
;
...
...
@@ -3242,9 +3265,13 @@ void UpdateCenterTripC(void)
break
;
case
STAGE_AutoCheck
:
//�Լ�
// AUTO_Display();
DspOneLineDynamicStr
(
corenum
,
0
,
70
);
DspOneLineDynamicStr
(
corenum1
,
0
,
90
);
DspOneLineDynamicStr
(
corenum2
,
0
,
110
);
if
(
zhenduansendStep
==
4
)
{
DspOneLineDynamicStr
(
corenum
,
0
,
70
);
DspOneLineDynamicStr
(
corenum1
,
0
,
90
);
DspOneLineDynamicStr
(
corenum2
,
0
,
110
);
}
break
;
case
STAGE_Led_Telltale_Check
:
//双闪
...
...
source/bsp_source/bsp_button/bsp_app_led_output.c
View file @
fcc380c4
...
...
@@ -429,7 +429,7 @@ void HJ_LED(en_port_gpio_level_t LedState)
//Port_SetPortPinLevel(2, 0, PortGpioHigh);
// Port_SetPortPinLevel(2, 14, PortGpioHigh);
//Speed_Output_Update(PWMCH_SPEED_OUT, 1910, 50);
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
//测试
//
Port_SetPortPinLevel(1, 21, PortGpioHigh);//测试
break
;
case
3
:
...
...
source/bsp_source/bsp_button/bsp_button.c
View file @
fcc380c4
...
...
@@ -521,7 +521,9 @@ void Button_Statu_Manage(void)
{
zhenduanflag
=
0
;
zhenduansendStep
=
0
;
g_Stage
=
2
;
// zhenduanflag = 0;
// RS485_TX_finish = 0;
}
else
...
...
@@ -589,6 +591,8 @@ void Button_Statu_Manage(void)
Botton
.
EOL
.
Statu
=
1
;
Button_Press
=
1
;
Button_Value
=
13
;
clearodoflag
=
1
;
// zhenduanflag = 0xFF;
}
Botton
.
EOL
.
Time
=
0
;
}
...
...
@@ -829,7 +833,7 @@ void Button_Statu_Manage(void)
if
(
Botton
.
End
.
Time
>
50
)
{
Botton
.
End
.
Time
=
51
;
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
//
Port_SetPortPinLevel(1, 21, PortGpioHigh);
}
}
else
{
...
...
@@ -837,7 +841,7 @@ void Button_Statu_Manage(void)
if
(
Botton
.
End
.
Time
>
100
)
{
Botton
.
End
.
Time
=
0
;
Port_SetPortPinLevel
(
1
,
21
,
PortGpioLow
);
//
Port_SetPortPinLevel(1, 21, PortGpioLow);
}
}
...
...
@@ -2548,7 +2552,7 @@ void Stage_Manage()
#if (SEMI_AUTOMATIC_STAGE)
UserPressKey15
();
//KL15����
#else
UserPressKey15
();
//KL15����
//
UserPressKey15();//KL15����
#endif
}
...
...
@@ -2566,8 +2570,8 @@ void Stage_Manage()
#else
// UserPressEOL();//��������
g_Stage
=
STAGE_Other
;
//
g_Stage = STAGE_Other;
clearodoflag
=
1
;
ClearOtherSWFlagFun
();
ClearOtherFlagFun
();
Othercount
=
0
;
...
...
source/bsp_source/bsp_motor/bsp_motor.c
View file @
fcc380c4
...
...
@@ -235,7 +235,7 @@ void SMC_Drive_Init(stc_motor_t *motorConfig,uint8_t cycle_width,uint8_t clkdiv)
.
enGpioDirection
=
PortGpioOutput
,
.
enGpioInitOutputLevel
=
PortGpioLow
};
Port_SetPinConfig
(
1
,
21
,
&
stc_port_pin_config1_21
);
//
Port_SetPinConfig( 1, 21, &stc_port_pin_config1_21 );
//
m_stc_smc
.
unPWC
.
u16Register
=
0
;
...
...
source/bsp_source/mfs_uart/mfs_uart.c
View file @
fcc380c4
...
...
@@ -1002,7 +1002,7 @@ en_result_t Mfs_Uart_Read(pstc_uart_type_t pstcUart,
}
/* Call wait loop hook */
PDL_WAIT_LOOP_HOOK
();
//
PDL_WAIT_LOOP_HOOK();
}
return
Ok
;
...
...
source/main.c
View file @
fcc380c4
...
...
@@ -89,7 +89,7 @@ uint8_t CheckResult[53] = {0};
uint8_t
Flag_DisplayErr
=
0
;
uint32_t
DisplayErrTimer
=
0
;
uint8_t
Autopower_flag
=
0
;
uint8_t
wait_write_flag
=
0
;
uint8_t
key_array
[
4
];
uint8_t
seed_value
[
4
];
#if (PRO_KS)
...
...
@@ -158,6 +158,8 @@ uint8_t zhenduanflag = 0;
uint32_t
key_value
;
uint8_t
lineNum
=
0
;
uint8_t
powerwrong
=
0
;
uint8_t
clearodoflag
=
0
;
uint32_t
clearodotime
=
0
;
enum
{
PACKAGE_TYPE_HEART
,
PACKAGE_TYPE_QR
,
...
...
@@ -314,6 +316,7 @@ void check_getdata(void)
{
if
(
Test_array_Uart11
[
0
]
==
0x59
&&
Test_array_Uart11
[
1
]
==
0x44
)
{
g_Stage
=
1
;
if
(((
Test_array_Uart11
[
WriteCount_Uart11
-
1
])
==
0x4A
)
&&
((
Test_array_Uart11
[
WriteCount_Uart11
-
2
])
==
0x4B
))
{
switch
(
zhenduansendStep
)
...
...
@@ -354,6 +357,12 @@ void check_getdata(void)
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
}
else
{
zhenduansendStep
=
0
;
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
}
}
break
;
case
3
:
...
...
@@ -365,6 +374,19 @@ void check_getdata(void)
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
}
if
(
Test_array_Uart11
[
4
]
==
0x7F
)
{
wait_write_flag
=
1
;
// RS485_TX_finish = 0;
WriteCount_Uart11
=
0
;
}
WriteCount_Uart0
=
0
;
memset
(
Test_array_Uart0
,
0
,
1000
);
}
else
{
RS485_TX_finish
=
0
;
}
break
;
default:
...
...
@@ -375,8 +397,8 @@ void check_getdata(void)
}
else
{
memset
(
Test_array_Uart11
,
0
,
1000
);
RS485_TX_finish
=
0
;
memset
(
Test_array_Uart11
,
0
x0
,
1000
);
RS485_TX_finish
=
0
x0
;
}
}
if
(
Test_array_Uart11
[
1
]
==
0x59
&&
Test_array_Uart11
[
2
]
==
0x44
)
...
...
@@ -432,9 +454,20 @@ void check_getdata(void)
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
}
if
(
Test_array_Uart11
[
5
]
==
0x7F
)
{
wait_write_flag
=
1
;
// RS485_TX_finish = 0;
WriteCount_Uart11
=
0
;
}
WriteCount_Uart0
=
0x0
;
memset
(
Test_array_Uart0
,
0x0
,
1000
);
// Delay(10);
}
break
;
default:
wait_write_flag
=
0
;
RS485_TX_finish
=
0
;
WriteCount_Uart11
=
0
;
break
;
...
...
@@ -558,6 +591,14 @@ void back_zhenduansend(void)
RS485_TX_finish
=
0
;
}
}
void
back_zhenduanwritesend
(
void
)
{
if
((
RS485_send_time
>=
15000
)
&&
(
RS485_TX_finish
==
1
))
{
// RS485_send_num--;
RS485_TX_finish
=
0
;
}
}
uint8_t
getYDnum
(
void
)
{
uint8_t
i
=
0
;
...
...
@@ -590,7 +631,7 @@ void Uart11_RX_Callback(uint16_t u16FillCnt)
// memset(Test_array_Uart11,0,10000);
Mfs_Uart_Read
(
UART11_Type
,
Test_array_Uart11
+
WriteCount_Uart11
,
&
u32ReadCnt
,
SAMPLE_UART_RX_BUFFSIZE
,
FALSE
);
Delay
(
100
);
YDnum
=
getYDnum
();
//
YDnum = getYDnum();
// Delay(100);
Time_100us
=
0
;
Uart_Pro_Flag_Uart11
=
1
;
...
...
@@ -628,51 +669,55 @@ static void Uart0_RX_Callback(uint16_t u16FillCnt)
{
uint32_t
u32ReadCnt
;
// memset(Test_array_Uart0,0,1000);
uint8_t
num
;
// WriteCount_Uart0 = 0
;
Mfs_Uart_Read
(
UART0_Type
,
Test_array_Uart0
+
WriteCount_Uart0
,
&
u32ReadCnt
,
SAMPLE_UART_RX_BUFFSIZE
,
FALSE
);
// Mfs_Uart_Read(UART0_Type, Test_array_Uart0, &u32ReadCnt, SAMPLE_UART_RX_BUFFSIZE, FALSE);
// Delay(10);
// num = Test_array_Uart0[20];
// for(int i = 0;Test_array_Uart0!='\0';i++)
// {
// corenum[i] = Test_array_Uart0[i];
// }
WriteCount_Uart0
+=
u32ReadCnt
;
barcode_Msg
[
0
]
=
Test_array_Uart0
[
6
];
barcode_Msg
[
1
]
=
Test_array_Uart0
[
7
];
barcode_Msg
[
2
]
=
Test_array_Uart0
[
8
];
barcode_Msg
[
3
]
=
Test_array_Uart0
[
9
];
barcode_Msg
[
4
]
=
Test_array_Uart0
[
10
];
barcode_Msg
[
5
]
=
Test_array_Uart0
[
11
];
barcode_Msg
[
6
]
=
Test_array_Uart0
[
12
];
barcode_Msg
[
7
]
=
Test_array_Uart0
[
13
];
barcode_Msg
[
8
]
=
Test_array_Uart0
[
14
];
barcode_Msg
[
9
]
=
Test_array_Uart0
[
15
];
barcode_Msg
[
10
]
=
Test_array_Uart0
[
16
];
barcode_Msg
[
11
]
=
Test_array_Uart0
[
17
];
barcode_Msg
[
12
]
=
Test_array_Uart0
[
18
];
barcode_Msg
[
13
]
=
Test_array_Uart0
[
19
];
barcode_Msg
[
14
]
=
Test_array_Uart0
[
20
];
memcpy
(
barcode_Msg
,
&
Test_array_Uart0
[
6
],
34
);
// Delay(100);
// barcode_Msg[0] = Test_array_Uart0[6];
// barcode_Msg[1] = Test_array_Uart0[7];
// barcode_Msg[2] = Test_array_Uart0[8];
// barcode_Msg[3] = Test_array_Uart0[9];
// barcode_Msg[4] = Test_array_Uart0[10];
// barcode_Msg[5] = Test_array_Uart0[11];
// barcode_Msg[6] = Test_array_Uart0[12];
// barcode_Msg[7] = Test_array_Uart0[13];
// barcode_Msg[8] = Test_array_Uart0[14];
// barcode_Msg[9] = Test_array_Uart0[15];
// barcode_Msg[10] = Test_array_Uart0[16];
// barcode_Msg[11] = Test_array_Uart0[17];
// barcode_Msg[12] = Test_array_Uart0[18];
// barcode_Msg[13] = Test_array_Uart0[19];
// barcode_Msg[14] = Test_array_Uart0[20];
barcode_Msg
[
15
]
=
Test_array_Uart0
[
22
];
barcode_Msg
[
16
]
=
Test_array_Uart0
[
23
];
barcode_Msg
[
17
]
=
Test_array_Uart0
[
24
];
barcode_Msg
[
18
]
=
Test_array_Uart0
[
25
];
barcode_Msg
[
19
]
=
Test_array_Uart0
[
26
];
//
barcode_Msg[15] = Test_array_Uart0[22];
//
barcode_Msg[16] = Test_array_Uart0[23];
//
barcode_Msg[17] = Test_array_Uart0[24];
//
barcode_Msg[18] = Test_array_Uart0[25];
//
barcode_Msg[19] = Test_array_Uart0[26];
barcode_Msg
[
20
]
=
Test_array_Uart0
[
28
];
barcode_Msg
[
21
]
=
Test_array_Uart0
[
29
];
barcode_Msg
[
22
]
=
Test_array_Uart0
[
30
];
barcode_Msg
[
23
]
=
Test_array_Uart0
[
31
];
barcode_Msg
[
24
]
=
Test_array_Uart0
[
32
];
barcode_Msg
[
25
]
=
Test_array_Uart0
[
33
];
barcode_Msg
[
26
]
=
Test_array_Uart0
[
34
];
barcode_Msg
[
27
]
=
Test_array_Uart0
[
35
];
//
barcode_Msg[20] = Test_array_Uart0[28];
//
barcode_Msg[21] = Test_array_Uart0[29];
//
barcode_Msg[22] = Test_array_Uart0[30];
//
barcode_Msg[23] = Test_array_Uart0[31];
//
barcode_Msg[24] = Test_array_Uart0[32];
//
barcode_Msg[25] = Test_array_Uart0[33];
//
barcode_Msg[26] = Test_array_Uart0[34];
//
barcode_Msg[27] = Test_array_Uart0[35];
barcode_Msg
[
28
]
=
Test_array_Uart0
[
37
];
barcode_Msg
[
29
]
=
Test_array_Uart0
[
38
];
barcode_Msg
[
30
]
=
Test_array_Uart0
[
39
];
barcode_Msg
[
31
]
=
Test_array_Uart0
[
40
];
barcode_Msg
[
32
]
=
Test_array_Uart0
[
41
];
barcode_Msg
[
33
]
=
Test_array_Uart0
[
42
];
//
barcode_Msg[28] = Test_array_Uart0[37];
//
barcode_Msg[29] = Test_array_Uart0[38];
//
barcode_Msg[30] = Test_array_Uart0[39];
//
barcode_Msg[31] = Test_array_Uart0[40];
//
barcode_Msg[32] = Test_array_Uart0[41];
//
barcode_Msg[33] = Test_array_Uart0[42];
if
(
Time_100us
>=
10000
)
{
memcpy
(
corenum
,
Test_array_Uart0
,
17
);
...
...
@@ -1276,8 +1321,8 @@ void CANInit(void)
#if (CAN_2ND || CAN_2P5)
memset
(
&
CanFDDataStruct
,
0
,
sizeof
(
CanFDDataStruct
));
memset
(
&
MMCanDataStruct
,
0
,
sizeof
(
MMCanDataStruct
));
bsp_CAN0_Init
();
bsp_CAN1_Init
();
//
bsp_CAN0_Init();
//
bsp_CAN1_Init();
#if (HARD_WARE_VERSION_2_1_7)
SetCan0Mode
(
1
);
...
...
@@ -1290,10 +1335,10 @@ void CANInit(void)
#endif
#if (CAN_3RD)
Can1_Init
();
//
Can1_Init();
CanCRCInint
();
bsp_CAN0_Init
();
bsp_CAN1_Init
();
//
bsp_CAN1_Init();
#if (HARD_WARE_VERSION_2_1_7)
SetCan0Mode
(
1
);
...
...
@@ -1355,7 +1400,7 @@ void main(void)
UART_PORT_init
();
UART_init
();
Port_SetPortPinLevel
(
1
,
19
,
PortGpioHigh
);
Port_SetPortPinLevel
(
1
,
20
,
PortGpioHigh
);
//
Port_SetPortPinLevel(1, 20, PortGpioHigh);
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
Port_SetPortPinLevel
(
1
,
15
,
PortGpioHigh
);
uint16_t
u16ReadCnt
=
0
;
...
...
@@ -1370,49 +1415,73 @@ void main(void)
#if ((PRO_CONFIG_CHECK_APPLY) || (PRO_CONFIG_EOL_APPLY))
for
(;;)
{
if
(
firstinit
==
0
)
// if(firstinit == 0)
// {
// zhenduanflag = 2;
// RS485_TX_finish = 0;
// while(zhenduanflag == 2)
// {
// uint32_t powerflag = 0xFF;
// back_zhenduansend();
// powerflag = R485_Send_Line_0x47(0);
// // if(powerflag == 0)
// // {
// // zhenduanflag = 0;
// // }
// }
// firstinit = 1;
// }
// RS485_TX_finish = 1;
// clearodoflag = 1;
if
(
clearodoflag
==
0
)
{
zhenduanflag
=
2
;
RS485_TX_finish
=
0
;
while
(
zhenduanflag
==
2
)
// Line_Temp();
if
(
zhenduanflag
==
0
)
{
if
(
powerdebugflag
==
0
)
{
uint32_t
powerflag
=
0xFF
;
back_zhenduansend
();
powerflag
=
R485_Send_Line_0x47
(
0
);
// if(powerflag == 0)
// {
// zhenduanflag = 0;
// }
wait_write_flag
=
0
;
Port_SetPortPinLevel
(
1
,
19
,
PortGpioHigh
);
// Port_SetPortPinLevel(1, 20, PortGpioHigh);
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
Port_SetPortPinLevel
(
1
,
15
,
PortGpioHigh
);
powerdebugflag
=
1
;
}
firstinit
=
1
;
}
Line_Temp
();
if
(
zhenduanflag
==
0
)
{
if
(
powerdebugflag
==
0
)
back_send
();
RS485_User_Tx_Data
();
}
else
if
(
zhenduanflag
==
1
)
{
Port_SetPortPinLevel
(
1
,
19
,
PortGpioHigh
);
Port_SetPortPinLevel
(
1
,
20
,
PortGpioHigh
);
Port_SetPortPinLevel
(
1
,
21
,
PortGpioHigh
);
Port_SetPortPinLevel
(
1
,
15
,
PortGpioHigh
);
powerdebugflag
=
1
;
powerdebugflag
=
0
;
if
(
wait_write_flag
==
0
)
{
back_zhenduanwritesend
();
}
R485_Send_0x47
();
}
else
{
back_zhenduansend
();
R485_Send_Line_0x47
(
lineNum
);
}
back_send
();
RS485_User_Tx_Data
();
}
else
if
(
zhenduanflag
==
1
)
{
powerdebugflag
=
0
;
back_zhenduansend
();
R485_Send_0x47
();
}
else
{
back_zhenduansend
();
R485_Send_Line_0x47
(
lineNum
);
HJ_OtherKeyCurrent
.
count
=
3
;
back_send
();
RS485_User_Tx_Data
();
if
(
clearodotime
<
300000
)
clearodotime
++
;
if
(
clearodotime
>=
150000
)
{
Port_SetPortPinLevel
(
2
,
9
,
PortGpioHigh
);
}
}
/*自动扫表*/
if
(
Auto_add_flag
==
1
)
{
...
...
source/main.h
View file @
fcc380c4
...
...
@@ -134,4 +134,6 @@ extern uint8_t Linestep;
extern
uint8_t
lineNum
;
extern
uint8_t
linewrong
;
extern
uint8_t
powerwrong
;
extern
uint8_t
clearodoflag
;
extern
uint32_t
clearodotime
;
#endif
/* __MAIN_H__ */
source/nm_osek/CAN_CFG.C
View file @
fcc380c4
...
...
@@ -67,7 +67,7 @@ void NM_D_Init(uint8_t state)
Port_SetPinConfig
(
1
,
22
,
&
stc_port_pin_config_out
);
//en
stc_port_pin_config_out
.
enGpioInitOutputLevel
=
PortGpioHigh
;
Port_SetPinConfig
(
1
,
21
,
&
stc_port_pin_config_out
);
//
Port_SetPinConfig( 1, 21, &stc_port_pin_config_out );
#endif
#if (CAN_3RD)
stc_port_pin_config_out
.
enGpioInitOutputLevel
=
PortGpioLow
;
...
...
@@ -76,7 +76,7 @@ void NM_D_Init(uint8_t state)
//stc_port_pin_config_out.enGpioInitOutputLevel = PortGpioHigh;
//Port_SetPinConfig( 1, 21, &stc_port_pin_config_out );
#endif
bsp_CAN1_Init
();
//
bsp_CAN1_Init();
break
;
case
BusSleep
:
bsp_tx_msgbuf_abort
(
1
);
...
...
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