Host software for the MAXREFDES220 Heart Rate Monitor Smart Sensor. Hosted on the MAX32630FTHR.

Dependencies:   max32630fthr USBDevice

Fork of MAXREFDES220_HEART_RATE_MONITOR by Maxim Integrated

Finger Heart Rate Monitor and SpO2 Monitor

The MAXREFDES220 Smart Sensor FeatherWing board is a integrated solution for providing finger-based heart rate measurements and SpO2 (blood oxygen saturation). This evaluation board interfaces to the host computer using the I2C interface. Heart rate outpu is available in beats per minute (BPM) and SpO2 is reported in percentages.; the PPG (photoplethysmography) raw data is also available. The board has an MAX30101 chip which is a low power heart rate monitor with adjustable sample rates and adjustable LED currents. The low cost MAX32664 microcontroller is pre-flashed with C code for finger-based pulse rate and SpO2 monitoring. Bootloader software is included to allow for future algorithms or updates to the algorithm from Maxim Integrated.

Ordering information will be available soon.

Note: SpO2 values are not calibrated. Calibration should be performed using the final end product.

Warning

The MAXREFDES220 source code listed is dated and only compatible with the 1.2.8a.msbl. The latest sample host source code is available on the MAX32664 website.

MAXREFDES220 FeatherWing Pinout Connections

/media/uploads/phonemacro/maxrefdes220_pinouts_heart_rate_monitor.jpg

