AKM AK9753 IR Sensor IC with I2C I/F

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AK9753.h Source File

AK9753.h

00001 /*************************************
00002  * AK9753
00003  * AKM Ultra-small IR Sensor IC with I2C I/F
00004  **/
00005 #ifndef _AK9753_H_
00006 #define _AK9753_H_
00007 #include "mbed.h"
00008 
00009 class AK9753
00010 {
00011 public:
00012   /**
00013   * AK9753 constructor
00014   *
00015   * @param sda SDA pin
00016   * @param sdl SCL pin
00017   * @param addr addr of the I2C peripheral
00018   */
00019   AK9753(PinName sda, PinName scl, int addr);
00020 
00021   /**
00022   * AK9753 destructor
00023   */
00024   ~AK9753();
00025   
00026   uint8_t getCompanyCode(void) ;
00027   uint8_t getDeviceID(void) ;
00028   bool    dataReady(void) ; /* returns ST1[0], read ST2 to clear */
00029   bool    dataOverRun(void) ; /* return ST1[1], read ST2, etc, to clear */
00030   uint8_t getINTST(void) ; /** return REG_INTST */
00031   uint8_t getST1(void) ;
00032   int16_t getRawIR1(void) ;
00033   float   getIR1(void) ;
00034   int16_t getRawIR2(void) ;
00035   float   getIR2(void) ;
00036   int16_t getRawIR3(void) ;
00037   float   getIR3(void) ;
00038   int16_t getRawIR4(void) ;
00039   float   getIR4(void) ;
00040   int16_t getRawTMP(void) ;
00041   float   getTMP(void) ;
00042   uint8_t getST2(void) ;
00043   int16_t getETH13H(void) ;
00044   int16_t getETH13L(void) ;
00045   int16_t getETH24H(void) ;
00046   int16_t getETH24L(void) ;
00047   uint8_t getEHYS13(void) ;
00048   uint8_t getEHYS24(void) ;
00049   uint8_t getEINTEN(void) ;
00050   uint8_t getECNTL1(void) ;
00051   uint8_t getCNTL2(void) ;
00052   
00053   void    setETH13H(int16_t value) ;
00054   void    setETH13L(int16_t value) ;
00055   void    setETH24H(int16_t value) ;
00056   void    setETH24L(int16_t value) ;
00057   void    setEHYS13(uint8_t value) ;
00058   void    setEHYS24(uint8_t value) ;
00059   void    setEINTEN(uint8_t value) ;
00060   void    setECNTL1(uint8_t value) ;
00061   void    software_reset(void) ;
00062   
00063 
00064 private:
00065   I2C m_i2c;
00066   int m_addr;
00067   int readRegs(int addr, uint8_t * data, int len);
00068   int writeRegs(uint8_t * data, int len);
00069 };
00070 
00071 #endif /* _AK9752_H_ */