2023-06-05 15:52:31 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2023, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2023-06-04 Chushicheng first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_ADC_H__
|
|
|
|
#define __DRV_ADC_H__
|
|
|
|
|
|
|
|
#include <rtdevice.h>
|
2024-01-28 21:02:26 +08:00
|
|
|
#ifdef BSP_USING_ADC
|
2023-06-05 15:52:31 +08:00
|
|
|
|
2024-01-28 21:02:26 +08:00
|
|
|
/* pico adc dirver class */
|
|
|
|
struct pico_adc
|
2023-06-05 15:52:31 +08:00
|
|
|
{
|
|
|
|
struct rt_adc_ops ops;
|
|
|
|
struct rt_adc_device pico_adc_device;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* pico config class */
|
2024-01-28 21:02:26 +08:00
|
|
|
struct pico_adc_config
|
2023-06-05 15:52:31 +08:00
|
|
|
{
|
|
|
|
rt_uint8_t pin;
|
|
|
|
rt_uint8_t channel;
|
|
|
|
const char *device_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef BSP_USING_ADC0
|
|
|
|
#define ADC0_CONFIG \
|
|
|
|
{ \
|
|
|
|
.pin = 26, \
|
|
|
|
.channel = 0, \
|
|
|
|
.device_name = "adc0", \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef BSP_USING_ADC1
|
|
|
|
#define ADC1_CONFIG \
|
|
|
|
{ \
|
|
|
|
.pin = 27, \
|
|
|
|
.channel = 1, \
|
|
|
|
.device_name = "adc1", \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef BSP_USING_ADC2
|
2024-01-28 21:02:26 +08:00
|
|
|
#define ADC2_CONFIG \
|
2023-06-05 15:52:31 +08:00
|
|
|
{ \
|
|
|
|
.pin = 28, \
|
|
|
|
.channel = 2, \
|
|
|
|
.device_name = "adc2", \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int rt_hw_adc_init(void);
|
|
|
|
|
|
|
|
#endif /* BSP_USING_ADC */
|
|
|
|
#endif /* __DRV_ADC_H__ */
|