14#define SX1272_REG_FIFO 0x00
15#define SX1272_REG_FIFO_ADDR_PTR 0x0D
16#define SX1272_REG_FIFO_TX_BASE_ADDR 0x0E
17#define SX1272_REG_FIFO_RX_BASE_ADDR 0x0F
18#define SX1272_REG_FIFO_RX_CURR_ADDR 0x10
20#define SX1272_REG_RX_BYTES 0x13
22#define SX1272_REG_DIO_MAPPING1 0x40
23#define SX1272_DIO_MAPPING_DIO0_Pos 0x06
24#define SX1272_DIO_MAPPING_DIO1_Pos 0x04
25#define SX1272_DIO_MAPPING_DIO2_Pos 0x02
26#define SX1272_DIO_MAPPING_DIO3_Pos 0x00
27#define SX1272_DIO_MAPPING_DIO4_Pos 0x06
28#define SX1272_DIO_MAPPING_DIO5_Pos 0x04
30#define SX1272_LORA_DIO_RXDONE 0x00 << SX1272_DIO_MAPPING_DIO0_Pos
31#define SX1272_LORA_DIO_TXDONE 0x01 << SX1272_DIO_MAPPING_DIO0_Pos
33#define SX1272_REG_IRQ_FLAGS_MASK 0x11
34#define SX1272_REG_IRQ_FLAGS 0x12
35#define SX1272_LORA_IRQ_RXDONE 0x40
36#define SX1272_LORA_IRQ_TXDONE 0x08
38#define SX1272_REG_OP_MODE 0x01
39#define SX1272_OP_MODE_LONG_RANGE_Pos 0x07
40#define SX1272_OP_MODE_MODE_Pos 0x00
42#define SX1272_REG_MODEM_CONFIG1 0x1D
43#define SX1272_REG_MODEM_CONFIG1_BW_Pos 0x06
44#define SX1272_REG_MODEM_CONFIG1_CR_Pos 0x03
45#define SX1272_REG_MODEM_CONFIG1_CRC_Pos 0x01
47#define SX1272_REG_MODEM_CONFIG2 0x1E
48#define SX1272_REG_MODEM_CONFIG2_SF_Pos 0x04
50#define SX1272_REG_PA_CONFIG 0x09
51#define SX1272_PA_SELECT 0x80
53#define SX1272_REG_LNA 0x0C
55#define SX1272_REG_PAYLOAD_LENGTH 0x22
56#define SX1272_REG_MAX_PAYLOAD_LENGTH 0x23
62#define LORA_MSG_LENGTH 0x20
63#define LORA_MSG_PAYLOAD_LENGTH (LORA_MSG_LENGTH - 1)
119 SX1272_MODE_RXCONTINUOUS,
120 SX1272_MODE_RXSINGLE,
126 uint8_t
data[LORA_MSG_PAYLOAD_LENGTH];
133typedef struct SX1272 {
156void SX1272_writeRegister(
SX1272_t *, uint8_t, uint8_t);
157uint8_t SX1272_readRegister(
SX1272_t *, uint8_t);
Struct definition for a GPIO pin.
Struct definition for SPI interface. Provides the interface for API consumers to interact with the SP...
uint8_t id
Packet header ID.
void(* enableBoost)(struct SX1272 *, bool)
Power amp boost toggle method.
void(* standby)(struct SX1272 *)
SX1272 standby method.
uint8_t data[LORA_MSG_PAYLOAD_LENGTH]
Packet payload.
void(* startReceive)(struct SX1272 *)
SX1272 LoRa continuous receive method.
bool(* readReceive)(struct SX1272 *, uint8_t *, uint8_t)
SX1272 LoRa receive buffer read method.
GPIOpin_t cs
Chip select GPIO.
void(* transmit)(struct SX1272 *, uint8_t *)
SX1272 LoRa transmit method.
SPI_t * base
Parent SPI interface.
void(* clearIRQ)(struct SX1272 *, uint8_t)
SX1272 LoRa IRQ flag clear method.
SX1272_Mode currentMode
Current operating mode.
void SX1272_transmit(SX1272_t *, uint8_t *)
Transmits data using the SX1272.
SX1272_Bandwidth
SX1272 bandwidth enum.
void _SX1272_setMode(SX1272_t *, SX1272_Mode)
Sets the operational mode of the LoRa module.
bool SX1272_readReceive(SX1272_t *, uint8_t *, uint8_t)
Reads contents of received packet to local buffer from the SX1272.
SX1272_SpreadingFactor
SX1272 spreading factor enum.
SX1272_Mode
SX1272 operating mode enum.
void SX1272_standby(SX1272_t *)
Sets the operational mode of the LoRa module to standby.
SX1272_t SX1272_init(SX1272_t *, SPI_t *, GPIOpin_t, SX1272_Bandwidth, SX1272_SpreadingFactor, SX1272_CodingRate)
Initializes the LoRa module with specified configuration parameters.
SX1272_CodingRate
SX1272 coding rate enum.
void SX1272_startReceive(SX1272_t *)
Begins continuous receive on the SX1272.
void SX1272_enableBoost(SX1272_t *, bool)
Enables/disables power amplifier boost.
void SX1272_clearIRQ(SX1272_t *, uint8_t)
Sets the value of RegIrqFlags in the SX1272 to the provided argument value. Writing a 1 to a bit in t...
Struct definition for SX1272. Provides the interface for API consumers to interact with the SX1272 Lo...