MCPcopy Create free account
hub / github.com/LowPowerLab/RFM69 / readAllRegs

Method readAllRegs

RFM69.cpp:679–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677#endif
678
679void RFM69::readAllRegs() {
680 uint8_t regVal;
681
682#if REGISTER_DETAIL
683 int capVal;
684
685 //... State Variables for intelligent decoding
686 uint8_t modeFSK = 0;
687 int bitRate = 0;
688 int freqDev = 0;
689 long freqCenter = 0;
690#endif
691
692 Serial.println("Address - HEX - BIN");
693 for (uint8_t regAddr = 1; regAddr <= 0x4F; regAddr++) {
694 select();
695 _spi->transfer(regAddr & 0x7F); // send address + r/w bit
696 regVal = _spi->transfer(0);
697 unselect();
698
699 Serial.print(regAddr, HEX);
700 Serial.print(" - ");
701 Serial.print(regVal, HEX);
702 Serial.print(" - ");
703 Serial.println(regVal, BIN);
704
705#if REGISTER_DETAIL
706 switch (regAddr){
707 case 0x1 : {
708 SerialPrint("Controls the automatic Sequencer ( see section 4.2 )\nSequencerOff : ");
709 if (0x80 & regVal) {
710 SerialPrint("1 -> Mode is forced by the user\n");
711 } else {
712 SerialPrint("0 -> Operating mode as selected with Mode bits in RegOpMode is automatically reached with the Sequencer\n");
713 }
714
715 SerialPrint("\nEnables Listen mode, should be enabled whilst in Standby mode:\nListenOn : ");
716 if (0x40 & regVal) {
717 SerialPrint("1 -> On\n");
718 } else {
719 SerialPrint("0 -> Off ( see section 4.3)\n");
720 }
721
722 SerialPrint("\nAborts Listen mode when set together with ListenOn=0 See section 4.3.4 for details (Always reads 0.)\n");
723 if (0x20 & regVal) {
724 SerialPrint("ERROR - ListenAbort should NEVER return 1 this is a write only register\n");
725 }
726
727 SerialPrint("\nTransceiver's operating modes:\nMode : ");
728 capVal = (regVal >> 2) & 0x7;
729 if (capVal == 0b000) {
730 SerialPrint("000 -> Sleep mode (SLEEP)\n");
731 } else if (capVal == 0b001) {
732 SerialPrint("001 -> Standby mode (STDBY)\n");
733 } else if (capVal == 0b010) {
734 SerialPrint("010 -> Frequency Synthesizer mode (FS)\n");
735 } else if (capVal == 0b011) {
736 SerialPrint("011 -> Transmitter mode (TX)\n");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected