mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-04 03:39:56 +00:00
1b34a0c6d8
Hi, I think the problem you were having building for ESP32 was due to a funny thing. Notice the #define for INTERRUPT_ATTR. That macro expands to IRAM_ATTR - which is a special flag the ESP32 requires for _any_ code that is going to be called from an ISR. So that the code is guaranteed to be in RAM (the ESP32 uses a clever scheme where the FLASH is actually high speed serial flash and all reads/writes are actually only happening to a small number of pages in RAM and they have a driver that is constantly copying blocks they need into that ram. This essentially how VM works for desktop computers, but in their case they are paging to FLASH. But for code that runs in an interrupt handler must _always_ be in RAM because if you took a 'page fault' for that code being missing in RAM they can't nicely do their clever VM scheme. So that's all good. The problem was - apparently GCC for the ESP32 has a a bug when that attribute is applied in the class declaration. So I moved it out into the cpp file and all seems well now.
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "RadioLibInterface.h"
|
|
|
|
/**
|
|
* Our adapter for SX1262 radios
|
|
*/
|
|
class SX1262Interface : public RadioLibInterface
|
|
{
|
|
SX1262 lora;
|
|
|
|
public:
|
|
SX1262Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi);
|
|
|
|
/// Initialise the Driver transport hardware and software.
|
|
/// Make sure the Driver is properly configured before calling init().
|
|
/// \return true if initialisation succeeded.
|
|
virtual bool init();
|
|
|
|
/// Apply any radio provisioning changes
|
|
/// Make sure the Driver is properly configured before calling init().
|
|
/// \return true if initialisation succeeded.
|
|
virtual bool reconfigure();
|
|
|
|
/// Prepare hardware for sleep. Call this _only_ for deep sleep, not needed for light sleep.
|
|
virtual bool sleep();
|
|
|
|
protected:
|
|
/**
|
|
* Glue functions called from ISR land
|
|
*/
|
|
virtual void disableInterrupt();
|
|
|
|
/**
|
|
* Enable a particular ISR callback glue function
|
|
*/
|
|
virtual void enableInterrupt(void (*callback)()) { lora.setDio1Action(callback); }
|
|
|
|
/** are we actively receiving a packet (only called during receiving state) */
|
|
virtual bool isActivelyReceiving();
|
|
|
|
/**
|
|
* Start waiting to receive a message
|
|
*/
|
|
virtual void startReceive();
|
|
/**
|
|
* Add SNR data to received messages
|
|
*/
|
|
virtual void addReceiveMetadata(MeshPacket *mp);
|
|
|
|
virtual void setStandby();
|
|
|
|
private:
|
|
|
|
}; |