working - HRTC, MUX
Dependencies: MAX30003 ds3231 max32630fthr
Revision 25:e1919afd0e2d, committed 2021-12-21
- Comitter:
- parthsagar2010
- Date:
- Tue Dec 21 01:30:08 2021 +0000
- Parent:
- 23:7590d93dfa5f
- Commit message:
- k
Changed in this revision
diff -r 7590d93dfa5f -r e1919afd0e2d ds3231.lib --- a/ds3231.lib Tue Aug 17 16:25:36 2021 +0000 +++ b/ds3231.lib Tue Dec 21 01:30:08 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/MH/code/ds3231/#c13d48b7ebd9 +https://os.mbed.com/teams/Maxim-Integrated/code/ds3231/#11630748e2f2
diff -r 7590d93dfa5f -r e1919afd0e2d main.cpp --- a/main.cpp Tue Aug 17 16:25:36 2021 +0000 +++ b/main.cpp Tue Dec 21 01:30:08 2021 +0000 @@ -18,25 +18,28 @@ //Timer t; MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); -//void task_fast(void); +void task_fast(void); //DigitalOut ledA(LED2); +//DigitalOut led1(P0_6); // output declaration + //DigitalOut EN(P1_7); //DigitalOut A0(P1_4); //DigitalOut A1(P7_2); // mux controller pins -DigitalOut S0(P4_0); //blue -DigitalOut S1(P5_6); -//DigitalOut S2(P3_3); -//DigitalOut S3(P3_2); //white +DigitalOut S0(P0_4); +DigitalOut S1(P0_5); +//DigitalOut S2(P7_2); +//DigitalOut S3(P7_2); //channel feedback -DigitalIn A(P5_5); //P17 -//DigitalIn B(P6_0); //P18 -//DigitalIn C(P4_0); //P19 +DigitalIn A(P1_3); //P17 +DigitalIn B(P1_4); //P18 +DigitalIn C(P1_5); //P19 - +//HRTC GPIO +DigitalIn SW(P6_3); void ecg_config(MAX30003 &ecgAFE); //BufferedSerial pc(P3_1,P3_0); // Use USB debug probe for serial link static Unbuffered @@ -61,11 +64,11 @@ int main(void) { - int t=0; + uint16_t tic=0; S0=0; - S1=1; + S1=0; // S2=0; // S3=0; @@ -83,16 +86,17 @@ //-------------------------------------------------------------RTC-------------------------------------------------------------// //instantiate rtc object Ds3231 rtc(SDA, SCL); -if (A==0) + +if (SW==0) { uint16_t rtn_val; //time = 12:00:00 AM 12hr mode -ds3231_time_t time = {50,20,10,0,0}; //seconds, min, hours, am=0/pm=1, mode 12=1/24=0 +ds3231_time_t time = {50,50,13,1,0}; //seconds, min, hours, am=0/pm=1, mode 12=1/24=0 rtn_val = rtc.set_time(time); //see datasheet for calendar format -ds3231_calendar_t calendar = {2,16,8,21}; //day date month year +ds3231_calendar_t calendar = {5,29,10,21}; //day date month year rtn_val = rtc.set_calendar(calendar); @@ -104,7 +108,7 @@ //timer_fast.start(); - DigitalOut rLed(LED2, LED_ON); + DigitalOut rLed(P0_6); // pc.baud(9600); //pc.set_baud(115200); // Baud rate = 115200 @@ -148,6 +152,7 @@ uint8_t p_4 = 0; // uint8_t channel_num= 1; uint8_t channel_num[1]= {0}; + uint8_t battery_level[1] ={40}; uint8_t data_len_1 = 0; uint8_t data_len_2 = 0; uint32_t packet_1 = 0; @@ -187,7 +192,8 @@ { if ((onesec_counter>=125)) - { //t++; + { + tic++; //t.start(); //ledA = !ledA; pc.write((uint8_t *)header_device_id, sizeof(header_device_id)); // device ID @@ -211,6 +217,8 @@ pc.write((uint8_t *)channel_num, sizeof(channel_num)); + pc.write((uint8_t *)battery_level, sizeof(battery_level)); + onesec_counter_temp = onesec_counter * 2; data_len_1 = onesec_counter_temp & 0xff; data_len_2 = (onesec_counter_temp >> 8) & 0xff; @@ -239,55 +247,59 @@ // t.reset(); // timer_fast.reset(); - if (t==10) //C1 + if (tic==10) //C1 { S0=1; S1=0; - //S2=0; - //S3=0; + // S2=0; + // S3=0; channel_num[0]= {1}; } - if (t==20) //C2 + if (tic==20) //C2 { S0=0; S1=1; - //S2=0; - //S3=0; + // S2=0; + // S3=0; channel_num[0]= {2}; } - if (t==30) // C0 + if (tic==30) // C0 { S0=0; S1=0; - //S2=0; - //S3=0; + // S2=0; + // S3=0; channel_num[0]= {0}; - t=0;} + tic=0;} + - /* if (A==0) //5_7 = P17 - {//t=50; + // for channel selection + + if (A==0) // + {tic=50; S0=0; S1=0; - S2=0; - S3=0; + // S2=0; + // S3=0; channel_num[0]= {0};} - if (B==0) // 6_0 = P18 - { + if (B==0) // + {tic=60; S0=1; S1=0; - S2=0; - S3=0; + // S2=0; + // S3=0; channel_num[0]= {1};} - if (C==0) // 4_0 = P19 - { + if (C==0) // + {tic=70; S0=0; S1=1; - S2=0; - S3=0; - channel_num[0]= {2};} */ + // S2=0; + // S3=0; + channel_num[0]= {2};} + } // Read back ECG samples from the FIFO
diff -r 7590d93dfa5f -r e1919afd0e2d max32630fthr.lib --- a/max32630fthr.lib Tue Aug 17 16:25:36 2021 +0000 +++ b/max32630fthr.lib Tue Dec 21 01:30:08 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/MH/code/MH_FINAL_HRTC/#51de7c280696 +http://developer.mbed.org/teams/MaximIntegrated/code/max32630fthr/#8f6e6a800f2f