Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RT_RMR42E
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
时昊
RT_RMR42E
Commits
8c26bdd8
Commit
8c26bdd8
authored
Jun 26, 2024
by
郑萍
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎉
init:更换adc采集和adc驱动
parent
89edae4e
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
39 deletions
+40
-39
RMR42E.uvguix.Administrator
...t/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvguix.Administrator
+15
-15
Analog_Signals.c
Firmware/Source/Component/Analog/Analog_Signals.c
+15
-18
Analog_Signals.h
Firmware/Source/Component/Analog/Analog_Signals.h
+3
-3
RTE_ADC_INTERIM_VERSION.c
...vice/Cmsemicon/BAT32A239/RTE/AD/RTE_ADC_INTERIM_VERSION.c
+5
-3
RTE_ADC_INTERIM_VERSION.h
...vice/Cmsemicon/BAT32A239/RTE/AD/RTE_ADC_INTERIM_VERSION.h
+2
-0
No files found.
Firmware/Project/Cmsemicon/BAT32A239/MDK_ARM/RMR42E.uvguix.Administrator
View file @
8c26bdd8
This diff is collapsed.
Click to expand it.
Firmware/Source/Component/Analog/Analog_Signals.c
View file @
8c26bdd8
...
...
@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/
3/31 13:14:40
* Date : 2024/
6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
...
...
@@ -15,7 +15,7 @@
#include "Analog_Signals.h"
/* Private typedef ----------------------------------------------------------*/
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
uint8_t
u8Ch
;
uint8_t
u8RefType
;
...
...
@@ -26,7 +26,7 @@ typedef struct
ADC_Circuit_Calc_Func
pfProcFunc
;
}
ADC_Ch_Cfg_st_t
;
typedef
enum
ASigConvStat
typedef
__attribute__
((
aligned
(
4
)))
enum
ASigConvStat
{
ADC_STAT_IDLE
=
0
,
ADC_STAT_INIT
,
...
...
@@ -36,7 +36,7 @@ typedef enum ASigConvStat
ADC_STAT_ERR
,
}
ADC_Stat_en_t
;
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
ADC_Stat_en_t
enStatus
;
uint8_t
u8CurrentCh
;
...
...
@@ -44,7 +44,7 @@ typedef struct
uint8_t
u8Timer
;
}
ADC_Ctrl_st_t
;
typedef
struct
typedef
struct
__attribute__
((
aligned
(
4
)))
{
uint8_t
u8Valid
;
uint8_t
u8Rsvd
;
...
...
@@ -72,25 +72,21 @@ ADC_Ctrl_st_t stADCCtrl;
uint16_t
u16ADCSample
[
ADC_CONV_CH_NUMBER
];
ADC_Data_st_t
stADCData
[
ADC_SIGNAL_CH_NUMBER
];
const
uint8_t
u8ADCChList
[
ADC_CONV_CH_NUMBER
]
=
const
uint8_t
__attribute__
((
aligned
(
4
)))
u8ADCChList
[
ADC_CONV_CH_NUMBER
]
=
{
2U
,
3U
,
7U
,
5U
,
2U
,
3U
,
};
const
ADC_Ch_Cfg_st_t
stADCChCfg
[
ADC_SIGNAL_CH_NUMBER
]
=
const
__attribute__
((
aligned
(
4
)))
ADC_Ch_Cfg_st_t
stADCChCfg
[
ADC_SIGNAL_CH_NUMBER
]
=
{
{
0U
,
0U
,
0U
,
0U
,
70
0U
,
1U
,
ADC_Voltage_Calc_Circuit102
,},
{
0U
,
0U
,
0U
,
0U
,
0U
,
1U
,
ADC_Voltage_Calc_Circuit102
,},
{
1U
,
0U
,
0U
,
0U
,
0U
,
1U
,
ADC_Voltage_Calc_Circuit102
,},
{
2U
,
0U
,
0U
,
0U
,
0U
,
1U
,
ADC_Voltage_Calc_Circuit101
,},
{
3U
,
2U
,
0U
,
2U
,
18U
,
1U
,
ADC_Res_Calc_Circuit101
,},
};
const
ADC_Res_List_st_t
stADCResList
[
ADC_SIGNAL_CH_NUMBER
]
=
const
__attribute__
((
aligned
(
4
)))
ADC_Res_List_st_t
stADCResList
[
ADC_SIGNAL_CH_NUMBER
]
=
{
{
3300000U
,
1000000U
,
0U
,
0U
,},
{
3300000U
,
1000000U
,
0U
,
0U
,},
{
0U
,
0U
,
0U
,
0U
,},
{
0U
,
0U
,
670U
,
300U
,},
};
/* Private function prototypes ----------------------------------------------*/
...
...
@@ -115,10 +111,11 @@ void Analog_Signal_Conv_Init(void)
}
}
RTE_ADC_Init
(
0
,
2
);
RTE_ADC_Init
(
0
,
3
);
RTE_ADC_Init
(
0
,
5
);
RTE_ADC_Init
(
0
,
7
);
for
(
i
=
0U
;
i
<
ADC_CONV_CH_NUMBER
;
i
++
)
{
RTE_ADC_Init
(
0
,
u8ADCChList
[
i
]);
}
for
(
i
=
0U
;
i
<
ADC_SIGNAL_CH_NUMBER
;
i
++
)
{
...
...
Firmware/Source/Component/Analog/Analog_Signals.h
View file @
8c26bdd8
...
...
@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/
3/31 13:14:40
* Date : 2024/
6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
...
...
@@ -33,8 +33,8 @@ enum ADCChName
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (
4
U)
#define ADC_SIGNAL_CH_NUMBER (
4
U)
#define ADC_TOTAL_CH_NUMBER (
2
U)
#define ADC_SIGNAL_CH_NUMBER (
2
U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
...
...
Firmware/Source/Device/Cmsemicon/BAT32A239/RTE/AD/RTE_ADC_INTERIM_VERSION.c
View file @
8c26bdd8
...
...
@@ -4,8 +4,9 @@
#include "cgc.h"
#include "gpio.h"
#include "isr.h"
#include "Analog\Analog_Signals.h"
uint8_t
u8NewChNum
[
4
]
=
{
2
,
3
,
7
,
5
};
// uint8_t
u8NewChNum[4] = {2, 3, 7, 5};
void
RTC_ADC_Interrupt
(
void
*
msg
)
{
...
...
@@ -18,6 +19,7 @@ void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum)
GPIO_InitTypeDef
GPIO_InitStructure
=
{
0
};
ADC_InitTypeDef
ADC_InitStructure
=
{
0
};
if
(
u8ChNum
<=
7
)
{
GPIO_InitStructure
.
GPIO_Pin
=
1U
<<
u8ChNum
;
...
...
@@ -133,13 +135,13 @@ void RTE_ADC_Get_Conversion_Result(uint16_t *pu16Data, uint8_t u8ChNum)
uint8_t
i
;
if
((
pu16Data
!=
0U
)
&&
(
u8ChNum
>
0U
)
&&
(
u8ChNum
<=
4U
))
if
((
pu16Data
!=
0U
)
&&
(
u8ChNum
>
0U
)
&&
(
u8ChNum
<=
ADC_TOTAL_CH_NUMBER
))
{
if
(
RTE_ADC_Get_Conversion_Status
()
==
0U
)
{
for
(
i
=
0U
;
i
<
u8ChNum
;
i
++
)
{
ADC_Converse
(
u8NewChNum
[
i
],
1
,
pu16Data
);
ADC_Converse
(
(
ADC_Channel_t
)
u8ADCChList
[
i
],
1
,
pu16Data
);
pu16Data
++
;
}
}
...
...
Firmware/Source/Device/Cmsemicon/BAT32A239/RTE/AD/RTE_ADC_INTERIM_VERSION.h
View file @
8c26bdd8
...
...
@@ -4,6 +4,8 @@
#include <stdint.h>
extern
const
uint8_t
u8ADCChList
[];
#define ADC_RESOLUTION (4096U)
/* 12bit ADC */
extern
void
RTE_ADC_Init
(
const
uint8_t
u8ChList
[],
uint8_t
u8ChNum
);
...
...
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