base code for the spi slave

Dependencies:   mbed

spi_slave.cpp

Committer:
chaos5338
Date:
2015-12-14
Revision:
0:e7e06df78282

File content as of revision 0:e7e06df78282:

// CECS 447 SPI Slave Test
#include "mbed.h"

    // Instantiate Functions and Classes
    DigitalOut RECEIVE(p25); // RGB LED to turn on if Recive is High
    SPISlave device(p11, p12, p13, p14);

int main(){
    device.reply(0x00);
    while(1){
        if(device.receive()){
            RECEIVE = 0;
            int v = device.read();
            v = (v+1) % 0x100;
            device.reply(v);
        }
    }
}