Hi guys! I want to add SPI to my BLE project to read some data from my gyro. Adding other headers was no problem, but when I want to add some code from the SPI-Example I got some errors I can't fix.
I've added the headers to a SPI-Header
#include "nrf_drv_spi.h"
#include "nrf_gpio.h"
#include "boards.h"
as well as to the project include path
..\..\..\SDK\components\drivers_nrf\spi_master
and added the nrf_drv_spi.c. But unfortunately the Keil IDE says "undeclared identifier"
But the nrf_drv_config.h is added to my project as well, where the definition of SPI0_USE_EASY_DMA is declared. Adding the header directly to the spi.h doesn't work either. Compiler also says "Browse information for nrf_drv_spi.c is not available", no matter how much I clean and rebuild.
Build-Log looks like this
compiling spi.c...
..\..\..\spi.h(8): warning: #1295-D: Deprecated declaration spi_init - give arg types void spi_init();
..\..\..\spi.c(3): error: #20: identifier "SPI0_USE_EASY_DMA" is undefined static const nrf_drv_spi_t spi = RF_DRV_SPI_INSTANCE(0);
..\..\..\spi.c(3): error: #20: identifier "SPI0_INSTANCE_INDEX" is undefined static const nrf_drv_spi_t spi = RF_DRV_SPI_INSTANCE(0);
..\..\..\spi.c(12): error: #20: identifier "SPI0_CONFIG_SCK_PIN" is undefined nrf_drv_spi_config_t spi_config = RF_DRV_SPI_DEFAULT_CONFIG(0);
..\..\..\spi.c(12): error: #20: identifier "SPI0_CONFIG_MOSI_PIN" is undefined nrf_drv_spi_config_t spi_config = RF_DRV_SPI_DEFAULT_CONFIG(0);
..\..\..\spi.c(12): error: #20: identifier "SPI0_CONFIG_MISO_PIN" is undefined nrf_drv_spi_config_t spi_config = RF_DRV_SPI_DEFAULT_CONFIG(0);
..\..\..\spi.c(12): error: #20: identifier "SPI0_CONFIG_IRQ_PRIORITY" is undefined nrf_drv_spi_config_t spi_config = RF_DRV_SPI_DEFAULT_CONFIG(0);
..\..\..\spi.c(14): warning: #1-D: last line of file ends without a newline }
..\..\..\spi.c(3): warning: #177-D: variable "spi" was declared but never referenced static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(0);
compiling nrf_drv_spi.c...
..\..\..\SDK\components\drivers_nrf\spi_master\nrf_drv_spi.c(56): error: #35: #error directive: "Wrong configuration."
#error "Wrong configuration."
..\..\..\SDK\components\drivers_nrf\spi_master\nrf_drv_spi.c: 0 warnings, 1 error
Did I miss something? How do I add SPI to my project properly? BTW, is there an example for using SPI without NRF-Libs?