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:
0:da5f5b56060a
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 0:da5f5b56060a 1 /*******************************************************************************
Shaun Kelsey 0:da5f5b56060a 2 * Author: Ismail Kose, Ismail.Kose@maximintegrated.com
Shaun Kelsey 0:da5f5b56060a 3 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Shaun Kelsey 0:da5f5b56060a 4 *
Shaun Kelsey 0:da5f5b56060a 5 * Permission is hereby granted, free of charge, to any person obtaining a
Shaun Kelsey 0:da5f5b56060a 6 * copy of this software and associated documentation files (the "Software"),
Shaun Kelsey 0:da5f5b56060a 7 * to deal in the Software without restriction, including without limitation
Shaun Kelsey 0:da5f5b56060a 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Shaun Kelsey 0:da5f5b56060a 9 * and/or sell copies of the Software, and to permit persons to whom the
Shaun Kelsey 0:da5f5b56060a 10 * Software is furnished to do so, subject to the following conditions:
Shaun Kelsey 0:da5f5b56060a 11 *
Shaun Kelsey 0:da5f5b56060a 12 * The above copyright notice and this permission notice shall be included
Shaun Kelsey 0:da5f5b56060a 13 * in all copies or substantial portions of the Software.
Shaun Kelsey 0:da5f5b56060a 14 *
Shaun Kelsey 0:da5f5b56060a 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Shaun Kelsey 0:da5f5b56060a 16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Shaun Kelsey 0:da5f5b56060a 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Shaun Kelsey 0:da5f5b56060a 18 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Shaun Kelsey 0:da5f5b56060a 19 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Shaun Kelsey 0:da5f5b56060a 20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Shaun Kelsey 0:da5f5b56060a 21 * OTHER DEALINGS IN THE SOFTWARE.
Shaun Kelsey 0:da5f5b56060a 22 *
Shaun Kelsey 0:da5f5b56060a 23 * Except as contained in this notice, the name of Maxim Integrated
Shaun Kelsey 0:da5f5b56060a 24 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Shaun Kelsey 0:da5f5b56060a 25 * Products, Inc. Branding Policy.
Shaun Kelsey 0:da5f5b56060a 26 *
Shaun Kelsey 0:da5f5b56060a 27 * The mere transfer of this software does not imply any licenses
Shaun Kelsey 0:da5f5b56060a 28 * of trade secrets, proprietary technology, copyrights, patents,
Shaun Kelsey 0:da5f5b56060a 29 * trademarks, maskwork rights, or any other form of intellectual
Shaun Kelsey 0:da5f5b56060a 30 * property whatsoever. Maxim Integrated Products, Inc. retains all
Shaun Kelsey 0:da5f5b56060a 31 * ownership rights.
Shaun Kelsey 0:da5f5b56060a 32 *******************************************************************************
Shaun Kelsey 0:da5f5b56060a 33 */
Shaun Kelsey 0:da5f5b56060a 34
Shaun Kelsey 0:da5f5b56060a 35 #ifndef _QUEUE_H_
Shaun Kelsey 0:da5f5b56060a 36 #define _QUEUE_H_
Shaun Kelsey 0:da5f5b56060a 37
Shaun Kelsey 0:da5f5b56060a 38 struct queue_t {
Shaun Kelsey 0:da5f5b56060a 39 void *wr; // write pointer
Shaun Kelsey 0:da5f5b56060a 40 void *rd; // read pointer
Shaun Kelsey 0:da5f5b56060a 41 void *base; // buffer base pointer
Shaun Kelsey 0:da5f5b56060a 42 int num_item; // number of data item
Shaun Kelsey 0:da5f5b56060a 43 int ovf_item; // Number of overflowed data
Shaun Kelsey 0:da5f5b56060a 44 int buffer_size; // buffer size in bytes
Shaun Kelsey 0:da5f5b56060a 45 int item_size; // data size
Shaun Kelsey 0:da5f5b56060a 46 };
Shaun Kelsey 0:da5f5b56060a 47
Shaun Kelsey 0:da5f5b56060a 48 #ifdef __cplusplus
Shaun Kelsey 0:da5f5b56060a 49 extern "C" {
Shaun Kelsey 0:da5f5b56060a 50 #endif
Shaun Kelsey 0:da5f5b56060a 51 /**
Shaun Kelsey 0:da5f5b56060a 52 * @brief Queue initialization.
Shaun Kelsey 0:da5f5b56060a 53 * @param[in] *q Points to the queue handle
Shaun Kelsey 0:da5f5b56060a 54 * @param[in] *buf Points to external queue buffer
Shaun Kelsey 0:da5f5b56060a 55 * @param[in] item_size Data size
Shaun Kelsey 0:da5f5b56060a 56 * @param[in] buffer_size Total buffer size in bytes
Shaun Kelsey 0:da5f5b56060a 57 * @param[out] *pDst points to output matrix structure
Shaun Kelsey 0:da5f5b56060a 58 * @return The function returns 0: success
Shaun Kelsey 0:da5f5b56060a 59 * -EINVAL (-22): Invalid Pointer, data or parameters
Shaun Kelsey 0:da5f5b56060a 60 * -2: Queue buffer is full, no more space
Shaun Kelsey 0:da5f5b56060a 61 **/
Shaun Kelsey 0:da5f5b56060a 62 int queue_init(struct queue_t *q, void *buf, int item_size, int buffer_size);
Shaun Kelsey 0:da5f5b56060a 63
Shaun Kelsey 0:da5f5b56060a 64
Shaun Kelsey 0:da5f5b56060a 65
Shaun Kelsey 0:da5f5b56060a 66
Shaun Kelsey 0:da5f5b56060a 67 /**
Shaun Kelsey 0:da5f5b56060a 68 * @brief Data reset.
Shaun Kelsey 0:da5f5b56060a 69 * @param[in] *q Points to the queue handle
Shaun Kelsey 0:da5f5b56060a 70 * @param[in] *data Points to any type of data to put FIFO
Shaun Kelsey 0:da5f5b56060a 71 * @param[out] *pDst Points to output matrix structure
Shaun Kelsey 0:da5f5b56060a 72 * @return The function returns 0: success
Shaun Kelsey 0:da5f5b56060a 73 * -EINVAL (-22): Invalid Pointer
Shaun Kelsey 0:da5f5b56060a 74 * -2: Queue buffer is full, no more space
Shaun Kelsey 0:da5f5b56060a 75 **/
Shaun Kelsey 0:da5f5b56060a 76 int queue_reset(struct queue_t *q);
Shaun Kelsey 0:da5f5b56060a 77
Shaun Kelsey 0:da5f5b56060a 78
Shaun Kelsey 0:da5f5b56060a 79 /**
Shaun Kelsey 0:da5f5b56060a 80 * @brief Data enqueue.
Shaun Kelsey 0:da5f5b56060a 81 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 82 * @param[in] *data points to any type of data to put FIFO
Shaun Kelsey 0:da5f5b56060a 83 * @return The function returns 0: success
Shaun Kelsey 0:da5f5b56060a 84 * -EINVAL (-22): Invalid Pointer
Shaun Kelsey 0:da5f5b56060a 85 * -2: Queue buffer is full, no more space
Shaun Kelsey 0:da5f5b56060a 86 **/
Shaun Kelsey 0:da5f5b56060a 87 int enqueue(struct queue_t *q, void *data);
Shaun Kelsey 0:da5f5b56060a 88
Shaun Kelsey 0:da5f5b56060a 89
Shaun Kelsey 0:da5f5b56060a 90 /**
Shaun Kelsey 0:da5f5b56060a 91 * @brief Data dequeue.
Shaun Kelsey 0:da5f5b56060a 92 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 93 * @param[in] *data points to any type of data to put FIFO
Shaun Kelsey 0:da5f5b56060a 94 * @param[out] *data pop data from Queue
Shaun Kelsey 0:da5f5b56060a 95 * @return The function returns 0: success
Shaun Kelsey 0:da5f5b56060a 96 * -EINVAL (-22): Invalid Pointer or data
Shaun Kelsey 0:da5f5b56060a 97 * -2: Queue buffer is empty
Shaun Kelsey 0:da5f5b56060a 98 **/
Shaun Kelsey 0:da5f5b56060a 99 int dequeue(struct queue_t *q, void *data);
Shaun Kelsey 0:da5f5b56060a 100
Shaun Kelsey 0:da5f5b56060a 101
Shaun Kelsey 0:da5f5b56060a 102
Shaun Kelsey 0:da5f5b56060a 103 /**
Shaun Kelsey 0:da5f5b56060a 104 * @brief Queue Destroy
Shaun Kelsey 0:da5f5b56060a 105 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 106 **/
Shaun Kelsey 0:da5f5b56060a 107 void queue_destroy(struct queue_t *q);
Shaun Kelsey 0:da5f5b56060a 108
Shaun Kelsey 0:da5f5b56060a 109 /**
Shaun Kelsey 0:da5f5b56060a 110 * @brief Number of elements in Queue
Shaun Kelsey 0:da5f5b56060a 111 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 112 * @return number of elements
Shaun Kelsey 0:da5f5b56060a 113 **/
Shaun Kelsey 0:da5f5b56060a 114 int queue_len(struct queue_t *q);
Shaun Kelsey 0:da5f5b56060a 115
Shaun Kelsey 0:da5f5b56060a 116
Shaun Kelsey 0:da5f5b56060a 117 /*
Shaun Kelsey 0:da5f5b56060a 118 Reads the item from the front of queue but does not remove
Shaun Kelsey 0:da5f5b56060a 119 */
Shaun Kelsey 0:da5f5b56060a 120 /**
Shaun Kelsey 0:da5f5b56060a 121 * @brief Copies an item from the front of queue to data, but does not remove it from queue
Shaun Kelsey 0:da5f5b56060a 122 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 123 * @param[out] Copy of item from front of the queue
Shaun Kelsey 0:da5f5b56060a 124 * @return if value is greater than 0, return value is number of elements.
Shaun Kelsey 0:da5f5b56060a 125 If value is less than 0, returns -EINVAL (-22)
Shaun Kelsey 0:da5f5b56060a 126 **/
Shaun Kelsey 0:da5f5b56060a 127
Shaun Kelsey 0:da5f5b56060a 128 int queue_front(struct queue_t *q, void *data);
Shaun Kelsey 0:da5f5b56060a 129
Shaun Kelsey 0:da5f5b56060a 130 /**
Shaun Kelsey 0:da5f5b56060a 131 * @brief Removes an item from front of queue
Shaun Kelsey 0:da5f5b56060a 132 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 133 * @return status, success or fail
Shaun Kelsey 0:da5f5b56060a 134 **/
Shaun Kelsey 0:da5f5b56060a 135 int queue_pop(struct queue_t *q);
Shaun Kelsey 0:da5f5b56060a 136
Shaun Kelsey 0:da5f5b56060a 137 /**
Shaun Kelsey 0:da5f5b56060a 138 * @brief returns fifo usage info
Shaun Kelsey 0:da5f5b56060a 139 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 140 * @param[out] *total returns total FIFO size in number of elements
Shaun Kelsey 0:da5f5b56060a 141 * @param[out] *nm_item returns number of elements in FIFO
Shaun Kelsey 0:da5f5b56060a 142 * @return status, success or fail
Shaun Kelsey 0:da5f5b56060a 143 * -EINVAL (-22): Invalid Pointer, data or parameters
Shaun Kelsey 0:da5f5b56060a 144 **/
Shaun Kelsey 0:da5f5b56060a 145 int queue_usage(struct queue_t *q, int *total, int *nm_item);
Shaun Kelsey 0:da5f5b56060a 146
Shaun Kelsey 0:da5f5b56060a 147 /**
Shaun Kelsey 0:da5f5b56060a 148 * @brief Pops out delimiter terminated string
Shaun Kelsey 0:da5f5b56060a 149 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 150 * @param[out] *buf output char array to write
Shaun Kelsey 0:da5f5b56060a 151 * @param[in] delimiter Delimiter character, NULL for string
Shaun Kelsey 0:da5f5b56060a 152 * @param[in] buffer_size Maximum buffer size to write the output char array
Shaun Kelsey 0:da5f5b56060a 153 * @return status, string length if positive or fail if negative
Shaun Kelsey 0:da5f5b56060a 154 * -EINVAL (-22): Invalid Pointer, data or parameters
Shaun Kelsey 0:da5f5b56060a 155 **/
Shaun Kelsey 0:da5f5b56060a 156 int dequeue_string(struct queue_t *q, char *buf, char delimiter, int buffer_size);
Shaun Kelsey 0:da5f5b56060a 157
Shaun Kelsey 0:da5f5b56060a 158 /**
Shaun Kelsey 0:da5f5b56060a 159 * @brief Pushes null terminated string (char array)
Shaun Kelsey 0:da5f5b56060a 160 * @param[in] *q points to the queue handle
Shaun Kelsey 0:da5f5b56060a 161 * @param[in] *data string(char array) to add it to the circullar buffer
Shaun Kelsey 0:da5f5b56060a 162 * @param[in] sz 'data' length
Shaun Kelsey 0:da5f5b56060a 163 * @return status, success or fail
Shaun Kelsey 0:da5f5b56060a 164 * -EINVAL (-22): Invalid Pointer, data or parameters
Shaun Kelsey 0:da5f5b56060a 165 **/
Shaun Kelsey 0:da5f5b56060a 166 int enqueue_string(struct queue_t *q, char *data, int sz);
Shaun Kelsey 0:da5f5b56060a 167
Shaun Kelsey 0:da5f5b56060a 168 #ifdef __cplusplus
Shaun Kelsey 0:da5f5b56060a 169 }
Shaun Kelsey 0:da5f5b56060a 170 #endif
Shaun Kelsey 0:da5f5b56060a 171 #endif //_QUEUE_H_