#ifndef _DM_IMITATE_SPI_H_
#define _DM_IMITATE_SPI_H_

#include "cpu.h"
#include "datatype.h"
#include "hci_hlp.h"

#define RECEIVE_FLAG  0x80
#define BUFF_LEN      5

typedef enum
{
    PRODUCT_ID1 = 0x00,
	PRODUCT_ID2 = 0x01,
	MOTION_STATUS = 0x02,
	DELTA_X = 0x03,
	DELTA_Y = 0x04,
	OPERATION_MODE = 0x05,
	CONFIGURATION = 0x06,
	IMAGE_QUALITY = 0x07,
	OPERATION_STATE = 0x08,
	WRITE_PROTECT = 0x09,
	SLEEP1_SETTING = 0x0A,
	ENTER_TIME = 0x0B,
	SLEEP2_SETTING = 0x0C,
	IMAGE_THRESHOLD = 0x0D,
	IMAGE_RECOGNITION = 0x0E,
}mouse_ic_register_t;

typedef enum
{
	IC_STATE_CLOSE,
	IC_STATE_OPEN,
	
	IC_STATE_OTP,

}ic_register_state_t;

typedef struct 
{
    int8_t  xdata[BUFF_LEN];
	int8_t  ydata[BUFF_LEN];
    uint32_t tx_save_pos;
    uint32_t tx_send_pos;
}tx_buf_t;

void mouse_ic_init(void);
void dm_imitate_spi_gpio_init(void);
void write_mouse_register(mouse_ic_register_t ic_register, uint8_t data);
uint8_t read_mouse_register(uint8_t ic_register);
#endif
