diff --git a/_c_c1101_8h_source.html b/_c_c1101_8h_source.html index a346a363..8ee3e696 100644 --- a/_c_c1101_8h_source.html +++ b/_c_c1101_8h_source.html @@ -546,188 +546,189 @@ $(document).ready(function(){initNavTree('_c_c1101_8h_source.html',''); initResi
458 // CC1101_REG_VERSION
459 #define CC1101_VERSION_CURRENT 0x14
460 #define CC1101_VERSION_LEGACY 0x04
-
461 
-
462 // CC1101_REG_MARCSTATE
-
463 #define CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
-
464 #define CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
-
465 #define CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
-
466 #define CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
-
467 #define CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
-
468 #define CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
-
469 #define CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
-
470 #define CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
-
471 #define CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
-
472 #define CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
-
473 #define CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
-
474 #define CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
-
475 #define CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
-
476 #define CC1101_MARC_STATE_RX 0x0D // 4 0 RX
-
477 #define CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
-
478 #define CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
-
479 #define CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
-
480 #define CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
-
481 #define CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
-
482 #define CC1101_MARC_STATE_TX 0x13 // 4 0 TX
-
483 #define CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
-
484 #define CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
-
485 #define CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
-
486 
-
487 // CC1101_REG_WORTIME1 + REG_WORTIME0
-
488 #define CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
-
489 #define CC1101_WORTIME_LSB 0x00 // 7 0
-
490 
-
491 // CC1101_REG_PKTSTATUS
-
492 #define CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
-
493 #define CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
-
494 #define CC1101_CS 0b01000000 // 6 6 carrier sense
-
495 #define CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
-
496 #define CC1101_CCA 0b00010000 // 4 4 channel clear
-
497 #define CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
-
498 #define CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
-
499 #define CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
-
500 
-
506 class CC1101: public PhysicalLayer {
-
507  public:
-
508  // introduce PhysicalLayer overloads
-
509  using PhysicalLayer::transmit;
-
510  using PhysicalLayer::receive;
-
511  using PhysicalLayer::startTransmit;
-
512  using PhysicalLayer::readData;
-
513 
-
519  CC1101(Module* module);
-
520 
-
521  // basic methods
-
522 
-
540  int16_t begin(float freq = 434.0, float br = 48.0, float freqDev = 48.0, float rxBw = 135.0, int8_t power = 10, uint8_t preambleLength = 16);
-
541 
-
554  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
-
555 
-
566  int16_t receive(uint8_t* data, size_t len) override;
-
567 
-
573  int16_t standby() override;
-
574 
-
582  int16_t transmitDirect(uint32_t frf = 0) override;
-
583 
-
589  int16_t receiveDirect() override;
-
590 
-
594  int16_t packetMode();
-
595 
-
596  // interrupt methods
-
597 
-
605  void setGdo0Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = RISING);
-
606 
-
610  void clearGdo0Action();
-
611 
-
619  void setGdo2Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = FALLING);
-
620 
-
624  void clearGdo2Action();
-
625 
-
638  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
-
639 
-
645  int16_t startReceive();
-
646 
-
656  int16_t readData(uint8_t* data, size_t len) override;
-
657 
-
658  // configuration methods
-
659 
-
667  int16_t setFrequency(float freq);
-
668 
-
676  int16_t setBitRate(float br);
-
677 
-
685  int16_t setRxBandwidth(float rxBw);
-
686 
-
694  int16_t setFrequencyDeviation(float freqDev) override;
-
695 
-
703  int16_t setOutputPower(int8_t power);
-
704 
-
718  int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
719 
-
733  int16_t setSyncWord(uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
734 
-
742  int16_t setPreambleLength(uint8_t preambleLength);
-
743 
-
753  int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
-
754 
-
760  int16_t disableAddressFiltering();
-
761 
-
769  int16_t setOOK(bool enableOOK);
-
770 
-
776  float getRSSI() const;
-
777 
-
783  uint8_t getLQI() const;
-
784 
-
792  size_t getPacketLength(bool update = true) override;
-
793 
-
801  int16_t fixedPacketLengthMode(uint8_t len = CC1101_MAX_PACKET_LENGTH);
-
802 
-
810  int16_t variablePacketLengthMode(uint8_t maxLen = CC1101_MAX_PACKET_LENGTH);
-
811 
-
821  int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
-
822 
-
830  int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
-
831 
-
839  int16_t setCrcFiltering(bool crcOn = true);
-
840 
-
848  int16_t setPromiscuousMode(bool promiscuous = true);
-
849 
-
855  bool getPromiscuousMode();
-
856 
-
865  int16_t setDataShaping(uint8_t sh) override;
-
866 
-
874  int16_t setEncoding(uint8_t encoding) override;
-
875 
-
884  void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
-
885 
-
891  uint8_t randomByte();
-
892 
-
898  int16_t getChipVersion();
-
899 
-
905  void setDirectAction(void (*func)(void));
-
906 
-
912  void readBit(RADIOLIB_PIN_TYPE pin);
-
913 
-
914  #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
-
915  protected:
-
916  #endif
-
917  Module* _mod;
-
918 
-
919  // SPI read overrides to set bit for burst write and status registers access
-
920  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
-
921  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
-
922  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
-
923  uint8_t SPIreadRegister(uint8_t reg);
-
924  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
-
925  void SPIwriteRegister(uint8_t reg, uint8_t data);
-
926 
-
927  void SPIsendCommand(uint8_t cmd);
-
928 
-
929  #if !defined(RADIOLIB_GODMODE)
-
930  protected:
-
931  #endif
-
932 
-
933  float _freq = 0;
-
934  float _br = 0;
-
935  uint8_t _rawRSSI = 0;
-
936  uint8_t _rawLQI = 0;
-
937  uint8_t _modulation = CC1101_MOD_FORMAT_2_FSK;
-
938 
-
939  size_t _packetLength = 0;
-
940  bool _packetLengthQueried = false;
-
941  uint8_t _packetLengthConfig = CC1101_LENGTH_CONFIG_VARIABLE;
-
942 
-
943  bool _promiscuous = false;
-
944  bool _crcOn = true;
-
945 
-
946  uint8_t _syncWordLength = 2;
-
947  int8_t _power = 0;
-
948 
-
949  int16_t config();
-
950  int16_t directMode();
-
951  static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
-
952  int16_t setPacketMode(uint8_t mode, uint8_t len);
-
953 };
-
954 
-
955 #endif
+
461 #define CC1101_VERSION_CLONE 0x17
+
462 
+
463 // CC1101_REG_MARCSTATE
+
464 #define CC1101_MARC_STATE_SLEEP 0x00 // 4 0 main radio control state: sleep
+
465 #define CC1101_MARC_STATE_IDLE 0x01 // 4 0 idle
+
466 #define CC1101_MARC_STATE_XOFF 0x02 // 4 0 XOFF
+
467 #define CC1101_MARC_STATE_VCOON_MC 0x03 // 4 0 VCOON_MC
+
468 #define CC1101_MARC_STATE_REGON_MC 0x04 // 4 0 REGON_MC
+
469 #define CC1101_MARC_STATE_MANCAL 0x05 // 4 0 MANCAL
+
470 #define CC1101_MARC_STATE_VCOON 0x06 // 4 0 VCOON
+
471 #define CC1101_MARC_STATE_REGON 0x07 // 4 0 REGON
+
472 #define CC1101_MARC_STATE_STARTCAL 0x08 // 4 0 STARTCAL
+
473 #define CC1101_MARC_STATE_BWBOOST 0x09 // 4 0 BWBOOST
+
474 #define CC1101_MARC_STATE_FS_LOCK 0x0A // 4 0 FS_LOCK
+
475 #define CC1101_MARC_STATE_IFADCON 0x0B // 4 0 IFADCON
+
476 #define CC1101_MARC_STATE_ENDCAL 0x0C // 4 0 ENDCAL
+
477 #define CC1101_MARC_STATE_RX 0x0D // 4 0 RX
+
478 #define CC1101_MARC_STATE_RX_END 0x0E // 4 0 RX_END
+
479 #define CC1101_MARC_STATE_RX_RST 0x0F // 4 0 RX_RST
+
480 #define CC1101_MARC_STATE_TXRX_SWITCH 0x10 // 4 0 TXRX_SWITCH
+
481 #define CC1101_MARC_STATE_RXFIFO_OVERFLOW 0x11 // 4 0 RXFIFO_OVERFLOW
+
482 #define CC1101_MARC_STATE_FSTXON 0x12 // 4 0 FSTXON
+
483 #define CC1101_MARC_STATE_TX 0x13 // 4 0 TX
+
484 #define CC1101_MARC_STATE_TX_END 0x14 // 4 0 TX_END
+
485 #define CC1101_MARC_STATE_RXTX_SWITCH 0x15 // 4 0 RXTX_SWITCH
+
486 #define CC1101_MARC_STATE_TXFIFO_UNDERFLOW 0x16 // 4 0 TXFIFO_UNDERFLOW
+
487 
+
488 // CC1101_REG_WORTIME1 + REG_WORTIME0
+
489 #define CC1101_WORTIME_MSB 0x00 // 7 0 WOR timer value
+
490 #define CC1101_WORTIME_LSB 0x00 // 7 0
+
491 
+
492 // CC1101_REG_PKTSTATUS
+
493 #define CC1101_CRC_OK 0b10000000 // 7 7 CRC check passed
+
494 #define CC1101_CRC_ERROR 0b00000000 // 7 7 CRC check failed
+
495 #define CC1101_CS 0b01000000 // 6 6 carrier sense
+
496 #define CC1101_PQT_REACHED 0b00100000 // 5 5 preamble quality reached
+
497 #define CC1101_CCA 0b00010000 // 4 4 channel clear
+
498 #define CC1101_SFD 0b00001000 // 3 3 start of frame delimiter - sync word received
+
499 #define CC1101_GDO2_ACTIVE 0b00000100 // 2 2 GDO2 is active/asserted
+
500 #define CC1101_GDO0_ACTIVE 0b00000001 // 0 0 GDO0 is active/asserted
+
501 
+
507 class CC1101: public PhysicalLayer {
+
508  public:
+
509  // introduce PhysicalLayer overloads
+
510  using PhysicalLayer::transmit;
+
511  using PhysicalLayer::receive;
+
512  using PhysicalLayer::startTransmit;
+
513  using PhysicalLayer::readData;
+
514 
+
520  CC1101(Module* module);
+
521 
+
522  // basic methods
+
523 
+
541  int16_t begin(float freq = 434.0, float br = 48.0, float freqDev = 48.0, float rxBw = 135.0, int8_t power = 10, uint8_t preambleLength = 16);
+
542 
+
555  int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
+
556 
+
567  int16_t receive(uint8_t* data, size_t len) override;
+
568 
+
574  int16_t standby() override;
+
575 
+
583  int16_t transmitDirect(uint32_t frf = 0) override;
+
584 
+
590  int16_t receiveDirect() override;
+
591 
+
595  int16_t packetMode();
+
596 
+
597  // interrupt methods
+
598 
+
606  void setGdo0Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = RISING);
+
607 
+
611  void clearGdo0Action();
+
612 
+
620  void setGdo2Action(void (*func)(void), RADIOLIB_INTERRUPT_STATUS dir = FALLING);
+
621 
+
625  void clearGdo2Action();
+
626 
+
639  int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
+
640 
+
646  int16_t startReceive();
+
647 
+
657  int16_t readData(uint8_t* data, size_t len) override;
+
658 
+
659  // configuration methods
+
660 
+
668  int16_t setFrequency(float freq);
+
669 
+
677  int16_t setBitRate(float br);
+
678 
+
686  int16_t setRxBandwidth(float rxBw);
+
687 
+
695  int16_t setFrequencyDeviation(float freqDev) override;
+
696 
+
704  int16_t setOutputPower(int8_t power);
+
705 
+
719  int16_t setSyncWord(uint8_t syncH, uint8_t syncL, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
720 
+
734  int16_t setSyncWord(uint8_t* syncWord, uint8_t len, uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
735 
+
743  int16_t setPreambleLength(uint8_t preambleLength);
+
744 
+
754  int16_t setNodeAddress(uint8_t nodeAddr, uint8_t numBroadcastAddrs = 0);
+
755 
+
761  int16_t disableAddressFiltering();
+
762 
+
770  int16_t setOOK(bool enableOOK);
+
771 
+
777  float getRSSI() const;
+
778 
+
784  uint8_t getLQI() const;
+
785 
+
793  size_t getPacketLength(bool update = true) override;
+
794 
+
802  int16_t fixedPacketLengthMode(uint8_t len = CC1101_MAX_PACKET_LENGTH);
+
803 
+
811  int16_t variablePacketLengthMode(uint8_t maxLen = CC1101_MAX_PACKET_LENGTH);
+
812 
+
822  int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0, bool requireCarrierSense = false);
+
823 
+
831  int16_t disableSyncWordFiltering(bool requireCarrierSense = false);
+
832 
+
840  int16_t setCrcFiltering(bool crcOn = true);
+
841 
+
849  int16_t setPromiscuousMode(bool promiscuous = true);
+
850 
+
856  bool getPromiscuousMode();
+
857 
+
866  int16_t setDataShaping(uint8_t sh) override;
+
867 
+
875  int16_t setEncoding(uint8_t encoding) override;
+
876 
+
885  void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
+
886 
+
892  uint8_t randomByte();
+
893 
+
899  int16_t getChipVersion();
+
900 
+
906  void setDirectAction(void (*func)(void));
+
907 
+
913  void readBit(RADIOLIB_PIN_TYPE pin);
+
914 
+
915  #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
+
916  protected:
+
917  #endif
+
918  Module* _mod;
+
919 
+
920  // SPI read overrides to set bit for burst write and status registers access
+
921  int16_t SPIgetRegValue(uint8_t reg, uint8_t msb = 7, uint8_t lsb = 0);
+
922  int16_t SPIsetRegValue(uint8_t reg, uint8_t value, uint8_t msb = 7, uint8_t lsb = 0, uint8_t checkInterval = 2);
+
923  void SPIreadRegisterBurst(uint8_t reg, uint8_t numBytes, uint8_t* inBytes);
+
924  uint8_t SPIreadRegister(uint8_t reg);
+
925  void SPIwriteRegisterBurst(uint8_t reg, uint8_t* data, size_t len);
+
926  void SPIwriteRegister(uint8_t reg, uint8_t data);
+
927 
+
928  void SPIsendCommand(uint8_t cmd);
+
929 
+
930  #if !defined(RADIOLIB_GODMODE)
+
931  protected:
+
932  #endif
+
933 
+
934  float _freq = 0;
+
935  float _br = 0;
+
936  uint8_t _rawRSSI = 0;
+
937  uint8_t _rawLQI = 0;
+
938  uint8_t _modulation = CC1101_MOD_FORMAT_2_FSK;
+
939 
+
940  size_t _packetLength = 0;
+
941  bool _packetLengthQueried = false;
+
942  uint8_t _packetLengthConfig = CC1101_LENGTH_CONFIG_VARIABLE;
+
943 
+
944  bool _promiscuous = false;
+
945  bool _crcOn = true;
+
946 
+
947  uint8_t _syncWordLength = 2;
+
948  int8_t _power = 0;
+
949 
+
950  int16_t config();
+
951  int16_t directMode();
+
952  static void getExpMant(float target, uint16_t mantOffset, uint8_t divExp, uint8_t expMax, uint8_t& exp, uint8_t& mant);
+
953  int16_t setPacketMode(uint8_t mode, uint8_t len);
+
954 };
+
955 
+
956 #endif
PhysicalLayer::transmit
int16_t transmit(__FlashStringHelper *fstr, uint8_t addr=0)
Arduino Flash String transmit method.
Definition: PhysicalLayer.cpp:10
@@ -772,7 +773,7 @@ $(document).ready(function(){initNavTree('_c_c1101_8h_source.html',''); initResi
CC1101::receiveDirect
int16_t receiveDirect() override
Starts direct mode reception.
Definition: CC1101.cpp:206
CC1101::enableSyncWordFiltering
int16_t enableSyncWordFiltering(uint8_t maxErrBits=0, bool requireCarrierSense=false)
Enable sync word filtering and generation.
Definition: CC1101.cpp:743
CC1101::setGdo0Action
void setGdo0Action(void(*func)(void), RADIOLIB_INTERRUPT_STATUS dir=RISING)
Sets interrupt service routine to call when GDO0 activates.
Definition: CC1101.cpp:226
-
CC1101
Control class for CC1101 module.
Definition: CC1101.h:506
+
CC1101
Control class for CC1101 module.
Definition: CC1101.h:507
CC1101::setRfSwitchPins
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn)
Some modules contain external RF switch controlled by two pins. This function gives RadioLib control ...
Definition: CC1101.cpp:845
CC1101::setPromiscuousMode
int16_t setPromiscuousMode(bool promiscuous=true)
Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address,...
Definition: CC1101.cpp:770
CC1101::setCrcFiltering
int16_t setCrcFiltering(bool crcOn=true)
Enable CRC filtering and generation.
Definition: CC1101.cpp:760