Alex Leung
/
HealthTracker
Test version
MAX30102.h@0:4be500de690c, 2018-03-20 (annotated)
- Committer:
- a2824256
- Date:
- Tue Mar 20 02:09:21 2018 +0000
- Revision:
- 0:4be500de690c
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
a2824256 | 0:4be500de690c | 1 | /** \file max30102.h ****************************************************** |
a2824256 | 0:4be500de690c | 2 | * |
a2824256 | 0:4be500de690c | 3 | * Project: MAXREFDES117# |
a2824256 | 0:4be500de690c | 4 | * Filename: max30102.h |
a2824256 | 0:4be500de690c | 5 | * Description: This module is an embedded controller driver header file for MAX30102 |
a2824256 | 0:4be500de690c | 6 | * |
a2824256 | 0:4be500de690c | 7 | * |
a2824256 | 0:4be500de690c | 8 | * -------------------------------------------------------------------- |
a2824256 | 0:4be500de690c | 9 | * |
a2824256 | 0:4be500de690c | 10 | * This code follows the following naming conventions: |
a2824256 | 0:4be500de690c | 11 | * |
a2824256 | 0:4be500de690c | 12 | * char ch_pmod_value |
a2824256 | 0:4be500de690c | 13 | * char (array) s_pmod_s_string[16] |
a2824256 | 0:4be500de690c | 14 | * float f_pmod_value |
a2824256 | 0:4be500de690c | 15 | * int32_t n_pmod_value |
a2824256 | 0:4be500de690c | 16 | * int32_t (array) an_pmod_value[16] |
a2824256 | 0:4be500de690c | 17 | * int16_t w_pmod_value |
a2824256 | 0:4be500de690c | 18 | * int16_t (array) aw_pmod_value[16] |
a2824256 | 0:4be500de690c | 19 | * uint16_t uw_pmod_value |
a2824256 | 0:4be500de690c | 20 | * uint16_t (array) auw_pmod_value[16] |
a2824256 | 0:4be500de690c | 21 | * uint8_t uch_pmod_value |
a2824256 | 0:4be500de690c | 22 | * uint8_t (array) auch_pmod_buffer[16] |
a2824256 | 0:4be500de690c | 23 | * uint32_t un_pmod_value |
a2824256 | 0:4be500de690c | 24 | * int32_t * pn_pmod_value |
a2824256 | 0:4be500de690c | 25 | * |
a2824256 | 0:4be500de690c | 26 | * ------------------------------------------------------------------------- */ |
a2824256 | 0:4be500de690c | 27 | /******************************************************************************* |
a2824256 | 0:4be500de690c | 28 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
a2824256 | 0:4be500de690c | 29 | * |
a2824256 | 0:4be500de690c | 30 | * Permission is hereby granted, free of charge, to any person obtaining a |
a2824256 | 0:4be500de690c | 31 | * copy of this software and associated documentation files (the "Software"), |
a2824256 | 0:4be500de690c | 32 | * to deal in the Software without restriction, including without limitation |
a2824256 | 0:4be500de690c | 33 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
a2824256 | 0:4be500de690c | 34 | * and/or sell copies of the Software, and to permit persons to whom the |
a2824256 | 0:4be500de690c | 35 | * Software is furnished to do so, subject to the following conditions: |
a2824256 | 0:4be500de690c | 36 | * |
a2824256 | 0:4be500de690c | 37 | * The above copyright notice and this permission notice shall be included |
a2824256 | 0:4be500de690c | 38 | * in all copies or substantial portions of the Software. |
a2824256 | 0:4be500de690c | 39 | * |
a2824256 | 0:4be500de690c | 40 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
a2824256 | 0:4be500de690c | 41 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
a2824256 | 0:4be500de690c | 42 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
a2824256 | 0:4be500de690c | 43 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
a2824256 | 0:4be500de690c | 44 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
a2824256 | 0:4be500de690c | 45 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
a2824256 | 0:4be500de690c | 46 | * OTHER DEALINGS IN THE SOFTWARE. |
a2824256 | 0:4be500de690c | 47 | * |
a2824256 | 0:4be500de690c | 48 | * Except as contained in this notice, the name of Maxim Integrated |
a2824256 | 0:4be500de690c | 49 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
a2824256 | 0:4be500de690c | 50 | * Products, Inc. Branding Policy. |
a2824256 | 0:4be500de690c | 51 | * |
a2824256 | 0:4be500de690c | 52 | * The mere transfer of this software does not imply any licenses |
a2824256 | 0:4be500de690c | 53 | * of trade secrets, proprietary technology, copyrights, patents, |
a2824256 | 0:4be500de690c | 54 | * trademarks, maskwork rights, or any other form of intellectual |
a2824256 | 0:4be500de690c | 55 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
a2824256 | 0:4be500de690c | 56 | * ownership rights. |
a2824256 | 0:4be500de690c | 57 | ******************************************************************************* |
a2824256 | 0:4be500de690c | 58 | */ |
a2824256 | 0:4be500de690c | 59 | #ifndef MAX30102_H_ |
a2824256 | 0:4be500de690c | 60 | #define MAX30102_H_ |
a2824256 | 0:4be500de690c | 61 | |
a2824256 | 0:4be500de690c | 62 | #include "mbed.h" |
a2824256 | 0:4be500de690c | 63 | |
a2824256 | 0:4be500de690c | 64 | #define I2C_WRITE_ADDR 0xAE |
a2824256 | 0:4be500de690c | 65 | #define I2C_READ_ADDR 0xAF |
a2824256 | 0:4be500de690c | 66 | |
a2824256 | 0:4be500de690c | 67 | //register addresses |
a2824256 | 0:4be500de690c | 68 | #define REG_INTR_STATUS_1 0x00 |
a2824256 | 0:4be500de690c | 69 | #define REG_INTR_STATUS_2 0x01 |
a2824256 | 0:4be500de690c | 70 | #define REG_INTR_ENABLE_1 0x02 |
a2824256 | 0:4be500de690c | 71 | #define REG_INTR_ENABLE_2 0x03 |
a2824256 | 0:4be500de690c | 72 | #define REG_FIFO_WR_PTR 0x04 |
a2824256 | 0:4be500de690c | 73 | #define REG_OVF_COUNTER 0x05 |
a2824256 | 0:4be500de690c | 74 | #define REG_FIFO_RD_PTR 0x06 |
a2824256 | 0:4be500de690c | 75 | #define REG_FIFO_DATA 0x07 |
a2824256 | 0:4be500de690c | 76 | #define REG_FIFO_CONFIG 0x08 |
a2824256 | 0:4be500de690c | 77 | #define REG_MODE_CONFIG 0x09 |
a2824256 | 0:4be500de690c | 78 | #define REG_SPO2_CONFIG 0x0A |
a2824256 | 0:4be500de690c | 79 | #define REG_LED1_PA 0x0C |
a2824256 | 0:4be500de690c | 80 | #define REG_LED2_PA 0x0D |
a2824256 | 0:4be500de690c | 81 | #define REG_PILOT_PA 0x10 |
a2824256 | 0:4be500de690c | 82 | #define REG_MULTI_LED_CTRL1 0x11 |
a2824256 | 0:4be500de690c | 83 | #define REG_MULTI_LED_CTRL2 0x12 |
a2824256 | 0:4be500de690c | 84 | #define REG_TEMP_INTR 0x1F |
a2824256 | 0:4be500de690c | 85 | #define REG_TEMP_FRAC 0x20 |
a2824256 | 0:4be500de690c | 86 | #define REG_TEMP_CONFIG 0x21 |
a2824256 | 0:4be500de690c | 87 | #define REG_PROX_INT_THRESH 0x30 |
a2824256 | 0:4be500de690c | 88 | #define REG_REV_ID 0xFE |
a2824256 | 0:4be500de690c | 89 | #define REG_PART_ID 0xFF |
a2824256 | 0:4be500de690c | 90 | |
a2824256 | 0:4be500de690c | 91 | bool maxim_max30102_init(); |
a2824256 | 0:4be500de690c | 92 | bool maxim_max30102_read_fifo(uint32_t *pun_red_led, uint32_t *pun_ir_led); |
a2824256 | 0:4be500de690c | 93 | bool maxim_max30102_write_reg(uint8_t uch_addr, uint8_t uch_data); |
a2824256 | 0:4be500de690c | 94 | bool maxim_max30102_read_reg(uint8_t uch_addr, uint8_t *puch_data); |
a2824256 | 0:4be500de690c | 95 | bool maxim_max30102_reset(void); |
a2824256 | 0:4be500de690c | 96 | |
a2824256 | 0:4be500de690c | 97 | #endif /* MAX30102_H_ */ |
a2824256 | 0:4be500de690c | 98 | |
a2824256 | 0:4be500de690c | 99 | |
a2824256 | 0:4be500de690c | 100 |