blob: d3baeaf8e854d6abd6632e8aeb294fcd3c630a7b [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001#include "ql_adc.h"
2#include "mbtk_adc.h"
3
4
5/*========================================================================
6 FUNCTION: ql_adc_show
7=========================================================================*/
8/** @brief
9 This function retrieves the ADC voltage value with the specified
10 ADC channel.
11 Support input vol value:
12 ADC0 : 0V-VBAT_BB
13 ADC1 : 0V-VBAT_BB
14
15 @param[in] qadc, adc channel definitions, one value of ADC_CHANNEL_E.
16
17 @return
18 adc value(mv) on success
19 on failure, the return value is -1;
20*/
21/*=======================================================================*/
22int ql_adc_show(ADC_CHANNEL_E qadc)
23{
24 if(qadc >= ADC0 && qadc <= ADC2) {
25 int result = mbtk_adc_get(ADC_DEVICE_AUX, (mbtk_adc_enum)(qadc - 1));
26 if(result < 0) {
27 return -1;
28 } else {
29 return result;
30 }
31 } else {
32 return -1;
33 }
34}
35