quec_boot_adc.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /** @file
  2. quec_boot_adc.h
  3. @brief
  4. This file is used to define boot adc api for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. 04/08/2021 Neo Init version
  17. =================================================================*/
  18. #ifndef QUEC_BOOT_ADC_H
  19. #define QUEC_BOOT_ADC_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /*===========================================================================
  24. * Macro Definition
  25. ===========================================================================*/
  26. #define QL_BOOT_ADC0_CHANNEL 0
  27. #define QL_BOOT_ADC1_CHANNEL 1
  28. #define QL_BOOT_ADC2_CHANNEL 2
  29. #define QL_BOOT_ADC3_CHANNEL 3
  30. #define QL_BOOT_VBAT_CHANNEL 4
  31. typedef enum
  32. {
  33. QL_BOOT_ADC_SCALE_1V250 = 0,
  34. QL_BOOT_ADC_SCALE_2V444 = 1,
  35. QL_BOOT_ADC_SCALE_3V233 = 2,
  36. QL_BOOT_ADC_SCALE_5V000 = 3,
  37. QL_BOOT_ADC_SCALE_MAX = 3,
  38. }ql_boot_adc_aux_scale;
  39. /*===========================================================================
  40. * Functions declaration
  41. ===========================================================================*/
  42. /**
  43. * @brief init adc
  44. */
  45. void quec_boot_adc_init(void);
  46. /**
  47. * @brief get adc channel volt
  48. * you need to initialize ADC first, and then call this function to get the voltage
  49. *
  50. * @param
  51. * channel id
  52. *
  53. * @return
  54. * channel volt
  55. */
  56. int quec_boot_adc_get_volt(int ql_adc_channel_id);
  57. /**
  58. * @brief get adc channel raw volt
  59. * you need to initialize ADC first, and then call this function to get the raw voltage
  60. * this interface obtain adc raw data in order to improve the speed, customers need to
  61. * optimize the accuracy themselves
  62. *
  63. * @param
  64. * adc_id [in] input adcid
  65. * aux_scale [in] input adc scale
  66. * adc_value [out] raw adc value
  67. *
  68. * @return
  69. * channel volt
  70. */
  71. int quec_boot_adc_get_volt_raw(int ql_adc_channel_id, ql_boot_adc_aux_scale aux_scale);
  72. #ifdef __cplusplus
  73. } /*"C" */
  74. #endif
  75. #endif /* QUEC_BOOT_ADC_H */