/**
******************************************************************************************************************************************************************************************
*@file                       dm_button.h
*@author         
*@data                       
*@version                    v1.0
*@par Copyright(c):
*
*@par History:
*     version:author,date,desc
*     v1.0   :create this file
*
*******************************************************************************************************************************************************************************************
*/
#ifndef _DM_BUTTON_H_
#define _DM_BUTTON_H_

#include "app_config.h"
#if(DM_BUTTON_KEYBOARD)
/*
* brief to identify button
* if it is button matrix
*     key = col_io_idx|row_io_idx
* else
*     key = io_idx
*/
typedef uint16_t dm_btn_id_t;

typedef enum
{
    DM_BTN_ACT_RELEASED,
	DM_BTN_ACT_PRESSED,

	DM_BTN_ACT_NONE,

}dm_btn_action_t;

typedef struct
{
    dm_btn_id_t     btn_id;
	dm_btn_action_t action;

}dm_btn_report_t;

typedef void (*dm_btn_cbk_t)(dm_btn_report_t* p_rpt);

typedef struct
{
    uint32_t      scan_interval;     /// scan interval defaule 10ms (ms)
    uint8_t       scan_valid_times;  /// scan valid times.
	uint8_t       scan_times;        /// scan times
	uint32_t      row_io_map;        /// io row map
	uint32_t      col_io_map;        /// io column map
	dm_btn_cbk_t  cbk;              /// must not be NULL

}dm_btn_conf_t;

#endif
#endif
