Wilson Tang
/
HSP_RPC_GUI
Fork of the offical HSP_RPC_GUI firmware
Fork of MAXREFDES100 firmware for MAX32620HSP
Diff: HSP/Test/Test_MAX30001.cpp
- Revision:
- 1:9490836294ea
- Parent:
- 0:e4a10ed6eb92
--- a/HSP/Test/Test_MAX30001.cpp Tue Oct 25 15:22:11 2016 +0000 +++ b/HSP/Test/Test_MAX30001.cpp Fri Apr 21 12:12:30 2017 -0500 @@ -35,11 +35,11 @@ uint32_t testing_max30001 = 0; uint32_t testing_ecg_flags[4]; +#define TESTING_TIMEOUT_SECONDS 10 //****************************************************************************** void test_MAX30001(void (*outputString)(const char *)) { int totalPass = 1; - int pass; uint32_t foundEcg = 0; uint32_t foundBioz = 0; uint32_t foundPace = 0; @@ -55,9 +55,9 @@ max30001 = Peripherals::max30001(); // read the id - max30001->max30001_reg_read(MAX30001::INFO, &id); + max30001->reg_read(MAX30001::INFO, &id); // read id twice because it needs to be read twice - max30001->max30001_reg_read(MAX30001::INFO, &id); + max30001->reg_read(MAX30001::INFO, &id); partVersion = id >> 12; partVersion = partVersion & 0x3; @@ -74,7 +74,7 @@ outputString("Testing MAX30003|"); outputString("Only Testing ECG and RtoR|"); } - sprintf(str2, "Device ID = 0x%06X|", id); + sprintf(str2, "Device ID = 0x%06X|", (unsigned int)id); outputString(str2); // clear testing flags @@ -91,21 +91,21 @@ if (partVersion == 3) outputString( "Start Streaming ECG, RtoR, CAL enabled, verifying streams...|"); - // max30001_CAL_InitStart(0b1, 0b1, 0b1, 0b011, 0x7FF, 0b0); - max30001->max30001_CAL_InitStart(0b1, 0b1, 0b1, 0b011, 0x7FF, 0b0); - max30001->max30001_ECG_InitStart(0b1, 0b1, 0b1, 0b0, 0b10, 0b11, 0x1F, 0b00, + // CAL_InitStart(0b1, 0b1, 0b1, 0b011, 0x7FF, 0b0); + max30001->CAL_InitStart(0b1, 0b1, 0b1, 0b011, 0x7FF, 0b0); + max30001->ECG_InitStart(0b1, 0b1, 0b1, 0b0, 0b10, 0b11, 0x1F, 0b00, 0b00, 0b0, 0b01); if (partVersion == 1) - max30001->max30001_PACE_InitStart(0b1, 0b0, 0b0, 0b1, 0x0, 0b0, 0b00, 0b0, + max30001->PACE_InitStart(0b1, 0b0, 0b0, 0b1, 0x0, 0b0, 0b00, 0b0, 0b0); if (partVersion == 1) - max30001->max30001_BIOZ_InitStart(0b1, 0b1, 0b1, 0b10, 0b11, 0b00, 7, 0b0, + max30001->BIOZ_InitStart(0b1, 0b1, 0b1, 0b10, 0b11, 0b00, 7, 0b0, 0b010, 0b0, 0b10, 0b00, 0b00, 2, 0b0, 0b111, 0b0000); - max30001->max30001_RtoR_InitStart(0b1, 0b0011, 0b1111, 0b00, 0b0011, 0b000001, + max30001->RtoR_InitStart(0b1, 0b0011, 0b1111, 0b00, 0b0011, 0b000001, 0b00, 0b000, 0b01); - max30001->max30001_Rbias_FMSTR_Init(0b01, 0b10, 0b1, 0b1, 0b00); - max30001->max30001_synch(); + max30001->Rbias_FMSTR_Init(0b01, 0b10, 0b1, 0b1, 0b00); + max30001->synch(); // look for each stream timer.start(); @@ -133,35 +133,35 @@ if ((foundEcg == 1) && (foundRtoR == 1) && (partVersion == 3)) { break; } - if (timer.read() >= TESTING_MAX30001_TIMEOUT_SECONDS) { + if (timer.read() >= TESTING_TIMEOUT_SECONDS) { break; } } timer.stop(); if (foundEcg == 0) { outputString("ECG Stream: FAIL|"); - totalPass &= pass; + totalPass = 0; } if ((foundBioz == 0) && (partVersion == 1)) { outputString("Bioz Stream: FAIL|"); - totalPass &= pass; + totalPass = 0; } if ((foundPace == 0) && (partVersion == 1)) { outputString("PACE Stream: FAIL|"); - totalPass &= pass; + totalPass = 0; } if (foundRtoR == 0) { outputString("RtoR Stream: FAIL|"); - totalPass &= pass; + totalPass = 0; } // stop all streams - max30001->max30001_Stop_ECG(); + max30001->Stop_ECG(); if (partVersion == 1) - max30001->max30001_Stop_PACE(); + max30001->Stop_PACE(); if (partVersion == 1) - max30001->max30001_Stop_BIOZ(); - max30001->max30001_Stop_RtoR(); + max30001->Stop_BIOZ(); + max30001->Stop_RtoR(); testing_max30001 = 0; // final results outputString("Result: ");