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 * Author: Shaun Kelsey, shaun.kelsey@maximintegrated.com
Shaun Kelsey 6:af745c7b8520 3 * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
Shaun Kelsey 6:af745c7b8520 4 *
Shaun Kelsey 6:af745c7b8520 5 * Permission is hereby granted, free of charge, to any person obtaining a
Shaun Kelsey 6:af745c7b8520 6 * copy of this software and associated documentation files (the "Software"),
Shaun Kelsey 6:af745c7b8520 7 * to deal in the Software without restriction, including without limitation
Shaun Kelsey 6:af745c7b8520 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Shaun Kelsey 6:af745c7b8520 9 * and/or sell copies of the Software, and to permit persons to whom the
Shaun Kelsey 6:af745c7b8520 10 * Software is furnished to do so, subject to the following conditions:
Shaun Kelsey 6:af745c7b8520 11 *
Shaun Kelsey 6:af745c7b8520 12 * The above copyright notice and this permission notice shall be included
Shaun Kelsey 6:af745c7b8520 13 * in all copies or substantial portions of the Software.
Shaun Kelsey 6:af745c7b8520 14 *
Shaun Kelsey 6:af745c7b8520 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Shaun Kelsey 6:af745c7b8520 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Shaun Kelsey 6:af745c7b8520 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Shaun Kelsey 6:af745c7b8520 18 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Shaun Kelsey 6:af745c7b8520 19 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Shaun Kelsey 6:af745c7b8520 20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Shaun Kelsey 6:af745c7b8520 21 * OTHER DEALINGS IN THE SOFTWARE.
Shaun Kelsey 6:af745c7b8520 22 *
Shaun Kelsey 6:af745c7b8520 23 * Except as contained in this notice, the name of Maxim Integrated
Shaun Kelsey 6:af745c7b8520 24 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Shaun Kelsey 6:af745c7b8520 25 * Products, Inc. Branding Policy.
Shaun Kelsey 6:af745c7b8520 26 *
Shaun Kelsey 6:af745c7b8520 27 * The mere transfer of this software does not imply any licenses
Shaun Kelsey 6:af745c7b8520 28 * of trade secrets, proprietary technology, copyrights, patents,
Shaun Kelsey 6:af745c7b8520 29 * trademarks, maskwork rights, or any other form of intellectual
Shaun Kelsey 6:af745c7b8520 30 * property whatsoever. Maxim Integrated Products, Inc. retains all
Shaun Kelsey 6:af745c7b8520 31 * ownership rights.
Shaun Kelsey 6:af745c7b8520 32 *******************************************************************************
Shaun Kelsey 6:af745c7b8520 33 */
keremsahin 8:0f55f59ca341 34 #ifdef ENABLE_LED_STATUS
Shaun Kelsey 6:af745c7b8520 35 #include "LEDStatus.h"
Shaun Kelsey 6:af745c7b8520 36 #include "Peripherals.h"
Shaun Kelsey 6:af745c7b8520 37
Shaun Kelsey 6:af745c7b8520 38 LEDStatus::LEDStatus(PinName red, int rstate, PinName green, int gstate, PinName blue, int bstate):
Shaun Kelsey 6:af745c7b8520 39 rLED(red, rstate), gLED(green, gstate), bLED(blue, bstate), blinking(false), timer()
Shaun Kelsey 6:af745c7b8520 40 {
Shaun Kelsey 6:af745c7b8520 41 }
Shaun Kelsey 6:af745c7b8520 42
Shaun Kelsey 6:af745c7b8520 43 void LEDStatus::set_state(int rstate, int gstate, int bstate)
Shaun Kelsey 6:af745c7b8520 44 {
Shaun Kelsey 6:af745c7b8520 45 r_act = rstate;
Shaun Kelsey 6:af745c7b8520 46 g_act = gstate;
Shaun Kelsey 6:af745c7b8520 47 b_act = bstate;
Shaun Kelsey 6:af745c7b8520 48
Shaun Kelsey 6:af745c7b8520 49 if (!blinking) {
Shaun Kelsey 6:af745c7b8520 50 rLED = r_act;
Shaun Kelsey 6:af745c7b8520 51 gLED = g_act;
Shaun Kelsey 6:af745c7b8520 52 bLED = b_act;
Shaun Kelsey 6:af745c7b8520 53 }
Shaun Kelsey 6:af745c7b8520 54 }
Shaun Kelsey 6:af745c7b8520 55
Shaun Kelsey 6:af745c7b8520 56 void LEDStatus::solid()
Shaun Kelsey 6:af745c7b8520 57 {
Shaun Kelsey 6:af745c7b8520 58 blinking = false;
Shaun Kelsey 6:af745c7b8520 59 rLED = r_act;
Shaun Kelsey 6:af745c7b8520 60 gLED = g_act;
Shaun Kelsey 6:af745c7b8520 61 bLED = b_act;
Shaun Kelsey 6:af745c7b8520 62
Shaun Kelsey 6:af745c7b8520 63 timer.stop();
Shaun Kelsey 6:af745c7b8520 64 }
Shaun Kelsey 6:af745c7b8520 65
Shaun Kelsey 6:af745c7b8520 66 void LEDStatus::blink(int ontime, int offtime, int nb)
Shaun Kelsey 6:af745c7b8520 67 {
Shaun Kelsey 6:af745c7b8520 68 ont_us = 1000 * ontime;
Shaun Kelsey 6:af745c7b8520 69 offt_us = 1000 * offtime;
Shaun Kelsey 6:af745c7b8520 70 count = 1;
Shaun Kelsey 6:af745c7b8520 71 total = nb;
Shaun Kelsey 6:af745c7b8520 72 blinking = true;
Shaun Kelsey 6:af745c7b8520 73
Shaun Kelsey 6:af745c7b8520 74 rLED = r_act;
Shaun Kelsey 6:af745c7b8520 75 gLED = g_act;
Shaun Kelsey 6:af745c7b8520 76 bLED = b_act;
Shaun Kelsey 6:af745c7b8520 77 bs = true;
Shaun Kelsey 6:af745c7b8520 78
Shaun Kelsey 6:af745c7b8520 79 timer.reset();
Shaun Kelsey 6:af745c7b8520 80 timer.start();
Shaun Kelsey 6:af745c7b8520 81 }
Shaun Kelsey 6:af745c7b8520 82
Shaun Kelsey 6:af745c7b8520 83 void LEDStatus::blink(int period, float duty, int nb)
Shaun Kelsey 6:af745c7b8520 84 {
Shaun Kelsey 6:af745c7b8520 85 ont_us = 1000 * period * duty;
Shaun Kelsey 6:af745c7b8520 86 offt_us = (1000 * period) - ont_us;
Shaun Kelsey 6:af745c7b8520 87 count = 1;
Shaun Kelsey 6:af745c7b8520 88 total = nb;
Shaun Kelsey 6:af745c7b8520 89 blinking = true;
Shaun Kelsey 6:af745c7b8520 90
Shaun Kelsey 6:af745c7b8520 91 rLED = r_act;
Shaun Kelsey 6:af745c7b8520 92 gLED = g_act;
Shaun Kelsey 6:af745c7b8520 93 bLED = b_act;
Shaun Kelsey 6:af745c7b8520 94 bs = true;
Shaun Kelsey 6:af745c7b8520 95
Shaun Kelsey 6:af745c7b8520 96 timer.reset();
Shaun Kelsey 6:af745c7b8520 97 }
Shaun Kelsey 6:af745c7b8520 98
Shaun Kelsey 6:af745c7b8520 99 bool LEDStatus::is_blinking()
Shaun Kelsey 6:af745c7b8520 100 {
Shaun Kelsey 6:af745c7b8520 101 return blinking;
Shaun Kelsey 6:af745c7b8520 102 }
Shaun Kelsey 6:af745c7b8520 103
Shaun Kelsey 6:af745c7b8520 104 void LEDStatus::update()
Shaun Kelsey 6:af745c7b8520 105 {
Shaun Kelsey 6:af745c7b8520 106 uint64_t time = timer.read_high_resolution_us();
Shaun Kelsey 6:af745c7b8520 107 uint64_t frame_time = time % (ont_us + offt_us);
Shaun Kelsey 6:af745c7b8520 108
Shaun Kelsey 6:af745c7b8520 109 if (bs && (frame_time > ont_us)) {
Shaun Kelsey 6:af745c7b8520 110 bs = false;
Shaun Kelsey 6:af745c7b8520 111 rLED = LED_OFF;
Shaun Kelsey 6:af745c7b8520 112 gLED = LED_OFF;
Shaun Kelsey 6:af745c7b8520 113 bLED = LED_OFF;
Shaun Kelsey 6:af745c7b8520 114 count++;
Shaun Kelsey 6:af745c7b8520 115
Shaun Kelsey 6:af745c7b8520 116 } else if (!bs && (frame_time <= ont_us)) {
Shaun Kelsey 6:af745c7b8520 117 bs = true;
Shaun Kelsey 6:af745c7b8520 118 rLED = r_act;
Shaun Kelsey 6:af745c7b8520 119 gLED = g_act;
Shaun Kelsey 6:af745c7b8520 120 bLED = b_act;
Shaun Kelsey 6:af745c7b8520 121
Shaun Kelsey 6:af745c7b8520 122 if (total > 0 && count >= total) {
Shaun Kelsey 6:af745c7b8520 123 blinking = false;
Shaun Kelsey 6:af745c7b8520 124 timer.stop();
Shaun Kelsey 6:af745c7b8520 125 }
Shaun Kelsey 6:af745c7b8520 126 }
Shaun Kelsey 6:af745c7b8520 127 }
keremsahin 8:0f55f59ca341 128 #endif //ENABLE_LED_STATUS