MAXREFDES117# Code Documentation  V01.00
Heart Rate / SpO2 Monitor
 All Data Structures Files Functions Variables Typedefs Macros Pages
max30102.h
Go to the documentation of this file.
1 
30 /*******************************************************************************
31 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
32 *
33 * Permission is hereby granted, free of charge, to any person obtaining a
34 * copy of this software and associated documentation files (the "Software"),
35 * to deal in the Software without restriction, including without limitation
36 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
37 * and/or sell copies of the Software, and to permit persons to whom the
38 * Software is furnished to do so, subject to the following conditions:
39 *
40 * The above copyright notice and this permission notice shall be included
41 * in all copies or substantial portions of the Software.
42 *
43 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
44 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
47 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
48 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
49 * OTHER DEALINGS IN THE SOFTWARE.
50 *
51 * Except as contained in this notice, the name of Maxim Integrated
52 * Products, Inc. shall not be used except as stated in the Maxim Integrated
53 * Products, Inc. Branding Policy.
54 *
55 * The mere transfer of this software does not imply any licenses
56 * of trade secrets, proprietary technology, copyrights, patents,
57 * trademarks, maskwork rights, or any other form of intellectual
58 * property whatsoever. Maxim Integrated Products, Inc. retains all
59 * ownership rights.
60 *******************************************************************************
61 */
62 #ifndef MAX30102_H_
63 #define MAX30102_H_
64 
65 #include <arduino.h>
66 #define I2C_WRITE_ADDR 0xAE
67 #define I2C_READ_ADDR 0xAF
68 
69 //register addresses
70 #define REG_INTR_STATUS_1 0x00
71 #define REG_INTR_STATUS_2 0x01
72 #define REG_INTR_ENABLE_1 0x02
73 #define REG_INTR_ENABLE_2 0x03
74 #define REG_FIFO_WR_PTR 0x04
75 #define REG_OVF_COUNTER 0x05
76 #define REG_FIFO_RD_PTR 0x06
77 #define REG_FIFO_DATA 0x07
78 #define REG_FIFO_CONFIG 0x08
79 #define REG_MODE_CONFIG 0x09
80 #define REG_SPO2_CONFIG 0x0A
81 #define REG_LED1_PA 0x0C
82 #define REG_LED2_PA 0x0D
83 #define REG_PILOT_PA 0x10
84 #define REG_MULTI_LED_CTRL1 0x11
85 #define REG_MULTI_LED_CTRL2 0x12
86 #define REG_TEMP_INTR 0x1F
87 #define REG_TEMP_FRAC 0x20
88 #define REG_TEMP_CONFIG 0x21
89 #define REG_PROX_INT_THRESH 0x30
90 #define REG_REV_ID 0xFE
91 #define REG_PART_ID 0xFF
92 
93 bool maxim_max30102_init();
94 #if defined(ARDUINO_AVR_UNO)
95 //Arduino Uno doesn't have enough SRAM to store 100 samples of IR led data and red led data in 32-bit format
96 //To solve this problem, 16-bit MSB of the sampled data will be truncated. Samples become 16-bit data.
97 bool maxim_max30102_read_fifo(uint16_t *pun_red_led, uint16_t *pun_ir_led);
98 #else
99 bool maxim_max30102_read_fifo(uint32_t *pun_red_led, uint32_t *pun_ir_led);
100 #endif
101 bool maxim_max30102_write_reg(uint8_t uch_addr, uint8_t uch_data);
102 bool maxim_max30102_read_reg(uint8_t uch_addr, uint8_t *puch_data);
103 bool maxim_max30102_reset(void);
104 #endif /* MAX30102_H_ */