Hi,
Trying to make an SPI transfer on a Raspberry Pi Zero.
Using your code and library :
#include "spi.h"
/* Initialize SPI 8 bits, 1Mhz, Mode 0, no semaphore locks */
SPI_HANDLE spi = SpiOpenPort(0, 8, 1000000, SPI_MODE_0, false);
int main(){
if (spi)
{
uint8_t buf[3] = { 0x01, 0x02, 0xAA }; // Data to send
SpiWriteAndRead(spi, &buf[0], &buf[0], 3, false); // Transfer buffer data to SPI
SpiClosePort(spi);
}
return 0;
}
Then on the pi :
g++ spi-test.c -o spitest
Gives the following error :
/usr/bin/ld: /tmp/ccMiUj6A.o: in function `__static_initialization_and_destruction_0(int, int)':
spi-test.c:(.text+0x9c): undefined reference to `SpiOpenPort'
collect2: error: ld returned 1 exit status
Please let me know if you spot an error, for now I'm stuck. Probably something obvious as I'm not an expert.
Thanks
Hi,
Trying to make an SPI transfer on a Raspberry Pi Zero.
Using your code and library :
Then on the pi :
g++ spi-test.c -o spitestGives the following error :
Please let me know if you spot an error, for now I'm stuck. Probably something obvious as I'm not an expert.
Thanks