//MAGNETOMETER1MMC.h

#ifndef MAGNETOMETER1MMC_H
#define	MAGNETOMETER1MMC_H

#define MMC_Address 0x30
#define MMC_Contr_Reg_0 0x1B
#define MMC_Contr_Reg_1 0x1C
#define MMC_Contr_Reg_2 0x1D
#define MMC_Device_Status_1 0x18
#define MMC_Device_Status_0 0x19
#define MMC_ODR 0x1A
#define MMC_X_out_0 0x00
#define MMC_X_out_1 0x01
#define MMC_X_out_2 0x06
#define MMC_Y_out_0 0x02
#define MMC_Y_out_1 0x03
#define MMC_Y_out_2 0x07
#define MMC_Z_out_0 0x04
#define MMC_Z_out_1 0x05
#define MMC_Z_out_2 0x08

#define MMC_Contr_Reg_0_Set 0xA1 //Auto Set/Reset, take measure xyz

typedef struct MMC_DATA {
    float mmc_x;
    float mmc_y;
    float mmc_z;
} MMC_DATA;

typedef struct {
    int16_t x;
    int16_t y;
    int16_t z;
} _axesInt;

void MMC_Set(void);
void MMC_Reset(void);
void MMC_Calib(uint16_t loop);
void MMC_Meas_HI_Compensated(uint16_t loop);
void MMC_Meas_Compensated(uint16_t loop);
void MMC_SI_Calib(uint16_t loop);
void MMC_Meas_Azimuth(uint16_t loop);
float MMC_Single_Meas_Azimuth(void);
void MMC_Meas_Set(uint8_t Contr_Reg_Num, uint8_t Contr_Reg_Num_Set);
void MMC_Separate_XYZ(uint8_t *data);
float MMC_Read_Data(uint8_t address);
void MMC_Get_Float_Data(MMC_DATA *);
void MMC_init(void);

#endif	/* MAGNETOMETER1MMC_H */

