/*
 * @Description: 按键模块-svc层
 * @Author: yangsw
 * @Date: 2021-06-11 09:49:42
 * @LastEditTime: 2021-07-13 10:40:10
 * @LastEditors: yangsw
 * @Reference:
 */
#ifndef H_SVC_KEY_H
#define H_SVC_KEY_H

#include "../bsp/bsp_key.h"

typedef enum
{
    /*默认状态*/
    E_KEY_INIT_STATE,
    /*正在按下*/
    E_KEY_IS_PRESS,
    E_KEY_1S_STATE, // 1s状态
    E_KEY_3S_STATE, // 3s状态
    E_KEY_6S_STATE, // 6s状态
} E_Key_Press_Type;

typedef struct
{
    E_Key_Press_Type e_keyPressType;
    gw_u16 key_cnt;
    gw_u16 key_rel_cnt; // 按键松开的时间ms
    gw_u8 key_up_cnt; // 按键上报次数
} S_Key;

#define KEY_1S          1
#define KEY_3S          3
#define KEY_6S          6
#define KEY_BREAK       14

#define KEY_RELEASE     100     //按键判定释放计数

void Svc_Key_Init(S_Key *ps_key_temp);
void Svc_Key_Press(S_Key *ps_key);
void Svc_Key_Release(S_Key *ps_key);
E_Gpio_State Svc_Key_Get_State(void);
E_Result_Check Svc_Key_Is_Busy(void);
void Svc_Key_Clear_Key_UpCnt(void);
#endif