2022-05-06 09:28:21 +08:00
|
|
|
/*
|
2024-01-09 21:56:37 +08:00
|
|
|
* Copyright (C) 2022-2024, Xiaohua Semiconductor Co., Ltd.
|
2022-05-06 09:28:21 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2022-04-28 CDT first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ADC_CONFIG_H__
|
|
|
|
#define __ADC_CONFIG_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
2022-05-15 20:57:35 +08:00
|
|
|
#include "irq_config.h"
|
2022-05-06 09:28:21 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef BSP_USING_ADC1
|
2022-05-15 20:57:35 +08:00
|
|
|
#ifndef ADC1_INIT_PARAMS
|
|
|
|
#define ADC1_INIT_PARAMS \
|
2022-05-06 09:28:21 +08:00
|
|
|
{ \
|
|
|
|
.name = "adc1", \
|
2024-01-09 21:56:37 +08:00
|
|
|
.vref = 3300, \
|
2022-05-06 09:28:21 +08:00
|
|
|
.resolution = ADC_RESOLUTION_12BIT, \
|
|
|
|
.data_align = ADC_DATAALIGN_RIGHT, \
|
|
|
|
.eoc_poll_time_max = 100, \
|
|
|
|
.hard_trig_enable = RT_FALSE, \
|
|
|
|
.hard_trig_src = ADC_HARDTRIG_ADTRG_PIN, \
|
|
|
|
.internal_trig0_comtrg0_enable = RT_FALSE, \
|
|
|
|
.internal_trig0_comtrg1_enable = RT_FALSE, \
|
|
|
|
.internal_trig0_sel = EVT_SRC_MAX, \
|
|
|
|
.internal_trig1_comtrg0_enable = RT_FALSE, \
|
|
|
|
.internal_trig1_comtrg1_enable = RT_FALSE, \
|
|
|
|
.internal_trig1_sel = EVT_SRC_MAX, \
|
|
|
|
.continue_conv_mode_enable = RT_FALSE, \
|
|
|
|
.data_reg_auto_clear = RT_TRUE, \
|
|
|
|
}
|
2022-05-15 20:57:35 +08:00
|
|
|
#endif /* ADC1_INIT_PARAMS */
|
2022-05-06 09:28:21 +08:00
|
|
|
#endif /* BSP_USING_ADC1 */
|
|
|
|
|
|
|
|
#ifdef BSP_USING_ADC2
|
2022-05-15 20:57:35 +08:00
|
|
|
#ifndef ADC2_INIT_PARAMS
|
|
|
|
#define ADC2_INIT_PARAMS \
|
2022-05-06 09:28:21 +08:00
|
|
|
{ \
|
|
|
|
.name = "adc2", \
|
2024-01-09 21:56:37 +08:00
|
|
|
.vref = 3300, \
|
2022-05-06 09:28:21 +08:00
|
|
|
.resolution = ADC_RESOLUTION_12BIT, \
|
|
|
|
.data_align = ADC_DATAALIGN_RIGHT, \
|
|
|
|
.eoc_poll_time_max = 100, \
|
|
|
|
.hard_trig_enable = RT_FALSE, \
|
|
|
|
.hard_trig_src = ADC_HARDTRIG_ADTRG_PIN, \
|
|
|
|
.internal_trig0_comtrg0_enable = RT_FALSE, \
|
|
|
|
.internal_trig0_comtrg1_enable = RT_FALSE, \
|
|
|
|
.internal_trig0_sel = EVT_SRC_MAX, \
|
|
|
|
.internal_trig1_comtrg0_enable = RT_FALSE, \
|
|
|
|
.internal_trig1_comtrg1_enable = RT_FALSE, \
|
|
|
|
.internal_trig1_sel = EVT_SRC_MAX, \
|
|
|
|
.continue_conv_mode_enable = RT_FALSE, \
|
|
|
|
.data_reg_auto_clear = RT_TRUE, \
|
|
|
|
}
|
2022-05-15 20:57:35 +08:00
|
|
|
#endif /* ADC2_INIT_PARAMS */
|
2022-05-06 09:28:21 +08:00
|
|
|
#endif /* BSP_USING_ADC2 */
|
|
|
|
|
|
|
|
#ifdef BSP_USING_ADC3
|
2022-05-15 20:57:35 +08:00
|
|
|
#ifndef ADC3_INIT_PARAMS
|
|
|
|
#define ADC3_INIT_PARAMS \
|
2022-05-06 09:28:21 +08:00
|
|
|
{ \
|
|
|
|
.name = "adc3", \
|
2024-01-09 21:56:37 +08:00
|
|
|
.vref = 3300, \
|
2022-05-06 09:28:21 +08:00
|
|
|
.resolution = ADC_RESOLUTION_12BIT, \
|
|
|
|
.data_align = ADC_DATAALIGN_RIGHT, \
|
|
|
|
.eoc_poll_time_max = 100, \
|
|
|
|
.hard_trig_enable = RT_FALSE, \
|
|
|
|
.hard_trig_src = ADC_HARDTRIG_ADTRG_PIN, \
|
|
|
|
.internal_trig0_comtrg0_enable = RT_FALSE, \
|
|
|
|
.internal_trig0_comtrg1_enable = RT_FALSE, \
|
|
|
|
.internal_trig0_sel = EVT_SRC_MAX, \
|
|
|
|
.internal_trig1_comtrg0_enable = RT_FALSE, \
|
|
|
|
.internal_trig1_comtrg1_enable = RT_FALSE, \
|
|
|
|
.internal_trig1_sel = EVT_SRC_MAX, \
|
|
|
|
.continue_conv_mode_enable = RT_FALSE, \
|
|
|
|
.data_reg_auto_clear = RT_TRUE, \
|
|
|
|
}
|
2022-05-15 20:57:35 +08:00
|
|
|
#endif /* ADC3_INIT_PARAMS */
|
2022-05-06 09:28:21 +08:00
|
|
|
#endif /* BSP_USING_ADC3 */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ADC_CONFIG_H__ */
|