Hello, this will be a bit of a long-winded explanation but here goes: I'm building an SPI driver that reads data from an external ADC and writes to a PWM signal. I got the PWM part of the code working with the example code 'pwm_library' and got the SPI driver working with the 'spi' example code. However, the two projects still existed independently of one another, so I copy and pasted my SPI driver code to my PWM project, (including the include files). I have been troubleshooting for a few hours now and reduced my errors down to a handful:
Compiling file: main.c In file included from ../../../main.c:1:0: ../../../../../../integration/nrfx/legacy/nrf_drv_spi.h:120:37: error: 'NRF_DRV_SPI_INSTANCE_0' undeclared here (not in a function); did you mean 'NRF_DRV_SPI_INSTANCE_'? #define NRF_DRV_SPI_INSTANCE_(id) NRF_DRV_SPI_INSTANCE_ ## id ^ ../../../../../../integration/nrfx/legacy/nrf_drv_spi.h:119:37: note: in expansion of macro 'NRF_DRV_SPI_INSTANCE_' #define NRF_DRV_SPI_INSTANCE(id) NRF_DRV_SPI_INSTANCE_(id) ^~~~~~~~~~~~~~~~~~~~~ ../../../main.c:43:34: note: in expansion of macro 'NRF_DRV_SPI_INSTANCE' static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE); /**< SPI instance. */ ^~~~~~~~~~~~~~~~~~~~ ../../../main.c: In function 'main': ../../../../../../integration/nrfx/legacy/nrf_drv_spi.h:220:21: error: 'SPI_DEFAULT_CONFIG_IRQ_PRIORITY' undeclared (first use in this function); did you mean 'TIMER_DEFAULT_CONFIG_IRQ_PRIORITY'? .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY, \ ^ ../../../main.c:92:39: note: in expansion of macro 'NRF_DRV_SPI_DEFAULT_CONFIG' nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG; ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../../../../integration/nrfx/legacy/nrf_drv_spi.h:220:21: note: each undeclared identifier is reported only once for each function it appears in .irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY, \ ^ ../../../main.c:92:39: note: in expansion of macro 'NRF_DRV_SPI_DEFAULT_CONFIG' nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG; ^~~~~~~~~~~~~~~~~~~~~~~~~~ make: *** [_build/nrf52832_xxaa/main.c.o] Error 1 BUILD FAILED (exit value 2, total time: 579ms)
All of the errors seem to be originating from inside the "nrf_drv_spi.h" file. Any idea why this might be happening? I wasn't getting any errors in the spi driver example and as far as I can see they're configured the same way.