PicoWAN SDK Documentation
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
radio.h File Reference

SX1272/6 radio driver. More...

Go to the source code of this file.

Data Structures

struct  radio_t
 

Macros

#define RADIO_OSC_STARTUP   1
 
#define RADIO_SLEEP_TO_RX   2
 
#define RADIO_WAKEUP_TIME   (RADIO_OSC_STARTUP + RADIO_SLEEP_TO_RX)
 
#define MAKERPS(sf, bw, cr, ih, nocrc)   ((rps_t) ((sf) | ((bw) << 3) | ((cr) << 7) | ((nocrc) ? (1 << 9) : 0) | ((ih & 0xFF) << 10)))
 

Typedefs

typedef uint8_t cr_t
 
typedef uint8_t sf_t
 
typedef uint8_t bw_t
 
typedef uint8_t dr_t
 
typedef uint32_t rps_t
 

Enumerations

enum  {
  RADIO_RST =0, RADIO_TX =1, RADIO_RX =2,
  RADIO_RXON =3
}
 
enum  _cr_t {
  CR_4_5 = 0, CR_4_6, CR_4_7,
  CR_4_8
}
 
enum  _sf_t {
  FSK = 0, SF6, SF7,
  SF8, SF9, SF10,
  SF11, SF12
}
 
enum  _bw_t {
  BW7_8 = 0, BW10_4, BW15_6,
  BW20_8, BW31_25, BW41_7,
  BW62_5, BW125, BW250,
  BW500
}
 
enum  { STD_PREAMBLE_LEN = 8 }
 
enum  { MAX_LEN_FRAME = 64 }
 

Functions

uint8_t radio_rand1 (void)
 Returns a random byte. More...
 
void radio_init (void)
 Initializes the radio driver.
 
void radio_reset (uint8_t val)
 Resets the SX127x module. More...
 
void radio_irq_handler (uint8_t dio)
 The radio driver IRQ handler. More...
 
uint8_t radio_rssi (void)
 Returns the current RSSI. More...
 
void os_radio (uint8_t mode)
 Changes the radio mode. More...
 
uint8_t radio_read (uint8_t reg)
 Reads a radio register. More...
 
void radio_write (uint8_t addr, uint8_t data)
 Writes a radio register. More...
 

Variables

struct radio_t RADIO
 

Detailed Description

SX1272/6 radio driver.

Macro Definition Documentation

#define RADIO_OSC_STARTUP   1

Radio wakeup time from SLEEP mode

#define RADIO_SLEEP_TO_RX   2

Radio PLL lock and Mode Ready delay which can vary with the temperature

#define RADIO_WAKEUP_TIME   (RADIO_OSC_STARTUP + RADIO_SLEEP_TO_RX)

Radio complete Wake-up Time with margin for temperature compensation

Function Documentation

void os_radio ( uint8_t  mode)

Changes the radio mode.

Parameters
modeThe mode in which the radio will be put. This can be RADIO_RST, RADIO_TX, RADIO_RX, or RADIO_RXON.
void radio_irq_handler ( uint8_t  dio)

The radio driver IRQ handler.

Parameters
dioThe INT number to handle.
uint8_t radio_rand1 ( void  )

Returns a random byte.

Return values
uint8_tA random byte.
uint8_t radio_read ( uint8_t  reg)

Reads a radio register.

The function reads the value of a specific SX127x register.

Parameters
regThe register to read from.
Return values
uint8_tThe value read.
void radio_reset ( uint8_t  val)

Resets the SX127x module.

Parameters
val1 to put the radio in reset, 0 to release the reset.
uint8_t radio_rssi ( void  )

Returns the current RSSI.

The function returns the current RSSI in dBm + 157 dBm. The SX127x has to be in RX mode.

Return values
uint8_tThe RSSI read.
void radio_write ( uint8_t  addr,
uint8_t  data 
)

Writes a radio register.

The function writes a value to a specific SX127x register.

Parameters
addrThe register to write to.
dataThe value to write.