RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
|
结构体 | |
struct | rt_adc_ops |
struct | rt_adc_device |
宏定义 | |
#define | RT_ADC_INTERN_CH_TEMPER (-1) |
#define | RT_ADC_INTERN_CH_VREF (-2) |
#define | RT_ADC_INTERN_CH_VBAT (-3) |
类型定义 | |
typedef struct rt_adc_device * | rt_adc_device_t |
枚举 | |
enum | rt_adc_cmd_t { RT_ADC_CMD_ENABLE = RT_DEVICE_CTRL_BASE(ADC) + 1 , RT_ADC_CMD_DISABLE = RT_DEVICE_CTRL_BASE(ADC) + 2 , RT_ADC_CMD_GET_RESOLUTION = RT_DEVICE_CTRL_BASE(ADC) + 3 , RT_ADC_CMD_GET_VREF = RT_DEVICE_CTRL_BASE(ADC) + 4 } |
函数 | |
rt_err_t | rt_hw_adc_register (rt_adc_device_t adc, const char *name, const struct rt_adc_ops *ops, const void *user_data) |
rt_uint32_t | rt_adc_read (rt_adc_device_t dev, rt_int8_t channel) |
rt_err_t | rt_adc_enable (rt_adc_device_t dev, rt_int8_t channel) |
rt_err_t | rt_adc_disable (rt_adc_device_t dev, rt_int8_t channel) |
rt_int16_t | rt_adc_voltage (rt_adc_device_t dev, rt_int8_t channel) |
ADC driver api
Example
typedef struct rt_adc_device* rt_adc_device_t |
enum rt_adc_cmd_t |
rt_err_t rt_hw_adc_register | ( | rt_adc_device_t | adc, |
const char * | name, | ||
const struct rt_adc_ops * | ops, | ||
const void * | user_data ) |
register the adc device
adc | adc device |
name | device name |
ops | device ops |
user_data | device private data |
rt_uint32_t rt_adc_read | ( | rt_adc_device_t | dev, |
rt_int8_t | channel ) |
rt_err_t rt_adc_enable | ( | rt_adc_device_t | dev, |
rt_int8_t | channel ) |
rt_err_t rt_adc_disable | ( | rt_adc_device_t | dev, |
rt_int8_t | channel ) |
rt_int16_t rt_adc_voltage | ( | rt_adc_device_t | dev, |
rt_int8_t | channel ) |