#ifndef _QMC5883L_H
#define _QMC5883L_H
#include "user.h"
enum IIC_ENUM
{
	start_error = 0,
	send_error = 1,
	recive_error = 2,
	sucess = 3
};
enum QMC_STATE
{
	qmc_init = 0,
	qmc_dec = 1,
	qmc_lowpower = 2,
	qmc_printf = 3,
        IDLE = 4
};

struct QMCSTR
{
    bool DataOkFlag;
    uint8_t QMC_DEC_CNT;
    uint8_t QMC_CUR_ROPORT[6];
    int16_t QMC_BASE[3];
    int16_t QMC_BEFORE[3];
    int16_t QMC_STABLE[3];
    int16_t QMC_CUR[3];
};
static int QMC5883L_Init(void);
static enum IIC_ENUM QMC_Reg_Write(uint8_t slave_add,uint8_t reg_add,uint8_t len,uint8_t* data);
static enum IIC_ENUM QMC_Reg_Read(uint8_t slave_add,uint8_t reg_add,uint8_t len,uint8_t* data);
static bool QMC5883L_init(void);
static void QmcTest(void);
void QmcDeal(void);
#define SLAVE_ADD 0x1A
#define HC_DEBUG 0
#define IIC_TEST_DEBUG 1
#define MagDataNum 6

extern struct QMCSTR QMC5883LStr;
#endif
