This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to use one SPI instance in two source files

Hello

I have both mai.c and app_sdcard.c
"static const nrf_drv_spi_t spi = SPI_INSTANCE (spi_instance);"
Want to use.

So using "extern"

main.c

#define SPI_INSTANCE 1;
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);//SPI_INSTANCE     (spi1)
static int *p_spi = &spi;

app_sdcard.c

ret_code_t ret = nrf_drv_spi_xfer(&p_spi,&xfer,NRF_DRV_SPI_FLAG_REPEATED_XFER);

app_sdcard.h

extern static int *p_spi;

And wrote the code.

But in app_sdcard.h
"multiple storage classes in declaration specifiers"
I get an error.
What can I do to resolve it?

Related