まだ動いていない
Nucleoのコード
// Reply to a SPI master as slave #include "mbed.h" SPISlave device(PA_7, PA_6, PA_5, PA_4); // mosi, miso, sclk, ssel Serial pc(SERIAL_TX, SERIAL_RX); int main() { device.reply(0x03); // Prime SPI with first reply while(1) { if(device.receive()) { pc.printf("data received.\n"); int v = 2000; // Read byte from master uint8_t hbyte = v / 256; uint8_t lbyte = v % 256; wait(0.002); device.reply(hbyte); // Make this the next reply wait(0.002); device.reply(lbyte); // Make this the next reply } } }