#include <stdio.h>
#include <string.h>
#define BUS 1
#define SLAVE 0
#define BUS_MODE SPI_MODE_0
#define SPI_SPEED 24000000
int main()
{
char* test_str = "Hello World";
int bytes = strlen(test_str)+1;
char buf[32];
int ret;
printf("Make sure the MISO and MOSI lines are connected with\n");
printf("a loopback jumper which is necessary for this test.\n");
printf("Testing SPI \n\n");
return -1;
}
printf("transfer test:\n");
printf("Sending %d bytes: %s\n", bytes, test_str);
ret =
rc_spi_transfer(BUS, SLAVE, (uint8_t*)test_str, bytes, (uint8_t*)buf);
if(ret<0){
printf("send failed\n");
return -1;
}
else printf("Received %d bytes: %s\n",ret, buf);\
rc_spi_close(BUS);
return 0;
}