Trying to change SPI driver compile error "error invalid use of incomplete type 'spi_t'"

themindfactory
Posts: 58
Joined: Mon Mar 26, 2018 7:57 pm

Trying to change SPI driver compile error "error invalid use of incomplete type 'spi_t'"

Postby themindfactory » Tue Dec 10, 2019 12:22 am

  1. #include <SPI.h>
  2.  
  3. SPIClass spi;
  4. SPISettings spiSettings = SPISettings(SPI_CLOCK, SPI_MSBFIRST, SPI_MODE);
  5.  
  6. void setup() {
  7.   Serial.begin(500000);
  8.   spi.begin(); //ck,miso,mosi,ss
  9.   spi_t *s;
  10.   s = spi.bus();
  11.   s->dev->mosi_dlen.usr_mosi_dbitlen = 48 - 1;
  12. }
  13.  
  14. void loop() {
  15. }
The s->dev->mosi_dlen.usr_mosi_dbitlen = 48 - 1; line is what is causing the error

I have tried various includes without luck. This was compiled with 1.01

RichardS

themindfactory
Posts: 58
Joined: Mon Mar 26, 2018 7:57 pm

Re: Trying to change SPI driver compile error "error invalid use of incomplete type 'spi_t'"

Postby themindfactory » Tue Dec 10, 2019 5:48 pm

I think this is happening as spi_struct_t is not defined in any .h files, its defined within a .c file, so the compiler does not know the members, so having the pointer to the object in Arduino is kind of useless not being about to easily get to the members of the struct. I will tinker and see...

RichardS

Who is online

Users browsing this forum: Google [Bot] and 80 guests