From e428702f3942da8be1d008ec90e26f97fffa0e70 Mon Sep 17 00:00:00 2001 From: MishalFerrao <51846137+MishalJasmine@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:50:37 +0530 Subject: [PATCH] cpp file corrected, ino file modified --- .../Example1-ECG-BioZ-stream-Openview.ino | 10 ++++---- .../Example2-tinyECG-ECG-BioZ-Openview.ino | 24 +++++++++---------- src/protocentral_max30001.cpp | 3 +-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/examples/Example1-ECG-BioZ-stream-Openview/Example1-ECG-BioZ-stream-Openview.ino b/examples/Example1-ECG-BioZ-stream-Openview/Example1-ECG-BioZ-stream-Openview.ino index 6e2b343..08da7df 100644 --- a/examples/Example1-ECG-BioZ-stream-Openview/Example1-ECG-BioZ-stream-Openview.ino +++ b/examples/Example1-ECG-BioZ-stream-Openview/Example1-ECG-BioZ-stream-Openview.ino @@ -28,13 +28,12 @@ // // For information on how to use, visit https://github.com/Protocentral/protocentral_max30001 // - ///////////////////////////////////////////////////////////////////////////////////////// #include #include "protocentral_max30001.h" -#define MAX30001_CS_PIN 17 +#define MAX30001_CS_PIN 7 // change this to 5 if using ESP32 #define MAX30001_DELAY_SAMPLES 8 // Time between consecutive samples #define CES_CMDIF_PKT_START_1 0x0A @@ -48,11 +47,12 @@ volatile char DataPacket[DATA_LEN]; const char DataPacketFooter[2] = {ZERO, CES_CMDIF_PKT_STOP}; const char DataPacketHeader[5] = {CES_CMDIF_PKT_START_1, CES_CMDIF_PKT_START_2, DATA_LEN, ZERO, CES_CMDIF_TYPE_DATA}; +uint8_t data_len = 0x0C; + MAX30001 max30001(MAX30001_CS_PIN); signed long ecg_data; signed long bioz_data; -bool BioZSkipSample = false; void sendData(signed long ecg_sample, signed long bioz_sample, bool _bioZSkipSample) { @@ -99,6 +99,8 @@ void sendData(signed long ecg_sample, signed long bioz_sample, bool _bioZSkipSam } } +bool BioZSkipSample = false; + void setup() { Serial.begin(57600); // Serial begin @@ -142,4 +144,4 @@ void loop() BioZSkipSample = false; } delay(MAX30001_DELAY_SAMPLES); -} +} \ No newline at end of file diff --git a/examples/Example2-tinyECG-ECG-BioZ-Openview/Example2-tinyECG-ECG-BioZ-Openview.ino b/examples/Example2-tinyECG-ECG-BioZ-Openview/Example2-tinyECG-ECG-BioZ-Openview.ino index ea06b5a..23830d6 100644 --- a/examples/Example2-tinyECG-ECG-BioZ-Openview/Example2-tinyECG-ECG-BioZ-Openview.ino +++ b/examples/Example2-tinyECG-ECG-BioZ-Openview/Example2-tinyECG-ECG-BioZ-Openview.ino @@ -7,17 +7,17 @@ // // Arduino connections: // -// |MAX30001 pin label| Pin Function |Arduino Connection|ESP32 Connection| -// |----------------- |:--------------------:|-----------------:|---------------:| -// | MISO | Slave Out | D12 | 19 | -// | MOSI | Slave In | D11 | 23 | -// | SCLK | Serial Clock | D13 | 18 | -// | CS | Chip Select | D7 | 5 | -// | VCC | Digital VDD | +5V | +5V | -// | GND | Digital Gnd | Gnd | Gnd | -// | FCLK | 32K CLOCK | - | - | -// | INT1 | Interrupt1 | 02 | 02 | -// | INT2 | Interrupt2 | - | - | +// |MAX30001 pin label| Pin Function |Arduino Connection| +// |----------------- |:--------------------:|-----------------:| +// | MISO | Slave Out | D12 | +// | MOSI | Slave In | D11 | +// | SCLK | Serial Clock | D13 | +// | CS | Chip Select | D7 | +// | VCC | Digital VDD | +5V | +// | GND | Digital Gnd | Gnd | +// | FCLK | 32K CLOCK | - | +// | INT1 | Interrupt1 | 02 | +// | INT2 | Interrupt2 | - | // // This software is licensed under the MIT License(http://opensource.org/licenses/MIT). // @@ -150,4 +150,4 @@ void loop() BioZSkipSample = false; } delay(8); -} +} \ No newline at end of file diff --git a/src/protocentral_max30001.cpp b/src/protocentral_max30001.cpp index 39e8fd4..80a3f88 100644 --- a/src/protocentral_max30001.cpp +++ b/src/protocentral_max30001.cpp @@ -219,7 +219,7 @@ void MAX30001::BeginECGBioZ() cnfg_bioz.bit.dlpf = 0x01; cnfg_bioz.bit.fcgen = 0b0100; cnfg_bioz.bit.cgmon = 0x00; - cnfg_bioz.bit.cgmag = 0b100; + cnfg_bioz.bit.cgmag = 0b010; cnfg_bioz.bit.phoff = 0x0011; // BioZ MUX Settings @@ -365,7 +365,6 @@ signed long MAX30001::getBioZSamples(void) return sbioztemp; } - void MAX30001::getHRandRR(void) { uint8_t regReadBuff[4];