Static method declarations for ISR handlers and singleton object.
This commit is contained in:
parent
2d5deedf54
commit
8fb40c3716
|
@ -1129,23 +1129,14 @@ uint32_t HamShield::findWhitespaceChannels(uint32_t buffer[],uint8_t buffsize, u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Setup the auxiliary button input mode and register the ISR */
|
||||||
BUG: I cannot figure out how to attach these interrupt handlers without the error:
|
|
||||||
|
|
||||||
/Users/casey/Documents/Arduino/libraries/HamShield/HamShield.cpp: In member function 'void HamShield::buttonMode(uint8_t)':
|
|
||||||
/Users/casey/Documents/Arduino/libraries/HamShield/HamShield.cpp:1125: error: argument of type 'void (HamShield::)()' does not match 'void (*)()'
|
|
||||||
/Users/casey/Documents/Arduino/libraries/HamShield/HamShield.cpp:1126: error: argument of type 'void (HamShield::)()' does not match 'void (*)()'
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
void HamShield::buttonMode(uint8_t mode) {
|
void HamShield::buttonMode(uint8_t mode) {
|
||||||
pinMode(HAMSHIELD_AUX_BUTTON,INPUT); // set the pin mode to input
|
pinMode(HAMSHIELD_AUX_BUTTON,INPUT); // set the pin mode to input
|
||||||
digitalWrite(HAMSHIELD_AUX_BUTTON,HIGH); // turn on internal pull up
|
digitalWrite(HAMSHIELD_AUX_BUTTON,HIGH); // turn on internal pull up
|
||||||
if(mode == PTT_MODE) { attachInterrupt(HAMSHIELD_AUX_BUTTON, isr_ptt, CHANGE); }
|
sHamShield = this;
|
||||||
if(mode == RESET_MODE) { attachInterrupt(HAMSHIELD_AUX_BUTTON, isr_reset, CHANGE); }
|
if(mode == PTT_MODE) { attachInterrupt(HAMSHIELD_AUX_BUTTON, HamShield::isr_ptt, CHANGE); }
|
||||||
|
if(mode == RESET_MODE) { attachInterrupt(HAMSHIELD_AUX_BUTTON, HamShield::isr_reset, CHANGE); }
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/* Interrupt routines */
|
/* Interrupt routines */
|
||||||
|
|
||||||
|
@ -1162,12 +1153,12 @@ void HamShield::isr_ptt() {
|
||||||
if((bouncer + 200) > millis()) {
|
if((bouncer + 200) > millis()) {
|
||||||
if(ptt == false) {
|
if(ptt == false) {
|
||||||
ptt = true;
|
ptt = true;
|
||||||
HamShield::setModeTransmit();
|
sHamShield->setModeTransmit();
|
||||||
bouncer = millis();
|
bouncer = millis();
|
||||||
}
|
}
|
||||||
if(ptt == true) {
|
if(ptt == true) {
|
||||||
ptt = false;
|
ptt = false;
|
||||||
HamShield::setModeReceive();
|
sHamShield->setModeReceive();
|
||||||
bouncer = millis();
|
bouncer = millis();
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,8 +519,8 @@ class HamShield {
|
||||||
uint32_t scanChannels(uint32_t buffer[],uint8_t buffsize, uint8_t speed, uint16_t threshold);
|
uint32_t scanChannels(uint32_t buffer[],uint8_t buffsize, uint8_t speed, uint16_t threshold);
|
||||||
uint32_t findWhitespaceChannels(uint32_t buffer[],uint8_t buffsize, uint8_t dwell, uint16_t threshold);
|
uint32_t findWhitespaceChannels(uint32_t buffer[],uint8_t buffsize, uint8_t dwell, uint16_t threshold);
|
||||||
void buttonMode(uint8_t mode);
|
void buttonMode(uint8_t mode);
|
||||||
void isr_ptt();
|
static void isr_ptt();
|
||||||
void isr_reset();
|
static void isr_reset();
|
||||||
void morseOut(char buffer[HAMSHIELD_MORSE_BUFFER_SIZE]);
|
void morseOut(char buffer[HAMSHIELD_MORSE_BUFFER_SIZE]);
|
||||||
char morseLookup(char letter);
|
char morseLookup(char letter);
|
||||||
bool waitForChannel(long timeout, long breakwindow, int setRSSI);
|
bool waitForChannel(long timeout, long breakwindow, int setRSSI);
|
||||||
|
@ -541,7 +541,7 @@ class HamShield {
|
||||||
uint32_t GMRS[];
|
uint32_t GMRS[];
|
||||||
uint32_t MURS[];
|
uint32_t MURS[];
|
||||||
uint32_t WX[];
|
uint32_t WX[];
|
||||||
|
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);
|
// int8_t A1846S::readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout);
|
||||||
// int8_t A1846S::readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout);
|
// int8_t A1846S::readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout);
|
||||||
|
|
Loading…
Reference in New Issue