hal_adc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /**
  2. * @file hal_adc.h
  3. * @author Xiao, Lifan (xiaolf6@midea.com)
  4. * @brief
  5. * @version 0.1
  6. * @date 2021-08-09
  7. *
  8. * @copyright Copyright (c) 2021
  9. *
  10. */
  11. #ifndef _HAL_ADC_H_
  12. #define _HAL_ADC_H_
  13. #include "hal_config.h"
  14. /****************************************************************
  15. *
  16. * Standard Interface
  17. *
  18. * *************************************************************/
  19. /******************************/
  20. /* Global Interface Variables */
  21. /******************************/
  22. /* !!!Important!!! */
  23. /* Interface Variable Should Not Be Modified By Application */
  24. /**
  25. * @brief The raw sampling results
  26. *
  27. */
  28. extern uint16_t *Hal_Adc_RawResults;
  29. /**
  30. * @brief The scaled sampling results, calculated by y=a(x+b)
  31. *
  32. */
  33. extern int32_t *Hal_Adc_ScaledResults;
  34. /*************************/
  35. /* Global Interface Hook */
  36. /*************************/
  37. /**
  38. * @brief Function hook called at the end of the sampling
  39. *
  40. */
  41. extern void (*Hal_Adc_SamplingCompleteHook)();
  42. /**************************************/
  43. /* Platform Layer Interface Functions */
  44. /**************************************/
  45. /**
  46. * @brief Init adc module
  47. *
  48. */
  49. void Hal_Adc_Init();
  50. /**
  51. * @brief Read sampling results from the adc peripheral
  52. *
  53. */
  54. void Hal_Adc_Read();
  55. /**
  56. * @brief Set the scale of the specified channel
  57. *
  58. * @param scale in format q17.15
  59. * @param channel channel index
  60. */
  61. void Hal_Adc_SetScale(int32_t scale, uint8_t channel);
  62. /**
  63. * @brief Set the offset of the specified channel
  64. *
  65. * @param offset in range 0...4096
  66. * @param channel channel index
  67. */
  68. void Hal_Adc_SetOffset(int16_t offset, uint8_t channel);
  69. #endif