drv_adc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-06-04 Chushicheng first version
  9. */
  10. #ifndef __DRV_ADC_H__
  11. #define __DRV_ADC_H__
  12. #include <rtdevice.h>
  13. #if defined BSP_USING_ADC
  14. /* pico i2c dirver class */
  15. static struct pico_adc
  16. {
  17. struct rt_adc_ops ops;
  18. struct rt_adc_device pico_adc_device;
  19. };
  20. /* pico config class */
  21. static struct pico_adc_config
  22. {
  23. rt_uint8_t pin;
  24. rt_uint8_t channel;
  25. const char *device_name;
  26. };
  27. #ifdef BSP_USING_ADC0
  28. #define ADC0_CONFIG \
  29. { \
  30. .pin = 26, \
  31. .channel = 0, \
  32. .device_name = "adc0", \
  33. }
  34. #endif
  35. #ifdef BSP_USING_ADC1
  36. #define ADC1_CONFIG \
  37. { \
  38. .pin = 27, \
  39. .channel = 1, \
  40. .device_name = "adc1", \
  41. }
  42. #endif
  43. #ifdef BSP_USING_ADC2
  44. #define ADC1_CONFIG \
  45. { \
  46. .pin = 28, \
  47. .channel = 2, \
  48. .device_name = "adc2", \
  49. }
  50. #endif
  51. int rt_hw_adc_init(void);
  52. #endif /* BSP_USING_ADC */
  53. #endif /* __DRV_ADC_H__ */