mirror of https://github.com/ARMmbed/mbed-os.git
Initial commit
commit
0d536766be
|
@ -0,0 +1,25 @@
|
|||
Copyright 2017 Arm Limited and affiliates.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,25 @@
|
|||
--- Revised BSD License ---
|
||||
Copyright (c) 2013, SEMTECH S.A.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Semtech corporation nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL SEMTECH S.A. BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1 @@
|
|||
# Mbed enabled SX1272 LoRa/FSK radio driver
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,402 @@
|
|||
/**
|
||||
/ _____) _ | |
|
||||
( (____ _____ ____ _| |_ _____ ____| |__
|
||||
\____ \| ___ | (_ _) ___ |/ ___) _ \
|
||||
_____) ) ____| | | || |_| ____( (___| | | |
|
||||
(______/|_____)_|_|_| \__)_____)\____)_| |_|
|
||||
(C)2013 Semtech
|
||||
___ _____ _ ___ _ _____ ___ ___ ___ ___
|
||||
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
|
||||
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
|
||||
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
|
||||
embedded.connectivity.solutions===============
|
||||
|
||||
Description: Radio driver for Semtech SX1272 radio. Implements LoRaRadio class.
|
||||
|
||||
License: Revised BSD License, see LICENSE.TXT file include in the project
|
||||
|
||||
Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
|
||||
|
||||
|
||||
Copyright (c) 2017, Arm Limited and affiliates.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef SX1272_LORARADIO_H_
|
||||
#define SX1272_LORARADIO_H_
|
||||
|
||||
#include "netsocket/LoRaRadio.h"
|
||||
|
||||
#ifdef MBED_SX1272_LORARADIO_BUFFER_SIZE
|
||||
#define MAX_DATA_BUFFER_SIZE MBED_SX1272_LORARADIO_BUFFER_SIZE
|
||||
#else
|
||||
#define MAX_DATA_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PinName rf_switch_ctl1;
|
||||
PinName rf_switch_ctl2;
|
||||
PinName txctl;
|
||||
PinName rxctl;
|
||||
PinName ant_switch;
|
||||
PinName pwr_amp_ctl;
|
||||
} rf_ctrls;
|
||||
|
||||
/**
|
||||
* Radio driver implementation for Semtech SX1272 plus variants.
|
||||
* Supports only SPI at the moment. Implements pure virtual LoRaRadio class.
|
||||
*/
|
||||
class SX1272_LoRaRadio: public LoRaRadio {
|
||||
public:
|
||||
/**
|
||||
* Use this constructor if pin definitions are provided manually.
|
||||
* The pins that are marked NC are optional. It is assumed that these
|
||||
* pins are not connected until/unless configured otherwise.
|
||||
*/
|
||||
SX1272_LoRaRadio(PinName mosi, PinName miso, PinName sclk, PinName nss,
|
||||
PinName reset, PinName dio0, PinName dio1, PinName dio2,
|
||||
PinName dio3, PinName dio4, PinName dio5,
|
||||
PinName rf_switch_ctl1=NC,
|
||||
PinName rf_switch_ctl2=NC, PinName txctl = NC,
|
||||
PinName rxctl = NC, PinName ant_switch = NC,
|
||||
PinName pwr_amp_ctl = NC);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~SX1272_LoRaRadio();
|
||||
|
||||
/**
|
||||
* Registers radio events with the Mbed LoRaWAN stack and
|
||||
* undergoes initialization steps if any
|
||||
*
|
||||
* @param events Structure containing the driver callback functions
|
||||
*/
|
||||
virtual void init_radio(radio_events_t *events);
|
||||
|
||||
/**
|
||||
* Resets the radio module
|
||||
*/
|
||||
virtual void radio_reset();
|
||||
|
||||
/**
|
||||
* Put the RF module in sleep mode
|
||||
*/
|
||||
virtual void sleep(void);
|
||||
|
||||
/**
|
||||
* Sets the radio in standby mode
|
||||
*/
|
||||
virtual void standby(void);
|
||||
|
||||
/**
|
||||
* Sets the reception parameters
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param bandwidth Sets the bandwidth
|
||||
* FSK : >= 2600 and <= 250000 Hz
|
||||
* LoRa: [0: 125 kHz, 1: 250 kHz,
|
||||
* 2: 500 kHz, 3: Reserved]
|
||||
* @param datarate Sets the Datarate
|
||||
* FSK : 600..300000 bits/s
|
||||
* LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
|
||||
* 10: 1024, 11: 2048, 12: 4096 chips]
|
||||
* @param coderate Sets the coding rate ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
|
||||
* @param bandwidth_afc Sets the AFC Bandwidth ( FSK only )
|
||||
* FSK : >= 2600 and <= 250000 Hz
|
||||
* LoRa: N/A ( set to 0 )
|
||||
* @param preamble_len Sets the Preamble length ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: Length in symbols ( the hardware adds 4 more symbols )
|
||||
* @param symb_timeout Sets the RxSingle timeout value
|
||||
* FSK : timeout number of bytes
|
||||
* LoRa: timeout in symbols
|
||||
* @param fixLen Fixed length packets [0: variable, 1: fixed]
|
||||
* @param payload_len Sets payload length when fixed lenght is used
|
||||
* @param crc_on Enables/Disables the CRC [0: OFF, 1: ON]
|
||||
* @param freq_hop_on Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
|
||||
* @param hop_period Number of symbols bewteen each hop (LoRa only)
|
||||
* @param iq_inverted Inverts IQ signals ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [0: not inverted, 1: inverted]
|
||||
* @param rx_continuous Sets the reception in continuous mode
|
||||
* [false: single mode, true: continuous mode]
|
||||
*/
|
||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
||||
uint32_t datarate, uint8_t coderate,
|
||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||
uint16_t symb_timeout, bool fix_len,
|
||||
uint8_t payload_len,
|
||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||
bool iq_inverted, bool rx_continuous);
|
||||
|
||||
/**
|
||||
* Sets the transmission parameters
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param power Sets the output power [dBm]
|
||||
* @param fdev Sets the frequency deviation ( FSK only )
|
||||
* FSK : [Hz]
|
||||
* LoRa: 0
|
||||
* @param bandwidth Sets the bandwidth ( LoRa only )
|
||||
* FSK : 0
|
||||
* LoRa: [0: 125 kHz, 1: 250 kHz,
|
||||
* 2: 500 kHz, 3: Reserved]
|
||||
* @param datarate Sets the Datarate
|
||||
* FSK : 600..300000 bits/s
|
||||
* LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
|
||||
* 10: 1024, 11: 2048, 12: 4096 chips]
|
||||
* @param coderate Sets the coding rate ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
|
||||
* @param preamble_len Sets the preamble length
|
||||
* @param fix_len Fixed length packets [0: variable, 1: fixed]
|
||||
* @param crc_on Enables disables the CRC [0: OFF, 1: ON]
|
||||
* @param freq_hop_on Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
|
||||
* @param hop_period Number of symbols bewteen each hop (LoRa only)
|
||||
* @param iq_inverted Inverts IQ signals ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [0: not inverted, 1: inverted]
|
||||
* @param timeout Transmission timeout [us]
|
||||
*/
|
||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||
uint32_t bandwidth, uint32_t datarate,
|
||||
uint8_t coderate, uint16_t preamble_len,
|
||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Sends the buffer of size
|
||||
*
|
||||
* Prepares the packet to be sent and sets the radio in transmission
|
||||
*
|
||||
* @param buffer Buffer pointer
|
||||
* @param size Buffer size
|
||||
*/
|
||||
virtual void send(uint8_t *buffer, uint8_t size);
|
||||
|
||||
/**
|
||||
* Sets the radio in reception mode for the given time
|
||||
*
|
||||
* It should be noted that if the timeout is set to 0, it essentially
|
||||
* puts the receiver in continuous mode and hence from thereon it should
|
||||
* be treated as if in continuous mode. However, an appropriate way of
|
||||
* setting the receiver in continuous mode is by using set_rx_config()
|
||||
* API.
|
||||
*
|
||||
* @param timeout Reception timeout [ms]
|
||||
*
|
||||
*/
|
||||
virtual void receive(uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Sets the carrier frequency
|
||||
*
|
||||
* @param freq Channel RF frequency
|
||||
*/
|
||||
virtual void set_channel(uint32_t freq);
|
||||
|
||||
/**
|
||||
* Generates a 32 bits random value based on the RSSI readings
|
||||
*
|
||||
* Remark this function sets the radio in LoRa modem mode and disables
|
||||
* all interrupts.
|
||||
* After calling this function either Radio.SetRxConfig or
|
||||
* Radio.SetTxConfig functions must be called.
|
||||
*
|
||||
* @return 32 bits random value
|
||||
*/
|
||||
virtual uint32_t random(void);
|
||||
|
||||
/**
|
||||
* Get radio status
|
||||
*
|
||||
* @param status Radio status [RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING]
|
||||
* @return Return current radio status
|
||||
*/
|
||||
virtual uint8_t get_status(void);
|
||||
|
||||
/**
|
||||
* Sets the maximum payload length
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param max Maximum payload length in bytes
|
||||
*/
|
||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max);
|
||||
|
||||
/**
|
||||
* Sets the network to public or private
|
||||
*
|
||||
* Updates the sync byte. Applies to LoRa modem only
|
||||
*
|
||||
* @param enable if true, it enables a public network
|
||||
*/
|
||||
virtual void set_public_network(bool enable);
|
||||
|
||||
/**
|
||||
* Computes the packet time on air for the given payload
|
||||
*
|
||||
* Remark can only be called once SetRxConfig or SetTxConfig have been called
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param pkt_len Packet payload length
|
||||
* @return Computed airTime for the given packet payload length
|
||||
*/
|
||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len);
|
||||
|
||||
/**
|
||||
* Perform carrier sensing
|
||||
*
|
||||
* Checks for a certain time if the RSSI is above a given threshold.
|
||||
* This threshold determines if there is already a transmission going on
|
||||
* in the channel or not.
|
||||
*
|
||||
* @param modem Type of the radio modem
|
||||
* @param freq Carrier frequency
|
||||
* @param rssi_threshold Threshold value of RSSI
|
||||
* @param max_carrier_sense_time time to sense the channel
|
||||
*
|
||||
* @return true if there is no active transmission
|
||||
* in the channel, false otherwise
|
||||
*/
|
||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||
uint32_t freq,
|
||||
int16_t rssi_threshold,
|
||||
uint32_t max_carrier_sense_time);
|
||||
|
||||
/**
|
||||
* Sets the radio in CAD mode
|
||||
*
|
||||
*/
|
||||
virtual void start_cad(void);
|
||||
|
||||
/**
|
||||
* Check if the given RF is in range
|
||||
*
|
||||
* @param frequency frequency needed to be checked
|
||||
*/
|
||||
virtual bool check_rf_frequency(uint32_t frequency);
|
||||
|
||||
/** Sets the radio in continuous wave transmission mode
|
||||
*
|
||||
* @param freq Channel RF frequency
|
||||
* @param power Sets the output power [dBm]
|
||||
* @param time Transmission mode timeout [s]
|
||||
*/
|
||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time);
|
||||
|
||||
/**
|
||||
* Acquire exclusive access
|
||||
*/
|
||||
virtual void lock(void);
|
||||
|
||||
/**
|
||||
* Release exclusive access
|
||||
*/
|
||||
virtual void unlock(void);
|
||||
|
||||
private:
|
||||
|
||||
// SPI and chip select control
|
||||
SPI _spi;
|
||||
DigitalOut _chip_select;
|
||||
|
||||
// module rest control
|
||||
DigitalInOut _reset_ctl;
|
||||
|
||||
// Interrupt controls
|
||||
InterruptIn _dio0_ctl;
|
||||
InterruptIn _dio1_ctl;
|
||||
InterruptIn _dio2_ctl;
|
||||
InterruptIn _dio3_ctl;
|
||||
InterruptIn _dio4_ctl;
|
||||
InterruptIn _dio5_ctl;
|
||||
|
||||
// Radio specific controls
|
||||
DigitalOut _rf_switch_ctl1;
|
||||
DigitalOut _rf_switch_ctl2;
|
||||
DigitalOut _txctl;
|
||||
DigitalOut _rxctl;
|
||||
DigitalInOut _ant_switch;
|
||||
DigitalOut _pwr_amp_ctl;
|
||||
|
||||
// Contains all RF control pin names
|
||||
// This storage is needed even after assigning the
|
||||
// pins to corresponding object, as the driver needs to know
|
||||
// which control pins are connected and which are not. This
|
||||
// variation is inherent to driver because of target configuration.
|
||||
rf_ctrls _rf_ctrls;
|
||||
|
||||
// Structure containing all user and network specified settings
|
||||
// for radio module
|
||||
radio_settings_t _rf_settings;
|
||||
|
||||
// Structure containing function pointers to the stack callbacks
|
||||
radio_events_t *_radio_events;
|
||||
|
||||
// Data buffer used for both TX and RX
|
||||
// Size of this buffer is configurable via Mbed config system
|
||||
// Default is 256 bytes
|
||||
uint8_t _data_buffer[MAX_DATA_BUFFER_SIZE];
|
||||
|
||||
// TX/RX Timers - all use milisecond units
|
||||
Timeout tx_timeout_timer;
|
||||
Timeout rx_timeout_timer;
|
||||
Timeout rx_timeout_sync_word;
|
||||
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
// Thread to handle interrupts
|
||||
Thread irq_thread;
|
||||
#endif
|
||||
|
||||
// Access protection
|
||||
PlatformMutex mutex;
|
||||
|
||||
// helper functions
|
||||
void setup_registers();
|
||||
void default_antenna_switch_ctrls();
|
||||
void set_antenna_switch(uint8_t operation_mode);
|
||||
void setup_spi();
|
||||
void gpio_init();
|
||||
void gpio_deinit();
|
||||
void setup_interrupts();
|
||||
void set_modem(uint8_t modem);
|
||||
void set_operation_mode(uint8_t mode);
|
||||
void set_low_power_mode(bool status);
|
||||
void set_sx1272_variant_type();
|
||||
uint8_t get_pa_conf_reg();
|
||||
void set_rf_tx_power(int8_t power);
|
||||
int16_t get_rssi(radio_modems_t modem);
|
||||
uint8_t get_fsk_bw_reg_val(uint32_t bandwidth);
|
||||
void write_to_register(uint8_t addr, uint8_t data);
|
||||
void write_to_register(uint8_t addr, uint8_t *data, uint8_t size);
|
||||
uint8_t read_register(uint8_t addr);
|
||||
void read_register(uint8_t addr, uint8_t *buffer, uint8_t size);
|
||||
void write_fifo(uint8_t *buffer, uint8_t size);
|
||||
void read_fifo(uint8_t *buffer, uint8_t size);
|
||||
void transmit(uint32_t timeout);
|
||||
void rf_irq_task(void);
|
||||
|
||||
// ISRs
|
||||
void dio0_irq_isr();
|
||||
void dio1_irq_isr();
|
||||
void dio2_irq_isr();
|
||||
void dio3_irq_isr();
|
||||
void dio4_irq_isr();
|
||||
void dio5_irq_isr();
|
||||
void timeout_irq_isr();
|
||||
|
||||
// Handlers called by thread in response to signal
|
||||
void handle_dio0_irq();
|
||||
void handle_dio1_irq();
|
||||
void handle_dio2_irq();
|
||||
void handle_dio3_irq();
|
||||
void handle_dio4_irq();
|
||||
void handle_dio5_irq();
|
||||
void handle_timeout_irq();
|
||||
};
|
||||
|
||||
#endif /* SX1272_LORARADIO_H_ */
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "sx1272-lora-driver",
|
||||
"config": {
|
||||
"spi-frequency": {
|
||||
"help": "SPI frequency, Default: 8 MHz",
|
||||
"value": 8000000
|
||||
},
|
||||
"buffer-size": {
|
||||
"help": "Max. buffer size the radio can handle, Default: 256 B",
|
||||
"value": 256
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,549 @@
|
|||
/**
|
||||
/ _____) _ | |
|
||||
( (____ _____ ____ _| |_ _____ ____| |__
|
||||
\____ \| ___ | (_ _) ___ |/ ___) _ \
|
||||
_____) ) ____| | | || |_| ____( (___| | | |
|
||||
(______/|_____)_|_|_| \__)_____)\____)_| |_|
|
||||
(C) 2015 Semtech
|
||||
|
||||
Description: SX1272 LoRa modem registers and bits definitions
|
||||
|
||||
License: Revised BSD License, see LICENSE.TXT file include in the project
|
||||
|
||||
Maintainer: Miguel Luis and Gregory Cristian
|
||||
|
||||
Copyright (c) 2017, Arm Limited and affiliates.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef __SX1272_REGS_LORA_H__
|
||||
#define __SX1272_REGS_LORA_H__
|
||||
|
||||
/*!
|
||||
* ============================================================================
|
||||
* SX1272 Internal registers Address
|
||||
* ============================================================================
|
||||
*/
|
||||
#define REG_LR_FIFO 0x00
|
||||
// Common settings
|
||||
#define REG_LR_OPMODE 0x01
|
||||
#define REG_LR_FRFMSB 0x06
|
||||
#define REG_LR_FRFMID 0x07
|
||||
#define REG_LR_FRFLSB 0x08
|
||||
// Tx settings
|
||||
#define REG_LR_PACONFIG 0x09
|
||||
#define REG_LR_PARAMP 0x0A
|
||||
#define REG_LR_OCP 0x0B
|
||||
// Rx settings
|
||||
#define REG_LR_LNA 0x0C
|
||||
// LoRa registers
|
||||
#define REG_LR_FIFOADDRPTR 0x0D
|
||||
#define REG_LR_FIFOTXBASEADDR 0x0E
|
||||
#define REG_LR_FIFORXBASEADDR 0x0F
|
||||
#define REG_LR_FIFORXCURRENTADDR 0x10
|
||||
#define REG_LR_IRQFLAGSMASK 0x11
|
||||
#define REG_LR_IRQFLAGS 0x12
|
||||
#define REG_LR_RXNBBYTES 0x13
|
||||
#define REG_LR_RXHEADERCNTVALUEMSB 0x14
|
||||
#define REG_LR_RXHEADERCNTVALUELSB 0x15
|
||||
#define REG_LR_RXPACKETCNTVALUEMSB 0x16
|
||||
#define REG_LR_RXPACKETCNTVALUELSB 0x17
|
||||
#define REG_LR_MODEMSTAT 0x18
|
||||
#define REG_LR_PKTSNRVALUE 0x19
|
||||
#define REG_LR_PKTRSSIVALUE 0x1A
|
||||
#define REG_LR_RSSIVALUE 0x1B
|
||||
#define REG_LR_HOPCHANNEL 0x1C
|
||||
#define REG_LR_MODEMCONFIG1 0x1D
|
||||
#define REG_LR_MODEMCONFIG2 0x1E
|
||||
#define REG_LR_SYMBTIMEOUTLSB 0x1F
|
||||
#define REG_LR_PREAMBLEMSB 0x20
|
||||
#define REG_LR_PREAMBLELSB 0x21
|
||||
#define REG_LR_PAYLOADLENGTH 0x22
|
||||
#define REG_LR_PAYLOADMAXLENGTH 0x23
|
||||
#define REG_LR_HOPPERIOD 0x24
|
||||
#define REG_LR_FIFORXBYTEADDR 0x25
|
||||
#define REG_LR_FEIMSB 0x28
|
||||
#define REG_LR_FEIMID 0x29
|
||||
#define REG_LR_FEILSB 0x2A
|
||||
#define REG_LR_RSSIWIDEBAND 0x2C
|
||||
#define REG_LR_DETECTOPTIMIZE 0x31
|
||||
#define REG_LR_INVERTIQ 0x33
|
||||
#define REG_LR_DETECTIONTHRESHOLD 0x37
|
||||
#define REG_LR_SYNCWORD 0x39
|
||||
#define REG_LR_INVERTIQ2 0x3B
|
||||
|
||||
// end of documented register in datasheet
|
||||
// I/O settings
|
||||
#define REG_LR_DIOMAPPING1 0x40
|
||||
#define REG_LR_DIOMAPPING2 0x41
|
||||
// Version
|
||||
#define REG_LR_VERSION 0x42
|
||||
// Additional settings
|
||||
#define REG_LR_AGCREF 0x43
|
||||
#define REG_LR_AGCTHRESH1 0x44
|
||||
#define REG_LR_AGCTHRESH2 0x45
|
||||
#define REG_LR_AGCTHRESH3 0x46
|
||||
#define REG_LR_PLLHOP 0x4B
|
||||
#define REG_LR_TCXO 0x58
|
||||
#define REG_LR_PADAC 0x5A
|
||||
#define REG_LR_PLL 0x5C
|
||||
#define REG_LR_PLLLOWPN 0x5E
|
||||
#define REG_LR_FORMERTEMP 0x6C
|
||||
|
||||
/*!
|
||||
* ============================================================================
|
||||
* SX1272 LoRa bits control definition
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFifo
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegOpMode
|
||||
*/
|
||||
#define RFLR_OPMODE_LONGRANGEMODE_MASK 0x7F
|
||||
#define RFLR_OPMODE_LONGRANGEMODE_OFF 0x00 // Default
|
||||
#define RFLR_OPMODE_LONGRANGEMODE_ON 0x80
|
||||
|
||||
#define RFLR_OPMODE_ACCESSSHAREDREG_MASK 0xBF
|
||||
#define RFLR_OPMODE_ACCESSSHAREDREG_ENABLE 0x40
|
||||
#define RFLR_OPMODE_ACCESSSHAREDREG_DISABLE 0x00 // Default
|
||||
|
||||
#define RFLR_OPMODE_MASK 0xF8
|
||||
#define RFLR_OPMODE_SLEEP 0x00
|
||||
#define RFLR_OPMODE_STANDBY 0x01 // Default
|
||||
#define RFLR_OPMODE_SYNTHESIZER_TX 0x02
|
||||
#define RFLR_OPMODE_TRANSMITTER 0x03
|
||||
#define RFLR_OPMODE_SYNTHESIZER_RX 0x04
|
||||
#define RFLR_OPMODE_RECEIVER 0x05
|
||||
// LoRa specific modes
|
||||
#define RFLR_OPMODE_RECEIVER_SINGLE 0x06
|
||||
#define RFLR_OPMODE_CAD 0x07
|
||||
|
||||
/*!
|
||||
* RegFrf (MHz)
|
||||
*/
|
||||
#define RFLR_FRFMSB_915_MHZ 0xE4 // Default
|
||||
#define RFLR_FRFMID_915_MHZ 0xC0 // Default
|
||||
#define RFLR_FRFLSB_915_MHZ 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegPaConfig
|
||||
*/
|
||||
#define RFLR_PACONFIG_PASELECT_MASK 0x7F
|
||||
#define RFLR_PACONFIG_PASELECT_PABOOST 0x80
|
||||
#define RFLR_PACONFIG_PASELECT_RFO 0x00 // Default
|
||||
|
||||
#define RFLR_PACONFIG_OUTPUTPOWER_MASK 0xF0
|
||||
|
||||
/*!
|
||||
* RegPaRamp
|
||||
*/
|
||||
#define RFLR_PARAMP_LOWPNTXPLL_MASK 0xE0
|
||||
#define RFLR_PARAMP_LOWPNTXPLL_OFF 0x10 // Default
|
||||
#define RFLR_PARAMP_LOWPNTXPLL_ON 0x00
|
||||
|
||||
#define RFLR_PARAMP_MASK 0xF0
|
||||
#define RFLR_PARAMP_3400_US 0x00
|
||||
#define RFLR_PARAMP_2000_US 0x01
|
||||
#define RFLR_PARAMP_1000_US 0x02
|
||||
#define RFLR_PARAMP_0500_US 0x03
|
||||
#define RFLR_PARAMP_0250_US 0x04
|
||||
#define RFLR_PARAMP_0125_US 0x05
|
||||
#define RFLR_PARAMP_0100_US 0x06
|
||||
#define RFLR_PARAMP_0062_US 0x07
|
||||
#define RFLR_PARAMP_0050_US 0x08
|
||||
#define RFLR_PARAMP_0040_US 0x09 // Default
|
||||
#define RFLR_PARAMP_0031_US 0x0A
|
||||
#define RFLR_PARAMP_0025_US 0x0B
|
||||
#define RFLR_PARAMP_0020_US 0x0C
|
||||
#define RFLR_PARAMP_0015_US 0x0D
|
||||
#define RFLR_PARAMP_0012_US 0x0E
|
||||
#define RFLR_PARAMP_0010_US 0x0F
|
||||
|
||||
/*!
|
||||
* RegOcp
|
||||
*/
|
||||
#define RFLR_OCP_MASK 0xDF
|
||||
#define RFLR_OCP_ON 0x20 // Default
|
||||
#define RFLR_OCP_OFF 0x00
|
||||
|
||||
#define RFLR_OCP_TRIM_MASK 0xE0
|
||||
#define RFLR_OCP_TRIM_045_MA 0x00
|
||||
#define RFLR_OCP_TRIM_050_MA 0x01
|
||||
#define RFLR_OCP_TRIM_055_MA 0x02
|
||||
#define RFLR_OCP_TRIM_060_MA 0x03
|
||||
#define RFLR_OCP_TRIM_065_MA 0x04
|
||||
#define RFLR_OCP_TRIM_070_MA 0x05
|
||||
#define RFLR_OCP_TRIM_075_MA 0x06
|
||||
#define RFLR_OCP_TRIM_080_MA 0x07
|
||||
#define RFLR_OCP_TRIM_085_MA 0x08
|
||||
#define RFLR_OCP_TRIM_090_MA 0x09
|
||||
#define RFLR_OCP_TRIM_095_MA 0x0A
|
||||
#define RFLR_OCP_TRIM_100_MA 0x0B // Default
|
||||
#define RFLR_OCP_TRIM_105_MA 0x0C
|
||||
#define RFLR_OCP_TRIM_110_MA 0x0D
|
||||
#define RFLR_OCP_TRIM_115_MA 0x0E
|
||||
#define RFLR_OCP_TRIM_120_MA 0x0F
|
||||
#define RFLR_OCP_TRIM_130_MA 0x10
|
||||
#define RFLR_OCP_TRIM_140_MA 0x11
|
||||
#define RFLR_OCP_TRIM_150_MA 0x12
|
||||
#define RFLR_OCP_TRIM_160_MA 0x13
|
||||
#define RFLR_OCP_TRIM_170_MA 0x14
|
||||
#define RFLR_OCP_TRIM_180_MA 0x15
|
||||
#define RFLR_OCP_TRIM_190_MA 0x16
|
||||
#define RFLR_OCP_TRIM_200_MA 0x17
|
||||
#define RFLR_OCP_TRIM_210_MA 0x18
|
||||
#define RFLR_OCP_TRIM_220_MA 0x19
|
||||
#define RFLR_OCP_TRIM_230_MA 0x1A
|
||||
#define RFLR_OCP_TRIM_240_MA 0x1B
|
||||
|
||||
/*!
|
||||
* RegLna
|
||||
*/
|
||||
#define RFLR_LNA_GAIN_MASK 0x1F
|
||||
#define RFLR_LNA_GAIN_G1 0x20 // Default
|
||||
#define RFLR_LNA_GAIN_G2 0x40
|
||||
#define RFLR_LNA_GAIN_G3 0x60
|
||||
#define RFLR_LNA_GAIN_G4 0x80
|
||||
#define RFLR_LNA_GAIN_G5 0xA0
|
||||
#define RFLR_LNA_GAIN_G6 0xC0
|
||||
|
||||
#define RFLR_LNA_BOOST_MASK 0xFC
|
||||
#define RFLR_LNA_BOOST_OFF 0x00 // Default
|
||||
#define RFLR_LNA_BOOST_ON 0x03
|
||||
|
||||
/*!
|
||||
* RegFifoAddrPtr
|
||||
*/
|
||||
#define RFLR_FIFOADDRPTR 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoTxBaseAddr
|
||||
*/
|
||||
#define RFLR_FIFOTXBASEADDR 0x80 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoTxBaseAddr
|
||||
*/
|
||||
#define RFLR_FIFORXBASEADDR 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoRxCurrentAddr (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegIrqFlagsMask
|
||||
*/
|
||||
#define RFLR_IRQFLAGS_RXTIMEOUT_MASK 0x80
|
||||
#define RFLR_IRQFLAGS_RXDONE_MASK 0x40
|
||||
#define RFLR_IRQFLAGS_PAYLOADCRCERROR_MASK 0x20
|
||||
#define RFLR_IRQFLAGS_VALIDHEADER_MASK 0x10
|
||||
#define RFLR_IRQFLAGS_TXDONE_MASK 0x08
|
||||
#define RFLR_IRQFLAGS_CADDONE_MASK 0x04
|
||||
#define RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL_MASK 0x02
|
||||
#define RFLR_IRQFLAGS_CADDETECTED_MASK 0x01
|
||||
|
||||
/*!
|
||||
* RegIrqFlags
|
||||
*/
|
||||
#define RFLR_IRQFLAGS_RXTIMEOUT 0x80
|
||||
#define RFLR_IRQFLAGS_RXDONE 0x40
|
||||
#define RFLR_IRQFLAGS_PAYLOADCRCERROR 0x20
|
||||
#define RFLR_IRQFLAGS_VALIDHEADER 0x10
|
||||
#define RFLR_IRQFLAGS_TXDONE 0x08
|
||||
#define RFLR_IRQFLAGS_CADDONE 0x04
|
||||
#define RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL 0x02
|
||||
#define RFLR_IRQFLAGS_CADDETECTED 0x01
|
||||
|
||||
/*!
|
||||
* RegFifoRxNbBytes (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxHeaderCntValueMsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxHeaderCntValueLsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxPacketCntValueMsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxPacketCntValueLsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegModemStat (Read Only)
|
||||
*/
|
||||
#define RFLR_MODEMSTAT_RX_CR_MASK 0x1F
|
||||
#define RFLR_MODEMSTAT_MODEM_STATUS_MASK 0xE0
|
||||
|
||||
/*!
|
||||
* RegPktSnrValue (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegPktRssiValue (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRssiValue (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegHopChannel (Read Only)
|
||||
*/
|
||||
#define RFLR_HOPCHANNEL_PLL_LOCK_TIMEOUT_MASK 0x7F
|
||||
#define RFLR_HOPCHANNEL_PLL_LOCK_FAIL 0x80
|
||||
#define RFLR_HOPCHANNEL_PLL_LOCK_SUCCEED 0x00 // Default
|
||||
|
||||
#define RFLR_HOPCHANNEL_CRCONPAYLOAD_MASK 0xBF
|
||||
#define RFLR_HOPCHANNEL_CRCONPAYLOAD_ON 0x40
|
||||
#define RFLR_HOPCHANNEL_CRCONPAYLOAD_OFF 0x00 // Default
|
||||
|
||||
#define RFLR_HOPCHANNEL_CHANNEL_MASK 0x3F
|
||||
|
||||
/*!
|
||||
* RegModemConfig1
|
||||
*/
|
||||
#define RFLR_MODEMCONFIG1_BW_MASK 0x3F
|
||||
#define RFLR_MODEMCONFIG1_BW_125_KHZ 0x00 // Default
|
||||
#define RFLR_MODEMCONFIG1_BW_250_KHZ 0x40
|
||||
#define RFLR_MODEMCONFIG1_BW_500_KHZ 0x80
|
||||
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_MASK 0xC7
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_5 0x08
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_6 0x10 // Default
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_7 0x18
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_8 0x20
|
||||
|
||||
#define RFLR_MODEMCONFIG1_IMPLICITHEADER_MASK 0xFB
|
||||
#define RFLR_MODEMCONFIG1_IMPLICITHEADER_ON 0x04
|
||||
#define RFLR_MODEMCONFIG1_IMPLICITHEADER_OFF 0x00 // Default
|
||||
|
||||
#define RFLR_MODEMCONFIG1_RXPAYLOADCRC_MASK 0xFD
|
||||
#define RFLR_MODEMCONFIG1_RXPAYLOADCRC_ON 0x02
|
||||
#define RFLR_MODEMCONFIG1_RXPAYLOADCRC_OFF 0x00 // Default
|
||||
|
||||
#define RFLR_MODEMCONFIG1_LOWDATARATEOPTIMIZE_MASK 0xFE
|
||||
#define RFLR_MODEMCONFIG1_LOWDATARATEOPTIMIZE_ON 0x01
|
||||
#define RFLR_MODEMCONFIG1_LOWDATARATEOPTIMIZE_OFF 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegModemConfig2
|
||||
*/
|
||||
#define RFLR_MODEMCONFIG2_SF_MASK 0x0F
|
||||
#define RFLR_MODEMCONFIG2_SF_6 0x60
|
||||
#define RFLR_MODEMCONFIG2_SF_7 0x70 // Default
|
||||
#define RFLR_MODEMCONFIG2_SF_8 0x80
|
||||
#define RFLR_MODEMCONFIG2_SF_9 0x90
|
||||
#define RFLR_MODEMCONFIG2_SF_10 0xA0
|
||||
#define RFLR_MODEMCONFIG2_SF_11 0xB0
|
||||
#define RFLR_MODEMCONFIG2_SF_12 0xC0
|
||||
|
||||
#define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_MASK 0xF7
|
||||
#define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_ON 0x08
|
||||
#define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_OFF 0x00
|
||||
|
||||
#define RFLR_MODEMCONFIG2_AGCAUTO_MASK 0xFB
|
||||
#define RFLR_MODEMCONFIG2_AGCAUTO_ON 0x04 // Default
|
||||
#define RFLR_MODEMCONFIG2_AGCAUTO_OFF 0x00
|
||||
|
||||
#define RFLR_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK 0xFC
|
||||
#define RFLR_MODEMCONFIG2_SYMBTIMEOUTMSB 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegSymbTimeoutLsb
|
||||
*/
|
||||
#define RFLR_SYMBTIMEOUTLSB_SYMBTIMEOUT 0x64 // Default
|
||||
|
||||
/*!
|
||||
* RegPreambleLengthMsb
|
||||
*/
|
||||
#define RFLR_PREAMBLELENGTHMSB 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegPreambleLengthLsb
|
||||
*/
|
||||
#define RFLR_PREAMBLELENGTHLSB 0x08 // Default
|
||||
|
||||
/*!
|
||||
* RegPayloadLength
|
||||
*/
|
||||
#define RFLR_PAYLOADLENGTH 0x0E // Default
|
||||
|
||||
/*!
|
||||
* RegPayloadMaxLength
|
||||
*/
|
||||
#define RFLR_PAYLOADMAXLENGTH 0xFF // Default
|
||||
|
||||
/*!
|
||||
* RegHopPeriod
|
||||
*/
|
||||
#define RFLR_HOPPERIOD_FREQFOPPINGPERIOD 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoRxByteAddr (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFeiMsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFeiMid (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFeiLsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRssiWideband (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegDetectOptimize
|
||||
*/
|
||||
#define RFLR_DETECTIONOPTIMIZE_MASK 0xF8
|
||||
#define RFLR_DETECTIONOPTIMIZE_SF7_TO_SF12 0x03 // Default
|
||||
#define RFLR_DETECTIONOPTIMIZE_SF6 0x05
|
||||
|
||||
/*!
|
||||
* RegInvertIQ
|
||||
*/
|
||||
#define RFLR_INVERTIQ_RX_MASK 0xBF
|
||||
#define RFLR_INVERTIQ_RX_OFF 0x00
|
||||
#define RFLR_INVERTIQ_RX_ON 0x40
|
||||
#define RFLR_INVERTIQ_TX_MASK 0xFE
|
||||
#define RFLR_INVERTIQ_TX_OFF 0x01
|
||||
#define RFLR_INVERTIQ_TX_ON 0x00
|
||||
|
||||
/*!
|
||||
* RegDetectionThreshold
|
||||
*/
|
||||
#define RFLR_DETECTIONTHRESH_SF7_TO_SF12 0x0A // Default
|
||||
#define RFLR_DETECTIONTHRESH_SF6 0x0C
|
||||
|
||||
/*!
|
||||
* RegInvertIQ2
|
||||
*/
|
||||
#define RFLR_INVERTIQ2_ON 0x19
|
||||
#define RFLR_INVERTIQ2_OFF 0x1D
|
||||
|
||||
/*!
|
||||
* RegDioMapping1
|
||||
*/
|
||||
#define RFLR_DIOMAPPING1_DIO0_MASK 0x3F
|
||||
#define RFLR_DIOMAPPING1_DIO0_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO0_01 0x40
|
||||
#define RFLR_DIOMAPPING1_DIO0_10 0x80
|
||||
#define RFLR_DIOMAPPING1_DIO0_11 0xC0
|
||||
|
||||
#define RFLR_DIOMAPPING1_DIO1_MASK 0xCF
|
||||
#define RFLR_DIOMAPPING1_DIO1_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO1_01 0x10
|
||||
#define RFLR_DIOMAPPING1_DIO1_10 0x20
|
||||
#define RFLR_DIOMAPPING1_DIO1_11 0x30
|
||||
|
||||
#define RFLR_DIOMAPPING1_DIO2_MASK 0xF3
|
||||
#define RFLR_DIOMAPPING1_DIO2_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO2_01 0x04
|
||||
#define RFLR_DIOMAPPING1_DIO2_10 0x08
|
||||
#define RFLR_DIOMAPPING1_DIO2_11 0x0C
|
||||
|
||||
#define RFLR_DIOMAPPING1_DIO3_MASK 0xFC
|
||||
#define RFLR_DIOMAPPING1_DIO3_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO3_01 0x01
|
||||
#define RFLR_DIOMAPPING1_DIO3_10 0x02
|
||||
#define RFLR_DIOMAPPING1_DIO3_11 0x03
|
||||
|
||||
/*!
|
||||
* RegDioMapping2
|
||||
*/
|
||||
#define RFLR_DIOMAPPING2_DIO4_MASK 0x3F
|
||||
#define RFLR_DIOMAPPING2_DIO4_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING2_DIO4_01 0x40
|
||||
#define RFLR_DIOMAPPING2_DIO4_10 0x80
|
||||
#define RFLR_DIOMAPPING2_DIO4_11 0xC0
|
||||
|
||||
#define RFLR_DIOMAPPING2_DIO5_MASK 0xCF
|
||||
#define RFLR_DIOMAPPING2_DIO5_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING2_DIO5_01 0x10
|
||||
#define RFLR_DIOMAPPING2_DIO5_10 0x20
|
||||
#define RFLR_DIOMAPPING2_DIO5_11 0x30
|
||||
|
||||
#define RFLR_DIOMAPPING2_MAP_MASK 0xFE
|
||||
#define RFLR_DIOMAPPING2_MAP_PREAMBLEDETECT 0x01
|
||||
#define RFLR_DIOMAPPING2_MAP_RSSI 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegVersion (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcRef
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcThresh1
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcThresh2
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcThresh3
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegPllHop
|
||||
*/
|
||||
#define RFLR_PLLHOP_FASTHOP_MASK 0x7F
|
||||
#define RFLR_PLLHOP_FASTHOP_ON 0x80
|
||||
#define RFLR_PLLHOP_FASTHOP_OFF 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegTcxo
|
||||
*/
|
||||
#define RFLR_TCXO_TCXOINPUT_MASK 0xEF
|
||||
#define RFLR_TCXO_TCXOINPUT_ON 0x10
|
||||
#define RFLR_TCXO_TCXOINPUT_OFF 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegPaDac
|
||||
*/
|
||||
#define RFLR_PADAC_20DBM_MASK 0xF8
|
||||
#define RFLR_PADAC_20DBM_ON 0x07
|
||||
#define RFLR_PADAC_20DBM_OFF 0x04 // Default
|
||||
|
||||
/*!
|
||||
* RegPll
|
||||
*/
|
||||
#define RFLR_PLL_BANDWIDTH_MASK 0x3F
|
||||
#define RFLR_PLL_BANDWIDTH_75 0x00
|
||||
#define RFLR_PLL_BANDWIDTH_150 0x40
|
||||
#define RFLR_PLL_BANDWIDTH_225 0x80
|
||||
#define RFLR_PLL_BANDWIDTH_300 0xC0 // Default
|
||||
|
||||
/*!
|
||||
* RegPllLowPn
|
||||
*/
|
||||
#define RFLR_PLLLOWPN_BANDWIDTH_MASK 0x3F
|
||||
#define RFLR_PLLLOWPN_BANDWIDTH_75 0x00
|
||||
#define RFLR_PLLLOWPN_BANDWIDTH_150 0x40
|
||||
#define RFLR_PLLLOWPN_BANDWIDTH_225 0x80
|
||||
#define RFLR_PLLLOWPN_BANDWIDTH_300 0xC0 // Default
|
||||
|
||||
/*!
|
||||
* RegFormerTemp
|
||||
*/
|
||||
|
||||
#endif // __SX1272_REGS_LORA_H__
|
|
@ -0,0 +1 @@
|
|||
# Mbed enabled SX1276 LoRa/FSK radio driver
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,424 @@
|
|||
/**
|
||||
/ _____) _ | |
|
||||
( (____ _____ ____ _| |_ _____ ____| |__
|
||||
\____ \| ___ | (_ _) ___ |/ ___) _ \
|
||||
_____) ) ____| | | || |_| ____( (___| | | |
|
||||
(______/|_____)_|_|_| \__)_____)\____)_| |_|
|
||||
(C)2013 Semtech
|
||||
___ _____ _ ___ _ _____ ___ ___ ___ ___
|
||||
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
|
||||
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
|
||||
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
|
||||
embedded.connectivity.solutions===============
|
||||
|
||||
Description: LoRaWAN stack layer that controls both MAC and PHY underneath
|
||||
|
||||
License: Revised BSD License, see LICENSE.TXT file include in the project
|
||||
|
||||
Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
|
||||
|
||||
|
||||
Copyright (c) 2017, Arm Limited and affiliates.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef SX1276_LORARADIO_H_
|
||||
#define SX1276_LORARADIO_H_
|
||||
|
||||
#include "netsocket/LoRaRadio.h"
|
||||
|
||||
#ifdef MBED_SX1276_LORARADIO_BUFFER_SIZE
|
||||
#define MAX_DATA_BUFFER_SIZE MBED_SX1276_LORARADIO_BUFFER_SIZE
|
||||
#else
|
||||
#define MAX_DATA_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PinName rf_switch_ctl1;
|
||||
PinName rf_switch_ctl2;
|
||||
PinName txctl;
|
||||
PinName rxctl;
|
||||
PinName ant_switch;
|
||||
PinName pwr_amp_ctl;
|
||||
PinName tcxo;
|
||||
} rf_ctrls;
|
||||
|
||||
/**
|
||||
* Radio driver implementation for Semtech SX1272 plus variants.
|
||||
* Supports only SPI at the moment. Implements pure virtual LoRaRadio class.
|
||||
*/
|
||||
class SX1276_LoRaRadio: public LoRaRadio {
|
||||
public:
|
||||
/**
|
||||
* Use this constructor if pin definitions are provided manually.
|
||||
* The pins that are marked NC are optional. It is assumed that these
|
||||
* pins are not connected until/unless configured otherwise.
|
||||
*
|
||||
* Note: Pin ant_switch is equivalent to RxTx pin at
|
||||
* https://developer.mbed.org/components/SX1276MB1xAS/.
|
||||
* Reading the state of this pin indicates if the radio module type is
|
||||
* SX1276MB1LAS(North American frequency band supported) or SX1276MAS
|
||||
* (European frequency band supported).
|
||||
* Pin dio4 can be mapped to multiple pins on the board, please refer to
|
||||
* schematic of your board. For reference look at
|
||||
* https://developer.mbed.org/components/SX1276MB1xAS/
|
||||
*
|
||||
* Most of the radio module control pins are not being used at the moment as
|
||||
* the SX1276MB1xAS shield has not connected them. For consistency and future
|
||||
* use we are leaving the pins in the constructor. For example, if in some
|
||||
* setting SX1276 radio module gets connected to an external power amplifier
|
||||
* or radio latch controls are connected.
|
||||
*/
|
||||
SX1276_LoRaRadio(PinName mosi, PinName miso, PinName sclk, PinName nss,
|
||||
PinName reset, PinName dio0, PinName dio1, PinName dio2,
|
||||
PinName dio3, PinName dio4, PinName dio5,
|
||||
PinName rf_switch_ctl1=NC,
|
||||
PinName rf_switch_ctl2=NC, PinName txctl = NC,
|
||||
PinName rxctl = NC, PinName ant_switch = NC,
|
||||
PinName pwr_amp_ctl = NC,
|
||||
PinName tcxo = NC);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~SX1276_LoRaRadio();
|
||||
|
||||
/**
|
||||
* Registers radio events with the Mbed LoRaWAN stack and
|
||||
* undergoes initialization steps if any
|
||||
*
|
||||
* @param events Structure containing the driver callback functions
|
||||
*/
|
||||
virtual void init_radio(radio_events_t *events);
|
||||
|
||||
/**
|
||||
* Resets the radio module
|
||||
*/
|
||||
virtual void radio_reset();
|
||||
|
||||
/**
|
||||
* Put the RF module in sleep mode
|
||||
*/
|
||||
virtual void sleep(void);
|
||||
|
||||
/**
|
||||
* Sets the radio in standby mode
|
||||
*/
|
||||
virtual void standby(void);
|
||||
|
||||
/**
|
||||
* Sets the reception parameters
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param bandwidth Sets the bandwidth
|
||||
* FSK : >= 2600 and <= 250000 Hz
|
||||
* LoRa: [0: 125 kHz, 1: 250 kHz,
|
||||
* 2: 500 kHz, 3: Reserved]
|
||||
* @param datarate Sets the Datarate
|
||||
* FSK : 600..300000 bits/s
|
||||
* LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
|
||||
* 10: 1024, 11: 2048, 12: 4096 chips]
|
||||
* @param coderate Sets the coding rate ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
|
||||
* @param bandwidth_afc Sets the AFC Bandwidth ( FSK only )
|
||||
* FSK : >= 2600 and <= 250000 Hz
|
||||
* LoRa: N/A ( set to 0 )
|
||||
* @param preamble_len Sets the Preamble length ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: Length in symbols ( the hardware adds 4 more symbols )
|
||||
* @param symb_timeout Sets the RxSingle timeout value
|
||||
* FSK : timeout number of bytes
|
||||
* LoRa: timeout in symbols
|
||||
* @param fixLen Fixed length packets [0: variable, 1: fixed]
|
||||
* @param payload_len Sets payload length when fixed lenght is used
|
||||
* @param crc_on Enables/Disables the CRC [0: OFF, 1: ON]
|
||||
* @param freq_hop_on Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
|
||||
* @param hop_period Number of symbols bewteen each hop (LoRa only)
|
||||
* @param iq_inverted Inverts IQ signals ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [0: not inverted, 1: inverted]
|
||||
* @param rx_continuous Sets the reception in continuous mode
|
||||
* [false: single mode, true: continuous mode]
|
||||
*/
|
||||
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
|
||||
uint32_t datarate, uint8_t coderate,
|
||||
uint32_t bandwidth_afc, uint16_t preamble_len,
|
||||
uint16_t symb_timeout, bool fix_len,
|
||||
uint8_t payload_len,
|
||||
bool crc_on, bool freq_hop_on, uint8_t hop_period,
|
||||
bool iq_inverted, bool rx_continuous);
|
||||
|
||||
/**
|
||||
* Sets the transmission parameters
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param power Sets the output power [dBm]
|
||||
* @param fdev Sets the frequency deviation ( FSK only )
|
||||
* FSK : [Hz]
|
||||
* LoRa: 0
|
||||
* @param bandwidth Sets the bandwidth ( LoRa only )
|
||||
* FSK : 0
|
||||
* LoRa: [0: 125 kHz, 1: 250 kHz,
|
||||
* 2: 500 kHz, 3: Reserved]
|
||||
* @param datarate Sets the Datarate
|
||||
* FSK : 600..300000 bits/s
|
||||
* LoRa: [6: 64, 7: 128, 8: 256, 9: 512,
|
||||
* 10: 1024, 11: 2048, 12: 4096 chips]
|
||||
* @param coderate Sets the coding rate ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8]
|
||||
* @param preamble_len Sets the preamble length
|
||||
* @param fix_len Fixed length packets [0: variable, 1: fixed]
|
||||
* @param crc_on Enables disables the CRC [0: OFF, 1: ON]
|
||||
* @param freq_hop_on Enables disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only)
|
||||
* @param hop_period Number of symbols bewteen each hop (LoRa only)
|
||||
* @param iq_inverted Inverts IQ signals ( LoRa only )
|
||||
* FSK : N/A ( set to 0 )
|
||||
* LoRa: [0: not inverted, 1: inverted]
|
||||
* @param timeout Transmission timeout [us]
|
||||
*/
|
||||
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
|
||||
uint32_t bandwidth, uint32_t datarate,
|
||||
uint8_t coderate, uint16_t preamble_len,
|
||||
bool fix_len, bool crc_on, bool freq_hop_on,
|
||||
uint8_t hop_period, bool iq_inverted, uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Sends the buffer of size
|
||||
*
|
||||
* Prepares the packet to be sent and sets the radio in transmission
|
||||
*
|
||||
* @param buffer Buffer pointer
|
||||
* @param size Buffer size
|
||||
*/
|
||||
virtual void send(uint8_t *buffer, uint8_t size);
|
||||
|
||||
/**
|
||||
* Sets the radio in reception mode for the given time
|
||||
*
|
||||
* It should be noted that if the timeout is set to 0, it essentially
|
||||
* puts the receiver in continuous mode and hence from thereon it should
|
||||
* be treated as if in continuous mode. However, an appropriate way of
|
||||
* setting the receiver in continuous mode is by using set_rx_config()
|
||||
* API.
|
||||
*
|
||||
* @param timeout Reception timeout [ms]
|
||||
*
|
||||
*/
|
||||
virtual void receive(uint32_t timeout);
|
||||
|
||||
/**
|
||||
* Sets the carrier frequency
|
||||
*
|
||||
* @param freq Channel RF frequency
|
||||
*/
|
||||
virtual void set_channel(uint32_t freq);
|
||||
|
||||
/**
|
||||
* Generates a 32 bits random value based on the RSSI readings
|
||||
*
|
||||
* Remark this function sets the radio in LoRa modem mode and disables
|
||||
* all interrupts.
|
||||
* After calling this function either Radio.SetRxConfig or
|
||||
* Radio.SetTxConfig functions must be called.
|
||||
*
|
||||
* @return 32 bits random value
|
||||
*/
|
||||
virtual uint32_t random(void);
|
||||
|
||||
/**
|
||||
* Get radio status
|
||||
*
|
||||
* @param status Radio status [RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING]
|
||||
* @return Return current radio status
|
||||
*/
|
||||
virtual uint8_t get_status(void);
|
||||
|
||||
/**
|
||||
* Sets the maximum payload length
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param max Maximum payload length in bytes
|
||||
*/
|
||||
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max);
|
||||
|
||||
/**
|
||||
* Sets the network to public or private
|
||||
*
|
||||
* Updates the sync byte. Applies to LoRa modem only
|
||||
*
|
||||
* @param enable if true, it enables a public network
|
||||
*/
|
||||
virtual void set_public_network(bool enable);
|
||||
|
||||
/**
|
||||
* Computes the packet time on air for the given payload
|
||||
*
|
||||
* Remark can only be called once SetRxConfig or SetTxConfig have been called
|
||||
*
|
||||
* @param modem Radio modem to be used [0: FSK, 1: LoRa]
|
||||
* @param pkt_len Packet payload length
|
||||
* @return Computed airTime for the given packet payload length
|
||||
*/
|
||||
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len);
|
||||
|
||||
/**
|
||||
* Perform carrier sensing
|
||||
*
|
||||
* Checks for a certain time if the RSSI is above a given threshold.
|
||||
* This threshold determines if there is already a transmission going on
|
||||
* in the channel or not.
|
||||
*
|
||||
* @param modem Type of the radio modem
|
||||
* @param freq Carrier frequency
|
||||
* @param rssi_threshold Threshold value of RSSI
|
||||
* @param max_carrier_sense_time time to sense the channel
|
||||
*
|
||||
* @return true if there is no active transmission
|
||||
* in the channel, false otherwise
|
||||
*/
|
||||
virtual bool perform_carrier_sense(radio_modems_t modem,
|
||||
uint32_t freq,
|
||||
int16_t rssi_threshold,
|
||||
uint32_t max_carrier_sense_time);
|
||||
|
||||
/**
|
||||
* Sets the radio in CAD mode
|
||||
*
|
||||
*/
|
||||
virtual void start_cad(void);
|
||||
|
||||
/**
|
||||
* Check if the given RF is in range
|
||||
*
|
||||
* @param frequency frequency needed to be checked
|
||||
*/
|
||||
virtual bool check_rf_frequency(uint32_t frequency);
|
||||
|
||||
/** Sets the radio in continuous wave transmission mode
|
||||
*
|
||||
* @param freq Channel RF frequency
|
||||
* @param power Sets the output power [dBm]
|
||||
* @param time Transmission mode timeout [s]
|
||||
*/
|
||||
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time);
|
||||
|
||||
/**
|
||||
* Acquire exclusive access
|
||||
*/
|
||||
virtual void lock(void);
|
||||
|
||||
/**
|
||||
* Release exclusive access
|
||||
*/
|
||||
virtual void unlock(void);
|
||||
|
||||
private:
|
||||
|
||||
// SPI and chip select control
|
||||
SPI _spi;
|
||||
DigitalOut _chip_select;
|
||||
|
||||
// module rest control
|
||||
DigitalInOut _reset_ctl;
|
||||
|
||||
// Interrupt controls
|
||||
InterruptIn _dio0_ctl;
|
||||
InterruptIn _dio1_ctl;
|
||||
InterruptIn _dio2_ctl;
|
||||
InterruptIn _dio3_ctl;
|
||||
InterruptIn _dio4_ctl;
|
||||
InterruptIn _dio5_ctl;
|
||||
|
||||
// Radio specific controls
|
||||
DigitalOut _rf_switch_ctl1;
|
||||
DigitalOut _rf_switch_ctl2;
|
||||
DigitalOut _txctl;
|
||||
DigitalOut _rxctl;
|
||||
DigitalInOut _ant_switch;
|
||||
DigitalOut _pwr_amp_ctl;
|
||||
DigitalOut _tcxo;
|
||||
|
||||
// Contains all RF control pin names
|
||||
// This storage is needed even after assigning the
|
||||
// pins to corresponding object, as the driver needs to know
|
||||
// which control pins are connected and which are not. This
|
||||
// variation is inherent to driver because of target configuration.
|
||||
rf_ctrls _rf_ctrls;
|
||||
|
||||
// Structure containing all user and network specified settings
|
||||
// for radio module
|
||||
radio_settings_t _rf_settings;
|
||||
|
||||
// Structure containing function pointers to the stack callbacks
|
||||
radio_events_t *_radio_events;
|
||||
|
||||
// Data buffer used for both TX and RX
|
||||
// Size of this buffer is configurable via Mbed config system
|
||||
// Default is 256 bytes
|
||||
uint8_t _data_buffer[MAX_DATA_BUFFER_SIZE];
|
||||
|
||||
// TX/RX Timers - all use milisecond units
|
||||
Timeout tx_timeout_timer;
|
||||
Timeout rx_timeout_timer;
|
||||
Timeout rx_timeout_sync_word;
|
||||
|
||||
#ifdef MBED_CONF_RTOS_PRESENT
|
||||
// Thread to handle interrupts
|
||||
Thread irq_thread;
|
||||
#endif
|
||||
|
||||
// Access protection
|
||||
PlatformMutex mutex;
|
||||
|
||||
// Murata board
|
||||
bool is_murata;
|
||||
|
||||
// helper functions
|
||||
void setup_registers();
|
||||
void default_antenna_switch_ctrls();
|
||||
void set_antenna_switch(uint8_t operation_mode);
|
||||
void setup_spi();
|
||||
void gpio_init();
|
||||
void gpio_deinit();
|
||||
void setup_interrupts();
|
||||
void set_operation_mode(uint8_t operation_mode);
|
||||
void set_low_power_mode();
|
||||
void set_sx1276_variant_type();
|
||||
uint8_t get_pa_conf_reg(uint32_t channel);
|
||||
void set_rf_tx_power(int8_t power);
|
||||
int16_t get_rssi(radio_modems_t modem);
|
||||
uint8_t get_fsk_bw_reg_val(uint32_t bandwidth);
|
||||
void write_to_register(uint8_t addr, uint8_t data);
|
||||
void write_to_register(uint8_t addr, uint8_t *data, uint8_t size);
|
||||
uint8_t read_register(uint8_t addr);
|
||||
void read_register(uint8_t addr, uint8_t *buffer, uint8_t size);
|
||||
void write_fifo(uint8_t *buffer, uint8_t size);
|
||||
void read_fifo(uint8_t *buffer, uint8_t size);
|
||||
void transmit(uint32_t timeout);
|
||||
void rf_irq_task(void);
|
||||
void set_modem(uint8_t modem);
|
||||
void rx_chain_calibration(void);
|
||||
|
||||
// ISRs
|
||||
void dio0_irq_isr();
|
||||
void dio1_irq_isr();
|
||||
void dio2_irq_isr();
|
||||
void dio3_irq_isr();
|
||||
void dio4_irq_isr();
|
||||
void dio5_irq_isr();
|
||||
void timeout_irq_isr();
|
||||
|
||||
// Handlers called by thread in response to signal
|
||||
void handle_dio0_irq();
|
||||
void handle_dio1_irq();
|
||||
void handle_dio2_irq();
|
||||
void handle_dio3_irq();
|
||||
void handle_dio4_irq();
|
||||
void handle_dio5_irq();
|
||||
void handle_timeout_irq();
|
||||
};
|
||||
|
||||
#endif // SX1276_LORARADIO_H_
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"name": "sx1276-lora-driver",
|
||||
"config": {
|
||||
"spi-frequency": {
|
||||
"help": "SPI frequency, Default: 8 MHz",
|
||||
"value": 8000000
|
||||
},
|
||||
"buffer-size": {
|
||||
"help": "Max. buffer size the radio can handle, Default: 256 B",
|
||||
"value": 256
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,569 @@
|
|||
/**
|
||||
/ _____) _ | |
|
||||
( (____ _____ ____ _| |_ _____ ____| |__
|
||||
\____ \| ___ | (_ _) ___ |/ ___) _ \
|
||||
_____) ) ____| | | || |_| ____( (___| | | |
|
||||
(______/|_____)_|_|_| \__)_____)\____)_| |_|
|
||||
(C) 2014 Semtech
|
||||
|
||||
Description: SX1276 LoRa modem registers and bits definitions
|
||||
|
||||
License: Revised BSD License, see LICENSE.TXT file include in the project
|
||||
|
||||
Maintainer: Miguel Luis and Gregory Cristian
|
||||
|
||||
Copyright (c) 2017, Arm Limited and affiliates.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef __SX1276_REGS_LORA_H__
|
||||
#define __SX1276_REGS_LORA_H__
|
||||
|
||||
/*!
|
||||
* ============================================================================
|
||||
* SX1276 Internal registers Address
|
||||
* ============================================================================
|
||||
*/
|
||||
#define REG_LR_FIFO 0x00
|
||||
// Common settings
|
||||
#define REG_LR_OPMODE 0x01
|
||||
#define REG_LR_FRFMSB 0x06
|
||||
#define REG_LR_FRFMID 0x07
|
||||
#define REG_LR_FRFLSB 0x08
|
||||
// Tx settings
|
||||
#define REG_LR_PACONFIG 0x09
|
||||
#define REG_LR_PARAMP 0x0A
|
||||
#define REG_LR_OCP 0x0B
|
||||
// Rx settings
|
||||
#define REG_LR_LNA 0x0C
|
||||
// LoRa registers
|
||||
#define REG_LR_FIFOADDRPTR 0x0D
|
||||
#define REG_LR_FIFOTXBASEADDR 0x0E
|
||||
#define REG_LR_FIFORXBASEADDR 0x0F
|
||||
#define REG_LR_FIFORXCURRENTADDR 0x10
|
||||
#define REG_LR_IRQFLAGSMASK 0x11
|
||||
#define REG_LR_IRQFLAGS 0x12
|
||||
#define REG_LR_RXNBBYTES 0x13
|
||||
#define REG_LR_RXHEADERCNTVALUEMSB 0x14
|
||||
#define REG_LR_RXHEADERCNTVALUELSB 0x15
|
||||
#define REG_LR_RXPACKETCNTVALUEMSB 0x16
|
||||
#define REG_LR_RXPACKETCNTVALUELSB 0x17
|
||||
#define REG_LR_MODEMSTAT 0x18
|
||||
#define REG_LR_PKTSNRVALUE 0x19
|
||||
#define REG_LR_PKTRSSIVALUE 0x1A
|
||||
#define REG_LR_RSSIVALUE 0x1B
|
||||
#define REG_LR_HOPCHANNEL 0x1C
|
||||
#define REG_LR_MODEMCONFIG1 0x1D
|
||||
#define REG_LR_MODEMCONFIG2 0x1E
|
||||
#define REG_LR_SYMBTIMEOUTLSB 0x1F
|
||||
#define REG_LR_PREAMBLEMSB 0x20
|
||||
#define REG_LR_PREAMBLELSB 0x21
|
||||
#define REG_LR_PAYLOADLENGTH 0x22
|
||||
#define REG_LR_PAYLOADMAXLENGTH 0x23
|
||||
#define REG_LR_HOPPERIOD 0x24
|
||||
#define REG_LR_FIFORXBYTEADDR 0x25
|
||||
#define REG_LR_MODEMCONFIG3 0x26
|
||||
#define REG_LR_FEIMSB 0x28
|
||||
#define REG_LR_FEIMID 0x29
|
||||
#define REG_LR_FEILSB 0x2A
|
||||
#define REG_LR_RSSIWIDEBAND 0x2C
|
||||
#define REG_LR_TEST2F 0x2F
|
||||
#define REG_LR_TEST30 0x30
|
||||
#define REG_LR_DETECTOPTIMIZE 0x31
|
||||
#define REG_LR_INVERTIQ 0x33
|
||||
#define REG_LR_TEST36 0x36
|
||||
#define REG_LR_DETECTIONTHRESHOLD 0x37
|
||||
#define REG_LR_SYNCWORD 0x39
|
||||
#define REG_LR_TEST3A 0x3A
|
||||
#define REG_LR_INVERTIQ2 0x3B
|
||||
|
||||
// end of documented register in datasheet
|
||||
// I/O settings
|
||||
#define REG_LR_DIOMAPPING1 0x40
|
||||
#define REG_LR_DIOMAPPING2 0x41
|
||||
// Version
|
||||
#define REG_LR_VERSION 0x42
|
||||
// Additional settings
|
||||
#define REG_LR_PLLHOP 0x44
|
||||
#define REG_LR_TCXO 0x4B
|
||||
#define REG_LR_PADAC 0x4D
|
||||
#define REG_LR_FORMERTEMP 0x5B
|
||||
#define REG_LR_BITRATEFRAC 0x5D
|
||||
#define REG_LR_AGCREF 0x61
|
||||
#define REG_LR_AGCTHRESH1 0x62
|
||||
#define REG_LR_AGCTHRESH2 0x63
|
||||
#define REG_LR_AGCTHRESH3 0x64
|
||||
#define REG_LR_PLL 0x70
|
||||
|
||||
/*!
|
||||
* ============================================================================
|
||||
* SX1276 LoRa bits control definition
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFifo
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegOpMode
|
||||
*/
|
||||
#define RFLR_OPMODE_LONGRANGEMODE_MASK 0x7F
|
||||
#define RFLR_OPMODE_LONGRANGEMODE_OFF 0x00 // Default
|
||||
#define RFLR_OPMODE_LONGRANGEMODE_ON 0x80
|
||||
|
||||
#define RFLR_OPMODE_ACCESSSHAREDREG_MASK 0xBF
|
||||
#define RFLR_OPMODE_ACCESSSHAREDREG_ENABLE 0x40
|
||||
#define RFLR_OPMODE_ACCESSSHAREDREG_DISABLE 0x00 // Default
|
||||
|
||||
#define RFLR_OPMODE_FREQMODE_ACCESS_MASK 0xF7
|
||||
#define RFLR_OPMODE_FREQMODE_ACCESS_LF 0x08 // Default
|
||||
#define RFLR_OPMODE_FREQMODE_ACCESS_HF 0x00
|
||||
|
||||
#define RFLR_OPMODE_MASK 0xF8
|
||||
#define RFLR_OPMODE_SLEEP 0x00
|
||||
#define RFLR_OPMODE_STANDBY 0x01 // Default
|
||||
#define RFLR_OPMODE_SYNTHESIZER_TX 0x02
|
||||
#define RFLR_OPMODE_TRANSMITTER 0x03
|
||||
#define RFLR_OPMODE_SYNTHESIZER_RX 0x04
|
||||
#define RFLR_OPMODE_RECEIVER 0x05
|
||||
// LoRa specific modes
|
||||
#define RFLR_OPMODE_RECEIVER_SINGLE 0x06
|
||||
#define RFLR_OPMODE_CAD 0x07
|
||||
|
||||
/*!
|
||||
* RegFrf (MHz)
|
||||
*/
|
||||
#define RFLR_FRFMSB_434_MHZ 0x6C // Default
|
||||
#define RFLR_FRFMID_434_MHZ 0x80 // Default
|
||||
#define RFLR_FRFLSB_434_MHZ 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegPaConfig
|
||||
*/
|
||||
#define RFLR_PACONFIG_PASELECT_MASK 0x7F
|
||||
#define RFLR_PACONFIG_PASELECT_PABOOST 0x80
|
||||
#define RFLR_PACONFIG_PASELECT_RFO 0x00 // Default
|
||||
|
||||
#define RFLR_PACONFIG_MAX_POWER_MASK 0x8F
|
||||
|
||||
#define RFLR_PACONFIG_OUTPUTPOWER_MASK 0xF0
|
||||
|
||||
/*!
|
||||
* RegPaRamp
|
||||
*/
|
||||
#define RFLR_PARAMP_TXBANDFORCE_MASK 0xEF
|
||||
#define RFLR_PARAMP_TXBANDFORCE_BAND_SEL 0x10
|
||||
#define RFLR_PARAMP_TXBANDFORCE_AUTO 0x00 // Default
|
||||
|
||||
#define RFLR_PARAMP_MASK 0xF0
|
||||
#define RFLR_PARAMP_3400_US 0x00
|
||||
#define RFLR_PARAMP_2000_US 0x01
|
||||
#define RFLR_PARAMP_1000_US 0x02
|
||||
#define RFLR_PARAMP_0500_US 0x03
|
||||
#define RFLR_PARAMP_0250_US 0x04
|
||||
#define RFLR_PARAMP_0125_US 0x05
|
||||
#define RFLR_PARAMP_0100_US 0x06
|
||||
#define RFLR_PARAMP_0062_US 0x07
|
||||
#define RFLR_PARAMP_0050_US 0x08
|
||||
#define RFLR_PARAMP_0040_US 0x09 // Default
|
||||
#define RFLR_PARAMP_0031_US 0x0A
|
||||
#define RFLR_PARAMP_0025_US 0x0B
|
||||
#define RFLR_PARAMP_0020_US 0x0C
|
||||
#define RFLR_PARAMP_0015_US 0x0D
|
||||
#define RFLR_PARAMP_0012_US 0x0E
|
||||
#define RFLR_PARAMP_0010_US 0x0F
|
||||
|
||||
/*!
|
||||
* RegOcp
|
||||
*/
|
||||
#define RFLR_OCP_MASK 0xDF
|
||||
#define RFLR_OCP_ON 0x20 // Default
|
||||
#define RFLR_OCP_OFF 0x00
|
||||
|
||||
#define RFLR_OCP_TRIM_MASK 0xE0
|
||||
#define RFLR_OCP_TRIM_045_MA 0x00
|
||||
#define RFLR_OCP_TRIM_050_MA 0x01
|
||||
#define RFLR_OCP_TRIM_055_MA 0x02
|
||||
#define RFLR_OCP_TRIM_060_MA 0x03
|
||||
#define RFLR_OCP_TRIM_065_MA 0x04
|
||||
#define RFLR_OCP_TRIM_070_MA 0x05
|
||||
#define RFLR_OCP_TRIM_075_MA 0x06
|
||||
#define RFLR_OCP_TRIM_080_MA 0x07
|
||||
#define RFLR_OCP_TRIM_085_MA 0x08
|
||||
#define RFLR_OCP_TRIM_090_MA 0x09
|
||||
#define RFLR_OCP_TRIM_095_MA 0x0A
|
||||
#define RFLR_OCP_TRIM_100_MA 0x0B // Default
|
||||
#define RFLR_OCP_TRIM_105_MA 0x0C
|
||||
#define RFLR_OCP_TRIM_110_MA 0x0D
|
||||
#define RFLR_OCP_TRIM_115_MA 0x0E
|
||||
#define RFLR_OCP_TRIM_120_MA 0x0F
|
||||
#define RFLR_OCP_TRIM_130_MA 0x10
|
||||
#define RFLR_OCP_TRIM_140_MA 0x11
|
||||
#define RFLR_OCP_TRIM_150_MA 0x12
|
||||
#define RFLR_OCP_TRIM_160_MA 0x13
|
||||
#define RFLR_OCP_TRIM_170_MA 0x14
|
||||
#define RFLR_OCP_TRIM_180_MA 0x15
|
||||
#define RFLR_OCP_TRIM_190_MA 0x16
|
||||
#define RFLR_OCP_TRIM_200_MA 0x17
|
||||
#define RFLR_OCP_TRIM_210_MA 0x18
|
||||
#define RFLR_OCP_TRIM_220_MA 0x19
|
||||
#define RFLR_OCP_TRIM_230_MA 0x1A
|
||||
#define RFLR_OCP_TRIM_240_MA 0x1B
|
||||
|
||||
/*!
|
||||
* RegLna
|
||||
*/
|
||||
#define RFLR_LNA_GAIN_MASK 0x1F
|
||||
#define RFLR_LNA_GAIN_G1 0x20 // Default
|
||||
#define RFLR_LNA_GAIN_G2 0x40
|
||||
#define RFLR_LNA_GAIN_G3 0x60
|
||||
#define RFLR_LNA_GAIN_G4 0x80
|
||||
#define RFLR_LNA_GAIN_G5 0xA0
|
||||
#define RFLR_LNA_GAIN_G6 0xC0
|
||||
|
||||
#define RFLR_LNA_BOOST_LF_MASK 0xE7
|
||||
#define RFLR_LNA_BOOST_LF_DEFAULT 0x00 // Default
|
||||
|
||||
#define RFLR_LNA_BOOST_HF_MASK 0xFC
|
||||
#define RFLR_LNA_BOOST_HF_OFF 0x00 // Default
|
||||
#define RFLR_LNA_BOOST_HF_ON 0x03
|
||||
|
||||
/*!
|
||||
* RegFifoAddrPtr
|
||||
*/
|
||||
#define RFLR_FIFOADDRPTR 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoTxBaseAddr
|
||||
*/
|
||||
#define RFLR_FIFOTXBASEADDR 0x80 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoTxBaseAddr
|
||||
*/
|
||||
#define RFLR_FIFORXBASEADDR 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoRxCurrentAddr (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegIrqFlagsMask
|
||||
*/
|
||||
#define RFLR_IRQFLAGS_RXTIMEOUT_MASK 0x80
|
||||
#define RFLR_IRQFLAGS_RXDONE_MASK 0x40
|
||||
#define RFLR_IRQFLAGS_PAYLOADCRCERROR_MASK 0x20
|
||||
#define RFLR_IRQFLAGS_VALIDHEADER_MASK 0x10
|
||||
#define RFLR_IRQFLAGS_TXDONE_MASK 0x08
|
||||
#define RFLR_IRQFLAGS_CADDONE_MASK 0x04
|
||||
#define RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL_MASK 0x02
|
||||
#define RFLR_IRQFLAGS_CADDETECTED_MASK 0x01
|
||||
|
||||
/*!
|
||||
* RegIrqFlags
|
||||
*/
|
||||
#define RFLR_IRQFLAGS_RXTIMEOUT 0x80
|
||||
#define RFLR_IRQFLAGS_RXDONE 0x40
|
||||
#define RFLR_IRQFLAGS_PAYLOADCRCERROR 0x20
|
||||
#define RFLR_IRQFLAGS_VALIDHEADER 0x10
|
||||
#define RFLR_IRQFLAGS_TXDONE 0x08
|
||||
#define RFLR_IRQFLAGS_CADDONE 0x04
|
||||
#define RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL 0x02
|
||||
#define RFLR_IRQFLAGS_CADDETECTED 0x01
|
||||
|
||||
/*!
|
||||
* RegFifoRxNbBytes (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxHeaderCntValueMsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxHeaderCntValueLsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxPacketCntValueMsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRxPacketCntValueLsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegModemStat (Read Only)
|
||||
*/
|
||||
#define RFLR_MODEMSTAT_RX_CR_MASK 0x1F
|
||||
#define RFLR_MODEMSTAT_MODEM_STATUS_MASK 0xE0
|
||||
|
||||
/*!
|
||||
* RegPktSnrValue (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegPktRssiValue (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRssiValue (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegHopChannel (Read Only)
|
||||
*/
|
||||
#define RFLR_HOPCHANNEL_PLL_LOCK_TIMEOUT_MASK 0x7F
|
||||
#define RFLR_HOPCHANNEL_PLL_LOCK_FAIL 0x80
|
||||
#define RFLR_HOPCHANNEL_PLL_LOCK_SUCCEED 0x00 // Default
|
||||
|
||||
#define RFLR_HOPCHANNEL_CRCONPAYLOAD_MASK 0xBF
|
||||
#define RFLR_HOPCHANNEL_CRCONPAYLOAD_ON 0x40
|
||||
#define RFLR_HOPCHANNEL_CRCONPAYLOAD_OFF 0x00 // Default
|
||||
|
||||
#define RFLR_HOPCHANNEL_CHANNEL_MASK 0x3F
|
||||
|
||||
/*!
|
||||
* RegModemConfig1
|
||||
*/
|
||||
#define RFLR_MODEMCONFIG1_BW_MASK 0x0F
|
||||
#define RFLR_MODEMCONFIG1_BW_7_81_KHZ 0x00
|
||||
#define RFLR_MODEMCONFIG1_BW_10_41_KHZ 0x10
|
||||
#define RFLR_MODEMCONFIG1_BW_15_62_KHZ 0x20
|
||||
#define RFLR_MODEMCONFIG1_BW_20_83_KHZ 0x30
|
||||
#define RFLR_MODEMCONFIG1_BW_31_25_KHZ 0x40
|
||||
#define RFLR_MODEMCONFIG1_BW_41_66_KHZ 0x50
|
||||
#define RFLR_MODEMCONFIG1_BW_62_50_KHZ 0x60
|
||||
#define RFLR_MODEMCONFIG1_BW_125_KHZ 0x70 // Default
|
||||
#define RFLR_MODEMCONFIG1_BW_250_KHZ 0x80
|
||||
#define RFLR_MODEMCONFIG1_BW_500_KHZ 0x90
|
||||
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_MASK 0xF1
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_5 0x02
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_6 0x04 // Default
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_7 0x06
|
||||
#define RFLR_MODEMCONFIG1_CODINGRATE_4_8 0x08
|
||||
|
||||
#define RFLR_MODEMCONFIG1_IMPLICITHEADER_MASK 0xFE
|
||||
#define RFLR_MODEMCONFIG1_IMPLICITHEADER_ON 0x01
|
||||
#define RFLR_MODEMCONFIG1_IMPLICITHEADER_OFF 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegModemConfig2
|
||||
*/
|
||||
#define RFLR_MODEMCONFIG2_SF_MASK 0x0F
|
||||
#define RFLR_MODEMCONFIG2_SF_6 0x60
|
||||
#define RFLR_MODEMCONFIG2_SF_7 0x70 // Default
|
||||
#define RFLR_MODEMCONFIG2_SF_8 0x80
|
||||
#define RFLR_MODEMCONFIG2_SF_9 0x90
|
||||
#define RFLR_MODEMCONFIG2_SF_10 0xA0
|
||||
#define RFLR_MODEMCONFIG2_SF_11 0xB0
|
||||
#define RFLR_MODEMCONFIG2_SF_12 0xC0
|
||||
|
||||
#define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_MASK 0xF7
|
||||
#define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_ON 0x08
|
||||
#define RFLR_MODEMCONFIG2_TXCONTINUOUSMODE_OFF 0x00
|
||||
|
||||
#define RFLR_MODEMCONFIG2_RXPAYLOADCRC_MASK 0xFB
|
||||
#define RFLR_MODEMCONFIG2_RXPAYLOADCRC_ON 0x04
|
||||
#define RFLR_MODEMCONFIG2_RXPAYLOADCRC_OFF 0x00 // Default
|
||||
|
||||
#define RFLR_MODEMCONFIG2_SYMBTIMEOUTMSB_MASK 0xFC
|
||||
#define RFLR_MODEMCONFIG2_SYMBTIMEOUTMSB 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegSymbTimeoutLsb
|
||||
*/
|
||||
#define RFLR_SYMBTIMEOUTLSB_SYMBTIMEOUT 0x64 // Default
|
||||
|
||||
/*!
|
||||
* RegPreambleLengthMsb
|
||||
*/
|
||||
#define RFLR_PREAMBLELENGTHMSB 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegPreambleLengthLsb
|
||||
*/
|
||||
#define RFLR_PREAMBLELENGTHLSB 0x08 // Default
|
||||
|
||||
/*!
|
||||
* RegPayloadLength
|
||||
*/
|
||||
#define RFLR_PAYLOADLENGTH 0x0E // Default
|
||||
|
||||
/*!
|
||||
* RegPayloadMaxLength
|
||||
*/
|
||||
#define RFLR_PAYLOADMAXLENGTH 0xFF // Default
|
||||
|
||||
/*!
|
||||
* RegHopPeriod
|
||||
*/
|
||||
#define RFLR_HOPPERIOD_FREQFOPPINGPERIOD 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegFifoRxByteAddr (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegModemConfig3
|
||||
*/
|
||||
#define RFLR_MODEMCONFIG3_LOWDATARATEOPTIMIZE_MASK 0xF7
|
||||
#define RFLR_MODEMCONFIG3_LOWDATARATEOPTIMIZE_ON 0x08
|
||||
#define RFLR_MODEMCONFIG3_LOWDATARATEOPTIMIZE_OFF 0x00 // Default
|
||||
|
||||
#define RFLR_MODEMCONFIG3_AGCAUTO_MASK 0xFB
|
||||
#define RFLR_MODEMCONFIG3_AGCAUTO_ON 0x04 // Default
|
||||
#define RFLR_MODEMCONFIG3_AGCAUTO_OFF 0x00
|
||||
|
||||
/*!
|
||||
* RegFeiMsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFeiMid (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegFeiLsb (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegRssiWideband (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegDetectOptimize
|
||||
*/
|
||||
#define RFLR_DETECTIONOPTIMIZE_MASK 0xF8
|
||||
#define RFLR_DETECTIONOPTIMIZE_SF7_TO_SF12 0x03 // Default
|
||||
#define RFLR_DETECTIONOPTIMIZE_SF6 0x05
|
||||
|
||||
/*!
|
||||
* RegInvertIQ
|
||||
*/
|
||||
#define RFLR_INVERTIQ_RX_MASK 0xBF
|
||||
#define RFLR_INVERTIQ_RX_OFF 0x00
|
||||
#define RFLR_INVERTIQ_RX_ON 0x40
|
||||
#define RFLR_INVERTIQ_TX_MASK 0xFE
|
||||
#define RFLR_INVERTIQ_TX_OFF 0x01
|
||||
#define RFLR_INVERTIQ_TX_ON 0x00
|
||||
|
||||
/*!
|
||||
* RegDetectionThreshold
|
||||
*/
|
||||
#define RFLR_DETECTIONTHRESH_SF7_TO_SF12 0x0A // Default
|
||||
#define RFLR_DETECTIONTHRESH_SF6 0x0C
|
||||
|
||||
/*!
|
||||
* RegInvertIQ2
|
||||
*/
|
||||
#define RFLR_INVERTIQ2_ON 0x19
|
||||
#define RFLR_INVERTIQ2_OFF 0x1D
|
||||
|
||||
/*!
|
||||
* RegDioMapping1
|
||||
*/
|
||||
#define RFLR_DIOMAPPING1_DIO0_MASK 0x3F
|
||||
#define RFLR_DIOMAPPING1_DIO0_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO0_01 0x40
|
||||
#define RFLR_DIOMAPPING1_DIO0_10 0x80
|
||||
#define RFLR_DIOMAPPING1_DIO0_11 0xC0
|
||||
|
||||
#define RFLR_DIOMAPPING1_DIO1_MASK 0xCF
|
||||
#define RFLR_DIOMAPPING1_DIO1_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO1_01 0x10
|
||||
#define RFLR_DIOMAPPING1_DIO1_10 0x20
|
||||
#define RFLR_DIOMAPPING1_DIO1_11 0x30
|
||||
|
||||
#define RFLR_DIOMAPPING1_DIO2_MASK 0xF3
|
||||
#define RFLR_DIOMAPPING1_DIO2_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO2_01 0x04
|
||||
#define RFLR_DIOMAPPING1_DIO2_10 0x08
|
||||
#define RFLR_DIOMAPPING1_DIO2_11 0x0C
|
||||
|
||||
#define RFLR_DIOMAPPING1_DIO3_MASK 0xFC
|
||||
#define RFLR_DIOMAPPING1_DIO3_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING1_DIO3_01 0x01
|
||||
#define RFLR_DIOMAPPING1_DIO3_10 0x02
|
||||
#define RFLR_DIOMAPPING1_DIO3_11 0x03
|
||||
|
||||
/*!
|
||||
* RegDioMapping2
|
||||
*/
|
||||
#define RFLR_DIOMAPPING2_DIO4_MASK 0x3F
|
||||
#define RFLR_DIOMAPPING2_DIO4_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING2_DIO4_01 0x40
|
||||
#define RFLR_DIOMAPPING2_DIO4_10 0x80
|
||||
#define RFLR_DIOMAPPING2_DIO4_11 0xC0
|
||||
|
||||
#define RFLR_DIOMAPPING2_DIO5_MASK 0xCF
|
||||
#define RFLR_DIOMAPPING2_DIO5_00 0x00 // Default
|
||||
#define RFLR_DIOMAPPING2_DIO5_01 0x10
|
||||
#define RFLR_DIOMAPPING2_DIO5_10 0x20
|
||||
#define RFLR_DIOMAPPING2_DIO5_11 0x30
|
||||
|
||||
#define RFLR_DIOMAPPING2_MAP_MASK 0xFE
|
||||
#define RFLR_DIOMAPPING2_MAP_PREAMBLEDETECT 0x01
|
||||
#define RFLR_DIOMAPPING2_MAP_RSSI 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegVersion (Read Only)
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegPllHop
|
||||
*/
|
||||
#define RFLR_PLLHOP_FASTHOP_MASK 0x7F
|
||||
#define RFLR_PLLHOP_FASTHOP_ON 0x80
|
||||
#define RFLR_PLLHOP_FASTHOP_OFF 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegTcxo
|
||||
*/
|
||||
#define RFLR_TCXO_TCXOINPUT_MASK 0xEF
|
||||
#define RFLR_TCXO_TCXOINPUT_ON 0x10
|
||||
#define RFLR_TCXO_TCXOINPUT_OFF 0x00 // Default
|
||||
|
||||
/*!
|
||||
* RegPaDac
|
||||
*/
|
||||
#define RFLR_PADAC_20DBM_MASK 0xF8
|
||||
#define RFLR_PADAC_20DBM_ON 0x07
|
||||
#define RFLR_PADAC_20DBM_OFF 0x04 // Default
|
||||
|
||||
/*!
|
||||
* RegFormerTemp
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegBitrateFrac
|
||||
*/
|
||||
#define RF_BITRATEFRAC_MASK 0xF0
|
||||
|
||||
/*!
|
||||
* RegAgcRef
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcThresh1
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcThresh2
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegAgcThresh3
|
||||
*/
|
||||
|
||||
/*!
|
||||
* RegPll
|
||||
*/
|
||||
#define RF_PLL_BANDWIDTH_MASK 0x3F
|
||||
#define RF_PLL_BANDWIDTH_75 0x00
|
||||
#define RF_PLL_BANDWIDTH_150 0x40
|
||||
#define RF_PLL_BANDWIDTH_225 0x80
|
||||
#define RF_PLL_BANDWIDTH_300 0xC0 // Default
|
||||
|
||||
#endif // __SX1276_REGS_LORA_H__
|
Loading…
Reference in New Issue