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