enable/disable to set + bool
This commit is contained in:
parent
2e019c3700
commit
c56a76d296
4 changed files with 27 additions and 37 deletions
|
@ -605,15 +605,15 @@ int16_t CC1101::disableSyncWordFiltering() {
|
||||||
return(SPIsetRegValue(CC1101_REG_MDMCFG2, CC1101_SYNC_MODE_NONE, 2, 0));
|
return(SPIsetRegValue(CC1101_REG_MDMCFG2, CC1101_SYNC_MODE_NONE, 2, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t CC1101::enableCrcFiltering() {
|
int16_t CC1101::setCrcFiltering(bool crcOn) {
|
||||||
|
if (crcOn == true) {
|
||||||
return(SPIsetRegValue(CC1101_REG_PKTCTRL0, CC1101_CRC_ON, 2, 2));
|
return(SPIsetRegValue(CC1101_REG_PKTCTRL0, CC1101_CRC_ON, 2, 2));
|
||||||
}
|
} else {
|
||||||
|
|
||||||
int16_t CC1101::disableCrcFiltering() {
|
|
||||||
return(SPIsetRegValue(CC1101_REG_PKTCTRL0, CC1101_CRC_OFF, 2, 2));
|
return(SPIsetRegValue(CC1101_REG_PKTCTRL0, CC1101_CRC_OFF, 2, 2));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int16_t CC1101::promiscuousMode(bool promiscuous) {
|
int16_t CC1101::setPromiscuousMode(bool promiscuous) {
|
||||||
int16_t state = ERR_NONE;
|
int16_t state = ERR_NONE;
|
||||||
|
|
||||||
if (_promiscuous == promiscuous) {
|
if (_promiscuous == promiscuous) {
|
||||||
|
@ -628,7 +628,7 @@ int16_t CC1101::promiscuousMode(bool promiscuous) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable CRC filtering
|
// disable CRC filtering
|
||||||
state = disableCrcFiltering();
|
state = setCrcFiltering(false);
|
||||||
} else {
|
} else {
|
||||||
// enable preamble and sync word filtering and insertion
|
// enable preamble and sync word filtering and insertion
|
||||||
state = enableSyncWordFiltering();
|
state = enableSyncWordFiltering();
|
||||||
|
@ -637,7 +637,7 @@ int16_t CC1101::promiscuousMode(bool promiscuous) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable CRC filtering
|
// enable CRC filtering
|
||||||
state = enableCrcFiltering();
|
state = setCrcFiltering(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
|
|
|
@ -778,11 +778,11 @@ class CC1101: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Enable sync word filtering and generation.
|
\brief Enable sync word filtering and generation.
|
||||||
|
|
||||||
\param len Size of sync word (1 or 2 bytes).
|
\param numBits Sync word length in bits.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t enableSyncWordFiltering(uint8_t len = CC1101_DEFAULT_SYNC_WORD_LENGTH);
|
int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Disable preamble and sync word filtering and generation.
|
\brief Disable preamble and sync word filtering and generation.
|
||||||
|
@ -794,16 +794,11 @@ class CC1101: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Enable CRC filtering and generation.
|
\brief Enable CRC filtering and generation.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\param crcOn Set or unset promiscuous mode.
|
||||||
*/
|
|
||||||
int16_t enableCrcFiltering();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Disable CRC filtering and generation.
|
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t disableCrcFiltering();
|
int16_t setCrcFiltering(bool crcOn = true);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
||||||
|
@ -812,7 +807,7 @@ class CC1101: public PhysicalLayer {
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t promiscuousMode(bool promiscuous = true);
|
int16_t setPromiscuousMode(bool promiscuous = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Module* _mod;
|
Module* _mod;
|
||||||
|
|
|
@ -669,15 +669,15 @@ int16_t RF69::disableSyncWordFiltering() {
|
||||||
return(state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::enableCrcFiltering() {
|
int16_t RF69::setCrcFiltering(bool crcOn) {
|
||||||
return(_mod->SPIsetRegValue(RF69_REG_PACKET_CONFIG_1, RF69_CRC_ON), 4, 4);
|
if (crcOn == true) {
|
||||||
|
return(_mod->SPIsetRegValue(RF69_REG_PACKET_CONFIG_1, RF69_CRC_ON, 4, 4));
|
||||||
|
} else {
|
||||||
|
return(_mod->SPIsetRegValue(RF69_REG_PACKET_CONFIG_1, RF69_CRC_OFF, 4, 4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::disableCrcFiltering() {
|
int16_t RF69::setPromiscuousMode(bool promiscuous) {
|
||||||
return(_mod->SPIsetRegValue(RF69_REG_PACKET_CONFIG_1, RF69_CRC_OFF), 4, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t RF69::promiscuousMode(bool promiscuous) {
|
|
||||||
int16_t state = ERR_NONE;
|
int16_t state = ERR_NONE;
|
||||||
|
|
||||||
if (_promiscuous == promiscuous) {
|
if (_promiscuous == promiscuous) {
|
||||||
|
@ -692,7 +692,7 @@ int16_t RF69::promiscuousMode(bool promiscuous) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable CRC filtering
|
// disable CRC filtering
|
||||||
state = disableCrcFiltering();
|
state = setCrcFiltering(false);
|
||||||
} else {
|
} else {
|
||||||
// enable preamble and sync word filtering and insertion
|
// enable preamble and sync word filtering and insertion
|
||||||
state = enableSyncWordFiltering();
|
state = enableSyncWordFiltering();
|
||||||
|
@ -701,7 +701,7 @@ int16_t RF69::promiscuousMode(bool promiscuous) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable CRC filtering
|
// enable CRC filtering
|
||||||
state = enableCrcFiltering();
|
state = setCrcFiltering(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(state);
|
return(state);
|
||||||
|
|
|
@ -735,7 +735,7 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t enableSyncWordFiltering(uint8_t numBits = 16);
|
int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Disable preamble and sync word filtering and generation.
|
\brief Disable preamble and sync word filtering and generation.
|
||||||
|
@ -747,16 +747,11 @@ class RF69: public PhysicalLayer {
|
||||||
/*!
|
/*!
|
||||||
\brief Enable CRC filtering and generation.
|
\brief Enable CRC filtering and generation.
|
||||||
|
|
||||||
\returns \ref status_codes
|
\param crcOn Set or unset promiscuous mode.
|
||||||
*/
|
|
||||||
int16_t enableCrcFiltering();
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Disable CRC filtering and generation.
|
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t disableCrcFiltering();
|
int16_t setCrcFiltering(bool crcOn = true);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
|
||||||
|
@ -765,7 +760,7 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
\returns \ref status_codes
|
\returns \ref status_codes
|
||||||
*/
|
*/
|
||||||
int16_t promiscuousMode(bool promiscuous = true);
|
int16_t setPromiscuousMode(bool promiscuous = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Module* _mod;
|
Module* _mod;
|
||||||
|
|
Loading…
Add table
Reference in a new issue