MAX30205 Human Body Temperature Sensor
MAX30205.h@1:eed7f4c33402, 2017-04-25 (annotated)
- Committer:
- Rhyme
- Date:
- Tue Apr 25 05:12:24 2017 +0000
- Revision:
- 1:eed7f4c33402
- Parent:
- 0:6cf99fa71e1b
format comment added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:6cf99fa71e1b | 1 | #ifndef _MAX30205_H_ |
Rhyme | 0:6cf99fa71e1b | 2 | #define _MAX30205_H_ |
Rhyme | 0:6cf99fa71e1b | 3 | /** |
Rhyme | 0:6cf99fa71e1b | 4 | * MAX30205 Human Body Temperature Sensor |
Rhyme | 0:6cf99fa71e1b | 5 | */ |
Rhyme | 0:6cf99fa71e1b | 6 | #include "mbed.h" |
Rhyme | 0:6cf99fa71e1b | 7 | |
Rhyme | 0:6cf99fa71e1b | 8 | class MAX30205 |
Rhyme | 0:6cf99fa71e1b | 9 | { |
Rhyme | 0:6cf99fa71e1b | 10 | public: |
Rhyme | 0:6cf99fa71e1b | 11 | /** |
Rhyme | 0:6cf99fa71e1b | 12 | * MAX30205 constructor |
Rhyme | 0:6cf99fa71e1b | 13 | * |
Rhyme | 0:6cf99fa71e1b | 14 | * @param sda SDA pin |
Rhyme | 0:6cf99fa71e1b | 15 | * @param sdl SCL pin |
Rhyme | 0:6cf99fa71e1b | 16 | * @param addr addr of the I2C peripheral |
Rhyme | 0:6cf99fa71e1b | 17 | */ |
Rhyme | 0:6cf99fa71e1b | 18 | MAX30205(PinName sda, PinName scl, int addr); |
Rhyme | 0:6cf99fa71e1b | 19 | |
Rhyme | 0:6cf99fa71e1b | 20 | /** |
Rhyme | 0:6cf99fa71e1b | 21 | * MAX30205 destructor |
Rhyme | 0:6cf99fa71e1b | 22 | */ |
Rhyme | 0:6cf99fa71e1b | 23 | ~MAX30205(); |
Rhyme | 0:6cf99fa71e1b | 24 | |
Rhyme | 0:6cf99fa71e1b | 25 | /** |
Rhyme | 0:6cf99fa71e1b | 26 | * Get temperature |
Rhyme | 0:6cf99fa71e1b | 27 | * @param (none) |
Rhyme | 0:6cf99fa71e1b | 28 | * @returns uint16_t temperature value |
Rhyme | 0:6cf99fa71e1b | 29 | * @note bit[15] Sign |
Rhyme | 0:6cf99fa71e1b | 30 | * @note bit[14] 64 C |
Rhyme | 0:6cf99fa71e1b | 31 | * @note bit[13] 32 C |
Rhyme | 0:6cf99fa71e1b | 32 | * @note bit[12] 16 C |
Rhyme | 0:6cf99fa71e1b | 33 | * @note bit[11] 8 C |
Rhyme | 0:6cf99fa71e1b | 34 | * @note bit[10] 4 C |
Rhyme | 0:6cf99fa71e1b | 35 | * @note bit[ 9] 2 C |
Rhyme | 0:6cf99fa71e1b | 36 | * @note bit[ 8] 1 C |
Rhyme | 0:6cf99fa71e1b | 37 | * @note bit[ 7] 0.5 C |
Rhyme | 0:6cf99fa71e1b | 38 | * @note bit[ 6] 0.25 C |
Rhyme | 0:6cf99fa71e1b | 39 | * @note bit[ 5] 0.125 C |
Rhyme | 0:6cf99fa71e1b | 40 | * @note bit[ 4] 0.0625 C |
Rhyme | 0:6cf99fa71e1b | 41 | * @note bit[ 3] 0.03125 C |
Rhyme | 0:6cf99fa71e1b | 42 | * @note bit[ 2] 0.015625 C |
Rhyme | 0:6cf99fa71e1b | 43 | * @note bit[ 1] 0.0078125 C |
Rhyme | 0:6cf99fa71e1b | 44 | * @note bit[ 0] 0.00390625 C |
Rhyme | 1:eed7f4c33402 | 45 | * @note in normal format Temp_float = (float)Temp_u16 / 256.0 ; |
Rhyme | 0:6cf99fa71e1b | 46 | */ |
Rhyme | 0:6cf99fa71e1b | 47 | uint16_t getTemp(void) ; |
Rhyme | 0:6cf99fa71e1b | 48 | |
Rhyme | 0:6cf99fa71e1b | 49 | /** |
Rhyme | 0:6cf99fa71e1b | 50 | * Get configuration register |
Rhyme | 0:6cf99fa71e1b | 51 | * @param (none) |
Rhyme | 0:6cf99fa71e1b | 52 | * @returns uint8_t configuration register value |
Rhyme | 0:6cf99fa71e1b | 53 | * @note bit[7] ONE-SHOT |
Rhyme | 0:6cf99fa71e1b | 54 | * @note bit[6] /TIMEOUT I2C but timeout 0: enable 1: disable |
Rhyme | 0:6cf99fa71e1b | 55 | * @note bit[5] DATAFORMAT 0: normal (0 - +50) 1: extended (64c + 2's comp) |
Rhyme | 0:6cf99fa71e1b | 56 | * @note bit[4] FAULT_QUEUE[1] determine the number of faults necessary to |
Rhyme | 0:6cf99fa71e1b | 57 | * @note bit[3] FAULT_QUEUE[0] trigger an OS condition. |
Rhyme | 0:6cf99fa71e1b | 58 | * @note bit[2] OS_POLARITY 0: OS output polarity active low 1: active high |
Rhyme | 0:6cf99fa71e1b | 59 | * @note bit[1] /COMPARATOR/INTERRUPT 0: comparator ode 1: interrupt mode |
Rhyme | 0:6cf99fa71e1b | 60 | * @note bit[0] SHUTDOWN 0: exit from shutdown 1: enter shutdown mode |
Rhyme | 0:6cf99fa71e1b | 61 | */ |
Rhyme | 0:6cf99fa71e1b | 62 | |
Rhyme | 0:6cf99fa71e1b | 63 | uint8_t getConf(void) ; |
Rhyme | 0:6cf99fa71e1b | 64 | |
Rhyme | 0:6cf99fa71e1b | 65 | /** |
Rhyme | 0:6cf99fa71e1b | 66 | * Set configuration register |
Rhyme | 0:6cf99fa71e1b | 67 | * @param uint8_t register value |
Rhyme | 0:6cf99fa71e1b | 68 | * @returns (none) |
Rhyme | 0:6cf99fa71e1b | 69 | */ |
Rhyme | 0:6cf99fa71e1b | 70 | void setConf(uint8_t conf) ; |
Rhyme | 0:6cf99fa71e1b | 71 | |
Rhyme | 0:6cf99fa71e1b | 72 | /** |
Rhyme | 0:6cf99fa71e1b | 73 | * Get Thyst (lower limit threshold) |
Rhyme | 0:6cf99fa71e1b | 74 | * @param (none) |
Rhyme | 0:6cf99fa71e1b | 75 | * @returns uint16_t Thyst value |
Rhyme | 0:6cf99fa71e1b | 76 | */ |
Rhyme | 0:6cf99fa71e1b | 77 | uint16_t getThyst(void) ; |
Rhyme | 0:6cf99fa71e1b | 78 | |
Rhyme | 0:6cf99fa71e1b | 79 | /** |
Rhyme | 0:6cf99fa71e1b | 80 | * Set Thyst |
Rhyme | 0:6cf99fa71e1b | 81 | * @param uint16_t thyst |
Rhyme | 0:6cf99fa71e1b | 82 | * @returns (none) |
Rhyme | 0:6cf99fa71e1b | 83 | */ |
Rhyme | 0:6cf99fa71e1b | 84 | void setThyst(uint16_t thyst) ; |
Rhyme | 0:6cf99fa71e1b | 85 | |
Rhyme | 0:6cf99fa71e1b | 86 | /** |
Rhyme | 0:6cf99fa71e1b | 87 | * Get Tos (upper limit threshold) |
Rhyme | 0:6cf99fa71e1b | 88 | * @param (none) |
Rhyme | 0:6cf99fa71e1b | 89 | * @returns uint16_t Tos |
Rhyme | 0:6cf99fa71e1b | 90 | */ |
Rhyme | 0:6cf99fa71e1b | 91 | uint16_t getTos(void) ; |
Rhyme | 0:6cf99fa71e1b | 92 | |
Rhyme | 0:6cf99fa71e1b | 93 | /** |
Rhyme | 0:6cf99fa71e1b | 94 | * Set Tos |
Rhyme | 0:6cf99fa71e1b | 95 | * @param uint16_t Tos |
Rhyme | 0:6cf99fa71e1b | 96 | * @returns (none) |
Rhyme | 0:6cf99fa71e1b | 97 | */ |
Rhyme | 0:6cf99fa71e1b | 98 | void setTos(uint16_t tos) ; |
Rhyme | 0:6cf99fa71e1b | 99 | |
Rhyme | 0:6cf99fa71e1b | 100 | private: |
Rhyme | 0:6cf99fa71e1b | 101 | I2C m_i2c; |
Rhyme | 0:6cf99fa71e1b | 102 | int m_addr; |
Rhyme | 0:6cf99fa71e1b | 103 | void readRegs(int addr, uint8_t * data, int len); |
Rhyme | 0:6cf99fa71e1b | 104 | void writeRegs(uint8_t * data, int len); |
Rhyme | 0:6cf99fa71e1b | 105 | |
Rhyme | 0:6cf99fa71e1b | 106 | }; |
Rhyme | 0:6cf99fa71e1b | 107 | |
Rhyme | 0:6cf99fa71e1b | 108 | #endif /* _MAX30205_H_ */ |