Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::SX1278Lora Class Reference

#include <SX1278Lora.h>

Inheritance diagram for Boardcore::SX1278Lora:
Collaboration diagram for Boardcore::SX1278Lora:

Classes

struct  Config
 Requested SX1278 configuration. More...
 

Public Types

enum class  Error { NONE , BAD_VALUE , BAD_VERSION , IRQ_TIMEOUT }
 Error enum. More...
 

Public Member Functions

 SX1278Lora (SPIBus &bus, miosix::GpioPin cs, miosix::GpioPin dio0, miosix::GpioPin dio1, miosix::GpioPin dio3, SPI::ClockDivider clock_divider, std::unique_ptr< SX1278::ISX1278Frontend > frontend)
 Construct a new SX1278.
 
virtual Error init (const Config &config)
 Setup the device.
 
bool checkVersion ()
 
virtual Error configure (const Config &config)
 Configure this device on the fly.
 
ssize_t receive (uint8_t *pkt, size_t max_len) override
 Wait until a new packet is received.
 
bool send (uint8_t *pkt, size_t len) override
 Send a packet. The function must block until the packet is sent (successfully or not)
 
float getLastRxRssi () override
 Get the RSSI in dBm, during last packet receive.
 
float getLastRxSnr () override
 Get the RSSI in dBm, during last packet receive.
 
- Public Member Functions inherited from Boardcore::SX1278::SX1278Common
void handleDioIRQ ()
 Handle generic DIO irq.
 
- Public Member Functions inherited from Boardcore::SX1278::ISX1278
virtual float getLastRxFei ()
 Get the frequency error index in Hz, during last packet receive (NaN if not available).
 
- Public Member Functions inherited from Boardcore::Transceiver
 Transceiver ()
 
virtual ~Transceiver ()
 

Static Public Attributes

static constexpr size_t MTU = 255
 

Additional Inherited Members

- Protected Types inherited from Boardcore::SX1278::ISX1278
using IrqFlags = int
 
using Mode = int
 
- Protected Member Functions inherited from Boardcore::SX1278::SX1278Common
 SX1278Common (SPIBus &bus, miosix::GpioPin cs, miosix::GpioPin dio0, miosix::GpioPin dio1, miosix::GpioPin dio3, SPI::ClockDivider clock_divider, std::unique_ptr< ISX1278Frontend > frontend)
 
 ~SX1278Common ()
 
void setDefaultMode (Mode mode, DioMapping mapping, InterruptTrigger dio1_trigger, bool set_tx_frontend_on, bool set_rx_frontend_on)
 Set default device mode.
 
IrqFlags waitForIrq (LockMode &guard, IrqFlags set_irq, IrqFlags reset_irq, bool unlock=false)
 Wait for generic irq.
 
IrqFlags waitForIrqBusy (LockMode &guard, IrqFlags set_irq, IrqFlags reset_irq, int timeout)
 Busy waits for an interrupt by polling the irq register.
 
IrqFlags checkForIrqAndReset (IrqFlags set_irq, IrqFlags reset_irq)
 Returns a mask containing triggered interrupts.
 
ISX1278FrontendgetFrontend ()
 
SPISlavegetSpiSlave ()
 

Detailed Description

Definition at line 33 of file SX1278Lora.h.

Member Enumeration Documentation

◆ Error

Error enum.

Enumerator
NONE 
BAD_VALUE 
BAD_VERSION 
IRQ_TIMEOUT 

Definition at line 130 of file SX1278Lora.h.

Constructor & Destructor Documentation

◆ SX1278Lora()

Boardcore::SX1278Lora::SX1278Lora ( SPIBus & bus,
miosix::GpioPin cs,
miosix::GpioPin dio0,
miosix::GpioPin dio1,
miosix::GpioPin dio3,
SPI::ClockDivider clock_divider,
std::unique_ptr< SX1278::ISX1278Frontend > frontend )
inlineexplicit

Construct a new SX1278.

Definition at line 141 of file SX1278Lora.h.

Member Function Documentation

◆ checkVersion()

bool Boardcore::SX1278Lora::checkVersion ( )

Definition at line 146 of file SX1278Lora.cpp.

◆ configure()

SX1278Lora::Error Boardcore::SX1278Lora::configure ( const Config & config)
virtual

Configure this device on the fly.

Definition at line 163 of file SX1278Lora.cpp.

◆ getLastRxRssi()

float Boardcore::SX1278Lora::getLastRxRssi ( )
overridevirtual

Get the RSSI in dBm, during last packet receive.

Implements Boardcore::SX1278::ISX1278.

Definition at line 351 of file SX1278Lora.cpp.

◆ getLastRxSnr()

float Boardcore::SX1278Lora::getLastRxSnr ( )
overridevirtual

Get the RSSI in dBm, during last packet receive.

Reimplemented from Boardcore::SX1278::ISX1278.

Definition at line 369 of file SX1278Lora.cpp.

◆ init()

SX1278Lora::Error Boardcore::SX1278Lora::init ( const Config & config)
virtual

Setup the device.

Definition at line 133 of file SX1278Lora.cpp.

◆ receive()

ssize_t Boardcore::SX1278Lora::receive ( uint8_t * pkt,
size_t max_len )
overridevirtual

Wait until a new packet is received.

Parameters
pktBuffer to store the received packet into.
pkt_lenMaximum length of the received data.
Returns
Size of the data received or -1 if failure

Implements Boardcore::Transceiver.

Definition at line 294 of file SX1278Lora.cpp.

◆ send()

bool Boardcore::SX1278Lora::send ( uint8_t * pkt,
size_t len )
overridevirtual

Send a packet. The function must block until the packet is sent (successfully or not)

Parameters
pktPointer to the packet (needs to be at least pkt_len bytes).
pkt_lenLength of the packet to be sent.
Returns
True if the message was sent correctly.

Implements Boardcore::Transceiver.

Definition at line 324 of file SX1278Lora.cpp.

Member Data Documentation

◆ MTU

constexpr size_t Boardcore::SX1278Lora::MTU = 255
staticconstexpr

Definition at line 36 of file SX1278Lora.h.


The documentation for this class was generated from the following files: