RadioLib
Universal wireless communication library for Arduino
|
Extension of Module class for UART-based modules, only exists to distinguish the UART constructor. More...
#include <Module.h>
Public Member Functions | |
SerialModule (RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, HardwareSerial *serial=nullptr, RADIOLIB_PIN_TYPE rst=RADIOLIB_NC) | |
UART-based module constructor. More... | |
![]() | |
Module (RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst) | |
SPI-based module constructor. Will use the default SPI interface automatically initialize it. More... | |
Module (RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio) | |
Extended SPI-based module constructor. Will use the default SPI interface automatically initialize it. More... | |
Module (RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, SPIClass &spi, SPISettings spiSettings) | |
SPI-based module constructor. More... | |
Module (RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE gpio, SPIClass &spi, SPISettings spiSettings=SPISettings(2000000, MSBFIRST, SPI_MODE0)) | |
Extended SPI-based module constructor. More... | |
Module (RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE rx, RADIOLIB_PIN_TYPE tx, SPIClass &spi=RADIOLIB_DEFAULT_SPI, SPISettings spiSettings=SPISettings(2000000, MSBFIRST, SPI_MODE0), HardwareSerial *serial=nullptr) | |
Generic module constructor. More... | |
Module (const Module &mod) | |
Copy constructor. More... | |
Module & | operator= (const Module &mod) |
Overload for assignment operator. More... | |
void | init (uint8_t interface) |
Initialize low-level module control. More... | |
void | term (uint8_t interface) |
Terminate low-level module control. More... | |
void | ATemptyBuffer () |
Empty internal AT buffer. | |
bool | ATgetResponse () |
Get response after sending AT command. More... | |
bool | ATsendCommand (const char *cmd) |
Send AT command. Will also call ATgetResponse. More... | |
bool | ATsendData (uint8_t *data, uint32_t len) |
Send raw AT data. Will also call ATgetResponse. More... | |
int16_t | SPIgetRegValue (uint8_t reg, uint8_t msb=7, uint8_t lsb=0) |
SPI read method that automatically masks unused bits. This method is the preferred SPI read mechanism. More... | |
int16_t | SPIsetRegValue (uint8_t reg, uint8_t value, uint8_t msb=7, uint8_t lsb=0, uint8_t checkInterval=2, uint8_t checkMask=0xFF) |
Overwrite-safe SPI write method with verification. This method is the preferred SPI write mechanism. More... | |
void | SPIreadRegisterBurst (uint8_t reg, uint8_t numBytes, uint8_t *inBytes) |
SPI burst read method. More... | |
uint8_t | SPIreadRegister (uint8_t reg) |
SPI basic read method. Use of this method is reserved for special cases, SPIgetRegValue should be used instead. More... | |
void | SPIwriteRegisterBurst (uint8_t reg, uint8_t *data, uint8_t numBytes) |
SPI burst write method. More... | |
void | SPIwriteRegister (uint8_t reg, uint8_t data) |
SPI basic write method. Use of this method is reserved for special cases, SPIsetRegValue should be used instead. More... | |
void | SPItransfer (uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) |
SPI single transfer method. More... | |
RADIOLIB_PIN_TYPE | getCs () const |
Access method to get the pin number of SPI chip select. More... | |
RADIOLIB_PIN_TYPE | getIrq () const |
Access method to get the pin number of interrupt/GPIO. More... | |
RADIOLIB_PIN_TYPE | getRst () const |
Access method to get the pin number of hardware reset pin. More... | |
RADIOLIB_PIN_TYPE | getGpio () const |
Access method to get the pin number of second interrupt/GPIO. More... | |
RADIOLIB_PIN_TYPE | getRx () const |
Access method to get the pin number of UART Rx. More... | |
RADIOLIB_PIN_TYPE | getTx () const |
Access method to get the pin number of UART Rx. More... | |
SPIClass * | getSpi () const |
Access method to get the SPI interface. More... | |
SPISettings | getSpiSettings () const |
Access method to get the SPI interface settings. More... | |
void | setRfSwitchPins (RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) |
Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state. When using automatic RF switch control, DO NOT change the pin mode of rxEn or txEn from Arduino sketch! More... | |
void | setRfSwitchState (RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState) |
Set RF switch state. More... | |
Additional Inherited Members | |
![]() | |
static void | pinMode (RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_MODE mode) |
Arduino core pinMode override that checks RADIOLIB_NC as alias for unused pin. More... | |
static void | digitalWrite (RADIOLIB_PIN_TYPE pin, RADIOLIB_PIN_STATUS value) |
Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin. More... | |
static RADIOLIB_PIN_STATUS | digitalRead (RADIOLIB_PIN_TYPE pin) |
Arduino core digitalWrite override that checks RADIOLIB_NC as alias for unused pin. More... | |
static void | tone (RADIOLIB_PIN_TYPE pin, uint16_t value) |
Arduino core tone override that checks RADIOLIB_NC as alias for unused pin and RADIOLIB_TONE_UNSUPPORTED to make sure the platform does support tone. More... | |
static void | noTone (RADIOLIB_PIN_TYPE pin) |
Arduino core noTone override that checks RADIOLIB_NC as alias for unused pin and RADIOLIB_TONE_UNSUPPORTED to make sure the platform does support tone. More... | |
static void | attachInterrupt (RADIOLIB_PIN_TYPE interruptNum, void(*userFunc)(void), RADIOLIB_INTERRUPT_STATUS mode) |
Arduino core attachInterrupt override. More... | |
static void | detachInterrupt (RADIOLIB_PIN_TYPE interruptNum) |
Arduino core detachInterrupt override. More... | |
static void | yield () |
Arduino core yield override. | |
static void | delay (uint32_t ms) |
Arduino core delay override. More... | |
static void | delayMicroseconds (uint32_t us) |
Arduino core delayMicroseconds override. More... | |
static uint32_t | millis () |
Arduino core millis override. | |
static uint32_t | micros () |
Arduino core micros override. | |
static uint8_t | flipBits (uint8_t b) |
Function to reflect bits within a byte. | |
static uint16_t | flipBits16 (uint16_t i) |
Function to reflect bits within an integer. | |
![]() | |
SoftwareSerial * | ModuleSerial |
Internal SoftwareSerial instance. | |
uint32_t | baudrate = 9600 |
Baud rate of SoftwareSerial UART communication. Defaults to 9600 baud. | |
char | AtLineFeed [3] = {'\r', '\n'} |
Line feed to be used when sending AT commands. Defaults to CR+LF. | |
uint8_t | SPIreadCommand = 0b00000000 |
Basic SPI read command. Defaults to 0x00. | |
uint8_t | SPIwriteCommand = 0b10000000 |
Basic SPI write command. Defaults to 0x80. | |
Extension of Module class for UART-based modules, only exists to distinguish the UART constructor.
SerialModule::SerialModule | ( | RADIOLIB_PIN_TYPE | rx, |
RADIOLIB_PIN_TYPE | tx, | ||
HardwareSerial * | serial = nullptr , |
||
RADIOLIB_PIN_TYPE | rst = RADIOLIB_NC |
||
) |
UART-based module constructor.
rx | Arduino pin to be used as Rx pin for SoftwareSerial communication. |
tx | Arduino pin to be used as Tx pin for SoftwareSerial communication. |
serial | HardwareSerial to be used on platforms that do not support SoftwareSerial. Defaults to Serial1. |
rst | Arduino pin to be used as hardware reset for the module. Defaults to NC (unused). |