test

Dependencies:   SimpleDMA mbed-rtos mbed

Fork of spiDMAtest by Siva ram

main.cpp

Committer:
shreeshas95
Date:
2015-07-15
Revision:
0:f0f5102ed9ca
Child:
1:3cceef118195

File content as of revision 0:f0f5102ed9ca:

#include "mbed.h"
#include "rtos.h"
#include "SimpleDMA.h"
#include "dmaSPIslave.h"

dmaSPISlave spi(PTA16, PTA17, PTA15, PTA14);
RawSerial pc(USBTX, USBRX);
DigitalOut ledg(LED_GREEN);

int main(){
    pc.baud(9600);
    pc.printf("inside main\r\n");
    spi.format(8,3);
    spi.frequency(1000000);
    
    uint8_t buffer[100] = {0};
    pc.printf("welcome to dma test, start sending data now\r\n");
    
//    int i = 0;
//    while(i < 100){
//        if(spi.receive()){
//            buffer[i] = spi.read();
//            ++i;
//            ledg = !ledg;
//        }
//    }
    spi.bulkRead(buffer, 100);
    
    for(int i = 0 ; i < 100 ; ++i){
        pc.printf("%02x ", buffer[i]);
    }
    pc.printf("\r\n");
    
    return 0;
}