Driver library for SX1272/SX1276 transceivers

Dependents:   LORA_RX LORA_TX WindConcentrator hid_test ... more

Embed: (wiki syntax)

« Back to documentation index

SX127x Class Reference

SX127x Class Reference

FSK/LoRa radio transceiver. More...

#include <sx12xx.h>

Public Member Functions

 SX127x (PinName dio0, PinName dio_1, PinName cs, SPI &, PinName rst)
 Create SX127x instance.
void set_frf_MHz (float MHz)
 set center operating frequency
float get_frf_MHz (void)
 get center operating frequency
void hw_reset (void)
 reset radio using pin
void init (void)
 initialise SX1232 class to radio
uint8_t read_reg (uint8_t addr)
 read register from radio
void ReadBuffer (uint8_t addr, uint8_t *buffer, uint8_t size)
 read register from radio.
void write_reg (uint8_t addr, uint8_t data)
 write register to radio
void WriteBuffer (uint8_t addr, uint8_t *buffer, uint8_t size)
 write register(s) to radio, to an arbitrary amount of registers following first

Data Fields

uint8_t tx_buf [256]
 RF transmit packet buffer.
uint8_t rx_buf [256]
 RF receive packet buffer.
type_e type
 radio chip type plugged in
RegOpMode_t RegOpMode
 operating mode
RegPaConfig_t RegPaConfig
 transmitter power configuration
RegDioMapping1_t RegDioMapping1
 pin assignments
RegDioMapping2_t RegDioMapping2
 pin assignments
Callback< void()> rf_switch

Detailed Description

FSK/LoRa radio transceiver.

see http://en.wikipedia.org/wiki/Chirp_spread_spectrum

Definition at line 210 of file sx12xx.h.


Constructor & Destructor Documentation

SX127x ( PinName  dio0,
PinName  dio_1,
PinName  cs,
SPI &  spi_r,
PinName  rst 
)

Create SX127x instance.

Parameters:
mosiSPI master-out pin
misoSPI master-in pin
sclkSPI clock pin
csSPI chip-select pin
rstradio hardware reset pin
dio_0interrupt pin from radio
fem_ctxrx-tx switch for HF bands (800/900)
fem_cpsrx-tx switch for LF bands (vhf/433)

Definition at line 19 of file sx127x.cpp.


Member Function Documentation

float get_frf_MHz ( void   )

get center operating frequency

Returns:
operating frequency in MHz

Definition at line 243 of file sx127x.cpp.

void hw_reset ( void   )

reset radio using pin

Definition at line 268 of file sx127x.cpp.

void init ( void   )

initialise SX1232 class to radio

Note:
this is called from class instantiation, but must also be manually called after hardware reset

Definition at line 35 of file sx127x.cpp.

uint8_t read_reg ( uint8_t  addr )

read register from radio

Parameters:
addrregister address
Returns:
the value read from the register

Definition at line 109 of file sx127x.cpp.

void ReadBuffer ( uint8_t  addr,
uint8_t *  buffer,
uint8_t  size 
)

read register from radio.

from an arbitrary amount of registers following the first

Parameters:
addrregister address
bufferthe read values will be placed here
sizehow many registers to read

Definition at line 93 of file sx127x.cpp.

void set_frf_MHz ( float  MHz )

set center operating frequency

Parameters:
MHzoperating frequency in MHz

Definition at line 230 of file sx127x.cpp.

void write_reg ( uint8_t  addr,
uint8_t  data 
)

write register to radio

Parameters:
addrregister address
databyte to write

Definition at line 194 of file sx127x.cpp.

void WriteBuffer ( uint8_t  addr,
uint8_t *  buffer,
uint8_t  size 
)

write register(s) to radio, to an arbitrary amount of registers following first

Parameters:
addrregister address
bufferbyte(s) to write
sizecount of registers to write to

Definition at line 204 of file sx127x.cpp.


Field Documentation

RegDioMapping1_t RegDioMapping1

pin assignments

Definition at line 304 of file sx12xx.h.

RegDioMapping2_t RegDioMapping2

pin assignments

Definition at line 307 of file sx12xx.h.

RegOpMode_t RegOpMode

operating mode

Definition at line 293 of file sx12xx.h.

RegPaConfig_t RegPaConfig

transmitter power configuration

Definition at line 296 of file sx12xx.h.

Callback<void()> rf_switch

board-specific RF switch callback, called whenever operating mode is changed This function should also set RegPaConfig.bits.PaSelect to use PA_BOOST or RFO during TX. examples: PE4259-63: controlled directly by radio chip, no software function needed SKY13350-385LF: two separate control lines, requires two DigitalOut pins

Definition at line 321 of file sx12xx.h.

uint8_t rx_buf[256]

RF receive packet buffer.

Definition at line 287 of file sx12xx.h.

uint8_t tx_buf[256]

RF transmit packet buffer.

Definition at line 284 of file sx12xx.h.

type_e type

radio chip type plugged in

Definition at line 290 of file sx12xx.h.