MAX30001-MAX32630FTHR SYS EvKit

Dependencies:   USBDevice max32630fthr

Max30001 EVKIT Summary

The MAX30001 EVKIT SYS-MBED Evaluation System (EV System) is used to evaluates the MAX30001 sensor, which is an ECG (electrocardiogram), biopotential and bioimpedance analog front end solution for wearable applications. The full EV System consists of the MAX32630FTHR Development board (DEV board) and MAX30001 sensor board and the evaluation software. The EvKit features EKG, PACE, RtoR (R-peak timing), Bio-Z, and raw data logging.

The MAX30001 EVKIT SYS-MBED evaluation system is assembled, tested and contains the necessary circuitry and connections to evaluate the MAX30001 sensor.

When evaluated as an EV System, the MAX32630FTHR board provides the necessary logic rails, master clock, SPI, USB-to-Serial interfaces that are needed to evaluate the MAX30001 sensor board. MAX32630FTHR can be used as an independent development platform. Another wiki page for that platform is available here.

Communication with the DEV board is facilitated by Windows 7, Windows 8 and Windows 10 compatible software that provides a simple and intuitive graphical user interface (GUI).

Committer:
Emre.Eken@IST-LT-35101.maxim-ic.internal
Date:
Thu Apr 05 10:53:26 2018 +0300
Revision:
0:8e4630a71eb1
mbed os 5.8.1 compatible

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 1 /*******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 3 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 4 * Permission is hereby granted, free of charge, to any person obtaining a
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 5 * copy of this software and associated documentation files (the "Software"),
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 6 * to deal in the Software without restriction, including without limitation
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 8 * and/or sell copies of the Software, and to permit persons to whom the
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 9 * Software is furnished to do so, subject to the following conditions:
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 10 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 11 * The above copyright notice and this permission notice shall be included
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 12 * in all copies or substantial portions of the Software.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 13 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 20 * OTHER DEALINGS IN THE SOFTWARE.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 21 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 22 * Except as contained in this notice, the name of Maxim Integrated
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 24 * Products, Inc. Branding Policy.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 25 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 26 * The mere transfer of this software does not imply any licenses
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 27 * of trade secrets, proprietary technology, copyrights, patents,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 28 * trademarks, maskwork rights, or any other form of intellectual
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 30 * ownership rights.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 31 *******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 32 */
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 33
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 34 #include <stdio.h>
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 35 #include "StringHelper.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 36 #include "MAX30001.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 37 #include "Streaming.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 38 #include "StringInOut.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 39 #include "MAX30001_helper.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 40 #include "RpcFifo.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 41 #include "RpcServer.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 42 #include "Peripherals.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 43 #include "DataLoggingService.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 44
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 45 int highDataRate = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 46
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 47 uint32_t max30001_RegRead(MAX30001::MAX30001_REG_map_t addr) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 48 uint32_t data;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 49 Peripherals::max30001()->max30001_reg_read(addr, &data);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 50 return data;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 51 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 52
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 53 void max30001_RegWrite(MAX30001::MAX30001_REG_map_t addr, uint32_t data) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 54 Peripherals::max30001()->max30001_reg_write(addr, data);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 55 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 56
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 57 int MAX30001_WriteReg(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 58 uint32_t args[2];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 59 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 60 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 61 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 62
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 63 max30001_RegWrite((MAX30001::MAX30001_REG_map_t)args[0], args[1]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 64 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 65 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 66 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 67 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 68
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 69 int MAX30001_ReadReg(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 70 uint32_t args[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 71 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 72 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 73 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 74 value = max30001_RegRead((MAX30001::MAX30001_REG_map_t)args[0]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 75 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 76 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 77 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 78 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 79
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 80 int MAX30001_Rbias_FMSTR_Init(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 81 uint32_t args[5];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 82 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 83 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 84 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 85
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 86 value = Peripherals::max30001()->max30001_Rbias_FMSTR_Init(args[0], // En_rbias
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 87 args[1], // Rbiasv
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 88 args[2], // Rbiasp
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 89 args[3], // Rbiasn
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 90 args[4]); // Fmstr
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 91
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 92 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 93 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 94 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 95 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 96
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 97 int MAX30001_CAL_InitStart(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 98 uint32_t args[6];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 99 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 100 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 101 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 102
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 103 // Peripherals::serial()->printf("MAX30001_CAL_InitStart 0 ");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 104 value = Peripherals::max30001()->max30001_CAL_InitStart(args[0], // En_Vcal
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 105 args[1], // Vmag
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 106 args[2], // Fcal
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 107 args[3], // Thigh
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 108 args[4], // Fifty
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 109 args[5]); // Vmode
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 110
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 111 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 112 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 113 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 114 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 115
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 116 int MAX30001_ECG_InitStart(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 117 uint32_t args[11];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 118 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 119 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 120 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 121
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 122 // Peripherals::serial()->printf("MAX30001_ECG_InitStart 0 ");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 123 value = Peripherals::max30001()->max30001_ECG_InitStart(args[0], // En_ecg
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 124 args[1], // Openp
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 125 args[2], // Openn
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 126 args[3], // Pol
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 127 args[4], // Calp_sel
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 128 args[5], // Caln_sel
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 129 args[6], // E_fit
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 130 args[7], // Rate
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 131 args[8], // Gain
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 132 args[9], // Dhpf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 133 args[10]); // Dlpf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 134 // Peripherals::serial()->printf("MAX30001_ECG_InitStart 1 ");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 135 MAX30001_Helper_SetStreamingFlag(eStreaming_ECG, 1);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 136 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 137 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 138 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 139 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 140
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 141 int MAX30001_ECGFast_Init(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 142 uint32_t args[3];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 143 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 144 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 145 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 146
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 147 value = Peripherals::max30001()->max30001_ECGFast_Init(args[0], // Clr_Fast
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 148 args[1], // Fast
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 149 args[2]); // Fast_Th
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 150
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 151 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 152 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 153 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 154 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 155
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 156 int MAX30001_PACE_InitStart(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 157 uint32_t args[9];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 158 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 159 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 160 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 161
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 162 value =
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 163 Peripherals::max30001()->max30001_PACE_InitStart(args[0], // En_pace
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 164 args[1], // Clr_pedge
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 165 args[2], // Pol
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 166 args[3], // Gn_diff_off
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 167 args[4], // Gain
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 168 args[5], // Aout_lbw
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 169 args[6], // Aout
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 170 args[7], // Dacp
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 171 args[8]); // Dacn
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 172
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 173 MAX30001_Helper_SetStreamingFlag(eStreaming_PACE, 1);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 174 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 175 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 176 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 177 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 178
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 179 int MAX30001_BIOZ_InitStart(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 180 uint32_t args[18];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 181 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 182 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 183 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 184
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 185 value = Peripherals::max30001()->max30001_BIOZ_InitStart(args[0], // En_bioz
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 186 args[1], // Openp
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 187 args[2], // Openn
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 188 args[3], // Calp_sel
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 189 args[4], // Caln_sel
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 190 args[5], // CG_mode
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 191 args[6], // B_fit
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 192 args[7], // Rate
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 193 args[8], // Ahpf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 194 args[9], // Ext_rbias
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 195 args[10], // Gain
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 196 args[11], // Dhpf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 197 args[12], // Dlpf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 198 args[13], // Fcgen
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 199 args[14], // Cgmon
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 200 args[15], // Cgmag
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 201 args[16], // Phoff
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 202 args[17]); //INAPow_mode
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 203
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 204 MAX30001_Helper_SetStreamingFlag(eStreaming_BIOZ, 1);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 205 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 206 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 207 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 208 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 209
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 210 int MAX30001_RtoR_InitStart(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 211 uint32_t args[9];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 212 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 213 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 214 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 215
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 216 value = Peripherals::max30001()->max30001_RtoR_InitStart(args[0], // En_rtor
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 217 args[1], // Wndw
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 218 args[2], // Gain
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 219 args[3], // Pavg
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 220 args[4], // Ptsf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 221 args[5], // Hoff
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 222 args[6], // Ravg
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 223 args[7], // Rhsf
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 224 args[8]); // Clr_rrint
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 225
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 226 MAX30001_Helper_SetStreamingFlag(eStreaming_RtoR, 1);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 227 reply[0] = value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 228 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 229 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 230 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 231
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 232 int MAX30001_Stop_ECG(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 233 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 234 Peripherals::max30001()->max30001_Stop_ECG();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 235 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 236 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 237 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 238 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 239 int MAX30001_Stop_PACE(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 240 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 241 Peripherals::max30001()->max30001_Stop_PACE();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 242 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 243 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 244 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 245 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 246 int MAX30001_Stop_BIOZ(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 247 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 248 Peripherals::max30001()->max30001_Stop_BIOZ();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 249 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 250 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 251 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 252 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 253 int MAX30001_Stop_RtoR(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 254 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 255 Peripherals::max30001()->max30001_Stop_RtoR();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 256 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 257 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 258 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 259 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 260 int MAX30001_Stop_Cal(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 261 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 262 // max30001_Stop_Cal();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 263 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 264 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 265 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 266 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 267
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 268 void max30001_ServiceStreaming() {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 269 char ch;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 270 uint32_t val;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 271 USBSerial *usbSerial = Peripherals::usbSerial();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 272
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 273 fifo_clear(GetStreamOutFifo());
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 274
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 275 SetStreaming(TRUE);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 276 clearOutReadFifo();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 277 while (IsStreaming() == TRUE) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 278
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 279 if (fifo_empty(GetStreamOutFifo()) == 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 280 fifo_get32(GetStreamOutFifo(), &val);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 281
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 282 usbSerial->printf("%02X ", val);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 283
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 284 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 285 if (usbSerial->available()) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 286 ch = usbSerial->_getc();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 287
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 288 MAX30001_Helper_Stop();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 289 SetStreaming(FALSE);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 290 fifo_clear(GetUSBIncomingFifo()); // clear USB serial incoming fifo
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 291 fifo_clear(GetStreamOutFifo());
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 292 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 293
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 294 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 295 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 296
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 297 int MAX30001_Start(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 298 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 299 uint32_t all;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 300 fifo_clear(GetUSBIncomingFifo());
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 301 Peripherals::max30001()->max30001_synch();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 302 // max30001_ServiceStreaming();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 303 highDataRate = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 304 Peripherals::max30001()->max30001_reg_read(MAX30001::STATUS, &all);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 305 LoggingService_StartLoggingUsb();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 306
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 307 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 308 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 309 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 310 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 311
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 312 int MAX30001_Stop(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 313 /* uint32_t args[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 314 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 315 uint32_t value;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 316 //ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 317 max30001_StopTest();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 318 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 319 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);*/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 320 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 321 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 322
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 323 int MAX30001_INT_assignment(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 324 uint32_t args[17];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 325 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 326 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 327 /*
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 328 printf("MAX30001_INT_assignment ");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 329 printf("%d ",args[0]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 330 printf("%d ",args[1]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 331 printf("%d ",args[2]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 332 printf("%d ",args[3]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 333 printf("%d ",args[4]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 334 printf("%d ",args[5]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 335 printf("%d ",args[6]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 336 printf("%d ",args[7]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 337 printf("%d ",args[8]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 338 printf("%d ",args[9]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 339 printf("%d ",args[10]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 340 printf("%d ",args[11]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 341 printf("%d ",args[12]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 342 printf("%d ",args[13]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 343 printf("%d ",args[14]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 344 printf("%d ",args[15]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 345 printf("%d ",args[16]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 346 printf("\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 347 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 348 */
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 349
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 350 Peripherals::max30001()->max30001_INT_assignment(
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 351 (MAX30001::max30001_intrpt_Location_t)args[0],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 352 (MAX30001::max30001_intrpt_Location_t)args[1],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 353 (MAX30001::max30001_intrpt_Location_t)args[2],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 354 (MAX30001::max30001_intrpt_Location_t)args[3],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 355 (MAX30001::max30001_intrpt_Location_t)args[4],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 356 (MAX30001::max30001_intrpt_Location_t)args[5],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 357 (MAX30001::max30001_intrpt_Location_t)args[6],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 358 (MAX30001::max30001_intrpt_Location_t)args[7],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 359 (MAX30001::max30001_intrpt_Location_t)args[8],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 360 (MAX30001::max30001_intrpt_Location_t)args[9],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 361 (MAX30001::max30001_intrpt_Location_t)args[10],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 362 (MAX30001::max30001_intrpt_Location_t)args[11],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 363 (MAX30001::max30001_intrpt_Location_t)args[12],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 364 (MAX30001::max30001_intrpt_Location_t)args[13],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 365 (MAX30001::max30001_intrpt_Location_t)args[14],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 366 (MAX30001::max30001_intrpt_type_t)args[15],
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 367 (MAX30001::max30001_intrpt_type_t)args[16]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 368 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 369 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 370 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 371 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 372
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 373 int MAX30001_StartTest(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 374 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 375 // ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 376
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 377 /*** Set FMSTR over here ****/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 378
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 379 /*** Set and Start the VCAL input ***/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 380 /* NOTE VCAL must be set first if VCAL is to be used */
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 381 Peripherals::max30001()->max30001_CAL_InitStart(0b1, 0b1, 0b1, 0b011, 0x7FF, 0b0);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 382
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 383 /**** ECG Initialization ****/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 384 Peripherals::max30001()->max30001_ECG_InitStart(0b1, 0b1, 0b1, 0b0, 0b10, 0b11, 31, 0b00, 0b00, 0b0, 0b01);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 385
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 386 /***** PACE Initialization ***/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 387 Peripherals::max30001()->max30001_PACE_InitStart(0b1, 0b0, 0b0, 0b1, 0b000, 0b0, 0b00, 0b0, 0b0);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 388
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 389 /**** BIOZ Initialization ****/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 390 Peripherals::max30001()->max30001_BIOZ_InitStart(
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 391 0b1, 0b1, 0b1, 0b10, 0b11, 0b00, 7, 0b0, 0b111, 0b0, 0b10, 0b00, 0b00, 0b0001, 0b0, 0b111, 0b0000, 0b0000);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 392
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 393 /*** Set RtoR registers ***/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 394 Peripherals::max30001()->max30001_RtoR_InitStart(
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 395 0b1, 0b0011, 0b1111, 0b00, 0b0011, 0b000001, 0b00, 0b000, 0b01);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 396
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 397 /*** Set Rbias & FMSTR over here ****/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 398 Peripherals::max30001()->max30001_Rbias_FMSTR_Init(0b01, 0b10, 0b1, 0b1, 0b00);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 399
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 400 /**** Interrupt Setting ****/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 401
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 402 /*** Set ECG Lead ON/OFF ***/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 403 // max30001_ECG_LeadOnOff();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 404
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 405 /*** Set BIOZ Lead ON/OFF ***/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 406 // max30001_BIOZ_LeadOnOff(); Does not work yet...
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 407
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 408 /**** Do a Synch ****/
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 409 Peripherals::max30001()->max30001_synch();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 410
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 411 fifo_clear(GetUSBIncomingFifo());
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 412 max30001_ServiceStreaming();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 413
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 414 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 415 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 416 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 417 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 418 /*
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 419 static void StopAll() {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 420 if (startedEcg == 1) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 421 max30001_Stop_ECG();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 422 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 423 if (startedCal == 1) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 424 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 425 if (startedBioz == 1) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 426 max30001_Stop_BIOZ();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 427 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 428 if (startedPace == 1) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 429 max30001_Stop_PACE();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 430 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 431 if (startedRtor == 1) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 432 max30001_Stop_RtoR();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 433 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 434 startedEcg = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 435 startedBioz = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 436 startedCal = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 437 startedPace = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 438 startedRtor = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 439 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 440 */
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 441 /*
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 442 // switch to ECG DC Lead ON
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 443 max30001_Enable_LeadON(0b01);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 444 // switch to BIOZ DC Lead ON
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 445 max30001_Enable_LeadON(0b10);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 446 */
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 447 int MAX30001_Enable_ECG_LeadON(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 448 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 449 // switch to ECG DC Lead ON
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 450 Peripherals::max30001()->max30001_Enable_LeadON(0b01);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 451 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 452 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 453 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 454 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 455 int MAX30001_Enable_BIOZ_LeadON(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 456 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 457 // switch to BIOZ DC Lead ON
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 458 Peripherals::max30001()->max30001_Enable_LeadON(0b10);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 459 reply[0] = 0x80;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 460 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 461 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 462 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 463 // uint32_t max30001_LeadOn; // This holds the LeadOn data, BIT1 = BIOZ Lead ON, BIT0 = ECG Lead ON
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 464 int MAX30001_Read_LeadON(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 465 uint32_t reply[1];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 466 // return the max30001_LeadOn var from the MAX30001 driver
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 467 reply[0] = Peripherals::max30001()->max30001_LeadOn;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 468 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 469 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 470 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 471