Committer:
Shaun Kelsey
Date:
Wed Apr 11 16:01:32 2018 -0700
Revision:
0:da5f5b56060a
Child:
5:e458409e913f
Initial commit of Pegasus OS24 SmartSensor Host

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Shaun Kelsey 0:da5f5b56060a 1 /***************************************************************************
Shaun Kelsey 0:da5f5b56060a 2 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
Shaun Kelsey 0:da5f5b56060a 3 *
Shaun Kelsey 0:da5f5b56060a 4 * Permission is hereby granted, free of charge, to any person obtaining a
Shaun Kelsey 0:da5f5b56060a 5 * copy of this software and associated documentation files (the "Software"),
Shaun Kelsey 0:da5f5b56060a 6 * to deal in the Software without restriction, including without limitation
Shaun Kelsey 0:da5f5b56060a 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Shaun Kelsey 0:da5f5b56060a 8 * and/or sell copies of the Software, and to permit persons to whom the
Shaun Kelsey 0:da5f5b56060a 9 * Software is furnished to do so, subject to the following conditions:
Shaun Kelsey 0:da5f5b56060a 10 *
Shaun Kelsey 0:da5f5b56060a 11 * The above copyright notice and this permission notice shall be included
Shaun Kelsey 0:da5f5b56060a 12 * in all copies or substantial portions of the Software.
Shaun Kelsey 0:da5f5b56060a 13 *
Shaun Kelsey 0:da5f5b56060a 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Shaun Kelsey 0:da5f5b56060a 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Shaun Kelsey 0:da5f5b56060a 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Shaun Kelsey 0:da5f5b56060a 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Shaun Kelsey 0:da5f5b56060a 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Shaun Kelsey 0:da5f5b56060a 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Shaun Kelsey 0:da5f5b56060a 20 * OTHER DEALINGS IN THE SOFTWARE.
Shaun Kelsey 0:da5f5b56060a 21 *
Shaun Kelsey 0:da5f5b56060a 22 * Except as contained in this notice, the name of Maxim Integrated
Shaun Kelsey 0:da5f5b56060a 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Shaun Kelsey 0:da5f5b56060a 24 * Products, Inc. Branding Policy.
Shaun Kelsey 0:da5f5b56060a 25 *
Shaun Kelsey 0:da5f5b56060a 26 * The mere transfer of this software does not imply any licenses
Shaun Kelsey 0:da5f5b56060a 27 * of trade secrets, proprietary technology, copyrights, patents,
Shaun Kelsey 0:da5f5b56060a 28 * trademarks, maskwork rights, or any other form of intellectual
Shaun Kelsey 0:da5f5b56060a 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Shaun Kelsey 0:da5f5b56060a 30 * ownership rights.
Shaun Kelsey 0:da5f5b56060a 31 ****************************************************************************
Shaun Kelsey 0:da5f5b56060a 32 */
Shaun Kelsey 0:da5f5b56060a 33
Shaun Kelsey 0:da5f5b56060a 34 #include "utils.h"
Shaun Kelsey 0:da5f5b56060a 35 #include <ctype.h>
Shaun Kelsey 0:da5f5b56060a 36
Shaun Kelsey 0:da5f5b56060a 37 /*
Shaun Kelsey 0:da5f5b56060a 38 * @brief Parse DeviceStudio get_reg command
Shaun Kelsey 0:da5f5b56060a 39 * @details format is "get_reg <type> <addr>"
Shaun Kelsey 0:da5f5b56060a 40 *
Shaun Kelsey 0:da5f5b56060a 41 * @return 0 on success, -1 on failure
Shaun Kelsey 0:da5f5b56060a 42 */
Shaun Kelsey 0:da5f5b56060a 43 int parse_get_reg_cmd(const char* str, const char* dev_type, uint8_t* addr)
Shaun Kelsey 0:da5f5b56060a 44 {
Shaun Kelsey 0:da5f5b56060a 45 const char* num_start = str + strlen("get_reg") + strlen(dev_type) + 2;
Shaun Kelsey 0:da5f5b56060a 46 unsigned int addr32;
Shaun Kelsey 0:da5f5b56060a 47
Shaun Kelsey 0:da5f5b56060a 48 int num_found = sscanf(num_start, "%x", &addr32);
Shaun Kelsey 0:da5f5b56060a 49 if (num_found == 1) {
Shaun Kelsey 0:da5f5b56060a 50 *addr = (uint8_t)addr32;
Shaun Kelsey 0:da5f5b56060a 51 return 0;
Shaun Kelsey 0:da5f5b56060a 52 } else {
Shaun Kelsey 0:da5f5b56060a 53 return -1;
Shaun Kelsey 0:da5f5b56060a 54 }
Shaun Kelsey 0:da5f5b56060a 55 }
Shaun Kelsey 0:da5f5b56060a 56
Shaun Kelsey 0:da5f5b56060a 57 /*
Shaun Kelsey 0:da5f5b56060a 58 * @brief Parse DeviceStudio set_reg command
Shaun Kelsey 0:da5f5b56060a 59 * @details format is "set_reg <type> <addr> <val>"
Shaun Kelsey 0:da5f5b56060a 60 *
Shaun Kelsey 0:da5f5b56060a 61 * @return 0 on success, -1 on failure
Shaun Kelsey 0:da5f5b56060a 62 */
Shaun Kelsey 0:da5f5b56060a 63 int parse_set_reg_cmd(const char* str, const char* dev_type, uint8_t* addr, uint8_t* val)
Shaun Kelsey 0:da5f5b56060a 64 {
Shaun Kelsey 0:da5f5b56060a 65 const char* num_start = str + strlen("set_reg") + strlen(dev_type) + 2;
Shaun Kelsey 0:da5f5b56060a 66 unsigned int addr32, val32;
Shaun Kelsey 0:da5f5b56060a 67
Shaun Kelsey 0:da5f5b56060a 68 int num_found = sscanf(num_start, "%x %x", &addr32, &val32);
Shaun Kelsey 0:da5f5b56060a 69 if (num_found == 2) {
Shaun Kelsey 0:da5f5b56060a 70 *addr = (uint8_t)addr32;
Shaun Kelsey 0:da5f5b56060a 71 *val = (uint8_t)val32;
Shaun Kelsey 0:da5f5b56060a 72 return 0;
Shaun Kelsey 0:da5f5b56060a 73 } else {
Shaun Kelsey 0:da5f5b56060a 74 return -1;
Shaun Kelsey 0:da5f5b56060a 75 }
Shaun Kelsey 0:da5f5b56060a 76 }
Shaun Kelsey 0:da5f5b56060a 77 int parse_set_reg_cmd(const char* str, const char* dev_type, uint8_t* addr, uint16_t* val)
Shaun Kelsey 0:da5f5b56060a 78 {
Shaun Kelsey 0:da5f5b56060a 79 const char* num_start = str + strlen("set_reg") + strlen(dev_type) + 2;
Shaun Kelsey 0:da5f5b56060a 80 unsigned int addr32, val32;
Shaun Kelsey 0:da5f5b56060a 81
Shaun Kelsey 0:da5f5b56060a 82 int num_found = sscanf(num_start, "%x %x", &addr32, &val32);
Shaun Kelsey 0:da5f5b56060a 83 if (num_found == 2) {
Shaun Kelsey 0:da5f5b56060a 84 *addr = (uint8_t)addr32;
Shaun Kelsey 0:da5f5b56060a 85 *val = (uint8_t)val32;
Shaun Kelsey 0:da5f5b56060a 86 return 0;
Shaun Kelsey 0:da5f5b56060a 87 } else {
Shaun Kelsey 0:da5f5b56060a 88 return -1;
Shaun Kelsey 0:da5f5b56060a 89 }
Shaun Kelsey 0:da5f5b56060a 90 }
Shaun Kelsey 0:da5f5b56060a 91 int parse_set_reg_cmd(const char* str, const char* dev_type, uint8_t* addr, uint32_t* val)
Shaun Kelsey 0:da5f5b56060a 92 {
Shaun Kelsey 0:da5f5b56060a 93 const char* num_start = str + strlen("set_reg") + strlen(dev_type) + 2;
Shaun Kelsey 0:da5f5b56060a 94 unsigned int addr32, val32;
Shaun Kelsey 0:da5f5b56060a 95
Shaun Kelsey 0:da5f5b56060a 96 int num_found = sscanf(num_start, "%x %x", &addr32, &val32);
Shaun Kelsey 0:da5f5b56060a 97 if (num_found == 2) {
Shaun Kelsey 0:da5f5b56060a 98 *addr = (uint8_t)addr32;
Shaun Kelsey 0:da5f5b56060a 99 *val = (uint8_t)val32;
Shaun Kelsey 0:da5f5b56060a 100 return 0;
Shaun Kelsey 0:da5f5b56060a 101 } else {
Shaun Kelsey 0:da5f5b56060a 102 return -1;
Shaun Kelsey 0:da5f5b56060a 103 }
Shaun Kelsey 0:da5f5b56060a 104 }