Addressing PR#279 comments
This commit is contained in:
parent
aebe2d2f98
commit
012c39e7f5
5 changed files with 37 additions and 11 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -13,4 +13,4 @@ extras/decoder/log.txt
|
|||
extras/decoder/out.txt
|
||||
|
||||
# PlatformIO
|
||||
.pio*
|
||||
.pio*
|
||||
|
|
|
@ -269,7 +269,7 @@ int16_t CC1101::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
if (_packetLengthConfig == CC1101_LENGTH_CONFIG_VARIABLE) {
|
||||
|
||||
// enforce variable len limit.
|
||||
if (len > 254) {
|
||||
if (len > CC1101_MAX_PACKET_LENGTH - 1) {
|
||||
return (ERR_PACKET_TOO_LONG);
|
||||
}
|
||||
|
||||
|
@ -307,6 +307,12 @@ int16_t CC1101::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
dataSent += bytesToWrite;
|
||||
} else {
|
||||
// wait for radio to send some data.
|
||||
/*
|
||||
* Does this work for all rates? If 1 ms is longer than the 1ms delay
|
||||
* then the entire FIFO will be transmitted during that delay.
|
||||
*
|
||||
* TODO: drop this delay(1) or come up with a better solution:
|
||||
*/
|
||||
delay(1);
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +355,7 @@ int16_t CC1101::readData(uint8_t* data, size_t len) {
|
|||
}
|
||||
|
||||
uint8_t bytesInFIFO = SPIgetRegValue(CC1101_REG_RXBYTES, 6, 0);
|
||||
uint16_t readBytes = 0;
|
||||
size_t readBytes = 0;
|
||||
uint32_t lastPop = millis();
|
||||
|
||||
// keep reading from FIFO until we get all the packet.
|
||||
|
@ -360,6 +366,12 @@ int16_t CC1101::readData(uint8_t* data, size_t len) {
|
|||
RADIOLIB_DEBUG_PRINTLN(F("No data for more than 5mS. Stop here."));
|
||||
break;
|
||||
} else {
|
||||
/*
|
||||
* Does this work for all rates? If 1 ms is longer than the 1ms delay
|
||||
* then the entire FIFO will be transmitted during that delay.
|
||||
*
|
||||
* TODO: drop this delay(1) or come up with a better solution:
|
||||
*/
|
||||
delay(1);
|
||||
bytesInFIFO = SPIgetRegValue(CC1101_REG_RXBYTES, 6, 0);
|
||||
continue;
|
||||
|
@ -392,7 +404,7 @@ int16_t CC1101::readData(uint8_t* data, size_t len) {
|
|||
_rawLQI = val & 0x7F;
|
||||
|
||||
// check CRC
|
||||
if (_crcOn && (val & 0b10000000) == 0b00000000) {
|
||||
if (_crcOn && (val & CC1101_CRC_OK) == CC1101_CRC_ERROR) {
|
||||
return (ERR_CRC_MISMATCH);
|
||||
}
|
||||
}
|
||||
|
@ -786,6 +798,10 @@ int16_t CC1101::setPromiscuousMode(bool promiscuous) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
bool CC1101::getPromiscuousMode() {
|
||||
return (_promiscuous);
|
||||
}
|
||||
|
||||
int16_t CC1101::setDataShaping(uint8_t sh) {
|
||||
// set mode to standby
|
||||
int16_t state = standby();
|
||||
|
|
|
@ -602,7 +602,7 @@ class CC1101: public PhysicalLayer {
|
|||
|
||||
\param dir Signal change direction. Defaults to RISING.
|
||||
*/
|
||||
void setGdo0Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = FALLING);
|
||||
void setGdo0Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = RISING);
|
||||
|
||||
/*!
|
||||
\brief Clears interrupt service routine to call when GDO0 activates.
|
||||
|
@ -847,6 +847,13 @@ class CC1101: public PhysicalLayer {
|
|||
*/
|
||||
int16_t setPromiscuousMode(bool promiscuous = true);
|
||||
|
||||
/*!
|
||||
\brief Get whether the modem is in promiscuous mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
||||
|
||||
\returns Whether the modem is in promiscuous mode
|
||||
*/
|
||||
bool getPromiscuousMode();
|
||||
|
||||
/*!
|
||||
\brief Sets Gaussian filter bandwidth-time product that will be used for data shaping.
|
||||
Allowed value is RADIOLIB_SHAPING_0_5. Set to RADIOLIB_SHAPING_NONE to disable data shaping.
|
||||
|
|
|
@ -910,4 +910,8 @@ void RF69::clearIRQFlags() {
|
|||
_mod->SPIwriteRegister(RF69_REG_IRQ_FLAGS_2, 0b11111111);
|
||||
}
|
||||
|
||||
int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2) {
|
||||
return (_mod->SPIsetRegValue(reg, value, msb, lsb, checkInterval));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -874,13 +874,12 @@ class RF69: public PhysicalLayer {
|
|||
#endif
|
||||
Module* _mod;
|
||||
|
||||
// SPI read overrides to set bit for burst write and status registers access
|
||||
int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
|
||||
/*!
|
||||
\brief Proxy to _mod->SPIsetRegValue (to avoid exposing _mod)
|
||||
|
||||
\returns \ref status code
|
||||
*/
|
||||
int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
|
||||
void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
|
||||
uint8_t SPIreadRegister(uint8_t reg);
|
||||
void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
|
||||
void SPIwriteRegister(uint8_t reg, uint8_t data);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
protected:
|
||||
|
|
Loading…
Add table
Reference in a new issue