Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
haoJin750TFT
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
时昊
haoJin750TFT
Commits
d19ce431
Commit
d19ce431
authored
Sep 14, 2024
by
张金硕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:修改RTE_TIM40.c的QAC问题
parent
d6b4d355
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
45 deletions
+60
-45
RTE_TIM40.c
...e/Source/Device/Cmsemicon/BAT32A279/RTE/Tim40/RTE_TIM40.c
+60
-45
No files found.
Firmware/Source/Device/Cmsemicon/BAT32A279/RTE/Tim40/RTE_TIM40.c
View file @
d19ce431
...
...
@@ -222,57 +222,72 @@ void RTE_Calc_Freq(uint8_t u8ch)
uint16_t
u16TSR
;
uint8_t
u8RollingCh
=
0
;
switch
(
u8ch
)
if
((
u8ch
<
0
)
||
(
u8ch
>=
RTE_TIM40_CH_SUM
))
{
case
RTE_TIM40_CH0
:
u16TDR
=
TM40
->
TDR
[
0U
];
u16TSR
=
TM40
->
TSR
[
0U
];
break
;
case
RTE_TIM40_CH1
:
u16TDR
=
TM40
->
TDR
[
1U
];
u16TSR
=
TM40
->
TSR
[
1U
];
u8RollingCh
=
0U
;
break
;
case
RTE_TIM40_CH2
:
u16TDR
=
TM40
->
TDR
[
2U
];
u16TSR
=
TM40
->
TSR
[
2U
];
break
;
case
RTE_TIM40_CH3
:
u16TDR
=
TM40
->
TDR
[
3U
];
u16TSR
=
TM40
->
TSR
[
3U
];
break
;
default:
u16TDR
=
TM40
->
TDR
[
0U
];
u16TSR
=
TM40
->
TSR
[
0U
];
break
;
}
if
(
1U
==
(
u16TSR
&
_0001_TM4_OVERFLOW_OCCURS
))
{
g_stTIM40CapObj
[
u8ch
].
u32Period
[
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
]
=
(
uint32_t
)(
u16TDR
+
1UL
)
+
0x10000UL
;
;
}
else
{
g_stTIM40CapObj
[
u8ch
].
u32Period
[
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
]
=
(
uint32_t
)(
u16TDR
+
1UL
);
// Fre_In_Channel_Capture_ISR_Reset_Count(FRE_ENGINE,g_stTIM40CapObj[u8ch].u32Period[g_stTIM40CapObj[u8ch].u8PeriodBufCnt]);
}
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
++
;
if
(
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
>=
RTE_TIM40_PERIOD_FILTER_SUM
)
{
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
=
0U
;
if
((
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
<
0
)
||
(
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
>=
RTE_TIM40_PERIOD_FILTER_SUM
))
{
;
}
else
{
switch
(
u8ch
)
{
case
RTE_TIM40_CH0
:
u16TDR
=
TM40
->
TDR
[
0U
];
u16TSR
=
TM40
->
TSR
[
0U
];
break
;
case
RTE_TIM40_CH1
:
u16TDR
=
TM40
->
TDR
[
1U
];
u16TSR
=
TM40
->
TSR
[
1U
];
u8RollingCh
=
0U
;
break
;
case
RTE_TIM40_CH2
:
u16TDR
=
TM40
->
TDR
[
2U
];
u16TSR
=
TM40
->
TSR
[
2U
];
break
;
case
RTE_TIM40_CH3
:
u16TDR
=
TM40
->
TDR
[
3U
];
u16TSR
=
TM40
->
TSR
[
3U
];
break
;
default:
u16TDR
=
TM40
->
TDR
[
0U
];
u16TSR
=
TM40
->
TSR
[
0U
];
break
;
}
if
(
1U
==
(
u16TSR
&
_0001_TM4_OVERFLOW_OCCURS
))
{
g_stTIM40CapObj
[
u8ch
].
u32Period
[
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
]
=
(
uint32_t
)(
u16TDR
+
1UL
)
+
0x10000UL
;
}
else
{
g_stTIM40CapObj
[
u8ch
].
u32Period
[
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
]
=
(
uint32_t
)(
u16TDR
+
1UL
);
// Fre_In_Channel_Capture_ISR_Reset_Count(FRE_ENGINE,g_stTIM40CapObj[u8ch].u32Period[g_stTIM40CapObj[u8ch].u8PeriodBufCnt]);
}
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
++
;
if
(
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
>=
RTE_TIM40_PERIOD_FILTER_SUM
)
{
g_stTIM40CapObj
[
u8ch
].
u8PeriodBufCnt
=
0U
;
}
if
(
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
<
RTE_TIM40_PERIOD_FILTER_SUM
)
{
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
++
;
}
for
(
i
=
0U
;
i
<
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
;
i
++
)
{
u32Temp
+=
g_stTIM40CapObj
[
u8ch
].
u32Period
[
i
];
}
u32Temp
=
u32Temp
/
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
;
g_stTIM40CapObj
[
u8ch
].
u32Freq
=
(
g_stTIM40CapObj
[
u8ch
].
u32CHClock
*
10U
)
/
u32Temp
;
}
}
if
(
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
<
RTE_TIM40_PERIOD_FILTER_SUM
)
{
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
++
;
}
for
(
i
=
0U
;
i
<
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
;
i
++
)
{
u32Temp
+=
g_stTIM40CapObj
[
u8ch
].
u32Period
[
i
];
}
u32Temp
=
u32Temp
/
g_stTIM40CapObj
[
u8ch
].
u8PeriodCnt
;
g_stTIM40CapObj
[
u8ch
].
u32Freq
=
(
g_stTIM40CapObj
[
u8ch
].
u32CHClock
*
10U
)
/
u32Temp
;
}
/***********************************************************************************************************************
...
...
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