Write "Hello world!" out via SPI protocol and receive an echo
cmake_minimum_required(VERSION 3.3)
project(SPI_Demo)
create_simple_executable(${PROJECT_NAME} SPI_Demo.cpp)
void error (
const PropWare::ErrorCode err,
const PropWare::SPI *spi);
const uint32_t
FREQ = 100000;
char string[] = "Hello world!\n";
char *s;
char in;
while (1) {
while (*s) {
waitcnt(CLKFREQ/100 + CNT);
cs.clear();
cs.set();
waitcnt(CLKFREQ/100 + CNT);
in = (char) 0xff;
while (in != *s) {
cs.clear();
cs.set();
}
++s;
}
debugLEDs.toggle();
}
return 0;
}
void error (
const PropWare::ErrorCode err,
const PropWare::SPI *spi) {
} else
while (1) {
debugLEDs.write(err);
waitcnt(100*MILLISECOND);
debugLEDs.write(0);
waitcnt(100*MILLISECOND);
}
}