[CC1101] Implemented RF switch control
This commit is contained in:
parent
78022ce6ad
commit
3aafb2f5bf
2 changed files with 20 additions and 0 deletions
|
@ -232,6 +232,9 @@ int16_t CC1101::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
||||||
// write packet to FIFO
|
// write packet to FIFO
|
||||||
SPIwriteRegisterBurst(CC1101_REG_FIFO, data, len);
|
SPIwriteRegisterBurst(CC1101_REG_FIFO, data, len);
|
||||||
|
|
||||||
|
// set RF switch (if present)
|
||||||
|
_mod->setRfSwitchState(true);
|
||||||
|
|
||||||
// set mode to transmit
|
// set mode to transmit
|
||||||
SPIsendCommand(CC1101_CMD_TX);
|
SPIsendCommand(CC1101_CMD_TX);
|
||||||
|
|
||||||
|
@ -249,6 +252,9 @@ int16_t CC1101::startReceive() {
|
||||||
int state = SPIsetRegValue(CC1101_REG_IOCFG0, CC1101_GDOX_SYNC_WORD_SENT_OR_RECEIVED);
|
int state = SPIsetRegValue(CC1101_REG_IOCFG0, CC1101_GDOX_SYNC_WORD_SENT_OR_RECEIVED);
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
|
// set RF switch (if present)
|
||||||
|
_mod->setRfSwitchState(false);
|
||||||
|
|
||||||
// set mode to receive
|
// set mode to receive
|
||||||
SPIsendCommand(CC1101_CMD_RX);
|
SPIsendCommand(CC1101_CMD_RX);
|
||||||
|
|
||||||
|
@ -710,6 +716,10 @@ int16_t CC1101::setEncoding(uint8_t encoding) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CC1101::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
|
||||||
|
_mod->setRfSwitchPins(rxEn, txEn);
|
||||||
|
}
|
||||||
|
|
||||||
int16_t CC1101::config() {
|
int16_t CC1101::config() {
|
||||||
// Reset the radio. Registers may be dirty from previous usage.
|
// Reset the radio. Registers may be dirty from previous usage.
|
||||||
SPIsendCommand(CC1101_CMD_RESET);
|
SPIsendCommand(CC1101_CMD_RESET);
|
||||||
|
|
|
@ -864,6 +864,16 @@ class CC1101: public PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
int16_t setEncoding(uint8_t encoding);
|
int16_t setEncoding(uint8_t encoding);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state.
|
||||||
|
When using automatic RF switch control, DO NOT change the pin mode of rxEn or txEn from Arduino sketch!
|
||||||
|
|
||||||
|
\param rxEn RX enable pin.
|
||||||
|
|
||||||
|
\param txEn TX enable pin.
|
||||||
|
*/
|
||||||
|
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
|
||||||
|
|
||||||
#ifndef RADIOLIB_GODMODE
|
#ifndef RADIOLIB_GODMODE
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue