Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
VC66_7C
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
ISUZU
VC66_7C
Commits
e339f97b
Commit
e339f97b
authored
Oct 20, 2021
by
hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整4051驱动方式,弃用联合体用法
parent
b743c980
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22036 additions
and
21958 deletions
+22036
-21958
project
ghs/project
+0
-0
project.hex
ghs/project.hex
+21785
-21788
project.siz
ghs/project.siz
+1
-1
PowerManagement_user.c
...ce/Application/APP/PowerManagement/PowerManagement_user.c
+1
-0
CD4051.c
source/Driver/CD4051/CD4051.c
+137
-78
CD4051.h
source/Driver/CD4051/CD4051.h
+111
-89
tasks.c
source/System/tasks.c
+1
-2
No files found.
ghs/project
View file @
e339f97b
No preview for this file type
ghs/project.hex
View file @
e339f97b
This diff is collapsed.
Click to expand it.
ghs/project.siz
View file @
e339f97b
project .intvect 1536
project .intvect 1536
project .text 29
9052
project .text 29
8988
project .rodata 412383
project .rodata 412383
project .secinfo 120
project .secinfo 120
project .syscall 6
project .syscall 6
...
...
source/Application/APP/PowerManagement/PowerManagement_user.c
View file @
e339f97b
...
@@ -248,6 +248,7 @@ void Power_IG_ON_Init(void)
...
@@ -248,6 +248,7 @@ void Power_IG_ON_Init(void)
/*5s不按按键计时清零*/
/*5s不按按键计时清零*/
//LongTimeNoKey_Operation_TimeRest();
//LongTimeNoKey_Operation_TimeRest();
CD4051B_KL15Init
();
Fuel_Consump_K15_Init
();
Fuel_Consump_K15_Init
();
...
...
source/Driver/CD4051/CD4051.c
View file @
e339f97b
/******************************************************************************
文件名:CD4051B.C
功能:实现4051通道切换
编写时间:2021/3/25
******************************************************************************/
#include "CD4051.h"
#include "CD4051.h"
#include "GPIO.h"
#include "GPIO.h"
volatile
u_CD4051_Input
CD4051_Input
[
ID_MAX
];
#include "dr7f701441.dvf.h"
unsigned
char
pChannel
=
0
;
void
CD4051_Pin_Init
(
void
)
CD4051BChannel
CD4051B_CurrentChannel
;
{
CD4051_Input
[
ID_COM1
].
Byte
=
0x00
;
CD4051_Input
[
ID_COM2
].
Byte
=
0x00
;
CD4051_Input
[
ID_COM3
].
Byte
=
0x00
;
CD4051_Input
[
ID_COM4
].
Byte
=
0x00
;
CD4051_Input
[
ID_COM5
].
Byte
=
0x00
;
CD4051_Input
[
ID_COM6
].
Byte
=
0x00
;
CD4051_Input
[
ID_COM7
].
Byte
=
0x00
;
pChannel
=
0
;
CD4051A_A_MCU_OUT
=
0
;
CD4051CtrStruct
CD4051CtrStr
[
COMTotal
][
MaxChannel
];
CD4051A_B_MCU_OUT
=
0
;
uint16_t
CD4051B_GeneralCOM_Cache
[
COMTotal
][
MaxChannel
];
CD4051A_C_MCU_OUT
=
0
;
uint16_t
CD4051B_GeneralCOM_Value
[
COMTotal
][
MaxChannel
];
}
void
CD4051
_GetInputStatus
(
unsigned
char
Channel
)
void
CD4051
B_KL15Init
(
void
)
{
{
}
uint8_t
i
,
j
;
i
=
0u
;
j
=
0u
;
// VCCA_EN = 1u;
for
(
i
=
0u
;
i
<
COMTotal
;
i
++
)
{
for
(
j
=
0u
;
j
<
MaxChannel
;
j
++
)
{
CD4051CtrStr
[
i
][
j
].
time
=
0u
;
CD4051CtrStr
[
i
][
j
].
Last
=
0u
;
CD4051B_GeneralCOM_Cache
[
i
][
j
]
=
0u
;
CD4051B_GeneralCOM_Value
[
i
][
j
]
=
0u
;
}
}
CD4051B_C_MCU
=
0u
;
CD4051B_B_MCU
=
0u
;
CD4051B_A_MCU
=
0u
;
void
CD4051_Choose_Channel
(
unsigned
char
Channel
)
CD4051B_CurrentChannel
=
0u
;
{
CD4051A_A_MCU_OUT
=
Channel
&
0x01
;
CD4051A_B_MCU_OUT
=
(
Channel
>>
1
)
&
0x01
;
CD4051A_C_MCU_OUT
=
(
Channel
>>
2
)
&
0x01
;
}
}
/****************************************************************************
void
CD4051_IOStatus
(
unsigned
char
Channel
)
CD4051B_ChannelSet
CD4051B_C_MCU CD4051B_B_MCU CD4051B_A_MCU Channel ON
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
******************************************************************************/
void
CD4051B_ChannelSet
(
CD4051BChannel
Ch
)
{
{
if
(
CD4051A_COM1_MCU_IN
)
if
(
Ch
<
MaxChannel
)
{
CD4051_Input
[
ID_COM1
].
Byte
|=
(
1
<<
Channel
);
}
else
{
CD4051_Input
[
ID_COM1
].
Byte
&=
~
(
1
<<
Channel
);
}
if
(
CD4051A_COM2_MCU_IN
)
{
CD4051_Input
[
ID_COM2
].
Byte
|=
(
1
<<
Channel
);
}
else
{
CD4051_Input
[
ID_COM2
].
Byte
&=
~
(
1
<<
Channel
);
}
if
(
CD4051A_COM3_MCU_IN
)
{
{
CD4051_Input
[
ID_COM3
].
Byte
|=
(
1
<<
Channel
);
CD4051B_CurrentChannel
=
Ch
;
CD4051B_C_MCU
=
(
Ch
&
0x04u
)
>>
2u
;
CD4051B_B_MCU
=
(
Ch
&
0x02u
)
>>
1u
;
CD4051B_A_MCU
=
Ch
&
0x01u
;
}
}
else
else
{
{
CD4051_Input
[
ID_COM3
].
Byte
&=
~
(
1
<<
Channel
)
;
;
}
}
if
(
CD4051A_COM4_MCU_IN
)
}
{
/****************************************************************************
CD4051_Input
[
ID_COM4
].
Byte
|=
(
1
<<
Channel
);
函数名:CD4051B_ChannelGet
}
形参:无
else
返回值:CD4051BChannel 当前通道数
{
功能:获取当前通道数
CD4051_Input
[
ID_COM4
].
Byte
&=
~
(
1
<<
Channel
);
******************************************************************************/
}
CD4051BChannel
CD4051B_ChannelGet
(
void
)
if
(
CD4051A_COM5_MCU_IN
)
{
{
return
CD4051B_CurrentChannel
;
CD4051_Input
[
ID_COM5
].
Byte
|=
(
1
<<
Channel
);
}
}
else
/****************************************************************************
{
CD4051B_ReadSignal_Serviece
CD4051_Input
[
ID_COM5
].
Byte
&=
~
(
1
<<
Channel
);
}
if
(
CD4051A_COM6_MCU_IN
)
******************************************************************************/
{
void
CD4051B_ReadSignal_Serviece
(
void
)
CD4051_Input
[
ID_COM6
].
Byte
|=
(
1
<<
Channel
);
{
}
uint8_t
channel
=
0u
;
else
{
channel
=
CD4051B_ChannelGet
();
CD4051_Input
[
ID_COM6
].
Byte
&=
~
(
1
<<
Channel
);
}
CD4051B_GeneralCOM_Cache
[
COM1
][
channel
]
=
CD4051B_InputGOIO_Com1
;
if
(
CD4051A_COM7_MCU_IN
)
CD4051B_GeneralCOM_Cache
[
COM2
][
channel
]
=
CD4051B_InputGOIO_Com2
;
CD4051B_GeneralCOM_Cache
[
COM3
][
channel
]
=
CD4051B_InputGOIO_Com3
;
CD4051B_GeneralCOM_Cache
[
COM4
][
channel
]
=
CD4051B_InputGOIO_Com4
;
CD4051B_GeneralCOM_Cache
[
COM5
][
channel
]
=
CD4051B_InputGOIO_Com5
;
CD4051B_GeneralCOM_Cache
[
COM6
][
channel
]
=
CD4051B_InputGOIO_Com6
;
CD4051B_GeneralCOM_Cache
[
COM7
][
channel
]
=
CD4051B_InputGOIO_Com7
;
if
(
channel
<
(
MaxChannel
-
1u
))
{
{
CD4051_Input
[
ID_COM7
].
Byte
|=
(
1
<<
Channel
)
;
channel
++
;
}
}
else
else
{
{
CD4051_Input
[
ID_COM7
].
Byte
&=
~
(
1
<<
Channel
)
;
channel
=
Channel0
;
}
}
CD4051B_ChannelSet
(
channel
);
}
}
/****************************************************************************
CD4051B_Debounce_Service
void
CD4051_GetInputStatusProc
(
void
)
******************************************************************************/
void
CD4051B_Debounce_Service
(
void
)
{
{
CD4051_IOStatus
(
pChannel
);
uint8_t
comcnt
;
pChannel
++
;
uint8_t
chcnt
;
CD4051_Choose_Channel
(
pChannel
);
comcnt
=
0u
;
if
(
pChannel
>
7
)
chcnt
=
0u
;
for
(
comcnt
=
0u
;
comcnt
<
COMTotal
;
comcnt
++
)
{
{
pChannel
=
0
;
for
(
chcnt
=
0u
;
chcnt
<
MaxChannel
;
chcnt
++
)
{
if
(
CD4051B_GeneralCOM_Cache
[
comcnt
][
chcnt
]
==
CD4051CtrStr
[
comcnt
][
chcnt
].
Last
)
{
CD4051CtrStr
[
comcnt
][
chcnt
].
time
++
;
if
(
CD4051B_GeneralCOM_Cache
[
comcnt
][
chcnt
]
==
1u
)
{
if
(
CD4051CtrStr
[
comcnt
][
chcnt
].
time
>=
CD4051B_DEBOUNCE_High_CNT
)
{
CD4051CtrStr
[
comcnt
][
chcnt
].
time
=
0u
;
CD4051B_GeneralCOM_Value
[
comcnt
][
chcnt
]
=
1u
;
}
else
{
;
}
}
else
{
if
(
CD4051CtrStr
[
comcnt
][
chcnt
].
time
>=
CD4051B_DEBOUNCE_Low_CNT
)
{
CD4051CtrStr
[
comcnt
][
chcnt
].
time
=
0u
;
CD4051B_GeneralCOM_Value
[
comcnt
][
chcnt
]
=
0u
;
}
else
{
;
}
}
}
else
{
CD4051CtrStr
[
comcnt
][
chcnt
].
time
=
0u
;
CD4051CtrStr
[
comcnt
][
chcnt
].
Last
=
CD4051B_GeneralCOM_Cache
[
comcnt
][
chcnt
];
}
}
}
}
}
/****************************************************************************
CD4051B_GetComValue
******************************************************************************/
uint16_t
CD4051B_GetComValue
(
uint8_t
num
,
uint8_t
ch
)
{
return
CD4051B_GeneralCOM_Value
[
num
][
ch
];
}
}
\ No newline at end of file
source/Driver/CD4051/CD4051.h
View file @
e339f97b
This diff is collapsed.
Click to expand it.
source/System/tasks.c
View file @
e339f97b
...
@@ -127,8 +127,6 @@ void Sys_Run_Mode_2ms_Tasks(void)
...
@@ -127,8 +127,6 @@ void Sys_Run_Mode_2ms_Tasks(void)
Common_Input_Para
();
Common_Input_Para
();
Gauges_Time_Xms_Count
(
2
);
Gauges_Time_Xms_Count
(
2
);
UDS_10ms_Service
();
UDS_10ms_Service
();
CD4051_GetInputStatusProc
();
}
}
/*============================================================================*/
/*============================================================================*/
/*==============================================================================
/*==============================================================================
...
@@ -156,6 +154,7 @@ void Sys_Run_Mode_10ms_Tasks(void)
...
@@ -156,6 +154,7 @@ void Sys_Run_Mode_10ms_Tasks(void)
/*表头调度函数 added by yutian*/
/*表头调度函数 added by yutian*/
UserGaugeSchedule
();
/*在主循环中调用*/
UserGaugeSchedule
();
/*在主循环中调用*/
/*end*/
/*end*/
CD4051B_ReadSignal_Serviece
();
Sound_Play_Service
();
Sound_Play_Service
();
Can_BusOff_Fun
();
Can_BusOff_Fun
();
...
...
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