ADS1299 GPIO Control test

Dependencies:   mbed

main.cpp

Committer:
futuremax
Date:
2021-12-23
Revision:
0:fdf66b6680cb

File content as of revision 0:fdf66b6680cb:

#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);       
    }
}