adc_config.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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-01-05 zylx first version
  9. * 2019-01-08 SummerGift clean up the code
  10. */
  11. #ifndef __ADC_CONFIG_H__
  12. #define __ADC_CONFIG_H__
  13. #include <rtthread.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #ifdef BSP_USING_ADC1
  18. #ifndef ADC1_CONFIG
  19. #define ADC1_CONFIG \
  20. { \
  21. .Instance = ADC1, \
  22. .Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1, \
  23. .Init.Resolution = ADC_RESOLUTION_12B, \
  24. .Init.DataAlign = ADC_DATAALIGN_RIGHT, \
  25. .Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD, \
  26. .Init.EOCSelection = ADC_EOC_SINGLE_CONV, \
  27. .Init.LowPowerAutoWait = DISABLE, \
  28. .Init.LowPowerAutoPowerOff = DISABLE, \
  29. .Init.ContinuousConvMode = DISABLE, \
  30. .Init.DiscontinuousConvMode = ENABLE, \
  31. .Init.ExternalTrigConv = ADC_SOFTWARE_START, \
  32. .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \
  33. .Init.DMAContinuousRequests = ENABLE, \
  34. .Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \
  35. }
  36. #endif /* ADC1_CONFIG */
  37. #endif /* BSP_USING_ADC1 */
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* __ADC_CONFIG_H__ */