Shivam Garg / Mbed OS EVAL-ADBMS2950_copy

Dependencies:   ADBMS2950

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "application.h"
00002 /*
00003 https://os.mbed.com/platforms/SDP_K1/
00004 Mbed SDP-K1 board MOSI, MOSI, SCK definition.
00005 Arduino Header Pinout
00006 MOSI = D11
00007 MISO = D12
00008 SCK  = D13
00009 CSB =  D10
00010 */
00011 int main(void);
00012 void spi_init(void);
00013 
00014 DigitalOut chip_select(D10);                /* SPI chip select */
00015 DigitalOut mosi(D11);                       /* MOSI */
00016 DigitalIn miso(D12);                        /* MISO */
00017 DigitalOut sclk(D13);                       /* SCK */
00018 SPI spi(D11, D12, D13);                     /* SPI MOSI, MISO, SCK */
00019 Serial pc(USBTX, USBRX);                    /* USB Tx,Rx */
00020 Timer timer;
00021 int main()
00022 {
00023     spi_init();
00024     app_main ();
00025     return 0;
00026 }
00027 
00028 void spi_init()
00029 {
00030     chip_select = 1;
00031     spi.format(8,0);            /* 8bit data, CPOL-CPHA= 0*/
00032     spi.frequency(2000000);     /* SPI clock 2Mhz */
00033     pc.baud(115200);            /* Usb baud rate */
00034 }