diff --git a/HamShield.cpp b/HamShield.cpp index 687765f..9eb2af5 100644 --- a/HamShield.cpp +++ b/HamShield.cpp @@ -11,6 +11,7 @@ /* don't change this regulatory value, use dangerMode() and safeMode() instead */ bool restrictions = true; +HamShield *HamShield::sHamShield = NULL; /* channel lookup tables */ @@ -119,6 +120,7 @@ volatile long bouncer = 0; */ HamShield::HamShield() { devAddr = A1846S_DEV_ADDR_SENLOW; + sHamShield = this; } /** Specific address constructor. @@ -1198,7 +1200,6 @@ uint32_t HamShield::findWhitespaceChannels(uint32_t buffer[],uint8_t buffsize, u void HamShield::buttonMode(uint8_t mode) { pinMode(HAMSHIELD_AUX_BUTTON,INPUT); // set the pin mode to input digitalWrite(HAMSHIELD_AUX_BUTTON,HIGH); // turn on internal pull up - sHamShield = this; if(mode == PTT_MODE) { attachInterrupt(HAMSHIELD_AUX_BUTTON, HamShield::isr_ptt, CHANGE); } if(mode == RESET_MODE) { attachInterrupt(HAMSHIELD_AUX_BUTTON, HamShield::isr_reset, CHANGE); } } diff --git a/HamShield.h b/HamShield.h index 57200fb..3bde6c5 100644 --- a/HamShield.h +++ b/HamShield.h @@ -544,6 +544,8 @@ class HamShield { uint32_t GMRS[]; uint32_t MURS[]; uint32_t WX[]; + + public: static HamShield *sHamShield; // HamShield singleton, used for ISRs mostly // int8_t A1846S::readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout);