ClusterDuck Protocol
Public Member Functions | List of all members
SX1231 Class Reference

Control class for SX1231 module. Overrides some methods from RF69 due to different register values. More...

#include <SX1231.h>

Inheritance diagram for SX1231:
RF69 PhysicalLayer

Public Member Functions

 SX1231 (Module *mod)
 Default constructor. More...
 
int16_t begin (float freq=434.0, float br=48.0, float rxBw=125.0, float freqDev=50.0, int8_t power=13)
 Initialization method. More...
 
- Public Member Functions inherited from RF69
 RF69 (Module *module)
 Default constructor. More...
 
int16_t begin (float freq=434.0, float br=48.0, float freqDev=50.0, float rxBw=125.0, int8_t power=13)
 Initialization method. More...
 
void reset ()
 Reset method. Will reset the chip to the default state using RST pin.
 
int16_t transmit (uint8_t *data, size_t len, uint8_t addr=0)
 Blocking binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer. More...
 
int16_t receive (uint8_t *data, size_t len)
 Blocking binary receive method. Overloads for string-based transmissions are implemented in PhysicalLayer. More...
 
int16_t sleep ()
 Sets the module to sleep mode. More...
 
int16_t standby ()
 Sets the module to standby mode. More...
 
int16_t transmitDirect (uint32_t frf=0)
 Starts direct mode transmission. More...
 
int16_t receiveDirect ()
 Starts direct mode reception. More...
 
int16_t packetMode ()
 Stops direct mode. It is required to call this method to switch from direct transmissions to packet-based transmissions.
 
void setAESKey (uint8_t *key)
 Sets AES key. More...
 
int16_t enableAES ()
 Enables AES encryption. More...
 
int16_t disableAES ()
 Disables AES encryption. More...
 
void setDio0Action (void(*func)(void))
 Sets interrupt service routine to call when DIO0 activates. More...
 
void clearDio0Action ()
 Clears interrupt service routine to call when DIO0 activates.
 
void setDio1Action (void(*func)(void))
 Sets interrupt service routine to call when DIO1 activates. More...
 
void clearDio1Action ()
 Clears interrupt service routine to call when DIO1 activates.
 
int16_t startTransmit (uint8_t *data, size_t len, uint8_t addr=0)
 Interrupt-driven binary transmit method. Overloads for string-based transmissions are implemented in PhysicalLayer. More...
 
int16_t startReceive ()
 Interrupt-driven receive method. GDO0 will be activated when full packet is received. More...
 
int16_t readData (uint8_t *data, size_t len)
 Reads data received after calling startReceive method. More...
 
int16_t setFrequency (float freq)
 Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510.0 MHz and 862.0 to 1020.0 MHz. More...
 
int16_t setBitRate (float br)
 Sets bit rate. Allowed values range from 1.2 to 300.0 kbps. More...
 
int16_t setRxBandwidth (float rxBw)
 Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25.0, 31.3, 41.7, 50.0, 62.5, 83.3, 100.0, 125.0, 166.7, 200.0, 250.0, 333.3, 400.0 and 500.0 kHz. More...
 
int16_t setFrequencyDeviation (float freqDev)
 Sets frequency deviation. More...
 
int16_t setOutputPower (int8_t power)
 Sets output power. Allowed values are -30, -20, -15, -10, 0, 5, 7 or 10 dBm. More...
 
int16_t setSyncWord (uint8_t *syncWord, size_t len, uint8_t maxErrBits=0)
 Sets sync word. Up to 8 bytes can be set as sync word. More...
 
int16_t setNodeAddress (uint8_t nodeAddr)
 Sets node address. Calling this method will also enable address filtering for node address only. More...
 
int16_t setBroadcastAddress (uint8_t broadAddr)
 Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address. More...
 
int16_t disableAddressFiltering ()
 Disables address filtering. Calling this method will also erase previously set addresses. More...
 
void setAmbientTemperature (int16_t tempAmbient)
 Sets ambient temperature. Required to correct values from on-board temperature sensor. More...
 
int16_t getTemperature ()
 Measures temperature. More...
 
size_t getPacketLength (bool update=true)
 Query modem for the packet length of received payload. More...
 
int16_t fixedPacketLengthMode (uint8_t len=RF69_MAX_PACKET_LENGTH)
 Set modem in fixed packet length mode. More...
 
int16_t variablePacketLengthMode (uint8_t maxLen=RF69_MAX_PACKET_LENGTH)
 Set modem in variable packet length mode. More...
 
