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 #include "mbed.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 34 #include "max32630fthr.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 35 #include "SDBlockDevice.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 36 #include "USBSerial.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 37 #include "QuadSpiInterface.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 38 #include "S25FS512.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 39 #include "MAX30001.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 40 #include "HspLed.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 41 #include "PushButton.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 42 #include "version.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 43 #include "Peripherals.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 44 #include "Streaming.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 45 #include "RpcServer.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 46 #include "DataLoggingService.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 47 #include "StringInOut.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 48
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 49 //Init PMIC on FTHR board and set logic thresholds to 3.3V
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 50 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 51
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 52 SDBlockDevice sd(P0_5, P0_6, P0_4, P0_7); //mosi, miso, sclk, cs
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 53
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 54 ///
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 55 /// wire Interfaces
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 56 ///
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 57 /// Define with Maxim VID and a Maxim assigned PID, set to version 0x0001 and non-blocking
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 58 USBSerial usbSerial(0x0b6a, 0x7531, 0x0001, false);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 59
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 60 //SD card insertion detection pin
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 61 DigitalIn SDDetect(P2_2, PullUp);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 62
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 63 /// DigitalOut for CS
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 64 DigitalOut cs(P5_6);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 65
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 66 /// SPI Master 2 with SPI0_SS for use with MAX30001
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 67 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // used by MAX30001
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 68
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 69 QuadSpiInterface quadSpiInterface(SPI1_MOSI, SPI1_MISO, SPI1_SCK,SPI1_SS); // used by S25FS512
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 70
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 71 ///Debug port
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 72 Serial Debug(USBTX, USBRX);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 73
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 74 ///
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 75 /// Devices
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 76 ///
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 77
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 78 /// External Flash
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 79 S25FS512 s25fs512(&quadSpiInterface);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 80
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 81 /// ECG device
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 82 MAX30001 max30001(&spi, &cs);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 83
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 84 InterruptIn max30001_InterruptB(P5_5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 85 InterruptIn max30001_Interrupt2B(P5_4);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 86
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 87 /// HSP platform LED
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 88 HspLed hspLed(LED_RED);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 89
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 90 /// Packet TimeStamp Timer, set for 1uS
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 91 Timer timestampTimer;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 92
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 93 /// HSP Platform push button
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 94 PushButton pushButton(SW1);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 95
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 96 int main()
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 97 {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 98 //boost baudrate so we can get messages while running gui
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 99 Debug.baud(115200);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 100
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 101 // local input state of the RPC
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 102 int inputState;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 103 // RPC request buffer
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 104 char request[128];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 105 // RPC reply buffer
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 106 char reply[128];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 107
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 108 // display start banner
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 109 Debug.printf("Maxim Integrated mbed hSensor %d.%d.%d %02d/%02d/%02d\n",
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 110 VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 111 VERSION_MONTH, VERSION_DAY, VERSION_SHORT_YEAR);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 112 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 113
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 114 // turn on red led
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 115 Debug.printf("Init HSPLED...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 116 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 117 hspLed.on();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 118
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 119 // set NVIC priorities for GPIO to prevent priority inversion
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 120 Debug.printf("Init NVIC Priorities...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 121 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 122 NVIC_SetPriority(GPIO_P0_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 123 NVIC_SetPriority(GPIO_P1_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 124 NVIC_SetPriority(GPIO_P2_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 125 NVIC_SetPriority(GPIO_P3_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 126 NVIC_SetPriority(GPIO_P4_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 127 NVIC_SetPriority(GPIO_P5_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 128 NVIC_SetPriority(GPIO_P6_IRQn, 5);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 129 // used by the MAX30001
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 130 NVIC_SetPriority(SPIM2_IRQn, 0);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 131
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 132 // Be able to statically reference these devices anywhere in the application
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 133 Peripherals::setS25FS512(&s25fs512);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 134 Peripherals::setUSBSerial(&usbSerial);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 135 Peripherals::setTimestampTimer(&timestampTimer);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 136 Peripherals::setHspLed(&hspLed);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 137 Peripherals::setPushButton(&pushButton);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 138 Peripherals::setMAX30001(&max30001);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 139 Peripherals::setSdFS(&sd);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 140 Peripherals::setSDDetect(&SDDetect);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 141
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 142 // init the S25FS256 external flash device
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 143 Debug.printf("Init S25FS512...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 144 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 145 s25fs512.init();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 146
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 147 // start blinking led1
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 148 Debug.printf("Init HSPLED Blink...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 149 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 150 hspLed.blink(1000);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 151
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 152 //
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 153 // MAX30001
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 154 //
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 155 Debug.printf("Init MAX30001 callbacks, interrupts...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 156 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 157 max30001_InterruptB.disable_irq();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 158 max30001_Interrupt2B.disable_irq();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 159 max30001_InterruptB.mode(PullUp);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 160 max30001_InterruptB.fall(&MAX30001Mid_IntB_Handler);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 161 max30001_Interrupt2B.mode(PullUp);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 162 max30001_Interrupt2B.fall(&MAX30001Mid_Int2B_Handler);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 163 max30001_InterruptB.enable_irq();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 164 max30001_Interrupt2B.enable_irq();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 165 MAX30001_AllowInterrupts(1);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 166 max30001.max30001_sw_rst(); // Do a software reset of the MAX30001
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 167 max30001.max30001_INT_assignment(MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, MAX30001::MAX30001_NO_INT, // en_enint_loc, en_eovf_loc, en_fstint_loc,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 168 MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_NO_INT, // en_dcloffint_loc, en_bint_loc, en_bovf_loc,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 169 MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_NO_INT, // en_bover_loc, en_bundr_loc, en_bcgmon_loc,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 170 MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, MAX30001::MAX30001_NO_INT, // en_pint_loc, en_povf_loc, en_pedge_loc,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 171 MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, // en_lonint_loc, en_rrint_loc, en_samp_loc,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 172 MAX30001::MAX30001_INT_ODNR, MAX30001::MAX30001_INT_ODNR); // intb_Type, int2b_Type)
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 173 max30001.onDataAvailable(&StreamPacketUint32);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 174
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 175 // initialize the RPC server
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 176 Debug.printf("Init RPC Server...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 177 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 178 RPC_init();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 179
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 180 // initialize the logging service
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 181 Debug.printf("Init LoggingService...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 182 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 183 LoggingService_Init();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 184
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 185 // initialize the SD disk
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 186 sd.init();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 187
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 188 // start main loop
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 189 Debug.printf("Start main loop...\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 190 fflush(stdout);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 191
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 192 while(1)
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 193 {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 194 // get a RPC string if one is available
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 195 inputState = getLine(request, sizeof(request));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 196 // if a string has been captured, process string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 197 if (inputState == GETLINE_DONE)
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 198 {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 199 //Send request to debug port
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 200 Debug.printf(request);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 201 // process the RPC string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 202 RPC_call(request, reply);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 203 //Send reply to debug port
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 204 Debug.printf(reply);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 205 // output the reply
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 206 putStr(reply);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 207 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 208
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 209 // process any logging or streaming requests
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 210 LoggingService_ServiceRoutine();
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 211 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 212 }