fork from Sog

Dependencies:   NNN50_WIFI_API

Fork of mbed_SPIS_multiByte_example_SOG by Sog Yang

Committer:
tsungta
Date:
Wed May 31 07:39:37 2017 +0000
Revision:
1:58f0712d9aa2
Parent:
0:b7415ae44dac
Child:
2:c520d7c7739d
Able to receive multiple bytes in single CS cycle;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsungta 0:b7415ae44dac 1 #include "mbed.h"
tsungta 0:b7415ae44dac 2
tsungta 0:b7415ae44dac 3 #include "SPISlave_multiByte.h"
tsungta 0:b7415ae44dac 4 SPISlave_multiByte device(A1, A2, A3, p3); // mosi, miso, sclk, ssel
tsungta 0:b7415ae44dac 5 Serial uart(USBTX, USBRX);
tsungta 0:b7415ae44dac 6
tsungta 0:b7415ae44dac 7 int main() {
tsungta 0:b7415ae44dac 8 uart.printf("START!");
tsungta 1:58f0712d9aa2 9 device.format(8,1);
tsungta 1:58f0712d9aa2 10
tsungta 0:b7415ae44dac 11 while(1) {
tsungta 0:b7415ae44dac 12 if(device.receive()) {
tsungta 0:b7415ae44dac 13 int v = device.read(); // Read byte from master
tsungta 1:58f0712d9aa2 14 uart.printf("v = %s ", v);
tsungta 1:58f0712d9aa2 15
tsungta 0:b7415ae44dac 16 }
tsungta 0:b7415ae44dac 17 }
tsungta 0:b7415ae44dac 18 }