#ifndef bexus_mag_h #define bexus_mag_h #ifdef __cplusplus extern "C" { #endif //#include "cmsis_os.h" #include "main.h" #include #include "bexus_variables.h" #include "i2c.h" #include #include // register addresses enum regAddr { WHO_AM_I = 0x0F, CTRL_REG1 = 0x20, CTRL_REG2 = 0x21, CTRL_REG3 = 0x22, CTRL_REG4 = 0x23, CTRL_REG5 = 0x24, STATUS_REG = 0x27, OUT_X_L = 0x28, OUT_X_H = 0x29, OUT_Y_L = 0x2A, OUT_Y_H = 0x2B, OUT_Z_L = 0x2C, OUT_Z_H = 0x2D, TEMP_OUT_L = 0x2E, TEMP_OUT_H = 0x2F, INT_CFG = 0x30, INT_SRC = 0x31, INT_THS_L = 0x32, INT_THS_H = 0x33, }; void Mag_cal(void); void Mag_Init(void); void writeReg(uint8_t reg, uint8_t value); uint8_t readReg(uint8_t reg); int Mag_Read(void); uint8_t testReg(uint8_t address, uint8_t reg); /* void vector_cross (struct vector_Uint *a,struct vector_Uint *b,struct vector_Uint *out ) { out->x = (a->y * b->z) - (a->z * b->y); out->y = (a->z * b->x) - (a->x * b->z); out->z = (a->x * b->y) - (a->y * b->x); }*/ #ifdef __cplusplus } #endif #endif