diff options
| author | Meco Man <[email protected]> | 2023-04-08 22:24:19 -0400 |
|---|---|---|
| committer | Man, Jianting (Meco) <[email protected]> | 2023-04-08 22:40:37 -0400 |
| commit | e9bbc2e3490d1259c3a597a6305ca1376e767878 (patch) | |
| tree | 215c7a90543da5a13720ec65461cde37be492c59 /components/drivers/include | |
| parent | c8956357e4006216861a034e06c4a85fa6b132a2 (diff) | |
[adc] modify adc channel data type from rt_uint32_t to rt_int8_t
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/adc.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/drivers/include/drivers/adc.h b/components/drivers/include/drivers/adc.h index 2e4da26819..b332c94538 100644 --- a/components/drivers/include/drivers/adc.h +++ b/components/drivers/include/drivers/adc.h @@ -12,17 +12,18 @@ #ifndef __ADC_H__ #define __ADC_H__ + #include <rtthread.h> -#define RT_ADC_INTERN_CH_TEMPER ((rt_uint32_t)-1) -#define RT_ADC_INTERN_CH_VREF ((rt_uint32_t)-2) -#define RT_ADC_INTERN_CH_VBAT ((rt_uint32_t)-3) +#define RT_ADC_INTERN_CH_TEMPER (-1) +#define RT_ADC_INTERN_CH_VREF (-2) +#define RT_ADC_INTERN_CH_VBAT (-3) struct rt_adc_device; struct rt_adc_ops { - rt_err_t (*enabled)(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled); - rt_err_t (*convert)(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value); + rt_err_t (*enabled)(struct rt_adc_device *device, rt_int8_t channel, rt_bool_t enabled); + rt_err_t (*convert)(struct rt_adc_device *device, rt_int8_t channel, rt_uint32_t *value); rt_uint8_t (*get_resolution)(struct rt_adc_device *device); rt_int16_t (*get_vref) (struct rt_adc_device *device); }; @@ -43,10 +44,9 @@ typedef 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); - -rt_uint32_t rt_adc_read(rt_adc_device_t dev, rt_uint32_t channel); -rt_err_t rt_adc_enable(rt_adc_device_t dev, rt_uint32_t channel); -rt_err_t rt_adc_disable(rt_adc_device_t dev, rt_uint32_t channel); -rt_int16_t rt_adc_voltage(rt_adc_device_t dev, rt_uint32_t channel); +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); #endif /* __ADC_H__ */ |
