Files
kunlun/ftm/inc/zero_cross_detec.h
2024-09-28 14:24:04 +08:00

59 lines
2.0 KiB
C
Executable File

/****************************************************************************
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 __ZERO_CROSS_DETEC_H
#define __ZERO_CROSS_DETEC_H
#ifdef __cplusplus
extern "C" {
#endif
#define IOT_ZC_FULL_PERIOD (500000)
#define IOT_ZC_FULL_OFFSET (1000)
#define IOT_ZC_BUF (10)
/* pt zc circuit check status */
typedef struct _zc_circuit_check_status {
/* zc circuit check status */
uint8_t status;
/* zc buf collect length */
uint8_t zc_buf_len;
/* zc time buf */
uint32_t zc_buf[IOT_ZC_BUF];
} zc_circuit_check_status_t;
/* pt zc circuit interrupt init */
/**
* @brief iot_zc_circuit_interrupt_init - initialize pt zc circuit interrupt init
* @param phase_zc [phase of the zero cross.]
* @return ret [ERR_OK for good otherwise ERR_FAIL.]
*/
uint32_t iot_zc_circuit_interrupt_init(uint8_t phase_zc);
/* get pt zc circuit check status */
/**
* @brief iot_zc_circuit_check_status_get - get pt zc circuit check
* @param phase_zc [phase of the zero cross.]
* @param zc_inform [zero cross information.]
* @return [check status]
*/
uint8_t iot_zc_circuit_check_status_get(uint8_t phase_zc, \
zc_circuit_check_status_t * zc_inform);
#ifdef __cplusplus
}
#endif
#endif /* __ZERO_CROSS_DETEC_H */