adc_config.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2018-12-24 zylx first version
  9. */
  10. #ifndef __ADC_CONFIG_H__
  11. #define __ADC_CONFIG_H__
  12. #include <rtthread.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifdef BSP_USING_ADC1
  17. #ifndef ADC1_CONFIG
  18. #define ADC1_CONFIG \
  19. { \
  20. .Instance = ADC1, \
  21. .Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1, \
  22. .Init.Resolution = ADC_RESOLUTION_12B, \
  23. .Init.DataAlign = ADC_DATAALIGN_RIGHT, \
  24. .Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD, \
  25. .Init.EOCSelection = ADC_EOC_SINGLE_CONV, \
  26. .Init.LowPowerAutoWait = DISABLE, \
  27. .Init.LowPowerAutoPowerOff = DISABLE, \
  28. .Init.ContinuousConvMode = DISABLE, \
  29. .Init.DiscontinuousConvMode = ENABLE, \
  30. .Init.ExternalTrigConv = ADC_SOFTWARE_START, \
  31. .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \
  32. .Init.DMAContinuousRequests = ENABLE, \
  33. .Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \
  34. }
  35. #endif /* ADC1_CONFIG */
  36. #endif /* BSP_USING_ADC1 */
  37. #ifdef __cplusplus
  38. }
  39. #endif
  40. #endif /* __ADC_CONFIG_H__ */