luat_adc.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /******************************************************************************
  2. * ADC设备操作抽象层
  3. * @author wendal
  4. * @since 0.1.5
  5. *****************************************************************************/
  6. #ifndef Luat_ADC_H
  7. #define Luat_ADC_H
  8. #include "luat_base.h"
  9. typedef enum
  10. {
  11. ADC_SET_GLOBAL_RANGE = 0x80,
  12. }ADC_SET_CMD_ENUM;
  13. /******************************************************************************
  14. * luat_adc_open
  15. * Description: 打开一个adc通道
  16. * @param pin[in] adc通道的序号
  17. * @param args[in] 保留用,传NULL
  18. * @return 0 成功, 其他值为失败
  19. ******************************************************************************/
  20. int luat_adc_open(int pin, void* args);
  21. /******************************************************************************
  22. * luat_adc_read
  23. * Description: 读取adc通道的值
  24. * @param pin[in] adc通道的序号
  25. * @param val[out] adc通道的原始值
  26. * @param val2[out] adc通道的计算值,与具体通道有关
  27. * @return 0 成功, 其他值为失败
  28. ******************************************************************************/
  29. int luat_adc_read(int pin, int* val, int* val2);
  30. /******************************************************************************
  31. * luat_adc_close
  32. * Description: 关闭adc通道
  33. * @param pin[in] adc通道的序号
  34. * @return 0 成功, 其他值为失败
  35. ******************************************************************************/
  36. int luat_adc_close(int pin);
  37. #endif