mirror of
https://github.com/lumapu/ahoy.git
synced 2025-08-06 09:58:23 +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
|
#ifdef ESP32
|
||||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
|
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
|
||||||
SPIClass* mSpi = new SPIClass(FSPI);
|
mSpi = new SPIClass(FSPI);
|
||||||
#else
|
#else
|
||||||
SPIClass* mSpi = new SPIClass(VSPI);
|
mSpi = new SPIClass(VSPI);
|
||||||
#endif
|
#endif
|
||||||
mSpi->begin(sclk, miso, mosi, cs);
|
mSpi->begin(sclk, miso, mosi, cs);
|
||||||
#else
|
#else
|
||||||
//the old ESP82xx cannot freely place their SPI pins
|
//the old ESP82xx cannot freely place their SPI pins
|
||||||
SPIClass* mSpi = new SPIClass();
|
mSpi = new SPIClass();
|
||||||
mSpi->begin();
|
mSpi->begin();
|
||||||
#endif
|
#endif
|
||||||
mNrf24.begin(mSpi, ce, cs);
|
mNrf24.begin(mSpi, ce, cs);
|
||||||
|
@ -363,6 +363,7 @@ class HmRadio {
|
||||||
uint8_t mTxChIdx;
|
uint8_t mTxChIdx;
|
||||||
uint8_t mRxChIdx;
|
uint8_t mRxChIdx;
|
||||||
|
|
||||||
|
SPIClass* mSpi;
|
||||||
RF24 mNrf24;
|
RF24 mNrf24;
|
||||||
uint8_t mTxBuf[MAX_RF_PAYLOAD_SIZE];
|
uint8_t mTxBuf[MAX_RF_PAYLOAD_SIZE];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue