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
|
||||
+++ b/src/Module.h
|
||||
@@ -190,7 +190,7 @@ class Module {
|
||||
|
||||
\param numBytes Number of bytes to transfer.
|
||||
*/
|
||||
- void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes);
|
||||
+ virtual void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t* dataOut, uint8_t* dataIn, uint8_t numBytes);
|
||||
|
||||
// pin number access methods
|
||||
@@ -361,9 +361,9 @@ class Module {
|
||||
// helper functions to set up SPI overrides on Arduino
|
||||
#if defined(RADIOLIB_BUILD_ARDUINO)
|
||||
void SPIbegin();
|
||||
- void SPIbeginTransaction();
|
||||
+ virtual void SPIbeginTransaction();
|
||||
uint8_t SPItransfer(uint8_t b);
|
||||
- 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
|
||||
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,
|
||||
|
@ -41,20 +41,8 @@ class LockingModule : public Module
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief SPI single transfer method.
|
||||
|
||||
\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);
|
||||
void SPIbeginTransaction() override;
|
||||
void SPIendTransaction() override;
|
||||
};
|
||||
|
||||
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
||||
|
Loading…
Reference in New Issue
Block a user