battery_code
Dependencies: MAX30003 max32630fthr DS1307
Diff: main.cpp
- Revision:
- 22:07eec382c267
- Parent:
- 21:193a10530741
- Child:
- 23:288c5d1babd1
--- a/main.cpp Tue Jun 29 16:16:56 2021 +0000 +++ b/main.cpp Fri Jul 02 16:22:17 2021 +0000 @@ -2,9 +2,9 @@ #include "MAX30003.h" #include "mbed.h" #include "max32630fthr.h" -#include "ds1307.h" +//#include "ds1307.h" //#include <BufferedSerial.h> -#include <string> +//#include <string> //#include <Serial.h> #include "ds3231.h" @@ -14,26 +14,27 @@ #define SDA P3_4 #define SCL P3_5 -Timer timer_fast; -Timer t; +//Timer timer_fast; +//Timer t; MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); -void task_fast(void); +//void task_fast(void); //DigitalOut ledA(LED2); //DigitalOut EN(P1_7); //DigitalOut A0(P1_4); //DigitalOut A1(P7_2); - +// mux controller pins DigitalOut S0(P5_6); DigitalOut S1(P5_5); DigitalOut S2(P3_3); DigitalOut S3(P3_2); -DigitalIn AB(P5_7); -DigitalIn AC(P6_0); - +//channel feedback +DigitalIn A(P5_7); //P17 +DigitalIn B(P6_0); //P18 +DigitalIn C(P4_0); //P19 @@ -45,7 +46,7 @@ // //Serial pc(P3_1,P3_0); volatile bool ecgFIFOIntFlag = 0; -volatile bool timerflag = 0; +//volatile bool timerflag = 0; FileHandle *mbed::mbed_override_console(int fd) { @@ -84,14 +85,14 @@ uint16_t rtn_val; //time = 12:00:00 AM 12hr mode - ds3231_time_t time = {50,20,10,1,0}; //seconds, min, hours, am_pm, mode +ds3231_time_t time = {50,30,11,1,0}; //seconds, min, hours, am_pm, mode rtn_val = rtc.set_time(time); //see datasheet for calendar format - ds3231_calendar_t calendar = {3,29,6,21}; //day date month year + ds3231_calendar_t calendar = {6,2,7,21}; //day date month year rtn_val = rtc.set_calendar(calendar); @@ -105,7 +106,7 @@ //------------------------------------------------------------------------------------------------------------------------------// - timer_fast.start(); + //timer_fast.start(); DigitalOut rLed(LED2, LED_ON); // pc.baud(9600); @@ -132,14 +133,14 @@ uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status; int16_t ecgSample[32]; //bool timerflag = false; - int16_t ecgSample_1sec[250]; + int16_t ecgSample_1sec[125]; uint8_t ecg_1 = 0; uint8_t ecg_2 = 0; uint16_t onesec_counter = 0; uint16_t onesec_counter_temp = 0; - int16_t sample = 300; - uint8_t final[10]; + // int16_t sample = 300; + // uint8_t final[10]; uint16_t checksum_ = 0; uint16_t mod_checksum = 0; @@ -162,7 +163,7 @@ uint8_t ending[5] = {'@','#','%','!','7'}; bool flip = true; - int sampleps = 0; + uint8_t sampleps = 0; char buf[20];//={"1622326341"}; // pc.write("Welcome",8*sizeof(char)); @@ -267,16 +268,24 @@ channel_num[0]= {0}; t=0;} - if (AB ==0) //5_7 = P17 - {t=50; + if (A==0) //5_7 = P17 + {//t=50; + S0=0; + S1=0; + S2=0; + S3=0; + channel_num[0]= {0};} + + if (B==0) // 6_0 = P18 + { S0=1; S1=0; S2=0; S3=0; - channel_num[0]= {1};} - - if (AC==0) // 6_0 = P18 - {t=60; + channel_num[0]= {1};} + + if (C==0) // 4_0 = P19 + { S0=0; S1=1; S2=0;