// SPI_MasterSimpleAccess.cpp : Defines the entry point for the console application. // #include #include #include #include "stdafx.h" extern "C" { #include "SPIIC.h" } int _tmain(int argc, _TCHAR* argv[]) { // // Go to the work directory // printf("\nGoing to the work directory...\n"); #ifdef _DEBUG _chdir("..\\debug"); #else _chdir("..\\release"); #endif; // // Open library // printf("Opening the SPIIC library...\n"); spi_SPIIC(); // // Read configuration // printf("Reading configuration and data file...\n"); spi_ReadConfFile("..\\cfg_files\\spi_simple.cfg", true); // // SPI4, 32 bits read/write access // int DataOut = 0x12345678; int DataIn = 0; spi_ShiftWrAndRd(32, (char *)&DataOut, (char *)&DataIn, true); printf("Sent data : 0x%08x\n", DataOut); printf("Received data : 0x%08x\n", DataIn); // // Close the library // spi_Terminate(); // // Wait for user input to close the window // printf("Press any key...\n", 1); int ch = _getch(); return 0; }