port oxullo library Arduino

Dependents:   MAX30100_oxullo

Committer:
AVELARDEV
Date:
Fri Nov 25 00:52:54 2016 +0000
Revision:
0:010b908e2187
max30100 example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AVELARDEV 0:010b908e2187 1 /*
AVELARDEV 0:010b908e2187 2 Arduino-MAX30100 oximetry / heart rate integrated sensor library
AVELARDEV 0:010b908e2187 3 Copyright (C) 2016 OXullo Intersecans <x@brainrapers.org>
AVELARDEV 0:010b908e2187 4 This program is free software: you can redistribute it and/or modify
AVELARDEV 0:010b908e2187 5 it under the terms of the GNU General Public License as published by
AVELARDEV 0:010b908e2187 6 the Free Software Foundation, either version 3 of the License, or
AVELARDEV 0:010b908e2187 7 (at your option) any later version.
AVELARDEV 0:010b908e2187 8 This program is distributed in the hope that it will be useful,
AVELARDEV 0:010b908e2187 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
AVELARDEV 0:010b908e2187 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
AVELARDEV 0:010b908e2187 11 GNU General Public License for more details.
AVELARDEV 0:010b908e2187 12 You should have received a copy of the GNU General Public License
AVELARDEV 0:010b908e2187 13 along with this program. If not, see <http://www.gnu.org/licenses/>.
AVELARDEV 0:010b908e2187 14 */
AVELARDEV 0:010b908e2187 15
AVELARDEV 0:010b908e2187 16 #ifndef MAX30100_REGISTERS_H
AVELARDEV 0:010b908e2187 17 #define MAX30100_REGISTERS_H
AVELARDEV 0:010b908e2187 18
AVELARDEV 0:010b908e2187 19 //#define MAX30100_I2C_ADDRESS 0x57
AVELARDEV 0:010b908e2187 20 #define I2C_WRITE_ADDR 0xAE
AVELARDEV 0:010b908e2187 21 #define I2C_READ_ADDR 0xAF
AVELARDEV 0:010b908e2187 22
AVELARDEV 0:010b908e2187 23 // Interrupt status register (RO)
AVELARDEV 0:010b908e2187 24 #define MAX30100_REG_INTERRUPT_STATUS 0x00
AVELARDEV 0:010b908e2187 25 #define MAX30100_IS_PWR_RDY (1 << 0)
AVELARDEV 0:010b908e2187 26 #define MAX30100_IS_SPO2_RDY (1 << 4)
AVELARDEV 0:010b908e2187 27 #define MAX30100_IS_HR_RDY (1 << 5)
AVELARDEV 0:010b908e2187 28 #define MAX30100_IS_TEMP_RDY (1 << 6)
AVELARDEV 0:010b908e2187 29 #define MAX30100_IS_A_FULL (1 << 7)
AVELARDEV 0:010b908e2187 30
AVELARDEV 0:010b908e2187 31 // Interrupt enable register
AVELARDEV 0:010b908e2187 32 #define MAX30100_REG_INTERRUPT_ENABLE 0x01
AVELARDEV 0:010b908e2187 33 #define MAX30100_IE_ENB_SPO2_RDY (1 << 4)
AVELARDEV 0:010b908e2187 34 #define MAX30100_IE_ENB_HR_RDY (1 << 5)
AVELARDEV 0:010b908e2187 35 #define MAX30100_IE_ENB_TEMP_RDY (1 << 6)
AVELARDEV 0:010b908e2187 36 #define MAX30100_IE_ENB_A_FULL (1 << 7)
AVELARDEV 0:010b908e2187 37
AVELARDEV 0:010b908e2187 38 // FIFO control and data registers
AVELARDEV 0:010b908e2187 39 #define MAX30100_REG_FIFO_WRITE_POINTER 0x02
AVELARDEV 0:010b908e2187 40 #define MAX30100_REG_FIFO_OVERFLOW_COUNTER 0x03
AVELARDEV 0:010b908e2187 41 #define MAX30100_REG_FIFO_READ_POINTER 0x04
AVELARDEV 0:010b908e2187 42 #define MAX30100_REG_FIFO_DATA 0x05 // Burst read does not autoincrement addr
AVELARDEV 0:010b908e2187 43
AVELARDEV 0:010b908e2187 44 // Mode Configuration register
AVELARDEV 0:010b908e2187 45 #define MAX30100_REG_MODE_CONFIGURATION 0x06
AVELARDEV 0:010b908e2187 46 #define MAX30100_MC_TEMP_EN (1 << 3)
AVELARDEV 0:010b908e2187 47 #define MAX30100_MC_RESET (1 << 6)
AVELARDEV 0:010b908e2187 48 #define MAX30100_MC_SHDN (1 << 7)
AVELARDEV 0:010b908e2187 49 typedef enum Mode {
AVELARDEV 0:010b908e2187 50 MAX30100_MODE_HRONLY = 0x02,
AVELARDEV 0:010b908e2187 51 MAX30100_MODE_SPO2_HR = 0x03
AVELARDEV 0:010b908e2187 52 } Mode;
AVELARDEV 0:010b908e2187 53
AVELARDEV 0:010b908e2187 54 // SpO2 Configuration register
AVELARDEV 0:010b908e2187 55 // Check tables 8 and 9, p19 of the MAX30100 datasheet to see the permissible
AVELARDEV 0:010b908e2187 56 // combinations of sampling rates and pulse widths
AVELARDEV 0:010b908e2187 57 #define MAX30100_REG_SPO2_CONFIGURATION 0x07
AVELARDEV 0:010b908e2187 58 #define MAX30100_SPC_SPO2_HI_RES_EN (1 << 6)
AVELARDEV 0:010b908e2187 59 typedef enum SamplingRate {
AVELARDEV 0:010b908e2187 60 MAX30100_SAMPRATE_50HZ = 0x00,
AVELARDEV 0:010b908e2187 61 MAX30100_SAMPRATE_100HZ = 0x01,
AVELARDEV 0:010b908e2187 62 MAX30100_SAMPRATE_167HZ = 0x02,
AVELARDEV 0:010b908e2187 63 MAX30100_SAMPRATE_200HZ = 0x03,
AVELARDEV 0:010b908e2187 64 MAX30100_SAMPRATE_400HZ = 0x04,
AVELARDEV 0:010b908e2187 65 MAX30100_SAMPRATE_600HZ = 0x05,
AVELARDEV 0:010b908e2187 66 MAX30100_SAMPRATE_800HZ = 0x06,
AVELARDEV 0:010b908e2187 67 MAX30100_SAMPRATE_1000HZ = 0x07
AVELARDEV 0:010b908e2187 68 } SamplingRate;
AVELARDEV 0:010b908e2187 69
AVELARDEV 0:010b908e2187 70 typedef enum LEDPulseWidth {
AVELARDEV 0:010b908e2187 71 MAX30100_SPC_PW_200US_13BITS = 0x00,
AVELARDEV 0:010b908e2187 72 MAX30100_SPC_PW_400US_14BITS = 0x01,
AVELARDEV 0:010b908e2187 73 MAX30100_SPC_PW_800US_15BITS = 0x02,
AVELARDEV 0:010b908e2187 74 MAX30100_SPC_PW_1600US_16BITS = 0x03
AVELARDEV 0:010b908e2187 75 } LEDPulseWidth;
AVELARDEV 0:010b908e2187 76
AVELARDEV 0:010b908e2187 77 // LED Configuration register
AVELARDEV 0:010b908e2187 78 #define MAX30100_REG_LED_CONFIGURATION 0x09
AVELARDEV 0:010b908e2187 79 typedef enum LEDCurrent {
AVELARDEV 0:010b908e2187 80 MAX30100_LED_CURR_0MA = 0x00,
AVELARDEV 0:010b908e2187 81 MAX30100_LED_CURR_4_4MA = 0x01,
AVELARDEV 0:010b908e2187 82 MAX30100_LED_CURR_7_6MA = 0x02,
AVELARDEV 0:010b908e2187 83 MAX30100_LED_CURR_11MA = 0x03,
AVELARDEV 0:010b908e2187 84 MAX30100_LED_CURR_14_2MA = 0x04,
AVELARDEV 0:010b908e2187 85 MAX30100_LED_CURR_17_4MA = 0x05,
AVELARDEV 0:010b908e2187 86 MAX30100_LED_CURR_20_8MA = 0x06,
AVELARDEV 0:010b908e2187 87 MAX30100_LED_CURR_24MA = 0x07,
AVELARDEV 0:010b908e2187 88 MAX30100_LED_CURR_27_1MA = 0x08,
AVELARDEV 0:010b908e2187 89 MAX30100_LED_CURR_30_6MA = 0x09,
AVELARDEV 0:010b908e2187 90 MAX30100_LED_CURR_33_8MA = 0x0a,
AVELARDEV 0:010b908e2187 91 MAX30100_LED_CURR_37MA = 0x0b,
AVELARDEV 0:010b908e2187 92 MAX30100_LED_CURR_40_2MA = 0x0c,
AVELARDEV 0:010b908e2187 93 MAX30100_LED_CURR_43_6MA = 0x0d,
AVELARDEV 0:010b908e2187 94 MAX30100_LED_CURR_46_8MA = 0x0e,
AVELARDEV 0:010b908e2187 95 MAX30100_LED_CURR_50MA = 0x0f
AVELARDEV 0:010b908e2187 96 } LEDCurrent;
AVELARDEV 0:010b908e2187 97
AVELARDEV 0:010b908e2187 98 // Temperature integer part register
AVELARDEV 0:010b908e2187 99 #define MAX30100_REG_TEMPERATURE_DATA_INT 0x16
AVELARDEV 0:010b908e2187 100 // Temperature fractional part register
AVELARDEV 0:010b908e2187 101 #define MAX30100_REG_TEMPERATURE_DATA_FRAC 0x17
AVELARDEV 0:010b908e2187 102
AVELARDEV 0:010b908e2187 103 // Revision ID register (RO)
AVELARDEV 0:010b908e2187 104 #define MAX30100_REG_REVISION_ID 0xfe
AVELARDEV 0:010b908e2187 105 // Part ID register
AVELARDEV 0:010b908e2187 106 #define MAX30100_REG_PART_ID 0xff
AVELARDEV 0:010b908e2187 107
AVELARDEV 0:010b908e2187 108 #endif