int16_t enableSyncWordFiltering (uint8_t maxErrBits=0)
 Enable sync word filtering and generation. More...
 
int16_t disableSyncWordFiltering ()
 Disable preamble and sync word filtering and generation. More...
 
int16_t setCrcFiltering (bool crcOn=true)
 Enable CRC filtering and generation. More...
 
int16_t setPromiscuousMode (bool promiscuous=true)
 Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC). More...
 
int16_t setDataShaping (float sh)
 Sets Gaussian filter bandwidth-time product that will be used for data shaping. Allowed values are 0.3, 0.5 or 1.0. Set to 0 to disable data shaping. More...
 
int16_t setEncoding (uint8_t encoding)
 Sets transmission encoding. More...
 
int16_t transmit (__FlashStringHelper *fstr, uint8_t addr=0)
 Arduino Flash String transmit method. More...
 
int16_t transmit (String &str, uint8_t addr=0)
 Arduino String transmit method. More...
 
int16_t transmit (const char *str, uint8_t addr=0)
 C-string transmit method. More...
 
virtual int16_t transmit (uint8_t *data, size_t len, uint8_t addr=0)=0
 Binary transmit method. Must be implemented in module class. More...
 
int16_t receive (String &str, size_t len=0)
 Arduino String receive method. More...
 
virtual int16_t receive (uint8_t *data, size_t len)=0
 Binary receive method. Must be implemented in module class. More...
 
int16_t startTransmit (String &str, uint8_t addr=0)
 Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes. More...
 
int16_t startTransmit (const char *str, uint8_t addr=0)
 Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes. More...
 
virtual int16_t startTransmit (uint8_t *data, size_t len, uint8_t addr=0)=0
 Interrupt-driven binary transmit method. More...
 
int16_t readData (String &str, size_t len=0)
 Reads data that was received after calling startReceive method. More...
 
virtual int16_t readData (uint8_t *data, size_t len)=0
 Reads data that was received after calling startReceive method. More...
 
- Public Member Functions inherited from PhysicalLayer
 PhysicalLayer (float freqStep, size_t maxPacketLength)
 Default constructor. More...
 
int16_t transmit (__FlashStringHelper *fstr, uint8_t addr=0)
 Arduino Flash String transmit method. More...
 
int16_t transmit (String &str, uint8_t addr=0)
 Arduino String transmit method. More...
 
int16_t transmit (const char *str, uint8_t addr=0)
 C-string transmit method. More...
 
int16_t receive (String &str, size_t len=0)
 Arduino String receive method. More...
 
int16_t startTransmit (String &str, uint8_t addr=0)
 Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes. More...
 
int16_t startTransmit (const char *str, uint8_t addr=0)
 Interrupt-driven Arduino String transmit method. Unlike the standard transmit method, this one is non-blocking. Interrupt pin will be activated when transmission finishes. More...
 
int16_t readData (String &str, size_t len=0)
 Reads data that was received after calling startReceive method. More...
 
float getFreqStep ()
 Gets the module frequency step size that was set in constructor. More...
 

Additional Inherited Members

- Public Attributes inherited from RF69
float lastPacketRSSI
 RSSI value of the last received packet.
 
- Protected Member Functions inherited from RF69
int16_t config ()
 
int16_t directMode ()
 
int16_t setPacketMode (uint8_t mode, uint8_t len)
 
- Protected Attributes inherited from RF69
Module_mod
 
float _br
 
float _rxBw
 
int16_t _tempOffset
 
size_t _packetLength
 
bool _packetLengthQueried
 
uint8_t _packetLengthConfig
 
bool _promiscuous
 
uint8_t _syncWordLength
 

Detailed Description

Control class for SX1231 module. Overrides some methods from RF69 due to different register values.

Constructor & Destructor Documentation

◆ SX1231()

SX1231::SX1231 ( Module mod)

Default constructor.

Parameters
modInstance of Module that will be used to communicate with the radio.

Member Function Documentation

◆ begin()

int16_t SX1231::begin ( float  freq = 434.0,
float  br = 48.0,
float  rxBw = 125.0,
float  freqDev = 50.0,
int8_t  power = 13 
)

Initialization method.

Parameters
freqCarrier frequency in MHz. Defaults to 434.0 MHz.
brBit rate to be used in kbps. Defaults to 48.0 kbps.
rxBwReceiver bandwidth in kHz. Defaults to 125.0 kHz.
freqDevFrequency deviation from carrier frequency in kHz Defaults to 50.0 kHz.
powerOutput power in dBm. Defaults to 13 dBm.
Returns
Status Codes

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