Artemis Teensy Flight Software
The software on the Teensy in the Artemis cubesat.
Artemis::Devices::RFM23 Class Reference

The RFM23 radio class. More...

#include <rfm23.h>

Classes

struct  rfm23_config
 The RFM23 radio configuration. More...
 

Public Member Functions

 RFM23 (uint8_t slaveSelectPin, uint8_t interruptPin, RHGenericSPI &spi=hardware_spi1)
 Construct a new RFM23 object. Wraps the RH_RFM23 constructor. More...
 
bool init (rfm23_config cfg, Threads::Mutex *mtx)
 Initialize the RFM23 radio. More...
 
void reset ()
 Resets the radio.
 
bool send (PacketComm &packet)
 Sends a packet through the radio. More...
 
int32_t recv (PacketComm &packet, uint16_t timeout)
 Receive a packet from the radio. More...
 

Detailed Description

The RFM23 radio class.

Constructor & Destructor Documentation

◆ RFM23()

Artemis::Devices::RFM23::RFM23 ( uint8_t  slaveSelectPin,
uint8_t  interruptPin,
RHGenericSPI &  spi = hardware_spi1 
)

Construct a new RFM23 object. Wraps the RH_RFM23 constructor.

Parameters
slaveSelectPinThe chip select pin unique to this instance.
interruptPinThe interrupt pin unique to this instance.
spiThe SPI interface connecting the Teensy to the radio.

Member Function Documentation

◆ init()

bool Artemis::Devices::RFM23::init ( rfm23_config  cfg,
Threads::Mutex *  mtx 
)

Initialize the RFM23 radio.

Parameters
cfgThe radio's configuration struct.
mtxThe mutex for the radio's SPI interface.
Returns
true The radio could be connected to and configured properly.
false The radio could not be connected to or configured.
Todo:
The function puts the rfm23 into sleep mode, then idle mode. Is this intended? idle overrides sleep.

◆ recv()

int32_t Artemis::Devices::RFM23::recv ( PacketComm packet,
uint16_t  timeout 
)

Receive a packet from the radio.

Parameters
packetThe packet that will hold the received data.
timeoutThe time to wait for a packet from the radio.
Returns
int32_t The size of the received packet, or -1 if failed to receive.
Todo:
The transmit and receive pins are set high and low respectively. check if this is intended behavior. either change the pin definitions or use setGpioReversed().

◆ send()

bool Artemis::Devices::RFM23::send ( PacketComm packet)

Sends a packet through the radio.

Parameters
packetThe packet to be sent.
Returns
true The packet was successfully sent.
false There was an error sending the packet.
Todo:
The function puts the rfm23 into sleep mode, then idle mode. Is this intended? idle overrides sleep.
Todo:
The transmit and receive pins are set low and high respectively. check if this is intended behavior. either change the pin definitions or use setGpioReversed().

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