MAX30205 Human Body Temperature Sensor

Dependents:   test_MAX30205

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX30205.h Source File

MAX30205.h

00001 #ifndef _MAX30205_H_
00002 #define _MAX30205_H_
00003 /**
00004  * MAX30205 Human Body Temperature Sensor 
00005  */
00006 #include "mbed.h"
00007 
00008 class MAX30205
00009 {
00010 public:
00011   /**
00012   * MAX30205 constructor
00013   *
00014   * @param sda SDA pin
00015   * @param sdl SCL pin
00016   * @param addr addr of the I2C peripheral
00017   */
00018   MAX30205(PinName sda, PinName scl, int addr);
00019 
00020   /**
00021   * MAX30205 destructor
00022   */
00023   ~MAX30205();
00024   
00025 /**
00026  * Get temperature
00027  * @param (none)
00028  * @returns uint16_t temperature value
00029  * @note bit[15] Sign
00030  * @note bit[14] 64 C
00031  * @note bit[13] 32 C
00032  * @note bit[12] 16 C
00033  * @note bit[11]  8 C
00034  * @note bit[10]  4 C
00035  * @note bit[ 9]  2 C
00036  * @note bit[ 8]  1 C
00037  * @note bit[ 7]  0.5 C
00038  * @note bit[ 6]  0.25 C
00039  * @note bit[ 5]  0.125 C
00040  * @note bit[ 4]  0.0625 C
00041  * @note bit[ 3]  0.03125 C
00042  * @note bit[ 2]  0.015625 C
00043  * @note bit[ 1]  0.0078125 C
00044  * @note bit[ 0]  0.00390625 C
00045  * @note in normal format Temp_float = (float)Temp_u16 / 256.0 ; 
00046  */
00047 uint16_t getTemp(void) ;
00048 
00049 /**
00050  * Get configuration register
00051  * @param (none)
00052  * @returns uint8_t configuration register value
00053  * @note bit[7] ONE-SHOT
00054  * @note bit[6] /TIMEOUT I2C but timeout 0: enable 1: disable
00055  * @note bit[5] DATAFORMAT 0: normal (0 - +50) 1: extended (64c + 2's comp)
00056  * @note bit[4] FAULT_QUEUE[1] determine the number of faults necessary to
00057  * @note bit[3] FAULT_QUEUE[0] trigger an OS condition.
00058  * @note bit[2] OS_POLARITY 0: OS output polarity active low 1: active high
00059  * @note bit[1] /COMPARATOR/INTERRUPT 0: comparator ode  1: interrupt mode
00060  * @note bit[0] SHUTDOWN 0: exit from shutdown 1: enter shutdown mode
00061  */
00062  
00063 uint8_t  getConf(void) ;
00064 
00065 /**
00066  * Set configuration register
00067  * @param uint8_t register value
00068  * @returns (none) 
00069  */
00070 void     setConf(uint8_t conf) ;
00071 
00072 /**
00073  * Get Thyst (lower limit threshold)
00074  * @param (none)
00075  * @returns uint16_t Thyst value
00076  */
00077 uint16_t getThyst(void) ;
00078 
00079 /**
00080  * Set Thyst
00081  * @param uint16_t thyst
00082  * @returns (none)
00083  */
00084 void     setThyst(uint16_t thyst) ;
00085 
00086 /**
00087  * Get Tos (upper limit threshold)
00088  * @param (none)
00089  * @returns uint16_t Tos
00090  */
00091 uint16_t getTos(void) ;
00092 
00093 /**
00094  * Set Tos
00095  * @param uint16_t Tos
00096  * @returns (none)
00097  */
00098 void     setTos(uint16_t tos) ;
00099 
00100 private:
00101   I2C m_i2c;
00102   int m_addr;
00103   void readRegs(int addr, uint8_t * data, int len);
00104   void writeRegs(uint8_t * data, int len);
00105 
00106 };
00107 
00108 #endif /* _MAX30205_H_ */