![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Test2
Dependencies: MAX30003 max32630fthr DS1307
main.cpp@18:462e396f9e5a, 2021-05-20 (annotated)
- Committer:
- kidecha_rahul
- Date:
- Thu May 20 15:54:10 2021 +0000
- Revision:
- 18:462e396f9e5a
- Parent:
- 17:4bf0775c1b38
Test2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
coreyharris | 6:86ac850c718d | 1 | |
kidecha_rahul | 17:4bf0775c1b38 | 2 | |
coreyharris | 0:38c49bc37c7c | 3 | #include "mbed.h" |
coreyharris | 0:38c49bc37c7c | 4 | #include "max32630fthr.h" |
parthsagar2010 | 9:24ecf16eab0f | 5 | #include "ds1307.h" |
kidecha_rahul | 17:4bf0775c1b38 | 6 | #include "MAX30003.h" |
kidecha_rahul | 17:4bf0775c1b38 | 7 | |
parthsagar2010 | 11:300afaf2696b | 8 | //#include <BufferedSerial.h> |
parthsagar2010 | 10:54aa50490b15 | 9 | #include <string> |
parthsagar2010 | 10:54aa50490b15 | 10 | //#include <Serial.h> |
parthsagar2010 | 11:300afaf2696b | 11 | |
parthsagar2010 | 11:300afaf2696b | 12 | #define TARGET_TX_PIN P3_1 |
parthsagar2010 | 11:300afaf2696b | 13 | #define TARGET_RX_PIN P3_0 |
parthsagar2010 | 11:300afaf2696b | 14 | |
parthsagar2010 | 9:24ecf16eab0f | 15 | Timer timer_fast; |
parthsagar2010 | 10:54aa50490b15 | 16 | Timer t; |
coreyharris | 0:38c49bc37c7c | 17 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
coreyharris | 0:38c49bc37c7c | 18 | |
parthsagar2010 | 9:24ecf16eab0f | 19 | void task_fast(void); |
kidecha_rahul | 18:462e396f9e5a | 20 | //DigitalOut ledA(LED2); |
parthsagar2010 | 13:0e7bbc06083f | 21 | |
coreyharris | 0:38c49bc37c7c | 22 | void ecg_config(MAX30003 &ecgAFE); |
kidecha_rahul | 17:4bf0775c1b38 | 23 | |
kidecha_rahul | 17:4bf0775c1b38 | 24 | void ecg_config_off(MAX30003& ecgAFE); |
kidecha_rahul | 17:4bf0775c1b38 | 25 | |
kidecha_rahul | 17:4bf0775c1b38 | 26 | |
parthsagar2010 | 11:300afaf2696b | 27 | //BufferedSerial pc(P3_1,P3_0); // Use USB debug probe for serial link static Unbuffered |
kidecha_rahul | 18:462e396f9e5a | 28 | //BufferedSerial pc(P0_1,P0_0); |
kidecha_rahul | 16:8fc65c8fa0e8 | 29 | |
kidecha_rahul | 18:462e396f9e5a | 30 | static BufferedSerial pc(TARGET_TX_PIN, TARGET_RX_PIN, 230400); // 230400 works well |
parthsagar2010 | 11:300afaf2696b | 31 | |
parthsagar2010 | 10:54aa50490b15 | 32 | //Serial uart_1(USBTX, USBRX); // Use USB debug probe for serial link static Unbuffered |
parthsagar2010 | 10:54aa50490b15 | 33 | // |
kidecha_rahul | 18:462e396f9e5a | 34 | //Serial pc(P0_1,P0_0); |
kidecha_rahul | 17:4bf0775c1b38 | 35 | |
parthsagar2010 | 9:24ecf16eab0f | 36 | volatile bool timerflag = 0; |
parthsagar2010 | 11:300afaf2696b | 37 | |
parthsagar2010 | 11:300afaf2696b | 38 | FileHandle *mbed::mbed_override_console(int fd) |
parthsagar2010 | 11:300afaf2696b | 39 | { |
parthsagar2010 | 11:300afaf2696b | 40 | return &pc; |
parthsagar2010 | 11:300afaf2696b | 41 | } |
parthsagar2010 | 11:300afaf2696b | 42 | |
kidecha_rahul | 17:4bf0775c1b38 | 43 | volatile bool ecgFIFOIntFlag = 0; |
kidecha_rahul | 17:4bf0775c1b38 | 44 | void ecgFIFO_callback() |
kidecha_rahul | 17:4bf0775c1b38 | 45 | { |
coreyharris | 0:38c49bc37c7c | 46 | ecgFIFOIntFlag = 1; |
coreyharris | 0:38c49bc37c7c | 47 | } |
coreyharris | 0:38c49bc37c7c | 48 | |
kidecha_rahul | 17:4bf0775c1b38 | 49 | volatile bool ecgFIFOIntFlag_1 = 0; |
kidecha_rahul | 17:4bf0775c1b38 | 50 | void ecgFIFO_callback_1() |
kidecha_rahul | 17:4bf0775c1b38 | 51 | { |
kidecha_rahul | 17:4bf0775c1b38 | 52 | ecgFIFOIntFlag_1 = 1; |
kidecha_rahul | 17:4bf0775c1b38 | 53 | } |
kidecha_rahul | 17:4bf0775c1b38 | 54 | |
parthsagar2010 | 12:10b49ad3c492 | 55 | time_t asUnixTime(int year, int mon, int mday, int hour, int min, int sec) { |
parthsagar2010 | 12:10b49ad3c492 | 56 | struct tm t; |
parthsagar2010 | 12:10b49ad3c492 | 57 | t.tm_year = year - 1900; |
parthsagar2010 | 12:10b49ad3c492 | 58 | t.tm_mon = mon - 1; // convert to 0 based month |
parthsagar2010 | 12:10b49ad3c492 | 59 | t.tm_mday = mday; |
parthsagar2010 | 12:10b49ad3c492 | 60 | t.tm_hour = hour; |
parthsagar2010 | 12:10b49ad3c492 | 61 | t.tm_min = min; |
parthsagar2010 | 12:10b49ad3c492 | 62 | t.tm_sec = sec; |
parthsagar2010 | 12:10b49ad3c492 | 63 | t.tm_isdst = -1; // Is Daylight saving time on? 1 = yes, 0 = no, -1 = unknown |
parthsagar2010 | 12:10b49ad3c492 | 64 | |
parthsagar2010 | 12:10b49ad3c492 | 65 | return mktime(&t); // returns seconds elapsed since January 1, 1970 (begin of the Epoch) |
parthsagar2010 | 12:10b49ad3c492 | 66 | } |
kidecha_rahul | 17:4bf0775c1b38 | 67 | |
parthsagar2010 | 11:300afaf2696b | 68 | int main(void) |
coreyharris | 3:420d5efbd967 | 69 | { |
parthsagar2010 | 11:300afaf2696b | 70 | // Constants |
coreyharris | 4:06e258ff0b97 | 71 | const int EINT_STATUS_MASK = 1 << 23; |
coreyharris | 6:86ac850c718d | 72 | const int FIFO_OVF_MASK = 0x7; |
coreyharris | 6:86ac850c718d | 73 | const int FIFO_VALID_SAMPLE_MASK = 0x0; |
coreyharris | 6:86ac850c718d | 74 | const int FIFO_FAST_SAMPLE_MASK = 0x1; |
coreyharris | 6:86ac850c718d | 75 | const int ETAG_BITS_MASK = 0x7; |
kidecha_rahul | 16:8fc65c8fa0e8 | 76 | |
parthsagar2010 | 9:24ecf16eab0f | 77 | timer_fast.start(); |
kidecha_rahul | 18:462e396f9e5a | 78 | // DigitalOut rLed(LED2, LED_ON); |
parthsagar2010 | 10:54aa50490b15 | 79 | // pc.baud(9600); |
parthsagar2010 | 11:300afaf2696b | 80 | //pc.set_baud(115200); // Baud rate = 115200 |
parthsagar2010 | 11:300afaf2696b | 81 | //pc.set_format( |
parthsagar2010 | 11:300afaf2696b | 82 | // /* bits */ 8, |
parthsagar2010 | 11:300afaf2696b | 83 | // /* parity */ BufferedSerial::None, |
parthsagar2010 | 11:300afaf2696b | 84 | // /* stop bit */ 1 //1 |
parthsagar2010 | 11:300afaf2696b | 85 | //); |
parthsagar2010 | 10:54aa50490b15 | 86 | //uart_1.baud(115200); |
kidecha_rahul | 17:4bf0775c1b38 | 87 | |
kidecha_rahul | 17:4bf0775c1b38 | 88 | //----------------------------------------------------------------------------------------------// |
kidecha_rahul | 17:4bf0775c1b38 | 89 | |
coreyharris | 1:86843c27cc81 | 90 | InterruptIn ecgFIFO_int(P5_4); // Config P5_4 as int. in for the |
kidecha_rahul | 17:4bf0775c1b38 | 91 | ecgFIFO_int.fall(&ecgFIFO_callback); // ecg FIFO interrupt at falling edge |
kidecha_rahul | 17:4bf0775c1b38 | 92 | |
kidecha_rahul | 17:4bf0775c1b38 | 93 | DigitalOut bLed(LED3, LED_ON); |
coreyharris | 0:38c49bc37c7c | 94 | |
coreyharris | 1:86843c27cc81 | 95 | SPI spiBus(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // SPI bus, P5_1 = MOSI, |
coreyharris | 1:86843c27cc81 | 96 | // P5_2 = MISO, P5_0 = SCK |
parthsagar2010 | 10:54aa50490b15 | 97 | |
coreyharris | 4:06e258ff0b97 | 98 | MAX30003 ecgAFE(spiBus, P5_3); // New MAX30003 on spiBus, CS = P5_3 |
parthsagar2010 | 8:6b9359f81cc0 | 99 | |
coreyharris | 4:06e258ff0b97 | 100 | ecg_config(ecgAFE); // Config ECG |
parthsagar2010 | 12:10b49ad3c492 | 101 | |
coreyharris | 0:38c49bc37c7c | 102 | |
coreyharris | 4:06e258ff0b97 | 103 | ecgAFE.writeRegister( MAX30003::SYNCH , 0); |
coreyharris | 0:38c49bc37c7c | 104 | |
coreyharris | 4:06e258ff0b97 | 105 | uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status; |
kidecha_rahul | 18:462e396f9e5a | 106 | int16_t ecgSample[32],x = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 107 | //-----------------------------------------------------------------------------------------------// |
kidecha_rahul | 16:8fc65c8fa0e8 | 108 | |
kidecha_rahul | 18:462e396f9e5a | 109 | //bool timerflag = false; |
parthsagar2010 | 10:54aa50490b15 | 110 | int16_t ecgSample_1sec[200]; |
kidecha_rahul | 16:8fc65c8fa0e8 | 111 | //uint8_t ecg_1 = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 112 | // uint8_t ecg_2 = 0; |
parthsagar2010 | 10:54aa50490b15 | 113 | uint16_t onesec_counter = 0; |
parthsagar2010 | 10:54aa50490b15 | 114 | uint16_t onesec_counter_temp = 0; |
parthsagar2010 | 10:54aa50490b15 | 115 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 116 | uint8_t channel_ID[3]= {1,2,3}; |
kidecha_rahul | 16:8fc65c8fa0e8 | 117 | uint8_t ecg_1 = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 118 | uint8_t ecg_2 = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 119 | uint8_t ecg_3 = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 120 | |
parthsagar2010 | 9:24ecf16eab0f | 121 | int16_t sample = 300; |
parthsagar2010 | 10:54aa50490b15 | 122 | uint8_t final[10]; |
parthsagar2010 | 12:10b49ad3c492 | 123 | |
parthsagar2010 | 10:54aa50490b15 | 124 | uint16_t checksum_ = 0; |
parthsagar2010 | 10:54aa50490b15 | 125 | uint16_t mod_checksum = 0; |
parthsagar2010 | 10:54aa50490b15 | 126 | |
parthsagar2010 | 10:54aa50490b15 | 127 | uint8_t p_1 = 0; |
parthsagar2010 | 10:54aa50490b15 | 128 | uint8_t p_2 = 0; |
parthsagar2010 | 10:54aa50490b15 | 129 | uint8_t p_3 = 0; |
parthsagar2010 | 10:54aa50490b15 | 130 | uint8_t p_4 = 0; |
parthsagar2010 | 10:54aa50490b15 | 131 | |
parthsagar2010 | 10:54aa50490b15 | 132 | uint8_t data_len_1 = 0; |
parthsagar2010 | 10:54aa50490b15 | 133 | uint8_t data_len_2 = 0; |
parthsagar2010 | 12:10b49ad3c492 | 134 | uint32_t packet_1 = 0; |
parthsagar2010 | 10:54aa50490b15 | 135 | uint8_t cksm_1 = 0; |
parthsagar2010 | 10:54aa50490b15 | 136 | uint8_t cksm_2 = 0; |
parthsagar2010 | 10:54aa50490b15 | 137 | uint8_t header_device_id[3] = {0,0,210}; |
parthsagar2010 | 10:54aa50490b15 | 138 | uint8_t header_packet_type[2] = {0,2}; |
parthsagar2010 | 10:54aa50490b15 | 139 | |
parthsagar2010 | 10:54aa50490b15 | 140 | uint8_t ending[5] = {'@','#','%','!','7'}; |
parthsagar2010 | 10:54aa50490b15 | 141 | |
parthsagar2010 | 15:0356e9454a60 | 142 | bool flip = true; |
parthsagar2010 | 15:0356e9454a60 | 143 | int sampleps = 0; |
parthsagar2010 | 15:0356e9454a60 | 144 | |
kidecha_rahul | 18:462e396f9e5a | 145 | char buf[20] = {"1621525631"}; |
kidecha_rahul | 16:8fc65c8fa0e8 | 146 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 147 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 148 | |
parthsagar2010 | 15:0356e9454a60 | 149 | // pc.write("Welcome",8*sizeof(char)); |
parthsagar2010 | 15:0356e9454a60 | 150 | // printf("In the main loop"); //printf("In the main loop"); |
parthsagar2010 | 11:300afaf2696b | 151 | bool flag_first = false; |
kidecha_rahul | 16:8fc65c8fa0e8 | 152 | bool timestamp_reader = false; |
kidecha_rahul | 18:462e396f9e5a | 153 | |
kidecha_rahul | 18:462e396f9e5a | 154 | /* |
kidecha_rahul | 18:462e396f9e5a | 155 | do |
parthsagar2010 | 11:300afaf2696b | 156 | { |
kidecha_rahul | 16:8fc65c8fa0e8 | 157 | if (pc.readable()) // For nordic - Readiing time |
parthsagar2010 | 12:10b49ad3c492 | 158 | { |
kidecha_rahul | 17:4bf0775c1b38 | 159 | scanf("%s",buf); |
parthsagar2010 | 15:0356e9454a60 | 160 | //printf("The entered string is %s : \n ",buf); |
parthsagar2010 | 12:10b49ad3c492 | 161 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 162 | packet_1 = atoi(buf); // converting ascii to integer |
kidecha_rahul | 16:8fc65c8fa0e8 | 163 | set_time(packet_1); // check unit in packet_1 ?? |
parthsagar2010 | 12:10b49ad3c492 | 164 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 165 | if ((packet_1 % 60) == 0) // tim stamp at the beginning of time |
parthsagar2010 | 15:0356e9454a60 | 166 | { |
parthsagar2010 | 15:0356e9454a60 | 167 | /* for (int u = 0;u<3;u++) |
parthsagar2010 | 15:0356e9454a60 | 168 | { |
parthsagar2010 | 15:0356e9454a60 | 169 | if (pc.readable()) |
parthsagar2010 | 15:0356e9454a60 | 170 | { |
parthsagar2010 | 15:0356e9454a60 | 171 | scanf("%s",buf); |
parthsagar2010 | 15:0356e9454a60 | 172 | printf("Entered the minute string %s : \n ",buf); |
parthsagar2010 | 15:0356e9454a60 | 173 | |
parthsagar2010 | 15:0356e9454a60 | 174 | packet_1 = atoi(buf); |
parthsagar2010 | 15:0356e9454a60 | 175 | set_time(packet_1); |
parthsagar2010 | 15:0356e9454a60 | 176 | } |
parthsagar2010 | 15:0356e9454a60 | 177 | }*/ |
kidecha_rahul | 18:462e396f9e5a | 178 | /*timestamp_reader = true; |
parthsagar2010 | 15:0356e9454a60 | 179 | } |
parthsagar2010 | 15:0356e9454a60 | 180 | else |
parthsagar2010 | 15:0356e9454a60 | 181 | { |
parthsagar2010 | 15:0356e9454a60 | 182 | //printf("The timestamp is not divisible by 60 \n"); |
parthsagar2010 | 15:0356e9454a60 | 183 | } |
parthsagar2010 | 12:10b49ad3c492 | 184 | //flag_first = true; |
coreyharris | 2:812d40f1853d | 185 | |
parthsagar2010 | 11:300afaf2696b | 186 | } |
parthsagar2010 | 11:300afaf2696b | 187 | |
kidecha_rahul | 18:462e396f9e5a | 188 | }while (timestamp_reader==false); // take the third timestamp */ |
kidecha_rahul | 18:462e396f9e5a | 189 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 190 | |
kidecha_rahul | 18:462e396f9e5a | 191 | packet_1 = atoi(buf); // converting ascii to integer |
kidecha_rahul | 18:462e396f9e5a | 192 | set_time(packet_1); // check unit in packet_1 ?? |
kidecha_rahul | 18:462e396f9e5a | 193 | |
kidecha_rahul | 18:462e396f9e5a | 194 | |
kidecha_rahul | 18:462e396f9e5a | 195 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 196 | while(1) |
parthsagar2010 | 9:24ecf16eab0f | 197 | { |
parthsagar2010 | 10:54aa50490b15 | 198 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 199 | if ((onesec_counter>=125)) //125 sample rate |
parthsagar2010 | 9:24ecf16eab0f | 200 | { |
parthsagar2010 | 11:300afaf2696b | 201 | //t.start(); |
parthsagar2010 | 10:54aa50490b15 | 202 | //ledA = !ledA; |
kidecha_rahul | 18:462e396f9e5a | 203 | //pc.write((uint8_t *)header_device_id, sizeof(header_device_id)); // sensor ID |
kidecha_rahul | 16:8fc65c8fa0e8 | 204 | // pc.write((uint8_t *)header_packet_type, sizeof(header_packet_type)); // packet type |
kidecha_rahul | 16:8fc65c8fa0e8 | 205 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 206 | time_t seconds = time(NULL); // setting zero |
parthsagar2010 | 12:10b49ad3c492 | 207 | packet_1 = seconds; |
kidecha_rahul | 18:462e396f9e5a | 208 | //packet_1 ++; |
parthsagar2010 | 15:0356e9454a60 | 209 | // printf("Time as seconds since January 1, 1970 = %d\n", packet_1); |
kidecha_rahul | 18:462e396f9e5a | 210 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 211 | p_1 = packet_1 & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 212 | p_2 = (packet_1 >> 8) & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 213 | p_3 = (packet_1 >> 16) & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 214 | p_4 = (packet_1 >> 24) & 0xff; |
kidecha_rahul | 18:462e396f9e5a | 215 | |
parthsagar2010 | 10:54aa50490b15 | 216 | // checksum_ = checksum_ + (packet_1 & 0xffff) + ((packet_1 >> 16) & 0xffff) ; |
parthsagar2010 | 10:54aa50490b15 | 217 | checksum_ = checksum_ + p_1 + p_2 + p_3 + p_4 ; |
parthsagar2010 | 10:54aa50490b15 | 218 | uint8_t header_packet_id[4] = {p_4,p_3,p_2,p_1}; |
kidecha_rahul | 18:462e396f9e5a | 219 | //pc.write((uint8_t *)header_packet_id, sizeof(header_packet_id)); //packet ID |
kidecha_rahul | 16:8fc65c8fa0e8 | 220 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 221 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 222 | uint8_t Channel_Num = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 223 | if(ecg_1 == 1) |
kidecha_rahul | 16:8fc65c8fa0e8 | 224 | Channel_Num = channel_ID[0]; |
kidecha_rahul | 16:8fc65c8fa0e8 | 225 | else if (ecg_2 == 1) |
kidecha_rahul | 16:8fc65c8fa0e8 | 226 | Channel_Num = channel_ID[1]; |
kidecha_rahul | 16:8fc65c8fa0e8 | 227 | else if (ecg_3 == 1) |
kidecha_rahul | 16:8fc65c8fa0e8 | 228 | Channel_Num = channel_ID[2]; |
kidecha_rahul | 16:8fc65c8fa0e8 | 229 | else |
kidecha_rahul | 16:8fc65c8fa0e8 | 230 | Channel_Num = 0; |
kidecha_rahul | 16:8fc65c8fa0e8 | 231 | //pc.write((uint8_t *)Channel_Num, sizeof(Channel_Num)); |
kidecha_rahul | 17:4bf0775c1b38 | 232 | //printf("%6d\r\n", Channel_Num); |
kidecha_rahul | 17:4bf0775c1b38 | 233 | printf("channel No is %d \n",Channel_Num); //Channel no |
kidecha_rahul | 16:8fc65c8fa0e8 | 234 | |
parthsagar2010 | 10:54aa50490b15 | 235 | onesec_counter_temp = onesec_counter * 2; |
parthsagar2010 | 10:54aa50490b15 | 236 | data_len_1 = onesec_counter_temp & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 237 | data_len_2 = (onesec_counter_temp >> 8) & 0xff; |
kidecha_rahul | 16:8fc65c8fa0e8 | 238 | checksum_ = checksum_ + data_len_1 + data_len_2; |
parthsagar2010 | 10:54aa50490b15 | 239 | //pc.write((uint32_t *)packet_1, sizeof(packet_1)); |
parthsagar2010 | 10:54aa50490b15 | 240 | uint8_t header_ecg_datalen[2] = {data_len_2,data_len_1}; |
kidecha_rahul | 16:8fc65c8fa0e8 | 241 | // pc.write((uint8_t *)header_ecg_datalen, sizeof(header_ecg_datalen)); // Data length |
kidecha_rahul | 16:8fc65c8fa0e8 | 242 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 243 | |
parthsagar2010 | 10:54aa50490b15 | 244 | mod_checksum = checksum_ % 65536 ; |
parthsagar2010 | 10:54aa50490b15 | 245 | cksm_1 = mod_checksum & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 246 | cksm_2 = (mod_checksum >> 8) & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 247 | uint8_t header_ecg_checksum[2] = {cksm_2,cksm_1}; |
kidecha_rahul | 16:8fc65c8fa0e8 | 248 | //pc.write((uint8_t *)header_ecg_checksum, sizeof(header_ecg_checksum)); // checksum |
parthsagar2010 | 10:54aa50490b15 | 249 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 250 | // pc.write((int16_t *)ecgSample_1sec,onesec_counter * sizeof(int16_t)); // ECG Data |
kidecha_rahul | 16:8fc65c8fa0e8 | 251 | printf("Samples per second %d \n", (onesec_counter)); |
kidecha_rahul | 18:462e396f9e5a | 252 | |
parthsagar2010 | 10:54aa50490b15 | 253 | onesec_counter = 0; |
parthsagar2010 | 10:54aa50490b15 | 254 | // memset(ecgSample_1sec, 0, sizeof(ecgSample_1sec)); |
parthsagar2010 | 10:54aa50490b15 | 255 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 256 | // pc.write((uint8_t *)ending, sizeof(ending)); // Ending of data |
kidecha_rahul | 16:8fc65c8fa0e8 | 257 | |
parthsagar2010 | 10:54aa50490b15 | 258 | checksum_ = 0; |
parthsagar2010 | 15:0356e9454a60 | 259 | //t.stop(); |
parthsagar2010 | 11:300afaf2696b | 260 | // auto us = t.elapsed_time().count(); |
parthsagar2010 | 15:0356e9454a60 | 261 | // float time_taken = us/1000000; |
parthsagar2010 | 15:0356e9454a60 | 262 | // printf("Timer time: %lu ms \n", (time_taken*100)); |
parthsagar2010 | 15:0356e9454a60 | 263 | // t.reset(); |
parthsagar2010 | 15:0356e9454a60 | 264 | // timer_fast.reset(); |
parthsagar2010 | 9:24ecf16eab0f | 265 | } |
kidecha_rahul | 16:8fc65c8fa0e8 | 266 | |
kidecha_rahul | 17:4bf0775c1b38 | 267 | do { |
kidecha_rahul | 17:4bf0775c1b38 | 268 | // Read back ECG samples from the FIFO |
kidecha_rahul | 17:4bf0775c1b38 | 269 | if( ecgFIFOIntFlag) { |
kidecha_rahul | 17:4bf0775c1b38 | 270 | |
kidecha_rahul | 16:8fc65c8fa0e8 | 271 | ecg_1 = 1; |
coreyharris | 5:f8d1f651bef5 | 272 | ecgFIFOIntFlag = 0; |
coreyharris | 4:06e258ff0b97 | 273 | status = ecgAFE.readRegister( MAX30003::STATUS ); // Read the STATUS register |
coreyharris | 2:812d40f1853d | 274 | |
coreyharris | 3:420d5efbd967 | 275 | // Check if EINT interrupt asserted |
kidecha_rahul | 17:4bf0775c1b38 | 276 | if ( ( status & EINT_STATUS_MASK ) == EINT_STATUS_MASK ) { |
coreyharris | 3:420d5efbd967 | 277 | |
kidecha_rahul | 17:4bf0775c1b38 | 278 | readECGSamples = 0; // Reset sample counter |
coreyharris | 3:420d5efbd967 | 279 | |
coreyharris | 2:812d40f1853d | 280 | do { |
kidecha_rahul | 17:4bf0775c1b38 | 281 | ecgFIFO = ecgAFE.readRegister( MAX30003::ECG_FIFO ); // Read FIFO |
coreyharris | 4:06e258ff0b97 | 282 | ecgSample[readECGSamples] = ecgFIFO >> 8; // Isolate voltage data |
coreyharris | 6:86ac850c718d | 283 | ETAG[readECGSamples] = ( ecgFIFO >> 3 ) & ETAG_BITS_MASK; // Isolate ETAG |
kidecha_rahul | 17:4bf0775c1b38 | 284 | readECGSamples++; |
kidecha_rahul | 17:4bf0775c1b38 | 285 | // Increment sample counter |
coreyharris | 3:420d5efbd967 | 286 | |
coreyharris | 3:420d5efbd967 | 287 | // Check that sample is not last sample in FIFO |
coreyharris | 6:86ac850c718d | 288 | } while ( ETAG[readECGSamples-1] == FIFO_VALID_SAMPLE_MASK || |
coreyharris | 6:86ac850c718d | 289 | ETAG[readECGSamples-1] == FIFO_FAST_SAMPLE_MASK ); |
coreyharris | 2:812d40f1853d | 290 | |
coreyharris | 3:420d5efbd967 | 291 | // Check if FIFO has overflowed |
kidecha_rahul | 17:4bf0775c1b38 | 292 | if( ETAG[readECGSamples - 1] == FIFO_OVF_MASK ){ |
coreyharris | 3:420d5efbd967 | 293 | ecgAFE.writeRegister( MAX30003::FIFO_RST , 0); // Reset FIFO |
kidecha_rahul | 17:4bf0775c1b38 | 294 | bLed = 1;//notifies the user that an over flow occured |
coreyharris | 3:420d5efbd967 | 295 | } |
parthsagar2010 | 15:0356e9454a60 | 296 | |
parthsagar2010 | 15:0356e9454a60 | 297 | if (flip) |
parthsagar2010 | 15:0356e9454a60 | 298 | { |
parthsagar2010 | 15:0356e9454a60 | 299 | sampleps = 12; |
parthsagar2010 | 15:0356e9454a60 | 300 | //printf("Flipped 12\r\n"); |
parthsagar2010 | 15:0356e9454a60 | 301 | } |
parthsagar2010 | 15:0356e9454a60 | 302 | else |
parthsagar2010 | 15:0356e9454a60 | 303 | { |
parthsagar2010 | 15:0356e9454a60 | 304 | sampleps = 13; |
parthsagar2010 | 15:0356e9454a60 | 305 | // printf("Flipped 13\r\n"); |
kidecha_rahul | 18:462e396f9e5a | 306 | } |
kidecha_rahul | 17:4bf0775c1b38 | 307 | // Print results |
kidecha_rahul | 17:4bf0775c1b38 | 308 | for( idx = 0; idx < readECGSamples; idx++ ) |
parthsagar2010 | 9:24ecf16eab0f | 309 | { |
kidecha_rahul | 17:4bf0775c1b38 | 310 | // pc.printf("%6d\r\n", ecgSample[idx]); |
kidecha_rahul | 17:4bf0775c1b38 | 311 | ecgSample_1sec[onesec_counter] = ecgSample[idx]; |
kidecha_rahul | 17:4bf0775c1b38 | 312 | |
kidecha_rahul | 17:4bf0775c1b38 | 313 | cksm_1 = ecgSample[idx] & 0xff; |
kidecha_rahul | 17:4bf0775c1b38 | 314 | cksm_2 = (ecgSample[idx] >> 8) & 0xff; |
kidecha_rahul | 17:4bf0775c1b38 | 315 | checksum_ += cksm_1 + cksm_2; |
kidecha_rahul | 17:4bf0775c1b38 | 316 | onesec_counter++; |
kidecha_rahul | 17:4bf0775c1b38 | 317 | } |
kidecha_rahul | 17:4bf0775c1b38 | 318 | //rLed = 1; |
kidecha_rahul | 17:4bf0775c1b38 | 319 | flip =!flip; |
kidecha_rahul | 17:4bf0775c1b38 | 320 | bLed = ! bLed; |
kidecha_rahul | 17:4bf0775c1b38 | 321 | x++; |
kidecha_rahul | 17:4bf0775c1b38 | 322 | //if (x==100) |
kidecha_rahul | 17:4bf0775c1b38 | 323 | //ecg_config_off(ecgAFE); |
kidecha_rahul | 17:4bf0775c1b38 | 324 | } |
kidecha_rahul | 17:4bf0775c1b38 | 325 | } |
kidecha_rahul | 17:4bf0775c1b38 | 326 | }while(x<50); |
kidecha_rahul | 17:4bf0775c1b38 | 327 | ecg_config_off(ecgAFE); |
kidecha_rahul | 17:4bf0775c1b38 | 328 | bLed = ~bLed; |
kidecha_rahul | 17:4bf0775c1b38 | 329 | x=0; |
kidecha_rahul | 17:4bf0775c1b38 | 330 | |
kidecha_rahul | 17:4bf0775c1b38 | 331 | //--------------------------------------channal 2-----------------------------------------------// |
kidecha_rahul | 17:4bf0775c1b38 | 332 | InterruptIn ecgFIFO_2_int(P1_5); // Config P5_4 as int. in for the |
kidecha_rahul | 17:4bf0775c1b38 | 333 | ecgFIFO_2_int.fall(&ecgFIFO_callback_1); // ecg FIFO almost full interrupt |
kidecha_rahul | 17:4bf0775c1b38 | 334 | |
kidecha_rahul | 17:4bf0775c1b38 | 335 | DigitalOut gLed(LED2, LED_ON); |
kidecha_rahul | 17:4bf0775c1b38 | 336 | |
kidecha_rahul | 17:4bf0775c1b38 | 337 | SPI spiBus2(P0_5,P0_6,P0_4); // SPI bus, P5_1 = MOSI, |
kidecha_rahul | 17:4bf0775c1b38 | 338 | // P5_2 = MISO, P5_0 = SCK |
kidecha_rahul | 17:4bf0775c1b38 | 339 | |
kidecha_rahul | 17:4bf0775c1b38 | 340 | MAX30003 ecgAFE_2(spiBus2, P0_7); // New MAX30003 on spiBus, CS = P5_3 |
kidecha_rahul | 17:4bf0775c1b38 | 341 | ecg_config(ecgAFE_2); // Config ECG |
kidecha_rahul | 17:4bf0775c1b38 | 342 | |
kidecha_rahul | 17:4bf0775c1b38 | 343 | // uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status; |
kidecha_rahul | 17:4bf0775c1b38 | 344 | //int16_t ecgSample[32], x = 0; |
kidecha_rahul | 17:4bf0775c1b38 | 345 | |
kidecha_rahul | 17:4bf0775c1b38 | 346 | ecgAFE_2.writeRegister( MAX30003::SYNCH , 0); |
kidecha_rahul | 17:4bf0775c1b38 | 347 | |
kidecha_rahul | 17:4bf0775c1b38 | 348 | do { |
kidecha_rahul | 17:4bf0775c1b38 | 349 | // Read back ECG samples from the FIFO |
kidecha_rahul | 17:4bf0775c1b38 | 350 | if( ecgFIFOIntFlag_1) { |
kidecha_rahul | 17:4bf0775c1b38 | 351 | |
kidecha_rahul | 17:4bf0775c1b38 | 352 | ecg_2 = 1; |
kidecha_rahul | 17:4bf0775c1b38 | 353 | ecgFIFOIntFlag_1 = 0; |
kidecha_rahul | 17:4bf0775c1b38 | 354 | status = ecgAFE_2.readRegister( MAX30003::STATUS ); // Read the STATUS register |
kidecha_rahul | 17:4bf0775c1b38 | 355 | |
kidecha_rahul | 17:4bf0775c1b38 | 356 | // Check if EINT interrupt asserted |
kidecha_rahul | 17:4bf0775c1b38 | 357 | if ( ( status & EINT_STATUS_MASK ) == EINT_STATUS_MASK ) { |
kidecha_rahul | 17:4bf0775c1b38 | 358 | |
kidecha_rahul | 17:4bf0775c1b38 | 359 | readECGSamples = 0; // Reset sample counter |
kidecha_rahul | 17:4bf0775c1b38 | 360 | |
kidecha_rahul | 17:4bf0775c1b38 | 361 | do { |
kidecha_rahul | 17:4bf0775c1b38 | 362 | ecgFIFO = ecgAFE_2.readRegister( MAX30003::ECG_FIFO ); // Read FIFO |
kidecha_rahul | 17:4bf0775c1b38 | 363 | ecgSample[readECGSamples] = ecgFIFO >> 8; // Isolate voltage data |
kidecha_rahul | 17:4bf0775c1b38 | 364 | ETAG[readECGSamples] = ( ecgFIFO >> 3 ) & ETAG_BITS_MASK; // Isolate ETAG |
kidecha_rahul | 17:4bf0775c1b38 | 365 | readECGSamples++; |
kidecha_rahul | 17:4bf0775c1b38 | 366 | // Increment sample counter |
kidecha_rahul | 17:4bf0775c1b38 | 367 | |
kidecha_rahul | 17:4bf0775c1b38 | 368 | // Check that sample is not last sample in FIFO |
kidecha_rahul | 17:4bf0775c1b38 | 369 | } while ( ETAG[readECGSamples-1] == FIFO_VALID_SAMPLE_MASK || |
kidecha_rahul | 17:4bf0775c1b38 | 370 | ETAG[readECGSamples-1] == FIFO_FAST_SAMPLE_MASK ); |
kidecha_rahul | 17:4bf0775c1b38 | 371 | |
kidecha_rahul | 17:4bf0775c1b38 | 372 | // Check if FIFO has overflowed |
kidecha_rahul | 17:4bf0775c1b38 | 373 | if( ETAG[readECGSamples - 1] == FIFO_OVF_MASK ){ |
kidecha_rahul | 17:4bf0775c1b38 | 374 | ecgAFE_2.writeRegister( MAX30003::FIFO_RST , 0); // Reset FIFO |
kidecha_rahul | 17:4bf0775c1b38 | 375 | gLed = 1;//notifies the user that an over flow occured |
kidecha_rahul | 17:4bf0775c1b38 | 376 | } |
kidecha_rahul | 17:4bf0775c1b38 | 377 | |
kidecha_rahul | 17:4bf0775c1b38 | 378 | if (flip) |
kidecha_rahul | 17:4bf0775c1b38 | 379 | { |
kidecha_rahul | 17:4bf0775c1b38 | 380 | sampleps = 12; |
kidecha_rahul | 17:4bf0775c1b38 | 381 | //printf("Flipped 12\r\n"); |
kidecha_rahul | 17:4bf0775c1b38 | 382 | } |
kidecha_rahul | 17:4bf0775c1b38 | 383 | else |
kidecha_rahul | 17:4bf0775c1b38 | 384 | { |
kidecha_rahul | 17:4bf0775c1b38 | 385 | sampleps = 13; |
kidecha_rahul | 17:4bf0775c1b38 | 386 | // printf("Flipped 13\r\n"); |
kidecha_rahul | 17:4bf0775c1b38 | 387 | } |
kidecha_rahul | 17:4bf0775c1b38 | 388 | |
kidecha_rahul | 17:4bf0775c1b38 | 389 | |
kidecha_rahul | 17:4bf0775c1b38 | 390 | // Print results |
kidecha_rahul | 17:4bf0775c1b38 | 391 | for( idx = 0; idx < readECGSamples; idx++ ) |
kidecha_rahul | 17:4bf0775c1b38 | 392 | { |
kidecha_rahul | 17:4bf0775c1b38 | 393 | //pc.printf("%6d\r\n", ecgSample[idx]); |
parthsagar2010 | 9:24ecf16eab0f | 394 | ecgSample_1sec[onesec_counter] = ecgSample[idx]; |
parthsagar2010 | 10:54aa50490b15 | 395 | |
parthsagar2010 | 10:54aa50490b15 | 396 | cksm_1 = ecgSample[idx] & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 397 | cksm_2 = (ecgSample[idx] >> 8) & 0xff; |
parthsagar2010 | 10:54aa50490b15 | 398 | checksum_ += cksm_1 + cksm_2; |
kidecha_rahul | 17:4bf0775c1b38 | 399 | onesec_counter++; |
kidecha_rahul | 17:4bf0775c1b38 | 400 | |
kidecha_rahul | 17:4bf0775c1b38 | 401 | } |
kidecha_rahul | 17:4bf0775c1b38 | 402 | gLed = ! gLed; |
kidecha_rahul | 17:4bf0775c1b38 | 403 | x++; |
kidecha_rahul | 17:4bf0775c1b38 | 404 | //if (x==100) |
kidecha_rahul | 17:4bf0775c1b38 | 405 | //ecg_config_off(ecgAFE); |
kidecha_rahul | 17:4bf0775c1b38 | 406 | } |
coreyharris | 0:38c49bc37c7c | 407 | } |
kidecha_rahul | 17:4bf0775c1b38 | 408 | }while(x<50); |
kidecha_rahul | 17:4bf0775c1b38 | 409 | ecg_config_off(ecgAFE_2); |
kidecha_rahul | 17:4bf0775c1b38 | 410 | gLed = ~gLed; |
kidecha_rahul | 17:4bf0775c1b38 | 411 | x=0; |
kidecha_rahul | 17:4bf0775c1b38 | 412 | |
coreyharris | 0:38c49bc37c7c | 413 | } |
coreyharris | 0:38c49bc37c7c | 414 | } |
coreyharris | 0:38c49bc37c7c | 415 | |
coreyharris | 0:38c49bc37c7c | 416 | |
coreyharris | 0:38c49bc37c7c | 417 | |
coreyharris | 0:38c49bc37c7c | 418 | |
coreyharris | 0:38c49bc37c7c | 419 | void ecg_config(MAX30003& ecgAFE) { |
coreyharris | 0:38c49bc37c7c | 420 | |
coreyharris | 1:86843c27cc81 | 421 | // Reset ECG to clear registers |
coreyharris | 1:86843c27cc81 | 422 | ecgAFE.writeRegister( MAX30003::SW_RST , 0); |
coreyharris | 0:38c49bc37c7c | 423 | |
coreyharris | 1:86843c27cc81 | 424 | // General config register setting |
coreyharris | 1:86843c27cc81 | 425 | MAX30003::GeneralConfiguration_u CNFG_GEN_r; |
coreyharris | 3:420d5efbd967 | 426 | CNFG_GEN_r.bits.en_ecg = 1; // Enable ECG channel |
coreyharris | 3:420d5efbd967 | 427 | CNFG_GEN_r.bits.rbiasn = 1; // Enable resistive bias on negative input |
coreyharris | 3:420d5efbd967 | 428 | CNFG_GEN_r.bits.rbiasp = 1; // Enable resistive bias on positive input |
coreyharris | 3:420d5efbd967 | 429 | CNFG_GEN_r.bits.en_rbias = 1; // Enable resistive bias |
coreyharris | 3:420d5efbd967 | 430 | CNFG_GEN_r.bits.imag = 2; // Current magnitude = 10nA |
coreyharris | 3:420d5efbd967 | 431 | CNFG_GEN_r.bits.en_dcloff = 1; // Enable DC lead-off detection |
parthsagar2010 | 12:10b49ad3c492 | 432 | //CNFG_GEN_r.bits.fmstr = 1; //125 sps FMSTR 1 |
coreyharris | 1:86843c27cc81 | 433 | ecgAFE.writeRegister( MAX30003::CNFG_GEN , CNFG_GEN_r.all); |
coreyharris | 1:86843c27cc81 | 434 | |
coreyharris | 1:86843c27cc81 | 435 | |
coreyharris | 1:86843c27cc81 | 436 | // ECG Config register setting |
coreyharris | 1:86843c27cc81 | 437 | MAX30003::ECGConfiguration_u CNFG_ECG_r; |
coreyharris | 3:420d5efbd967 | 438 | CNFG_ECG_r.bits.dlpf = 1; // Digital LPF cutoff = 40Hz |
coreyharris | 3:420d5efbd967 | 439 | CNFG_ECG_r.bits.dhpf = 1; // Digital HPF cutoff = 0.5Hz |
coreyharris | 3:420d5efbd967 | 440 | CNFG_ECG_r.bits.gain = 3; // ECG gain = 160V/V |
coreyharris | 3:420d5efbd967 | 441 | CNFG_ECG_r.bits.rate = 2; // Sample rate = 128 sps |
coreyharris | 1:86843c27cc81 | 442 | ecgAFE.writeRegister( MAX30003::CNFG_ECG , CNFG_ECG_r.all); |
coreyharris | 1:86843c27cc81 | 443 | |
coreyharris | 1:86843c27cc81 | 444 | |
coreyharris | 1:86843c27cc81 | 445 | //R-to-R configuration |
coreyharris | 1:86843c27cc81 | 446 | MAX30003::RtoR1Configuration_u CNFG_RTOR_r; |
coreyharris | 3:420d5efbd967 | 447 | CNFG_RTOR_r.bits.en_rtor = 1; // Enable R-to-R detection |
coreyharris | 1:86843c27cc81 | 448 | ecgAFE.writeRegister( MAX30003::CNFG_RTOR1 , CNFG_RTOR_r.all); |
coreyharris | 1:86843c27cc81 | 449 | |
coreyharris | 1:86843c27cc81 | 450 | |
coreyharris | 1:86843c27cc81 | 451 | //Manage interrupts register setting |
coreyharris | 1:86843c27cc81 | 452 | MAX30003::ManageInterrupts_u MNG_INT_r; |
coreyharris | 3:420d5efbd967 | 453 | MNG_INT_r.bits.efit = 0b00011; // Assert EINT w/ 4 unread samples |
coreyharris | 3:420d5efbd967 | 454 | MNG_INT_r.bits.clr_rrint = 0b01; // Clear R-to-R on RTOR reg. read back |
coreyharris | 1:86843c27cc81 | 455 | ecgAFE.writeRegister( MAX30003::MNGR_INT , MNG_INT_r.all); |
coreyharris | 0:38c49bc37c7c | 456 | |
coreyharris | 0:38c49bc37c7c | 457 | |
coreyharris | 1:86843c27cc81 | 458 | //Enable interrupts register setting |
coreyharris | 1:86843c27cc81 | 459 | MAX30003::EnableInterrupts_u EN_INT_r; |
coreyharris | 5:f8d1f651bef5 | 460 | EN_INT_r.all = 0; |
coreyharris | 3:420d5efbd967 | 461 | EN_INT_r.bits.en_eint = 1; // Enable EINT interrupt |
coreyharris | 4:06e258ff0b97 | 462 | EN_INT_r.bits.en_rrint = 0; // Disable R-to-R interrupt |
coreyharris | 3:420d5efbd967 | 463 | EN_INT_r.bits.intb_type = 3; // Open-drain NMOS with internal pullup |
coreyharris | 1:86843c27cc81 | 464 | ecgAFE.writeRegister( MAX30003::EN_INT , EN_INT_r.all); |
coreyharris | 1:86843c27cc81 | 465 | |
coreyharris | 1:86843c27cc81 | 466 | |
coreyharris | 1:86843c27cc81 | 467 | //Dyanmic modes config |
coreyharris | 1:86843c27cc81 | 468 | MAX30003::ManageDynamicModes_u MNG_DYN_r; |
coreyharris | 3:420d5efbd967 | 469 | MNG_DYN_r.bits.fast = 0; // Fast recovery mode disabled |
coreyharris | 1:86843c27cc81 | 470 | ecgAFE.writeRegister( MAX30003::MNGR_DYN , MNG_DYN_r.all); |
coreyharris | 5:f8d1f651bef5 | 471 | |
coreyharris | 5:f8d1f651bef5 | 472 | // MUX Config |
coreyharris | 5:f8d1f651bef5 | 473 | MAX30003::MuxConfiguration_u CNFG_MUX_r; |
coreyharris | 5:f8d1f651bef5 | 474 | CNFG_MUX_r.bits.openn = 0; // Connect ECGN to AFE channel |
coreyharris | 5:f8d1f651bef5 | 475 | CNFG_MUX_r.bits.openp = 0; // Connect ECGP to AFE channel |
coreyharris | 5:f8d1f651bef5 | 476 | ecgAFE.writeRegister( MAX30003::CNFG_EMUX , CNFG_MUX_r.all); |
coreyharris | 1:86843c27cc81 | 477 | |
coreyharris | 1:86843c27cc81 | 478 | return; |
coreyharris | 0:38c49bc37c7c | 479 | } |
coreyharris | 0:38c49bc37c7c | 480 | |
kidecha_rahul | 17:4bf0775c1b38 | 481 | |
kidecha_rahul | 17:4bf0775c1b38 | 482 | void ecg_config_off(MAX30003& ecgAFE) |
kidecha_rahul | 17:4bf0775c1b38 | 483 | { |
kidecha_rahul | 17:4bf0775c1b38 | 484 | // General config register setting |
kidecha_rahul | 17:4bf0775c1b38 | 485 | MAX30003::GeneralConfiguration_u CNFG_GEN_r; |
kidecha_rahul | 17:4bf0775c1b38 | 486 | CNFG_GEN_r.bits.en_ecg = 0; // Enable ECG channel |
kidecha_rahul | 17:4bf0775c1b38 | 487 | // CNFG_GEN_r.bits.rbiasn = 1; // Enable resistive bias on negative input |
kidecha_rahul | 17:4bf0775c1b38 | 488 | // CNFG_GEN_r.bits.rbiasp = 1; // Enable resistive bias on positive input |
kidecha_rahul | 17:4bf0775c1b38 | 489 | // CNFG_GEN_r.bits.en_rbias = 1; // Enable resistive bias |
kidecha_rahul | 17:4bf0775c1b38 | 490 | // CNFG_GEN_r.bits.imag = 2; // Current magnitude = 10nA |
kidecha_rahul | 17:4bf0775c1b38 | 491 | // CNFG_GEN_r.bits.en_dcloff = 1; // Enable DC lead-off detection |
kidecha_rahul | 17:4bf0775c1b38 | 492 | ecgAFE.writeRegister( MAX30003::CNFG_GEN , CNFG_GEN_r.all); |
kidecha_rahul | 17:4bf0775c1b38 | 493 | } |