/*
 * @file hv_pm51_app_IR.h
 * @brief Header file of IR remote module.
 *
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) Use ()
 *
 * @endverbatim
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2023-03-01
 */

#ifndef __HV_PM51_APP_IR_H__
#define __HV_PM51_APP_IR_H__

#define IR_HEADER                   0x2C001    /* 9+4.5  = 13.5ms */ /* (C51_CLK_FREQ*13.5)/1000/2 */
#define IR_REPEAT                   0x24AAB    /*  9+2.25 = 11.25ms */ /* (C51_CLK_FREQ*11.25)/1000/2 */
#define IR_BIT_ONE                  0x7555     /*  2.25ms */  /* (C51_CLK_FREQ*2.25)/1000/2 */
#define IR_BIT_ZERO                 0x3A68     /*  1.125ms */ /* (C51_CLK_FREQ*1.125)/1000/2 */
#define IR_MAX                      (IR_HEADER+IR_REPEAT)
#define IR_MIN                      (IR_BIT_ONE+IR_BIT_ZERO)

#define IR_DATA_BIT_LEN              32

typedef enum _IRStatusType
{
    E_IR_IDLE,
    E_IR_HEAD,
    E_IR_DATA,
} IRStatusType;

/**
 * @brief IR initialization.
 * @return None.
 */
void Hv_PM51_IR_Init(void);

/**
 * @brief Analyze IR header and data.
 * @return None.
 */
void Hv_PM51_IR_RecvHandler(void);

/**
 * @brief Send IR key values by mailbox.
 * @return None.
 */
void Hv_PM51_IR_SendKeyVal(void);

/**
 * @brief Get current IR handle status.
 * @return IR handle status.
 */
UCHAR8 Hv_PM51_IR_GetCurStatus(void);

void Hv_PM51_IR_Reset(void);

#endif
