ADS1299 GPIO Control test

Dependencies:   mbed

Committer:
futuremax
Date:
Thu Dec 23 17:07:06 2021 +0000
Revision:
0:fdf66b6680cb
ADS1299 GPIO Control test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
futuremax 0:fdf66b6680cb 1 #include "mbed.h"
futuremax 0:fdf66b6680cb 2 // Programed by Seungchan Lee, futuremax7@gmail.com
futuremax 0:fdf66b6680cb 3 // 2021.07.15
futuremax 0:fdf66b6680cb 4
futuremax 0:fdf66b6680cb 5 //Serial pc(USBTX, USBRX);
futuremax 0:fdf66b6680cb 6 static UARTSerial pc(USBTX, USBRX, 115200);
futuremax 0:fdf66b6680cb 7
futuremax 0:fdf66b6680cb 8 InterruptIn drdy(D10);
futuremax 0:fdf66b6680cb 9 SPI ads1299(D11, D12, D13); // mosi, miso, sclk
futuremax 0:fdf66b6680cb 10 DigitalOut cs(D9);
futuremax 0:fdf66b6680cb 11 DigitalOut reset(A1);
futuremax 0:fdf66b6680cb 12 DigitalOut pwdn(A2);
futuremax 0:fdf66b6680cb 13 DigitalOut start(A0);
futuremax 0:fdf66b6680cb 14
futuremax 0:fdf66b6680cb 15 int main() {
futuremax 0:fdf66b6680cb 16 // pc.baud(115200);
futuremax 0:fdf66b6680cb 17
futuremax 0:fdf66b6680cb 18 // GPIO Initialization
futuremax 0:fdf66b6680cb 19 reset = 1;
futuremax 0:fdf66b6680cb 20 pwdn = 1;
futuremax 0:fdf66b6680cb 21 start = 0;
futuremax 0:fdf66b6680cb 22 cs = 1;
futuremax 0:fdf66b6680cb 23
futuremax 0:fdf66b6680cb 24 // Setup the spi for 8 bit data, high steady state clock,
futuremax 0:fdf66b6680cb 25 // second edge capture, with a 1MHz clock rate
futuremax 0:fdf66b6680cb 26 ads1299.format(8,1);
futuremax 0:fdf66b6680cb 27 ads1299.frequency(5000000);
futuremax 0:fdf66b6680cb 28 wait(0.1);
futuremax 0:fdf66b6680cb 29
futuremax 0:fdf66b6680cb 30 cs = 0;
futuremax 0:fdf66b6680cb 31 ads1299.write(0x06); //RESET
futuremax 0:fdf66b6680cb 32 cs = 1;
futuremax 0:fdf66b6680cb 33 wait(0.5); // 100 ms
futuremax 0:fdf66b6680cb 34
futuremax 0:fdf66b6680cb 35 cs = 0;
futuremax 0:fdf66b6680cb 36 ads1299.write(0x11); //SDATAC
futuremax 0:fdf66b6680cb 37 cs = 1;
futuremax 0:fdf66b6680cb 38 wait(0.1); // 100 ms
futuremax 0:fdf66b6680cb 39
futuremax 0:fdf66b6680cb 40 printf("start!!!\n");
futuremax 0:fdf66b6680cb 41
futuremax 0:fdf66b6680cb 42 while(1)
futuremax 0:fdf66b6680cb 43 {
futuremax 0:fdf66b6680cb 44 cs = 0;
futuremax 0:fdf66b6680cb 45 ads1299.write(0x54);
futuremax 0:fdf66b6680cb 46 ads1299.write(0x00);
futuremax 0:fdf66b6680cb 47 ads1299.write(0x43);
futuremax 0:fdf66b6680cb 48 cs = 1;
futuremax 0:fdf66b6680cb 49 wait(0.1);
futuremax 0:fdf66b6680cb 50
futuremax 0:fdf66b6680cb 51 cs = 0;
futuremax 0:fdf66b6680cb 52 ads1299.write(0x54);
futuremax 0:fdf66b6680cb 53 ads1299.write(0x00);
futuremax 0:fdf66b6680cb 54 ads1299.write(0x03);
futuremax 0:fdf66b6680cb 55 cs = 1;
futuremax 0:fdf66b6680cb 56 wait(0.1);
futuremax 0:fdf66b6680cb 57 }
futuremax 0:fdf66b6680cb 58 }