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

Various SX1278 register/enums definitions. More...

#include <SX1278Fsk.h>

Inheritance diagram for Boardcore::SX1278Fsk:
Collaboration diagram for Boardcore::SX1278Fsk:

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

 SX1278Fsk (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 getCurRssi ()
 Get the current perceived RSSI in dBm.
 
float getLastRxRssi () override
 Get the RSSI in dBm, during last packet receive.
 
float getLastRxFei () override
 Get the frequency error index in Hz, 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 getLastRxSnr ()
 Get the signal to noise ratio, 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
 Maximum transmittable unit of this driver.
 

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

Various SX1278 register/enums definitions.

Definition at line 38 of file SX1278Fsk.h.

Member Enumeration Documentation

◆ Error

Error enum.

Enumerator
NONE 
BAD_VALUE 
BAD_VERSION 
IRQ_TIMEOUT 

Definition at line 127 of file SX1278Fsk.h.

Constructor & Destructor Documentation

◆ SX1278Fsk()

Boardcore::SX1278Fsk::SX1278Fsk ( 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 138 of file SX1278Fsk.h.

Member Function Documentation

◆ checkVersion()

bool Boardcore::SX1278Fsk::checkVersion ( )

Definition at line 59 of file SX1278Fsk.cpp.

◆ configure()

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

Configure this device on the fly.

Definition at line 76 of file SX1278Fsk.cpp.

◆ getCurRssi()

float Boardcore::SX1278Fsk::getCurRssi ( )

Get the current perceived RSSI in dBm.

Definition at line 381 of file SX1278Fsk.cpp.

◆ getLastRxFei()

float Boardcore::SX1278Fsk::getLastRxFei ( )
overridevirtual

Get the frequency error index in Hz, during last packet receive.

Reimplemented from Boardcore::SX1278::ISX1278.

Definition at line 373 of file SX1278Fsk.cpp.

◆ getLastRxRssi()

float Boardcore::SX1278Fsk::getLastRxRssi ( )
overridevirtual

Get the RSSI in dBm, during last packet receive.

Implements Boardcore::SX1278::ISX1278.

Definition at line 379 of file SX1278Fsk.cpp.

◆ init()

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

Setup the device.

Definition at line 46 of file SX1278Fsk.cpp.

◆ receive()

ssize_t Boardcore::SX1278Fsk::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 on failure

Implements Boardcore::Transceiver.

Definition at line 251 of file SX1278Fsk.cpp.

◆ send()

bool Boardcore::SX1278Fsk::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 322 of file SX1278Fsk.cpp.

Member Data Documentation

◆ MTU

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

Maximum transmittable unit of this driver.

Definition at line 44 of file SX1278Fsk.h.


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