mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2025-02-18 13:54:23 -05:00
Add reset functions + default bandwidth for SX127X
This commit is contained in:
parent
dbfa86d803
commit
0c1342257d
15
Radio.cpp
15
Radio.cpp
@ -1054,7 +1054,7 @@ sx127x::sx127x(uint8_t index, SPIClass* spi, int ss, int sclk, int mosi, int mis
|
||||
_spiSettings(8E6, MSBFIRST, SPI_MODE0),
|
||||
_spiModem(spi),
|
||||
_ss(ss), _sclk(sclk), _mosi(mosi), _miso(miso), _reset(reset), _dio0(dio0),
|
||||
_busy(busy), _frequency(0), _packetIndex(0), _preinit_done(false), _bw(0)
|
||||
_busy(busy), _frequency(0), _packetIndex(0), _preinit_done(false), _bw(7800)
|
||||
{ setTimeout(0); }
|
||||
|
||||
void sx127x::setSPIFrequency(uint32_t frequency) { _spiSettings = SPISettings(frequency, MSBFIRST, SPI_MODE0); }
|
||||
@ -1114,7 +1114,7 @@ uint8_t ISR_VECT sx127x::singleTransfer(uint8_t address, uint8_t value) {
|
||||
return response;
|
||||
}
|
||||
|
||||
int sx127x::begin() {
|
||||
void sx127x::reset() {
|
||||
if (_reset != -1) {
|
||||
pinMode(_reset, OUTPUT);
|
||||
|
||||
@ -1124,6 +1124,10 @@ int sx127x::begin() {
|
||||
digitalWrite(_reset, HIGH);
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
int sx127x::begin() {
|
||||
reset();
|
||||
|
||||
sleep();
|
||||
|
||||
@ -1799,7 +1803,7 @@ void sx128x::setPacketParams(uint32_t target_preamble, uint8_t headermode, uint8
|
||||
_last_preamble = target_preamble;
|
||||
}
|
||||
|
||||
int sx128x::begin()
|
||||
void sx128x::reset()
|
||||
{
|
||||
if (_reset != -1) {
|
||||
pinMode(_reset, OUTPUT);
|
||||
@ -1810,6 +1814,11 @@ int sx128x::begin()
|
||||
digitalWrite(_reset, HIGH);
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
int sx128x::begin()
|
||||
{
|
||||
reset();
|
||||
|
||||
if (_rxen != -1) {
|
||||
pinMode(_rxen, OUTPUT);
|
||||
|
10
Radio.hpp
10
Radio.hpp
@ -100,6 +100,8 @@ public:
|
||||
_lora_preamble_time_ms(0), _lora_header_time_ms(0), _lora_symbol_rate(0.0), _lora_us_per_byte(0.0), _bitrate(0),
|
||||
_packet{0}, _onReceive(NULL), _txp(0), _ldro(false), _limit_rate(false), _interference_detected(false), _avoid_interference(true), _difs_ms(CSMA_SIFS_MS + 2 * _csma_slot_ms), _difs_wait_start(0), _cw_wait_start(0), _cw_wait_target(0), _cw_wait_passed(0), _csma_cw(-1), _cw_band(1), _cw_min(0), _cw_max(CSMA_CW_PER_BAND_WINDOWS), _noise_floor_sampled(false), _noise_floor_sample(0), _noise_floor_buffer({0}), _noise_floor(-292), _led_id_filter(0), _preamble_detected_at(0) {};
|
||||
|
||||
virtual void reset() = 0;
|
||||
|
||||
virtual int begin() = 0;
|
||||
virtual void end() = 0;
|
||||
|
||||
@ -155,7 +157,6 @@ public:
|
||||
void updateBitrate() {
|
||||
if (!_radio_online) { _bitrate = 0; }
|
||||
else {
|
||||
|
||||
_lora_symbol_rate = (float)getSignalBandwidth()/(float)(pow(2, _sf));
|
||||
_lora_symbol_time_ms = (1.0/_lora_symbol_rate)*1000.0;
|
||||
_bitrate = (uint32_t)(_sf * ( (4.0/(float)getCodingRate4()) / ((float)(pow(2, _sf))/((float)getSignalBandwidth()/1000.0)) ) * 1000.0);
|
||||
@ -461,6 +462,8 @@ public:
|
||||
sx126x(uint8_t index, SPIClass* spi, bool tcxo, bool dio2_as_rf_switch, int ss, int sclk, int mosi, int miso, int reset, int
|
||||
dio0, int busy, int rxen);
|
||||
|
||||
void reset();
|
||||
|
||||
int begin();
|
||||
void end();
|
||||
|
||||
@ -541,7 +544,6 @@ private:
|
||||
void handleLowDataRate();
|
||||
void optimizeModemSensitivity();
|
||||
|
||||
void reset(void);
|
||||
void calibrate(void);
|
||||
void calibrate_image(uint32_t frequency);
|
||||
bool getPacketValidity();
|
||||
@ -575,6 +577,8 @@ class sx127x : public RadioInterface {
|
||||
public:
|
||||
sx127x(uint8_t index, SPIClass* spi, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy);
|
||||
|
||||
void reset();
|
||||
|
||||
int begin();
|
||||
void end();
|
||||
|
||||
@ -667,6 +671,8 @@ class sx128x : public RadioInterface {
|
||||
public:
|
||||
sx128x(uint8_t index, SPIClass* spi, bool tcxo, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy, int rxen, int txen);
|
||||
|
||||
void reset();
|
||||
|
||||
int begin();
|
||||
void end();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user