1.3使用wiringPi的程序执行
before run your app,you should load the spi module into the kernel by command:
gpio load spi
且app需要使用root权限,所以,
sudo ./rfpi
1.4wiringPi中SPI相关函数wiringPiSPIDataRW的注意事项
该函数的说明如下:
/*
* wiringPiSPIDataRW:
* Write and Read a block of data over the SPI bus.
* Note the data ia being read into the transmit buffer, so will
* overwrite it!
* This is also a full-duplex operation.
*********************************************************************************
*/
所以,对该函数的调用应该如下:
wiringPiSPIDataRW(0,&aByte,1);
ret = aByte;