[SX127x] Fixed reset implementation for SX1272/73

pull/127/head
jgromes 2020-03-13 21:16:29 +01:00
rodzic c12cd6a53d
commit c1c991acc8
6 zmienionych plików z 28 dodań i 13 usunięć

Wyświetl plik

@ -57,6 +57,14 @@ int16_t SX1272::beginFSK(float freq, float br, float rxBw, float freqDev, int8_t
return(state);
}
void SX1272::reset() {
Module::pinMode(_mod->getRst(), OUTPUT);
Module::digitalWrite(_mod->getRst(), HIGH);
delayMicroseconds(100);
Module::digitalWrite(_mod->getRst(), LOW);
delay(5);
}
int16_t SX1272::setFrequency(float freq) {
// check frequency range
if((freq < 860.0) || (freq > 1020.0)) {

Wyświetl plik

@ -155,6 +155,11 @@ class SX1272: public SX127x {
\returns \ref status_codes
*/
int16_t beginFSK(float freq = 915.0, float br = 48.0, float rxBw = 125.0, float freqDev = 50.0, int8_t power = 13, uint8_t currentLimit = 100, uint16_t preambleLength = 16, bool enableOOK = false);
/*!
\brief Reset method. Will reset the chip to the default state using RST pin.
*/
void reset();
// configuration methods

Wyświetl plik

@ -52,6 +52,14 @@ int16_t SX1278::beginFSK(float freq, float br, float freqDev, float rxBw, int8_t
return(state);
}
void SX1278::reset() {
Module::pinMode(_mod->getRst(), OUTPUT);
Module::digitalWrite(_mod->getRst(), LOW);
delayMicroseconds(100);
Module::digitalWrite(_mod->getRst(), HIGH);
delay(5);
}
int16_t SX1278::setFrequency(float freq) {
// check frequency range
if((freq < 137.0) || (freq > 525.0)) {

Wyświetl plik

@ -165,6 +165,11 @@ class SX1278: public SX127x {
*/
int16_t beginFSK(float freq = 434.0, float br = 48.0, float freqDev = 50.0, float rxBw = 125.0, int8_t power = 13, uint8_t currentLimit = 100, uint16_t preambleLength = 16, bool enableOOK = false);
/*!
\brief Reset method. Will reset the chip to the default state using RST pin.
*/
void reset();
// configuration methods
/*!

Wyświetl plik

@ -54,9 +54,6 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float br, float freqDev, float rxB
_mod->init(RADIOLIB_USE_SPI);
Module::pinMode(_mod->getIrq(), INPUT);
// reset the module
reset();
// try to find the SX127x chip
if(!SX127x::findChip(chipVersion)) {
RADIOLIB_DEBUG_PRINTLN(F("No SX127x found!"));
@ -121,14 +118,6 @@ int16_t SX127x::beginFSK(uint8_t chipVersion, float br, float freqDev, float rxB
return(state);
}
void SX127x::reset() {
Module::pinMode(_mod->getRst(), OUTPUT);
Module::digitalWrite(_mod->getRst(), LOW);
delayMicroseconds(100);
Module::digitalWrite(_mod->getRst(), HIGH);
delay(5);
}
int16_t SX127x::transmit(uint8_t* data, size_t len, uint8_t addr) {
// set mode to standby
int16_t state = setMode(SX127X_STANDBY);

Wyświetl plik

@ -565,9 +565,9 @@ class SX127x: public PhysicalLayer {
int16_t begin(uint8_t chipVersion, uint8_t syncWord, uint8_t currentLimit, uint16_t preambleLength);
/*!
\brief Reset method. Will reset the chip to the default state using RST pin.
\brief Reset method. Will reset the chip to the default state using RST pin. Declared pure virtual since SX1272 and SX1278 implmentations differ.
*/
void reset();
virtual void reset() = 0;
/*!
\brief Initialization method for FSK modem. Will be called with appropriate parameters when calling FSK initialization method from derived class.