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:
phonemacro
Date:
Fri Feb 05 01:59:25 2021 +0000
Revision:
14:3fdc09d9017b
Parent:
8:0f55f59ca341
Remove code for EventStats irq_evt - it no longer compiles on mBed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Shaun Kelsey 6:af745c7b8520 1 /***************************************************************************
Shaun Kelsey 6:af745c7b8520 2 * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
Shaun Kelsey 6:af745c7b8520 3 *
Shaun Kelsey 6:af745c7b8520 4 * Permission is hereby granted, free of charge, to any person obtaining a
Shaun Kelsey 6:af745c7b8520 5 * copy of this software and associated documentation files (the "Software"),
Shaun Kelsey 6:af745c7b8520 6 * to deal in the Software without restriction, including without limitation
Shaun Kelsey 6:af745c7b8520 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Shaun Kelsey 6:af745c7b8520 8 * and/or sell copies of the Software, and to permit persons to whom the
Shaun Kelsey 6:af745c7b8520 9 * Software is furnished to do so, subject to the following conditions:
Shaun Kelsey 6:af745c7b8520 10 *
Shaun Kelsey 6:af745c7b8520 11 * The above copyright notice and this permission notice shall be included
Shaun Kelsey 6:af745c7b8520 12 * in all copies or substantial portions of the Software.
Shaun Kelsey 6:af745c7b8520 13 *
Shaun Kelsey 6:af745c7b8520 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Shaun Kelsey 6:af745c7b8520 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Shaun Kelsey 6:af745c7b8520 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Shaun Kelsey 6:af745c7b8520 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Shaun Kelsey 6:af745c7b8520 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Shaun Kelsey 6:af745c7b8520 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Shaun Kelsey 6:af745c7b8520 20 * OTHER DEALINGS IN THE SOFTWARE.
Shaun Kelsey 6:af745c7b8520 21 *
Shaun Kelsey 6:af745c7b8520 22 * Except as contained in this notice, the name of Maxim Integrated
Shaun Kelsey 6:af745c7b8520 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Shaun Kelsey 6:af745c7b8520 24 * Products, Inc. Branding Policy.
Shaun Kelsey 6:af745c7b8520 25 *
Shaun Kelsey 6:af745c7b8520 26 * The mere transfer of this software does not imply any licenses
Shaun Kelsey 6:af745c7b8520 27 * of trade secrets, proprietary technology, copyrights, patents,
Shaun Kelsey 6:af745c7b8520 28 * trademarks, maskwork rights, or any other form of intellectual
Shaun Kelsey 6:af745c7b8520 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Shaun Kelsey 6:af745c7b8520 30 * ownership rights.
Shaun Kelsey 6:af745c7b8520 31 ****************************************************************************
Shaun Kelsey 6:af745c7b8520 32 */
keremsahin 8:0f55f59ca341 33 #ifdef ENABLE_EVENTSTATS
Shaun Kelsey 6:af745c7b8520 34 #include "EventStats.h"
Shaun Kelsey 6:af745c7b8520 35 #include "Peripherals.h"
Shaun Kelsey 6:af745c7b8520 36
Shaun Kelsey 6:af745c7b8520 37 EventStats::EventStats() :
Shaun Kelsey 6:af745c7b8520 38 single_evt(), all_evts()
Shaun Kelsey 6:af745c7b8520 39 {
Shaun Kelsey 6:af745c7b8520 40 name = "";
Shaun Kelsey 6:af745c7b8520 41 report_period = 1000000;
Shaun Kelsey 6:af745c7b8520 42 num_evts = 0;
Shaun Kelsey 6:af745c7b8520 43 total_evt_time = 0;
Shaun Kelsey 6:af745c7b8520 44
Shaun Kelsey 6:af745c7b8520 45 evt_in_prog = false;
Shaun Kelsey 6:af745c7b8520 46 }
Shaun Kelsey 6:af745c7b8520 47
Shaun Kelsey 6:af745c7b8520 48 EventStats::EventStats(int report_period, const char* name) :
Shaun Kelsey 6:af745c7b8520 49 single_evt(), all_evts()
Shaun Kelsey 6:af745c7b8520 50 {
Shaun Kelsey 6:af745c7b8520 51 if (name)
Shaun Kelsey 6:af745c7b8520 52 this->name = name;
Shaun Kelsey 6:af745c7b8520 53 else
Shaun Kelsey 6:af745c7b8520 54 this->name = "";
Shaun Kelsey 6:af745c7b8520 55
Shaun Kelsey 6:af745c7b8520 56 this->report_period = report_period;
Shaun Kelsey 6:af745c7b8520 57 num_evts = 0;
Shaun Kelsey 6:af745c7b8520 58 total_evt_time = 0;
Shaun Kelsey 6:af745c7b8520 59 evt_in_prog = false;
Shaun Kelsey 6:af745c7b8520 60
Shaun Kelsey 6:af745c7b8520 61 }
Shaun Kelsey 6:af745c7b8520 62
Shaun Kelsey 6:af745c7b8520 63 void EventStats::start()
Shaun Kelsey 6:af745c7b8520 64 {
Shaun Kelsey 6:af745c7b8520 65 if (evt_in_prog) {
Shaun Kelsey 6:af745c7b8520 66 pr_debug("EventStats::start() called twice without calling EventStats::stop()!");
Shaun Kelsey 6:af745c7b8520 67 }
Shaun Kelsey 6:af745c7b8520 68
Shaun Kelsey 6:af745c7b8520 69
Shaun Kelsey 6:af745c7b8520 70 if (!num_evts)
Shaun Kelsey 6:af745c7b8520 71 all_evts.start();
Shaun Kelsey 6:af745c7b8520 72
Shaun Kelsey 6:af745c7b8520 73 single_evt.start();
Shaun Kelsey 6:af745c7b8520 74 evt_in_prog = true;
Shaun Kelsey 6:af745c7b8520 75
Shaun Kelsey 6:af745c7b8520 76 }
Shaun Kelsey 6:af745c7b8520 77
Shaun Kelsey 6:af745c7b8520 78 void EventStats::stop()
Shaun Kelsey 6:af745c7b8520 79 {
Shaun Kelsey 6:af745c7b8520 80 if (!evt_in_prog) {
Shaun Kelsey 6:af745c7b8520 81 pr_debug("EventStats::stop() called before EventStats::start()!");
Shaun Kelsey 6:af745c7b8520 82 }
Shaun Kelsey 6:af745c7b8520 83
Shaun Kelsey 6:af745c7b8520 84 single_evt.stop();
Shaun Kelsey 6:af745c7b8520 85 num_evts++;
Shaun Kelsey 6:af745c7b8520 86 evt_in_prog = false;
Shaun Kelsey 6:af745c7b8520 87 total_evt_time += single_evt.read_us();
Shaun Kelsey 6:af745c7b8520 88 single_evt.reset();
Shaun Kelsey 6:af745c7b8520 89
Shaun Kelsey 6:af745c7b8520 90 int time_since_start = all_evts.read_us();
Shaun Kelsey 6:af745c7b8520 91 if (time_since_start > report_period) {
Shaun Kelsey 6:af745c7b8520 92 print_events(true);
Shaun Kelsey 6:af745c7b8520 93 }
Shaun Kelsey 6:af745c7b8520 94 }
Shaun Kelsey 6:af745c7b8520 95
Shaun Kelsey 6:af745c7b8520 96 void EventStats::print_events(bool reset)
Shaun Kelsey 6:af745c7b8520 97 {
Shaun Kelsey 6:af745c7b8520 98 if (num_evts > 0) {
Shaun Kelsey 6:af745c7b8520 99 int time_since_start = all_evts.read_us();
Shaun Kelsey 6:af745c7b8520 100 int avg = total_evt_time / num_evts;
Shaun Kelsey 6:af745c7b8520 101
Shaun Kelsey 6:af745c7b8520 102 pr_debug("[Event (%s) hit %d times in %dus. Avg: %dus, Total: %dus\r\n",
Shaun Kelsey 6:af745c7b8520 103 name,
Shaun Kelsey 6:af745c7b8520 104 num_evts,
Shaun Kelsey 6:af745c7b8520 105 time_since_start,
Shaun Kelsey 6:af745c7b8520 106 avg,
Shaun Kelsey 6:af745c7b8520 107 total_evt_time);
Shaun Kelsey 6:af745c7b8520 108 } else {
Shaun Kelsey 6:af745c7b8520 109 pr_debug("Event (%s) has not yet occurred\r\n", name);
Shaun Kelsey 6:af745c7b8520 110 }
Shaun Kelsey 6:af745c7b8520 111
Shaun Kelsey 6:af745c7b8520 112 if (reset) {
Shaun Kelsey 6:af745c7b8520 113 num_evts = 0;
Shaun Kelsey 6:af745c7b8520 114 all_evts.reset();
Shaun Kelsey 6:af745c7b8520 115 total_evt_time = 0;
Shaun Kelsey 6:af745c7b8520 116 }
Shaun Kelsey 6:af745c7b8520 117 }
keremsahin 8:0f55f59ca341 118
keremsahin 8:0f55f59ca341 119 #endif //ENABLE_EVENTSTATS