How do I use three parameter constructor in Radiohead library without errors?

158 Views Asked by At

These are instances declaration mentioned in the examples I opened

RH_RF95 rf95;
RH_RF95 rf95(5, 2);
RH_RF95 rf95(8, 3);

Opening the RH_RF95.h header file I saw the following prototype

RH_RF95(uint8_t slaveSelectPin = SS, uint8_t interruptPin = 2, 
RHGenericSPI& spi = hardware_spi);

Meaning I can also initialize with three argument but if I do it like this

RH_RF95 rf95(slaveSelectPin, interruptPin, hspi);

I get error that there is no matching function call.

radiohead_ex:12:48: error: no matching function for call to 
'RH_RF95::RH_RF95(int&, int&, SPIClass*&)' RH_RF95 rf95(slaveSelectPin, 
    interruptPin, hspi);

Why is that? I really need use the three parameter constructor so I could pass an SPI instance. Screenshoot of my code with the error

0

There are 0 best solutions below