Seungchan Lee / Mbed 2 deprecated 210714_ads1299_ex0_hello_world

Dependencies:   mbed

Revision:
0:85f12fbe14dd
Child:
1:f1e13a1aab6f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 14 19:19:01 2021 +0000
@@ -0,0 +1,53 @@
+#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(0x20);
+        ads1299.write(0x00);
+        char buf = ads1299.write(0x00);
+        cs = 1;
+        
+        printf("WHOAMI register = 0x%X\n", buf);     
+        wait(0.5);
+    }
+}
\ No newline at end of file