ADS1299 GPIO Control test

Dependencies:   mbed

Revision:
0:fdf66b6680cb
diff -r 000000000000 -r fdf66b6680cb main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Dec 23 17:07:06 2021 +0000
@@ -0,0 +1,58 @@
+#include "mbed.h"
+// Programed by Seungchan Lee, futuremax7@gmail.com
+// 2021.07.15
+
+//Serial pc(USBTX, USBRX);
+static UARTSerial pc(USBTX, USBRX, 115200);
+
+InterruptIn drdy(D10);
+SPI ads1299(D11, D12, D13); // mosi, miso, sclk
+DigitalOut cs(D9);
+DigitalOut reset(A1);
+DigitalOut pwdn(A2);
+DigitalOut start(A0);
+ 
+int main() {
+//    pc.baud(115200);
+    
+    // GPIO Initialization
+    reset = 1;
+    pwdn = 1;
+    start = 0;    
+    cs = 1;
+ 
+    // Setup the spi for 8 bit data, high steady state clock,
+    // second edge capture, with a 1MHz clock rate
+    ads1299.format(8,1);
+    ads1299.frequency(5000000);
+    wait(0.1);
+ 
+    cs = 0;
+    ads1299.write(0x06); //RESET
+    cs = 1;
+    wait(0.5); // 100 ms
+    
+    cs = 0;
+    ads1299.write(0x11); //SDATAC
+    cs = 1;
+    wait(0.1); // 100 ms
+    
+    printf("start!!!\n");     
+    
+    while(1)
+    {
+        cs = 0;        
+        ads1299.write(0x54);
+        ads1299.write(0x00);
+        ads1299.write(0x43);
+        cs = 1;
+        wait(0.1);
+
+        cs = 0;                
+        ads1299.write(0x54);
+        ads1299.write(0x00);
+        ads1299.write(0x03);
+        cs = 1;
+        wait(0.1);       
+    }
+}
\ No newline at end of file