AKM AK09970N 3D Magnetic Sensor with Programmable Switch
Embed:
(wiki syntax)
Show/hide line numbers
AK09970N.h
00001 #ifndef _AK09970N_H_ 00002 #define _AK09970N_H_ 00003 /** 00004 * AK09970N 00005 * 3D Magnetic Sensor with Programmable Switch 00006 */ 00007 #include "mbed.h" 00008 class AK09970N 00009 { 00010 public: 00011 /** 00012 * AK09970N constructor 00013 * 00014 * @param sda SDA pin 00015 * @param sdl SCL pin 00016 * @param addr addr of the I2C peripheral 00017 */ 00018 AK09970N(PinName sda, PinName scl, int addr); 00019 00020 /** 00021 * AK09970N destructor 00022 */ 00023 ~AK09970N(); 00024 int software_reset(void) ; 00025 int getID(uint16_t *CompanyID, uint16_t *DeviceID) ; 00026 uint16_t getStatus(void) ; 00027 int setINT(uint16_t value) ; 00028 uint16_t getINT(void) ; 00029 int setConfig(uint8_t config) ; 00030 uint8_t getConfig(void) ; 00031 int singleShot(void) ; 00032 float i2f(int16_t value) ; 00033 00034 /* get data float version */ 00035 int getX(uint16_t *status, float *x) ; 00036 int getY(uint16_t *status, float *y) ; 00037 int getZ(uint16_t *status, float *z) ; 00038 int getX_Y(uint16_t *status, float *x, float *y) ; 00039 int getX_Z(uint16_t *status, float *x, float *z) ; 00040 int getY_Z(uint16_t *status, float *y, float *z) ; 00041 int getX_Y_Z(uint16_t *status, float *x, float *y, float *z) ; 00042 00043 /* get data 16bit version */ 00044 int getHX(uint16_t *status, int16_t *x) ; 00045 int getHY(uint16_t *status, int16_t *y) ; 00046 int getHZ(uint16_t *status, int16_t *z) ; 00047 int getHX_HY(uint16_t *status, int16_t *x, int16_t *y) ; 00048 int getHX_HZ(uint16_t *status, int16_t *x, int16_t *z) ; 00049 int getHY_HZ(uint16_t *status, int16_t *y, int16_t *z) ; 00050 int getHX_HY_HZ(uint16_t *status, int16_t *x, int16_t *y, int16_t *z) ; 00051 00052 /* get data 8bit version */ 00053 int getBX(uint16_t *status, int8_t *x) ; 00054 int getBY(uint16_t *status, int8_t *y) ; 00055 int getBZ(uint16_t *status, int8_t *z) ; 00056 int getBX_BY(uint16_t *status, int8_t *x, int8_t *y) ; 00057 int getBX_BZ(uint16_t *status, int8_t *x, int8_t *z) ; 00058 int getBY_BZ(uint16_t *status, int8_t *y, int8_t *z) ; 00059 int getBX_BY_BZ(uint16_t *status, int8_t *x, int8_t *y, int8_t *z) ; 00060 00061 /* get thresholds */ 00062 int getTHS_X1(int16_t *bop, int16_t *brp) ; 00063 int getTHS_X2(int16_t *bop, int16_t *brp) ; 00064 int getTHS_Y1(int16_t *bop, int16_t *brp) ; 00065 int getTHS_Y2(int16_t *bop, int16_t *brp) ; 00066 int getTHS_Z1(int16_t *bop, int16_t *brp) ; 00067 int getTHS_Z2(int16_t *bop, int16_t *brp) ; 00068 00069 /* set thresholds */ 00070 int setTHS_X1(int16_t bop, int16_t brp) ; 00071 int setTHS_X2(int16_t bop, int16_t brp) ; 00072 int setTHS_Y1(int16_t bop, int16_t brp) ; 00073 int setTHS_Y2(int16_t bop, int16_t brp) ; 00074 int setTHS_Z1(int16_t bop, int16_t brp) ; 00075 int setTHS_Z2(int16_t bop, int16_t brp) ; 00076 00077 private: 00078 uint8_t _mode ; 00079 uint8_t _sdr ; 00080 uint8_t _smr ; 00081 I2C m_i2c; 00082 int m_addr; 00083 int readRegs(int addr, uint8_t * data, int len); 00084 int writeRegs(uint8_t * data, int len); 00085 }; 00086 #endif
Generated on Sat Jul 16 2022 02:15:28 by 1.7.2