mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-13 16:55:08 +00:00
New variant of Radiolib patch
This commit is contained in:
parent
f918548e44
commit
6b8afdadc2
@ -1,12 +1,15 @@
|
|||||||
index 3a7b098..2492c1a 100644
|
index 3a7b098..aa38f6d 100644
|
||||||
--- a/src/Module.h
|
--- a/src/Module.h
|
||||||
+++ b/src/Module.h
|
+++ b/src/Module.h
|
||||||
@@ -190,7 +190,7 @@ class Module {
|
@@ -361,9 +361,9 @@ class Module {
|
||||||
|
// helper functions to set up SPI overrides on Arduino
|
||||||
\param numBytes Number of bytes to transfer.
|
#if defined(RADIOLIB_BUILD_ARDUINO)
|
||||||
*/
|
void SPIbegin();
|
||||||
- void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes);
|
- void SPIbeginTransaction();
|
||||||
+ virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes);
|
+ virtual void SPIbeginTransaction();
|
||||||
|
uint8_t SPItransfer(uint8_t b);
|
||||||
// pin number access methods
|
- void SPIendTransaction();
|
||||||
|
+ virtual void SPIendTransaction();
|
||||||
|
void SPIend();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -11,11 +11,18 @@
|
|||||||
// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that
|
// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that
|
||||||
static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
||||||
|
|
||||||
void LockingModule::SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes)
|
void LockingModule::SPIbeginTransaction()
|
||||||
{
|
{
|
||||||
concurrency::LockGuard g(spiLock);
|
spiLock->lock();
|
||||||
|
|
||||||
Module::SPItransfer(cmd, reg, dataOut, dataIn, numBytes);
|
Module::SPIbeginTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LockingModule::SPIendTransaction()
|
||||||
|
{
|
||||||
|
spiLock->unlock();
|
||||||
|
|
||||||
|
Module::SPIendTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy,
|
||||||
|
@ -41,20 +41,8 @@ class LockingModule : public Module
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
void SPIbeginTransaction() override;
|
||||||
\brief SPI single transfer method.
|
void SPIendTransaction() override;
|
||||||
|
|
||||||
\param cmd SPI access command (read/write/burst/...).
|
|
||||||
|
|
||||||
\param reg Address of SPI register to transfer to/from.
|
|
||||||
|
|
||||||
\param dataOut Data that will be transfered from master to slave.
|
|
||||||
|
|
||||||
\param dataIn Data that was transfered from slave to master.
|
|
||||||
|
|
||||||
\param numBytes Number of bytes to transfer.
|
|
||||||
*/
|
|
||||||
virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
||||||
|
Loading…
Reference in New Issue
Block a user