1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #ifndef ADC_IF_H 10 #define ADC_IF_H 11 12 #include "platform_if.h" 13 14 #ifdef __cplusplus 15 #if __cplusplus 16 extern "C" { 17 #endif 18 #endif /* __cplusplus */ 19 20 struct AdcIoMsg { 21 uint32_t number; 22 uint32_t channel; 23 }; 24 25 DevHandle AdcOpen(uint32_t number); 26 27 void AdcClose(DevHandle handle); 28 29 int32_t AdcRead(DevHandle handle, uint32_t channel, uint32_t *val); 30 31 /** 32 * @brief Enumerates ADC I/O commands. 33 * 34 * @since 1.0 35 */ 36 enum AdcIoCmd { 37 ADC_IO_READ = 0, /**< Read the A/D data. */ 38 ADC_IO_OPEN, /**< Open the ADC device. */ 39 ADC_IO_CLOSE, /**< Close the ADC device. */ 40 }; 41 #ifdef __cplusplus 42 #if __cplusplus 43 } 44 #endif 45 #endif /* __cplusplus */ 46 47 #endif /* ADC_IF_H */ 48