Adapted sx1280-hal to new IRQ handler
This commit is contained in:
@@ -23,13 +23,7 @@ Maintainer: Miguel Luis, Gregory Cristian and Matthieu Verdy
|
||||
* \brief Used to block execution waiting for low state on radio busy pin.
|
||||
* Essentially used in SPI communications
|
||||
*/
|
||||
#define WaitOnBusy( ) for(uint8_t val=0; val != 1; BUSY->read(&val));
|
||||
|
||||
/*!
|
||||
* \brief Macro used to enable and disable callback without disabling IRQ
|
||||
*/
|
||||
|
||||
#define setDioIrqEnabled( enabled ) EXTIHandler::getInstance()->setCallbackEnabled(DIO1, enabled)
|
||||
#define WaitOnBusy( ) for(uint8_t val=1; val; BUSY->read(&val));
|
||||
|
||||
// This code handles cases where assert_param is undefined
|
||||
#ifndef assert_param
|
||||
@@ -63,10 +57,7 @@ void SX1280Hal::IoIrqInit( DioIrqHandler irqHandler )
|
||||
{
|
||||
assert_param( RadioSpi != NULL );
|
||||
SpiInit( );
|
||||
|
||||
std::function<void(void*)> callbackFunction = [this, irqHandler](void* ptr){(this->*irqHandler)();};
|
||||
EXTIHandler::getInstance()->registerCallback(callbackFunction, nullptr, DIO1);
|
||||
EXTIHandler::getInstance()->setCallbackEnabled(DIO1, true);
|
||||
DIO1->registerExtiCallback(this);
|
||||
}
|
||||
|
||||
void SX1280Hal::Reset( void )
|
||||
@@ -264,3 +255,11 @@ uint8_t SX1280Hal::GetDioStatus( void )
|
||||
retval += inter;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void SX1280Hal::setDioIrqEnabled(bool enabled) {
|
||||
dioIrqEnabled = enabled;
|
||||
}
|
||||
|
||||
void SX1280Hal::irqHandler(InterruptReason *reason) {
|
||||
|
||||
}
|
||||
|
||||
@@ -19,12 +19,11 @@ Maintainer: Miguel Luis and Gregory Cristian
|
||||
#include "sx1280.h"
|
||||
#include "../GPIO_Pin.hpp"
|
||||
#include "../SPI_Peripheral.hpp"
|
||||
#include "../EXTIHandler.hpp"
|
||||
|
||||
/*!
|
||||
* \brief Actual implementation of a SX1280 radio
|
||||
*/
|
||||
class SX1280Hal : public SX1280
|
||||
class SX1280Hal : public SX1280, private Interruptible
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
@@ -157,6 +156,12 @@ protected:
|
||||
* \param [in] irqHandler A function pointer of the function to be run on every DIO interrupt
|
||||
*/
|
||||
virtual void IoIrqInit( DioIrqHandler irqHandler );
|
||||
|
||||
private:
|
||||
bool dioIrqEnabled = false;
|
||||
|
||||
void setDioIrqEnabled(bool enabled);
|
||||
void irqHandler(InterruptReason* reason);
|
||||
};
|
||||
|
||||
#endif // __SX1280_HAL_H__
|
||||
|
||||
Reference in New Issue
Block a user