Files
kunlun/app/smart_grid/inc/iot_sg_sta_ext_mf.h
2024-09-28 14:24:04 +08:00

95 lines
2.9 KiB
C

/****************************************************************************
Copyright(c) 2019 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_SG_STA_EXT_MF_H
#define IOT_SG_STA_EXT_MF_H
#include "os_types_api.h"
#include "iot_sg_sta.h"
#ifdef __cplusplus
extern "C" {
#endif
/* define second pulse signal cycle detection */
#define IOT_SG_STA_EXT_MF_MODE_PPS_CYCLE (0)
/* define pulse signal count */
#define IOT_SG_STA_EXT_MF_MODE_PULSE_COUNT (1)
/* define second pulse callback type */
typedef void (*iot_sg_sta_ext_mf_sec_pulse_finish_handle)(uint32_t cycle);
/* define pulse count callback type */
typedef void (*iot_sg_sta_ext_mf_pulse_finish_handle)(uint32_t count);
/**
* @brief init multifunction signal if not initialized.
*
* @return uint32_t @see ERR_XXX
*/
uint32_t iot_sg_sta_ext_mf_init();
/**
* @brief deinit multifunction signal
*
* @return uint32_t @see ERR_XXX
*/
void iot_sg_sta_ext_mf_deinit();
/**
* @brief start multifunction second pulse signal measure
*
* @param callback called when the period measurement is complete
* @return uint32_t @see ERR_XXX
*/
uint32_t iot_sg_sta_ext_mf_start_second_pulse_monitor(
iot_sg_sta_ext_mf_sec_pulse_finish_handle callback);
/**
* @brief start multifunction pulse signal count measure.
*
* @param buffer memory for cache the time point of pulse, can`t local variable.
* @param buffer_count count of data that can be stored in buffer.
* @param exec_time total time required for run, unit is 1s, 0 mean unlimited.
* @param callback callback function called when the multifunction stop.
* including timed expiration and calling the stop function
* @return uint32_t @see ERR_XXX
*/
uint32_t iot_sg_sta_ext_mf_start_pulse_monitor(
uint32_t *buffer, uint32_t buffer_count, uint32_t exec_time,
iot_sg_sta_ext_mf_pulse_finish_handle callback);
/**
* @brief stop multifunction signal measure
*/
void iot_sg_sta_ext_mf_stop();
/**
* @brief multifunction for refresh time callback
*/
void iot_sg_sta_ext_mf_refresh();
/**
* @brief check if multifunction is running.
*
* @return uint8_t 1: running, 0: not running
*/
uint8_t iot_sg_sta_ext_mf_is_running();
#ifdef __cplusplus
}
#endif
#endif /* IOT_SG_STA_EXT_MF_H */