79 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			79 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								Copyright(c) 2024 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
							 | 
						||
| 
								 | 
							
								be copied by any method or incorporated into another program without
							 | 
						||
| 
								 | 
							
								the express written consent of Aerospace C.Power. This Information or any portion
							 | 
						||
| 
								 | 
							
								thereof remains the property of Aerospace C.Power. The Information contained herein
							 | 
						||
| 
								 | 
							
								is believed to be accurate and Aerospace C.Power assumes no responsibility or
							 | 
						||
| 
								 | 
							
								liability for its use in any way and conveys no license or title under
							 | 
						||
| 
								 | 
							
								any patent or copyright and makes no representation or warranty that this
							 | 
						||
| 
								 | 
							
								Information is free from patent or copyright infringement.
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								****************************************************************************/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifndef IOT_SUNSOLAR_ADC_H
							 | 
						||
| 
								 | 
							
								#define IOT_SUNSOLAR_ADC_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_sunsolar_adc_volt_get() - get voltage of sunsolar.
							 | 
						||
| 
								 | 
							
								 * @param ch         :    channel.
							 | 
						||
| 
								 | 
							
								 * @param [out] volt :    voltage, unit is 0.1V.
							 | 
						||
| 
								 | 
							
								 * @return           :    ERR_OK, got a valid value;
							 | 
						||
| 
								 | 
							
								 *                        ERR_FAIL, got an invalid value;
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_sunsolar_adc_volt_get(uint8_t ch, uint16_t * volt);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_sunsolar_adc_rsd_volt_get() - get RSD check voltage of sunsolar.
							 | 
						||
| 
								 | 
							
								 * @param ch         :    channel.
							 | 
						||
| 
								 | 
							
								 * @param [out] volt :    voltage, unit is 0.1V.
							 | 
						||
| 
								 | 
							
								 * @return           :    ERR_OK, got a valid value;
							 | 
						||
| 
								 | 
							
								 *                        ERR_FAIL, got an invalid value;
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_sunsolar_adc_rsd_volt_get(uint8_t ch, uint16_t * volt);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_sunsolar_adc_temp_get() - get temperature of sunsolar.
							 | 
						||
| 
								 | 
							
								 * @param [out] temp :    temperature, unit is 0.1C
							 | 
						||
| 
								 | 
							
								 * @return           :    ERR_OK, got a valid value;
							 | 
						||
| 
								 | 
							
								 *                        ERR_FAIL, got an invalid value;
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_sunsolar_adc_temp_get(int16_t * temp);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_sunsolar_adc_current_get() - get current of sunsolar.
							 | 
						||
| 
								 | 
							
								 * @param [out] current :    current, unit is 1mA.
							 | 
						||
| 
								 | 
							
								 * @return              :    ERR_OK, got a valid value;
							 | 
						||
| 
								 | 
							
								 *                           ERR_FAIL, got an invalid value;
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_sunsolar_adc_current_get(uint16_t * current);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_sunsolar_adc_init() - init voltate, current and temperature
							 | 
						||
| 
								 | 
							
								 *        sampler.
							 | 
						||
| 
								 | 
							
								 * @param [out] pv_count:   count of pv
							 | 
						||
| 
								 | 
							
								 * @return:  0 - for success case, otherwise fail
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								uint32_t iot_sunsolar_adc_init(uint8_t *pv_count);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @brief iot_sunsolar_adc_deinit() - deinit voltate, current and temperature
							 | 
						||
| 
								 | 
							
								 *        sampler.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								void iot_sunsolar_adc_deinit(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* IOT_SUNSOLAR_ADC_H */
							 |