zinnet yazıcı
/
max30105Example
maxrefdes117
MAX30105/MAX30105.h@0:78a2573ad768, 2019-08-06 (annotated)
- Committer:
- zinnetyazicii53
- Date:
- Tue Aug 06 12:19:46 2019 +0000
- Revision:
- 0:78a2573ad768
commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zinnetyazicii53 | 0:78a2573ad768 | 1 | |
zinnetyazicii53 | 0:78a2573ad768 | 2 | #ifndef _MAX30105_H_ |
zinnetyazicii53 | 0:78a2573ad768 | 3 | #define _MAX30105_H_ |
zinnetyazicii53 | 0:78a2573ad768 | 4 | |
zinnetyazicii53 | 0:78a2573ad768 | 5 | #include "mbed.h" |
zinnetyazicii53 | 0:78a2573ad768 | 6 | |
zinnetyazicii53 | 0:78a2573ad768 | 7 | |
zinnetyazicii53 | 0:78a2573ad768 | 8 | #define MAX30105_ADDRESS 0x57 //7-bit I2C Address //87 //1010111 |
zinnetyazicii53 | 0:78a2573ad768 | 9 | |
zinnetyazicii53 | 0:78a2573ad768 | 10 | //#define MAX30105_I2C_ADDR 0xAE << 1 //8-BİT //174//10101110 // |
zinnetyazicii53 | 0:78a2573ad768 | 11 | |
zinnetyazicii53 | 0:78a2573ad768 | 12 | //Note that MAX30102 has the same I2C address and Part ID |
zinnetyazicii53 | 0:78a2573ad768 | 13 | |
zinnetyazicii53 | 0:78a2573ad768 | 14 | |
zinnetyazicii53 | 0:78a2573ad768 | 15 | #define MAX30105_NO_ERROR 0 |
zinnetyazicii53 | 0:78a2573ad768 | 16 | #define MAX30105_ERROR -1 |
zinnetyazicii53 | 0:78a2573ad768 | 17 | #define MAX30105_TEMP_ERROR -999.0 |
zinnetyazicii53 | 0:78a2573ad768 | 18 | |
zinnetyazicii53 | 0:78a2573ad768 | 19 | //#define I2C_SPEED_STANDARD 100000 |
zinnetyazicii53 | 0:78a2573ad768 | 20 | //#define I2C_SPEED_FAST 400000 |
zinnetyazicii53 | 0:78a2573ad768 | 21 | |
zinnetyazicii53 | 0:78a2573ad768 | 22 | #define I2C_BUFFER_LENGTH 32 |
zinnetyazicii53 | 0:78a2573ad768 | 23 | |
zinnetyazicii53 | 0:78a2573ad768 | 24 | |
zinnetyazicii53 | 0:78a2573ad768 | 25 | |
zinnetyazicii53 | 0:78a2573ad768 | 26 | class MAX30105 { |
zinnetyazicii53 | 0:78a2573ad768 | 27 | public: |
zinnetyazicii53 | 0:78a2573ad768 | 28 | |
zinnetyazicii53 | 0:78a2573ad768 | 29 | |
zinnetyazicii53 | 0:78a2573ad768 | 30 | MAX30105(I2C &i2c); |
zinnetyazicii53 | 0:78a2573ad768 | 31 | MAX30105(void); |
zinnetyazicii53 | 0:78a2573ad768 | 32 | |
zinnetyazicii53 | 0:78a2573ad768 | 33 | //boolean begin(TwoWire &wirePort = Wire, uint32_t i2cSpeed = I2C_SPEED_STANDARD, uint8_t i2caddr = MAX30105_ADDRESS); |
zinnetyazicii53 | 0:78a2573ad768 | 34 | |
zinnetyazicii53 | 0:78a2573ad768 | 35 | uint32_t getRed(void); //Returns immediate red value |
zinnetyazicii53 | 0:78a2573ad768 | 36 | uint32_t getIR(void); //Returns immediate IR value |
zinnetyazicii53 | 0:78a2573ad768 | 37 | uint32_t getGreen(void); //Returns immediate green value |
zinnetyazicii53 | 0:78a2573ad768 | 38 | bool safeCheck(uint8_t maxTimeToCheck); //Given a max amount of time, check for new data |
zinnetyazicii53 | 0:78a2573ad768 | 39 | |
zinnetyazicii53 | 0:78a2573ad768 | 40 | // Configuration |
zinnetyazicii53 | 0:78a2573ad768 | 41 | void softReset(); |
zinnetyazicii53 | 0:78a2573ad768 | 42 | void shutDown(); |
zinnetyazicii53 | 0:78a2573ad768 | 43 | void wakeUp(); |
zinnetyazicii53 | 0:78a2573ad768 | 44 | |
zinnetyazicii53 | 0:78a2573ad768 | 45 | void setLEDMode(uint8_t mode); |
zinnetyazicii53 | 0:78a2573ad768 | 46 | |
zinnetyazicii53 | 0:78a2573ad768 | 47 | void setADCRange(uint8_t adcRange); |
zinnetyazicii53 | 0:78a2573ad768 | 48 | void setSampleRate(uint8_t sampleRate); |
zinnetyazicii53 | 0:78a2573ad768 | 49 | void setPulseWidth(uint8_t pulseWidth); |
zinnetyazicii53 | 0:78a2573ad768 | 50 | |
zinnetyazicii53 | 0:78a2573ad768 | 51 | void setPulseAmplitudeRed(uint8_t value); |
zinnetyazicii53 | 0:78a2573ad768 | 52 | void setPulseAmplitudeIR(uint8_t value); |
zinnetyazicii53 | 0:78a2573ad768 | 53 | void setPulseAmplitudeGreen(uint8_t value); |
zinnetyazicii53 | 0:78a2573ad768 | 54 | void setPulseAmplitudeProximity(uint8_t value); |
zinnetyazicii53 | 0:78a2573ad768 | 55 | |
zinnetyazicii53 | 0:78a2573ad768 | 56 | void setProximityThreshold(uint8_t threshMSB); |
zinnetyazicii53 | 0:78a2573ad768 | 57 | |
zinnetyazicii53 | 0:78a2573ad768 | 58 | //Multi-led configuration mode (page 22) |
zinnetyazicii53 | 0:78a2573ad768 | 59 | void enableSlot(uint8_t slotNumber, uint8_t device); //Given slot number, assign a device to slot |
zinnetyazicii53 | 0:78a2573ad768 | 60 | void disableSlots(void); |
zinnetyazicii53 | 0:78a2573ad768 | 61 | |
zinnetyazicii53 | 0:78a2573ad768 | 62 | // Data Collection |
zinnetyazicii53 | 0:78a2573ad768 | 63 | |
zinnetyazicii53 | 0:78a2573ad768 | 64 | //Interrupts (page 13, 14) |
zinnetyazicii53 | 0:78a2573ad768 | 65 | uint8_t getINT1(void); //Returns the main interrupt group |
zinnetyazicii53 | 0:78a2573ad768 | 66 | uint8_t getINT2(void); //Returns the temp ready interrupt |
zinnetyazicii53 | 0:78a2573ad768 | 67 | void enableAFULL(void); //Enable/disable individual interrupts |
zinnetyazicii53 | 0:78a2573ad768 | 68 | void disableAFULL(void); |
zinnetyazicii53 | 0:78a2573ad768 | 69 | void enableDATARDY(void); |
zinnetyazicii53 | 0:78a2573ad768 | 70 | void disableDATARDY(void); |
zinnetyazicii53 | 0:78a2573ad768 | 71 | void enableALCOVF(void); |
zinnetyazicii53 | 0:78a2573ad768 | 72 | void disableALCOVF(void); |
zinnetyazicii53 | 0:78a2573ad768 | 73 | void enablePROXINT(void); |
zinnetyazicii53 | 0:78a2573ad768 | 74 | void disablePROXINT(void); |
zinnetyazicii53 | 0:78a2573ad768 | 75 | void enableDIETEMPRDY(void); |
zinnetyazicii53 | 0:78a2573ad768 | 76 | void disableDIETEMPRDY(void); |
zinnetyazicii53 | 0:78a2573ad768 | 77 | |
zinnetyazicii53 | 0:78a2573ad768 | 78 | //FIFO Configuration (page 18) |
zinnetyazicii53 | 0:78a2573ad768 | 79 | void setFIFOAverage(uint8_t samples); |
zinnetyazicii53 | 0:78a2573ad768 | 80 | void enableFIFORollover(); |
zinnetyazicii53 | 0:78a2573ad768 | 81 | void disableFIFORollover(); |
zinnetyazicii53 | 0:78a2573ad768 | 82 | void setFIFOAlmostFull(uint8_t samples); |
zinnetyazicii53 | 0:78a2573ad768 | 83 | |
zinnetyazicii53 | 0:78a2573ad768 | 84 | //FIFO Reading |
zinnetyazicii53 | 0:78a2573ad768 | 85 | uint16_t check(void); //Checks for new data and fills FIFO |
zinnetyazicii53 | 0:78a2573ad768 | 86 | uint8_t available(void); //Tells caller how many new samples are available (head - tail) |
zinnetyazicii53 | 0:78a2573ad768 | 87 | void nextSample(void); //Advances the tail of the sense array |
zinnetyazicii53 | 0:78a2573ad768 | 88 | uint32_t getFIFORed(void); //Returns the FIFO sample pointed to by tail |
zinnetyazicii53 | 0:78a2573ad768 | 89 | uint32_t getFIFOIR(void); //Returns the FIFO sample pointed to by tail |
zinnetyazicii53 | 0:78a2573ad768 | 90 | uint32_t getFIFOGreen(void); //Returns the FIFO sample pointed to by tail |
zinnetyazicii53 | 0:78a2573ad768 | 91 | |
zinnetyazicii53 | 0:78a2573ad768 | 92 | uint8_t getWritePointer(void); |
zinnetyazicii53 | 0:78a2573ad768 | 93 | uint8_t getReadPointer(void); |
zinnetyazicii53 | 0:78a2573ad768 | 94 | void clearFIFO(void); //Sets the read/write pointers to zero |
zinnetyazicii53 | 0:78a2573ad768 | 95 | |
zinnetyazicii53 | 0:78a2573ad768 | 96 | //Proximity Mode Interrupt Threshold |
zinnetyazicii53 | 0:78a2573ad768 | 97 | void setPROXINTTHRESH(uint8_t val); |
zinnetyazicii53 | 0:78a2573ad768 | 98 | |
zinnetyazicii53 | 0:78a2573ad768 | 99 | // Die Temperature |
zinnetyazicii53 | 0:78a2573ad768 | 100 | float readTemperature(); |
zinnetyazicii53 | 0:78a2573ad768 | 101 | float readTemperatureF(); |
zinnetyazicii53 | 0:78a2573ad768 | 102 | |
zinnetyazicii53 | 0:78a2573ad768 | 103 | // Detecting ID/Revision |
zinnetyazicii53 | 0:78a2573ad768 | 104 | uint8_t getRevisionID(); |
zinnetyazicii53 | 0:78a2573ad768 | 105 | uint8_t readPartID(); |
zinnetyazicii53 | 0:78a2573ad768 | 106 | |
zinnetyazicii53 | 0:78a2573ad768 | 107 | // Setup the IC with user selectable settings |
zinnetyazicii53 | 0:78a2573ad768 | 108 | void setup(uint8_t powerLevel = 0x1F, uint8_t sampleAverage = 4, uint8_t ledMode = 3, int sampleRate = 400, int pulseWidth = 411, int adcRange = 4096); |
zinnetyazicii53 | 0:78a2573ad768 | 109 | |
zinnetyazicii53 | 0:78a2573ad768 | 110 | // Low-level I2C communication |
zinnetyazicii53 | 0:78a2573ad768 | 111 | uint8_t readRegister8(uint8_t address, uint8_t reg); |
zinnetyazicii53 | 0:78a2573ad768 | 112 | void writeRegister8(uint8_t address, uint8_t reg, uint8_t value); |
zinnetyazicii53 | 0:78a2573ad768 | 113 | int writeRegValue(uint8_t reg, char value); |
zinnetyazicii53 | 0:78a2573ad768 | 114 | int writeReg(uint8_t reg); |
zinnetyazicii53 | 0:78a2573ad768 | 115 | int readReg(uint8_t reg, char *value); |
zinnetyazicii53 | 0:78a2573ad768 | 116 | |
zinnetyazicii53 | 0:78a2573ad768 | 117 | private: |
zinnetyazicii53 | 0:78a2573ad768 | 118 | I2C _i2c; //The generic connection to user's chosen I2C hardware |
zinnetyazicii53 | 0:78a2573ad768 | 119 | uint8_t _i2caddr; |
zinnetyazicii53 | 0:78a2573ad768 | 120 | |
zinnetyazicii53 | 0:78a2573ad768 | 121 | //activeLEDs is the number of channels turned on, and can be 1 to 3. 2 is common for Red+IR. |
zinnetyazicii53 | 0:78a2573ad768 | 122 | uint8_t activeLEDs; //Gets set during setup. Allows check() to calculate how many uint8_ts to read from FIFO |
zinnetyazicii53 | 0:78a2573ad768 | 123 | |
zinnetyazicii53 | 0:78a2573ad768 | 124 | uint8_t revisionID; |
zinnetyazicii53 | 0:78a2573ad768 | 125 | |
zinnetyazicii53 | 0:78a2573ad768 | 126 | void readRevisionID(); |
zinnetyazicii53 | 0:78a2573ad768 | 127 | |
zinnetyazicii53 | 0:78a2573ad768 | 128 | void bitMask(uint8_t reg, uint8_t mask, uint8_t thing); |
zinnetyazicii53 | 0:78a2573ad768 | 129 | |
zinnetyazicii53 | 0:78a2573ad768 | 130 | #define STORAGE_SIZE 4 //Each long is 4 uint8_ts so limit this to fit on your micro |
zinnetyazicii53 | 0:78a2573ad768 | 131 | typedef struct Record |
zinnetyazicii53 | 0:78a2573ad768 | 132 | { |
zinnetyazicii53 | 0:78a2573ad768 | 133 | uint32_t red[STORAGE_SIZE]; |
zinnetyazicii53 | 0:78a2573ad768 | 134 | uint32_t IR[STORAGE_SIZE]; |
zinnetyazicii53 | 0:78a2573ad768 | 135 | uint32_t green[STORAGE_SIZE]; |
zinnetyazicii53 | 0:78a2573ad768 | 136 | uint8_t head; |
zinnetyazicii53 | 0:78a2573ad768 | 137 | uint8_t tail; |
zinnetyazicii53 | 0:78a2573ad768 | 138 | } sense_struct; //This is our circular buffer of readings from the sensor |
zinnetyazicii53 | 0:78a2573ad768 | 139 | |
zinnetyazicii53 | 0:78a2573ad768 | 140 | sense_struct sense; |
zinnetyazicii53 | 0:78a2573ad768 | 141 | |
zinnetyazicii53 | 0:78a2573ad768 | 142 | |
zinnetyazicii53 | 0:78a2573ad768 | 143 | |
zinnetyazicii53 | 0:78a2573ad768 | 144 | // Status Registers |
zinnetyazicii53 | 0:78a2573ad768 | 145 | static const uint8_t MAX30105_INTSTAT1 = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 146 | static const uint8_t MAX30105_INTSTAT2 = 0x01; |
zinnetyazicii53 | 0:78a2573ad768 | 147 | static const uint8_t MAX30105_INTENABLE1 = 0x02; |
zinnetyazicii53 | 0:78a2573ad768 | 148 | static const uint8_t MAX30105_INTENABLE2 = 0x03; |
zinnetyazicii53 | 0:78a2573ad768 | 149 | |
zinnetyazicii53 | 0:78a2573ad768 | 150 | // FIFO Registers |
zinnetyazicii53 | 0:78a2573ad768 | 151 | static const uint8_t MAX30105_FIFOWRITEPTR = 0x04; |
zinnetyazicii53 | 0:78a2573ad768 | 152 | static const uint8_t MAX30105_FIFOOVERFLOW = 0x05; |
zinnetyazicii53 | 0:78a2573ad768 | 153 | static const uint8_t MAX30105_FIFOREADPTR = 0x06; |
zinnetyazicii53 | 0:78a2573ad768 | 154 | static const uint8_t MAX30105_FIFODATA = 0x07; |
zinnetyazicii53 | 0:78a2573ad768 | 155 | |
zinnetyazicii53 | 0:78a2573ad768 | 156 | // Configuration Registers |
zinnetyazicii53 | 0:78a2573ad768 | 157 | static const uint8_t MAX30105_FIFOCONFIG = 0x08; |
zinnetyazicii53 | 0:78a2573ad768 | 158 | static const uint8_t MAX30105_MODECONFIG = 0x09; |
zinnetyazicii53 | 0:78a2573ad768 | 159 | static const uint8_t MAX30105_PARTICLECONFIG = 0x0A; // Note, sometimes listed as "SPO2" config in datasheet (pg. 11) |
zinnetyazicii53 | 0:78a2573ad768 | 160 | static const uint8_t MAX30105_LED1_PULSEAMP = 0x0C; |
zinnetyazicii53 | 0:78a2573ad768 | 161 | static const uint8_t MAX30105_LED2_PULSEAMP = 0x0D; |
zinnetyazicii53 | 0:78a2573ad768 | 162 | static const uint8_t MAX30105_LED3_PULSEAMP = 0x0E; |
zinnetyazicii53 | 0:78a2573ad768 | 163 | static const uint8_t MAX30105_LED_PROX_AMP = 0x10; |
zinnetyazicii53 | 0:78a2573ad768 | 164 | static const uint8_t MAX30105_MULTILEDCONFIG1 = 0x11; |
zinnetyazicii53 | 0:78a2573ad768 | 165 | static const uint8_t MAX30105_MULTILEDCONFIG2 = 0x12; |
zinnetyazicii53 | 0:78a2573ad768 | 166 | |
zinnetyazicii53 | 0:78a2573ad768 | 167 | // Die Temperature Registers |
zinnetyazicii53 | 0:78a2573ad768 | 168 | static const uint8_t MAX30105_DIETEMPINT = 0x1F; |
zinnetyazicii53 | 0:78a2573ad768 | 169 | static const uint8_t MAX30105_DIETEMPFRAC = 0x20; |
zinnetyazicii53 | 0:78a2573ad768 | 170 | static const uint8_t MAX30105_DIETEMPCONFIG = 0x21; |
zinnetyazicii53 | 0:78a2573ad768 | 171 | |
zinnetyazicii53 | 0:78a2573ad768 | 172 | // Proximity Function Registers |
zinnetyazicii53 | 0:78a2573ad768 | 173 | static const uint8_t MAX30105_PROXINTTHRESH = 0x30; |
zinnetyazicii53 | 0:78a2573ad768 | 174 | |
zinnetyazicii53 | 0:78a2573ad768 | 175 | // Part ID Registers |
zinnetyazicii53 | 0:78a2573ad768 | 176 | static const uint8_t MAX30105_REVISIONID = 0xFE; |
zinnetyazicii53 | 0:78a2573ad768 | 177 | static const uint8_t MAX30105_PARTID = 0xFF; // Should always be 0x15. Identical to MAX30102. |
zinnetyazicii53 | 0:78a2573ad768 | 178 | |
zinnetyazicii53 | 0:78a2573ad768 | 179 | // MAX30105 Commands |
zinnetyazicii53 | 0:78a2573ad768 | 180 | // Interrupt configuration (pg 13, 14) |
zinnetyazicii53 | 0:78a2573ad768 | 181 | static const uint8_t MAX30105_INT_A_FULL_MASK = (uint8_t)~0b10000000; |
zinnetyazicii53 | 0:78a2573ad768 | 182 | static const uint8_t MAX30105_INT_A_FULL_ENABLE = 0x80; |
zinnetyazicii53 | 0:78a2573ad768 | 183 | static const uint8_t MAX30105_INT_A_FULL_DISABLE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 184 | |
zinnetyazicii53 | 0:78a2573ad768 | 185 | static const uint8_t MAX30105_INT_DATA_RDY_MASK = (uint8_t)~0b01000000; |
zinnetyazicii53 | 0:78a2573ad768 | 186 | static const uint8_t MAX30105_INT_DATA_RDY_ENABLE = 0x40; |
zinnetyazicii53 | 0:78a2573ad768 | 187 | static const uint8_t MAX30105_INT_DATA_RDY_DISABLE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 188 | |
zinnetyazicii53 | 0:78a2573ad768 | 189 | static const uint8_t MAX30105_INT_ALC_OVF_MASK = (uint8_t)~0b00100000; |
zinnetyazicii53 | 0:78a2573ad768 | 190 | static const uint8_t MAX30105_INT_ALC_OVF_ENABLE = 0x20; |
zinnetyazicii53 | 0:78a2573ad768 | 191 | static const uint8_t MAX30105_INT_ALC_OVF_DISABLE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 192 | |
zinnetyazicii53 | 0:78a2573ad768 | 193 | static const uint8_t MAX30105_INT_PROX_INT_MASK = (uint8_t)~0b00010000; |
zinnetyazicii53 | 0:78a2573ad768 | 194 | static const uint8_t MAX30105_INT_PROX_INT_ENABLE = 0x10; |
zinnetyazicii53 | 0:78a2573ad768 | 195 | static const uint8_t MAX30105_INT_PROX_INT_DISABLE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 196 | |
zinnetyazicii53 | 0:78a2573ad768 | 197 | static const uint8_t MAX30105_INT_DIE_TEMP_RDY_MASK = (uint8_t)~0b00000010; |
zinnetyazicii53 | 0:78a2573ad768 | 198 | static const uint8_t MAX30105_INT_DIE_TEMP_RDY_ENABLE = 0x02; |
zinnetyazicii53 | 0:78a2573ad768 | 199 | static const uint8_t MAX30105_INT_DIE_TEMP_RDY_DISABLE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 200 | |
zinnetyazicii53 | 0:78a2573ad768 | 201 | static const uint8_t MAX30105_SAMPLEAVG_MASK = (uint8_t)~0b11100000; |
zinnetyazicii53 | 0:78a2573ad768 | 202 | static const uint8_t MAX30105_SAMPLEAVG_1 = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 203 | static const uint8_t MAX30105_SAMPLEAVG_2 = 0x20; |
zinnetyazicii53 | 0:78a2573ad768 | 204 | static const uint8_t MAX30105_SAMPLEAVG_4 = 0x40; |
zinnetyazicii53 | 0:78a2573ad768 | 205 | static const uint8_t MAX30105_SAMPLEAVG_8 = 0x60; |
zinnetyazicii53 | 0:78a2573ad768 | 206 | static const uint8_t MAX30105_SAMPLEAVG_16 = 0x80; |
zinnetyazicii53 | 0:78a2573ad768 | 207 | static const uint8_t MAX30105_SAMPLEAVG_32 = 0xA0; |
zinnetyazicii53 | 0:78a2573ad768 | 208 | |
zinnetyazicii53 | 0:78a2573ad768 | 209 | static const uint8_t MAX30105_ROLLOVER_MASK = 0xEF; |
zinnetyazicii53 | 0:78a2573ad768 | 210 | static const uint8_t MAX30105_ROLLOVER_ENABLE = 0x10; |
zinnetyazicii53 | 0:78a2573ad768 | 211 | static const uint8_t MAX30105_ROLLOVER_DISABLE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 212 | |
zinnetyazicii53 | 0:78a2573ad768 | 213 | static const uint8_t MAX30105_A_FULL_MASK = 0xF0; |
zinnetyazicii53 | 0:78a2573ad768 | 214 | |
zinnetyazicii53 | 0:78a2573ad768 | 215 | // Mode configuration commands (page 19) |
zinnetyazicii53 | 0:78a2573ad768 | 216 | static const uint8_t MAX30105_SHUTDOWN_MASK = 0x7F; |
zinnetyazicii53 | 0:78a2573ad768 | 217 | static const uint8_t MAX30105_SHUTDOWN = 0x80; |
zinnetyazicii53 | 0:78a2573ad768 | 218 | static const uint8_t MAX30105_WAKEUP = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 219 | |
zinnetyazicii53 | 0:78a2573ad768 | 220 | static const uint8_t MAX30105_RESET_MASK = 0xBF; |
zinnetyazicii53 | 0:78a2573ad768 | 221 | static const uint8_t MAX30105_RESET = 0x40; |
zinnetyazicii53 | 0:78a2573ad768 | 222 | |
zinnetyazicii53 | 0:78a2573ad768 | 223 | static const uint8_t MAX30105_MODE_MASK = 0xF8; |
zinnetyazicii53 | 0:78a2573ad768 | 224 | static const uint8_t MAX30105_MODE_REDONLY = 0x02; |
zinnetyazicii53 | 0:78a2573ad768 | 225 | static const uint8_t MAX30105_MODE_REDIRONLY = 0x03; |
zinnetyazicii53 | 0:78a2573ad768 | 226 | static const uint8_t MAX30105_MODE_MULTILED = 0x07; |
zinnetyazicii53 | 0:78a2573ad768 | 227 | |
zinnetyazicii53 | 0:78a2573ad768 | 228 | // Particle sensing configuration commands (pgs 19-20) |
zinnetyazicii53 | 0:78a2573ad768 | 229 | static const uint8_t MAX30105_ADCRANGE_MASK = 0x9F; |
zinnetyazicii53 | 0:78a2573ad768 | 230 | static const uint8_t MAX30105_ADCRANGE_2048 = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 231 | static const uint8_t MAX30105_ADCRANGE_4096 = 0x20; |
zinnetyazicii53 | 0:78a2573ad768 | 232 | static const uint8_t MAX30105_ADCRANGE_8192 = 0x40; |
zinnetyazicii53 | 0:78a2573ad768 | 233 | static const uint8_t MAX30105_ADCRANGE_16384 = 0x60; |
zinnetyazicii53 | 0:78a2573ad768 | 234 | |
zinnetyazicii53 | 0:78a2573ad768 | 235 | static const uint8_t MAX30105_SAMPLERATE_MASK = 0xE3; |
zinnetyazicii53 | 0:78a2573ad768 | 236 | static const uint8_t MAX30105_SAMPLERATE_50 = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 237 | static const uint8_t MAX30105_SAMPLERATE_100 = 0x04; |
zinnetyazicii53 | 0:78a2573ad768 | 238 | static const uint8_t MAX30105_SAMPLERATE_200 = 0x08; |
zinnetyazicii53 | 0:78a2573ad768 | 239 | static const uint8_t MAX30105_SAMPLERATE_400 = 0x0C; |
zinnetyazicii53 | 0:78a2573ad768 | 240 | static const uint8_t MAX30105_SAMPLERATE_800 = 0x10; |
zinnetyazicii53 | 0:78a2573ad768 | 241 | static const uint8_t MAX30105_SAMPLERATE_1000 = 0x14; |
zinnetyazicii53 | 0:78a2573ad768 | 242 | static const uint8_t MAX30105_SAMPLERATE_1600 = 0x18; |
zinnetyazicii53 | 0:78a2573ad768 | 243 | static const uint8_t MAX30105_SAMPLERATE_3200 = 0x1C; |
zinnetyazicii53 | 0:78a2573ad768 | 244 | |
zinnetyazicii53 | 0:78a2573ad768 | 245 | static const uint8_t MAX30105_PULSEWIDTH_MASK = 0xFC; |
zinnetyazicii53 | 0:78a2573ad768 | 246 | static const uint8_t MAX30105_PULSEWIDTH_69 = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 247 | static const uint8_t MAX30105_PULSEWIDTH_118 = 0x01; |
zinnetyazicii53 | 0:78a2573ad768 | 248 | static const uint8_t MAX30105_PULSEWIDTH_215 = 0x02; |
zinnetyazicii53 | 0:78a2573ad768 | 249 | static const uint8_t MAX30105_PULSEWIDTH_411 = 0x03; |
zinnetyazicii53 | 0:78a2573ad768 | 250 | |
zinnetyazicii53 | 0:78a2573ad768 | 251 | //Multi-LED Mode configuration (pg 22) |
zinnetyazicii53 | 0:78a2573ad768 | 252 | static const uint8_t MAX30105_SLOT1_MASK = 0xF8; |
zinnetyazicii53 | 0:78a2573ad768 | 253 | static const uint8_t MAX30105_SLOT2_MASK = 0x8F; |
zinnetyazicii53 | 0:78a2573ad768 | 254 | static const uint8_t MAX30105_SLOT3_MASK = 0xF8; |
zinnetyazicii53 | 0:78a2573ad768 | 255 | static const uint8_t MAX30105_SLOT4_MASK = 0x8F; |
zinnetyazicii53 | 0:78a2573ad768 | 256 | |
zinnetyazicii53 | 0:78a2573ad768 | 257 | static const uint8_t SLOT_NONE = 0x00; |
zinnetyazicii53 | 0:78a2573ad768 | 258 | static const uint8_t SLOT_RED_LED = 0x01; |
zinnetyazicii53 | 0:78a2573ad768 | 259 | static const uint8_t SLOT_IR_LED = 0x02; |
zinnetyazicii53 | 0:78a2573ad768 | 260 | static const uint8_t SLOT_GREEN_LED = 0x03; |
zinnetyazicii53 | 0:78a2573ad768 | 261 | static const uint8_t SLOT_NONE_PILOT = 0x04; |
zinnetyazicii53 | 0:78a2573ad768 | 262 | static const uint8_t SLOT_RED_PILOT = 0x05; |
zinnetyazicii53 | 0:78a2573ad768 | 263 | static const uint8_t SLOT_IR_PILOT = 0x06; |
zinnetyazicii53 | 0:78a2573ad768 | 264 | static const uint8_t SLOT_GREEN_PILOT = 0x07; |
zinnetyazicii53 | 0:78a2573ad768 | 265 | |
zinnetyazicii53 | 0:78a2573ad768 | 266 | static const uint8_t MAX_30105_EXPECTEDPARTID = 0x15; |
zinnetyazicii53 | 0:78a2573ad768 | 267 | |
zinnetyazicii53 | 0:78a2573ad768 | 268 | }; |
zinnetyazicii53 | 0:78a2573ad768 | 269 | #endif |