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 #ifndef _LEDSTATUS_H_
Shaun Kelsey 6:af745c7b8520 36 #define _LEDSTATUS_H_
Shaun Kelsey 6:af745c7b8520 37 #include "mbed.h"
Shaun Kelsey 6:af745c7b8520 38
Shaun Kelsey 6:af745c7b8520 39 class LEDStatus
Shaun Kelsey 6:af745c7b8520 40 {
Shaun Kelsey 6:af745c7b8520 41 public:
Shaun Kelsey 6:af745c7b8520 42
Shaun Kelsey 6:af745c7b8520 43 /** Create an LED_Status controller
Shaun Kelsey 6:af745c7b8520 44 *
Shaun Kelsey 6:af745c7b8520 45 * @param red PinName of red LED
Shaun Kelsey 6:af745c7b8520 46 * @param rstate Initial state of red LED
Shaun Kelsey 6:af745c7b8520 47 * @param green PinName of green LED
Shaun Kelsey 6:af745c7b8520 48 * @param gstate Initial state of green LED
Shaun Kelsey 6:af745c7b8520 49 * @param blue PinName of blue LED
Shaun Kelsey 6:af745c7b8520 50 * @param bstate Initial state of blue LED
Shaun Kelsey 6:af745c7b8520 51 */
Shaun Kelsey 6:af745c7b8520 52 LEDStatus(PinName red, int rstate, PinName green, int gstate, PinName blue, int bstate);
Shaun Kelsey 6:af745c7b8520 53
Shaun Kelsey 6:af745c7b8520 54 /** Set the active state of each LED
Shaun Kelsey 6:af745c7b8520 55 *
Shaun Kelsey 6:af745c7b8520 56 * @param rstate active state of red LED
Shaun Kelsey 6:af745c7b8520 57 * @param gstate active state of green LED
Shaun Kelsey 6:af745c7b8520 58 * @param bstate active state of blue LED
Shaun Kelsey 6:af745c7b8520 59 */
Shaun Kelsey 6:af745c7b8520 60 void set_state(int rstate, int gstate, int bstate);
Shaun Kelsey 6:af745c7b8520 61
Shaun Kelsey 6:af745c7b8520 62 /** Set and keep the LEDs in their active state */
Shaun Kelsey 6:af745c7b8520 63 void solid();
Shaun Kelsey 6:af745c7b8520 64
Shaun Kelsey 6:af745c7b8520 65 /** Set the LEDs to toggle between their active state and their off state
Shaun Kelsey 6:af745c7b8520 66 *
Shaun Kelsey 6:af745c7b8520 67 * @param ontime The amount of time (in milliseconds) to remain in the active state
Shaun Kelsey 6:af745c7b8520 68 * @param offtime The amount of time (in milliseconds) to remain off
Shaun Kelsey 6:af745c7b8520 69 * @param nb The number of times to blink before remaining in the off state
Shaun Kelsey 6:af745c7b8520 70 * Set to -1 to blink indefinitely
Shaun Kelsey 6:af745c7b8520 71 *
Shaun Kelsey 6:af745c7b8520 72 */
Shaun Kelsey 6:af745c7b8520 73 void blink(int ontime, int offtime, int nb = -1);
Shaun Kelsey 6:af745c7b8520 74
Shaun Kelsey 6:af745c7b8520 75 /** Set the LEDs to toggle between their active state and their off state
Shaun Kelsey 6:af745c7b8520 76 *
Shaun Kelsey 6:af745c7b8520 77 * @param period The period of each blink (in milliseconds)
Shaun Kelsey 6:af745c7b8520 78 * @param offtime The percentage of the period during which the LEDs will be in their active state
Shaun Kelsey 6:af745c7b8520 79 * @param nb The number of times to blink before remaining in the off state
Shaun Kelsey 6:af745c7b8520 80 * Set to -1 to blink indefinitely
Shaun Kelsey 6:af745c7b8520 81 */
Shaun Kelsey 6:af745c7b8520 82 void blink(int period, float duty, int nb = -1);
Shaun Kelsey 6:af745c7b8520 83
Shaun Kelsey 6:af745c7b8520 84 /** Get whether LEDState is in the blinking state
Shaun Kelsey 6:af745c7b8520 85 */
Shaun Kelsey 6:af745c7b8520 86 bool is_blinking();
Shaun Kelsey 6:af745c7b8520 87
Shaun Kelsey 6:af745c7b8520 88 /** Called in main loop of program to advance the state of the class
Shaun Kelsey 6:af745c7b8520 89 * @detail Instead of using a Ticker and generating additional interrupts and overhead,
Shaun Kelsey 6:af745c7b8520 90 * LEDStatus relies on update being called at a decent interval in order
Shaun Kelsey 6:af745c7b8520 91 * to advance its interval time keeping and blink LEDs and the correct rate.
Shaun Kelsey 6:af745c7b8520 92 * If only using solid() mode, update() does not need to be called.
Shaun Kelsey 6:af745c7b8520 93 */
Shaun Kelsey 6:af745c7b8520 94 void update();
Shaun Kelsey 6:af745c7b8520 95
Shaun Kelsey 6:af745c7b8520 96 private:
Shaun Kelsey 6:af745c7b8520 97
Shaun Kelsey 6:af745c7b8520 98 DigitalOut rLED;
Shaun Kelsey 6:af745c7b8520 99 DigitalOut gLED;
Shaun Kelsey 6:af745c7b8520 100 DigitalOut bLED;
Shaun Kelsey 6:af745c7b8520 101
Shaun Kelsey 6:af745c7b8520 102 int r_act;
Shaun Kelsey 6:af745c7b8520 103 int g_act;
Shaun Kelsey 6:af745c7b8520 104 int b_act;
Shaun Kelsey 6:af745c7b8520 105
Shaun Kelsey 6:af745c7b8520 106 bool blinking;
Shaun Kelsey 6:af745c7b8520 107 bool bs;
Shaun Kelsey 6:af745c7b8520 108 int count;
Shaun Kelsey 6:af745c7b8520 109 int total;
Shaun Kelsey 6:af745c7b8520 110
Shaun Kelsey 6:af745c7b8520 111 uint64_t ont_us;
Shaun Kelsey 6:af745c7b8520 112 uint64_t offt_us;
Shaun Kelsey 6:af745c7b8520 113
Shaun Kelsey 6:af745c7b8520 114 Timer timer;
Shaun Kelsey 6:af745c7b8520 115
Shaun Kelsey 6:af745c7b8520 116 };
Shaun Kelsey 6:af745c7b8520 117
Shaun Kelsey 6:af745c7b8520 118 #endif
keremsahin 8:0f55f59ca341 119 #endif //ENABLE_LED_STATUS