[BSP] CH32V307 add drv_adc (#6431)

添加了ch32v307的adc驱动,已在ch32v307评估班上对adc1ch5进行了验证,并修改了kconfig以及scons脚本,可以成功编译以及使用
This commit is contained in:
linshire
2022-09-16 22:50:57 -04:00
committed by GitHub
parent 4637eb16dc
commit fdcee2da20
4 changed files with 374 additions and 34 deletions
@@ -8,7 +8,6 @@ cwd = GetCurrentDir()
src = Split("""
""")
if GetDepend('SOC_RISCV_FAMILY_CH32'):
if GetDepend('RT_USING_PIN'):
@@ -17,13 +16,11 @@ if GetDepend('SOC_RISCV_FAMILY_CH32'):
if GetDepend(['RT_USING_SERIAL', 'BSP_USING_UART']):
src += ['drv_usart.c']
if GetDepend('RT_USING_ADC'):
src += ['drv_adc.c']
path = [cwd]
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path)
Return('group')
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-09-16 linshire add some operation function
* 2021-09-09 WCH the first version
*/
#ifndef DRV_ADC_H__
#define DRV_ADC_H__
typedef struct
{
ADC_TypeDef *Instance;
ADC_InitTypeDef Init;
}ADC_HandleTypeDef;
typedef struct
{
uint32_t Channel;
uint32_t Rank;
uint32_t SamplingTime;
uint32_t Offset;
}ADC_ChannelConfTypeDef;
#endif
+67 -29
View File
@@ -14,38 +14,76 @@ menu "On-chip Peripheral Drivers"
select RT_USING_SERIAL
default n
if BSP_USING_UART
config BSP_USING_UART1
bool "Enable UART1"
if BSP_USING_UART
config BSP_USING_UART1
bool "Enable UART1"
default n
config BSP_USING_UART2
bool "Enable UART2"
default n
config BSP_USING_UART3
bool "Enable UART3"
default n
config BSP_USING_UART4
bool "Enable UART4"
default n
config BSP_USING_UART5
bool "Enable UART5"
default n
config BSP_USING_UART6
bool "Enable UART6"
default n
config BSP_USING_UART7
bool "Enable UART7"
default n
config BSP_USING_UART8
bool "Enable UART8"
default n
endif
config BSP_USING_ADC
bool "Enable ADC"
select RT_USING_ADC
default n
if BSP_USING_ADC
config BSP_USING_ADC1
bool "Enable ADC1"
default n
config BSP_USING_ADC2
bool "Enable ADC2"
default n
config ADC_CHANNEL_16
bool "Enable ADC CHANNEL 16 (inside temperature)"
default n
config ADC_CHANNEL_17
bool "Enable ADC CHANNEL 17 (inside Verf)"
default n
endif
config BSP_USING_DAC
bool "Enable DAC"
select RT_USING_DAC
default n
config BSP_USING_UART2
bool "Enable UART2"
default n
if BSP_USING_DAC
config BSP_USING_DAC_CHANNEL1
bool "Enable DAC CHANNEL1"
default n
config BSP_USING_UART3
bool "Enable UART3"
default n
config BSP_USING_UART4
bool "Enable UART4"
default n
config BSP_USING_UART5
bool "Enable UART5"
default n
config BSP_USING_UART6
bool "Enable UART6"
default n
config BSP_USING_UART7
bool "Enable UART7"
default n
config BSP_USING_UART8
bool "Enable UART8"
default n
config BSP_USING_DAC_CHANNEL2
bool "Enable DAC CHANNEL2"
default n
endif
endmenu