![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
3 channel_MUX
Dependencies: BufferedSerial MAX30003 max32630fthr1 DS1307
Diff: main.cpp
- Revision:
- 11:1d4ecbca034e
- Parent:
- 10:3709e8f3d089
- Child:
- 12:2f1730e0e638
--- a/main.cpp Wed Apr 21 23:14:23 2021 +0000 +++ b/main.cpp Mon May 03 19:03:21 2021 +0000 @@ -5,7 +5,7 @@ MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); void ecg_config(MAX30003 &ecgAFE); - +DigitalOut led1(P3_0,LED_ON); /* ECG FIFO nearly full callback */ volatile bool ecgFIFOIntFlag = 0; void ecgFIFO_callback() { @@ -25,7 +25,7 @@ const int ETAG_BITS_MASK = 0x7; // Ports and serial connections - Serial pc(P3_1,P3_0); // Use USB debug probe for serial link + Serial pc(P3_0,P3_1); // Use USB debug probe for serial link pc.baud(230400); // Baud rate = 115200 DigitalOut bLed(LED3, LED_ON); // Debug LEDs @@ -33,9 +33,12 @@ InterruptIn ecgFIFO_int(P5_4); // Config P5_4 as int. in for the ecgFIFO_int.fall(&ecgFIFO_callback); // ecg FIFO almost full interrupt - SPI spiBus(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // SPI bus, P5_1 = MOSI, + //SPI spiBus(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // SPI bus, P5_1 = MOSI, // P5_2 = MISO, P5_0 = SCK + + SPI spiBus(P5_1, P5_2, P5_0); + MAX30003 ecgAFE(spiBus, P5_3); // New MAX30003 on spiBus, CS = P5_3 ecg_config(ecgAFE); // Config ECG @@ -46,6 +49,7 @@ int16_t ecgSample[32]; while(1) { + // Read back ECG samples from the FIFO if( ecgFIFOIntFlag ) { @@ -77,6 +81,7 @@ // Print results for( idx = 0; idx < readECGSamples; idx++ ) { pc.printf("%6d\r\n", ecgSample[idx]); + // pc.printf("Hello\n"); } bLed = ! bLed;