Library for MAX30101, read/write functions for registers implemented.
Dependents: test_MAX30101 testSensor
Diff: MAX30101.h
- Revision:
- 2:c465a8d44b9a
- Parent:
- 1:fc677d82d0f1
- Child:
- 3:d28dcc8fe74d
--- a/MAX30101.h Tue Dec 29 07:40:53 2015 +0000 +++ b/MAX30101.h Mon Mar 27 05:30:28 2017 +0000 @@ -23,6 +23,7 @@ uint8_t getID(void) ; uint8_t getRev(void) ; uint16_t getIntStatus(void) ; +uint16_t getIntEnable(void) ; void setIntEnable(uint16_t mask) ; uint8_t getFIFO_WR_PTR(void) ; void setFIFO_WR_PTR(uint8_t data) ; @@ -49,10 +50,15 @@ uint16_t getSLOT(void) ; void setSLOT(uint16_t data) ; uint8_t getTEMP_INT(void) ; -uint8_t getTEMP_FRAM(void) ; +uint8_t getTEMP_FRAC(void) ; uint8_t getTEMP_EN(void) ; /* ? */ +void setTEMP_EN(void) ; +float getTEMP(void) ; uint8_t getPROX_INT_THR(void) ; void setPROX_INT_THR(uint8_t data) ; +void clearFIFO(void) ; +uint32_t readFIFO(void) ; +void reset(void) ; /* * some member functions here (yet to be written) @@ -64,4 +70,29 @@ void readRegs(int addr, uint8_t *data, int len) ; void writeRegs(uint8_t *data, int len) ; } ; + +/* bits of Interrupt Status register */ +/* In this class Interrupt Status 1 and + * Interrupt Status 2 are combined to be a uint16_t + */ +#define INT_ST_A_FULL 0x8000 /* FIFO Almost Full Flag */ +#define INT_ST_PPG_RGY 0x4000 /* New FIFO Data Ready */ +#define INT_ST_ALC_OVF 0x2000 /* Ambient Light Cancellation Overflow */ +#define INT_ST_PROX_INT 0x1000 /* Proximity Threshold Triggered */ +#define INT_ST_PWR_RDY 0x0100 /* Power Ready Flag */ +#define INT_ST_DIE_TEMP_RDY 0x0002 /* Internal Temperature Ready Flag */ +/* bits of Interrupt Enable register */ +#define INT_EN_A_FULL 0x8000 /* FIFO Almost Full Flag */ +#define INT_EN_PPG_RGY 0x4000 /* New FIFO Data Ready */ +#define INT_EN_ALC_OVF 0x2000 /* Ambient Light Cancellation Overflow */ +#define INT_EN_PROX_INT 0x1000 /* Proximity Threshold Triggered */ +#define INT_EN_DIE_TEMP_RDY 0x0002 /* Internal Temperature Ready Flag */ +/* Mode configuration bits */ +#define MODE_HR 0x02 /* Heart Rate mode */ +#define MODE_SPO2 0x03 /* SpO2 mode */ +#define MODE_MULTI_LED 0x07 /* Multi-LED mode */ +#define MODE_RESET 0x40 /* Reset Control, this bit is auto clear */ +#define MODE_SHDN 0x80 /* Shutdown Control */ + + #endif /* _MAX30101_H_ */ \ No newline at end of file