mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-03 08:28:20 +02:00
fix pointer lifetime for SPIClass
This commit is contained in:
parent
e598865114
commit
29315b9b42
1 changed files with 4 additions and 3 deletions
|
@ -103,14 +103,14 @@ class HmRadio {
|
|||
|
||||
#ifdef ESP32
|
||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
|
||||
SPIClass* mSpi = new SPIClass(FSPI);
|
||||
mSpi = new SPIClass(FSPI);
|
||||
#else
|
||||
SPIClass* mSpi = new SPIClass(VSPI);
|
||||
mSpi = new SPIClass(VSPI);
|
||||
#endif
|
||||
mSpi->begin(sclk, miso, mosi, cs);
|
||||
#else
|
||||
//the old ESP82xx cannot freely place their SPI pins
|
||||
SPIClass* mSpi = new SPIClass();
|
||||
mSpi = new SPIClass();
|
||||
mSpi->begin();
|
||||
#endif
|
||||
mNrf24.begin(mSpi, ce, cs);
|
||||
|
@ -363,6 +363,7 @@ class HmRadio {
|
|||
uint8_t mTxChIdx;
|
||||
uint8_t mRxChIdx;
|
||||
|
||||
SPIClass* mSpi;
|
||||
RF24 mNrf24;
|
||||
uint8_t mTxBuf[MAX_RF_PAYLOAD_SIZE];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue