made certain library functions private to ensure they aren't improperly called from an arduino sketch

This commit is contained in:
morgan 2015-12-15 14:43:57 -08:00
parent 28f1ff016c
commit c107df93dd
1 changed files with 243 additions and 257 deletions

View File

@ -258,6 +258,9 @@
class HamShield { class HamShield {
public: public:
// public singleton for ISRs to reference
static HamShield *sHamShield; // HamShield singleton, used for ISRs mostly
HamShield(); HamShield();
HamShield(uint8_t address); HamShield(uint8_t address);
@ -268,41 +271,12 @@ class HamShield {
uint16_t readCtlReg(); uint16_t readCtlReg();
void softReset(); void softReset();
// center frequency // restrictions control
void setFrequency(uint32_t freq_khz); void dangerMode();
uint32_t getFrequency(); void safeMode();
// band
void setTxBand2m();
void setTxBand1_2m();
void setTxBand70cm();
bool frequency(uint32_t freq_khz); bool frequency(uint32_t freq_khz);
uint32_t getFrequency();
// xtal frequency (kHz)
// 12-14MHz crystal: this reg is set to crystal freq_khz
// 24-28MHz crystal: this reg is set to crystal freq_khz / 2
void setXtalFreq(uint16_t freq_kHz);
uint16_t getXtalFreq();
// adclk frequency (kHz)
// 12-14MHz crystal: this reg is set to crystal freq_khz / 2
// 24-28MHz crystal: this reg is set to crystal freq_khz / 4
void setAdcClkFreq(uint16_t freq_kHz);
uint16_t getAdcClkFreq();
// clk mode
// 12-14MHz: set to 1
// 24-28MHz: set to 0
void setClkMode(bool LFClk);
bool getClkMode();
// clk example
// 12.8MHz clock
// A1846S_XTAL_FREQ_REG[15:0]= xtal_freq<15:0>=12.8*1000=12800
// A1846S_ADCLK_FREQ_REG[12:0] =adclk_freq<15:0>=(12.8/2)*1000=6400
// A1846S_CLK_MODE_REG[0]= clk_mode =1
// TX/RX control
// channel mode // channel mode
// 11 - 25kHz channel // 11 - 25kHz channel
@ -311,13 +285,6 @@ class HamShield {
void setChanMode(uint16_t mode); void setChanMode(uint16_t mode);
uint16_t getChanMode(); uint16_t getChanMode();
// choose tx or rx
void setTX(bool on_noff);
bool getTX();
void setRX(bool on_noff);
bool getRX();
void setModeTransmit(); // turn off rx, turn on tx void setModeTransmit(); // turn off rx, turn on tx
void setModeReceive(); // turn on rx, turn off tx void setModeReceive(); // turn on rx, turn off tx
void setModeOff(); // turn off rx, turn off tx, set pwr_dwn bit void setModeOff(); // turn off rx, turn off tx, set pwr_dwn bit
@ -335,6 +302,7 @@ class HamShield {
void setTxSourceNone(); void setTxSourceNone();
uint16_t getTxSource(); uint16_t getTxSource();
// PA bias voltage is unused (maybe remove this)
// set PA_bias voltage // set PA_bias voltage
// 000000: 1.01V // 000000: 1.01V
// 000001:1.05V // 000001:1.05V
@ -513,11 +481,6 @@ class HamShield {
bool setWXChannel(uint8_t channel); bool setWXChannel(uint8_t channel);
uint8_t scanWXChannel(); uint8_t scanWXChannel();
// restrictions control
void dangerMode();
void safeMode();
// utilities // utilities
uint32_t scanMode(uint32_t start,uint32_t stop, uint8_t speed, uint16_t step, uint16_t threshold); uint32_t scanMode(uint32_t start,uint32_t stop, uint8_t speed, uint16_t step, uint16_t threshold);
uint32_t findWhitespace(uint32_t start,uint32_t stop, uint8_t dwell, uint16_t step, uint16_t threshold); uint32_t findWhitespace(uint32_t start,uint32_t stop, uint8_t dwell, uint16_t step, uint16_t threshold);
@ -555,16 +518,39 @@ class HamShield {
uint32_t MURS[]; uint32_t MURS[];
uint32_t WX[]; uint32_t WX[];
// public singleton for ISRs to reference // private utility functions
public: // these functions should not be called in the Arduino sketch
static HamShield *sHamShield; // HamShield singleton, used for ISRs mostly // just use the above public functions to do everything
// int8_t A1846S::readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout); void setFrequency(uint32_t freq_khz);
// int8_t A1846S::readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout); void setTxBand2m();
// int8_t A1846S::readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout); void setTxBand1_2m();
// int8_t A1846S::writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout); void setTxBand70cm();
// bool A1846S::writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data);
// bool A1846S::writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data); // xtal frequency (kHz)
// 12-14MHz crystal: this reg is set to crystal freq_khz
// 24-28MHz crystal: this reg is set to crystal freq_khz / 2
void setXtalFreq(uint16_t freq_kHz);
uint16_t getXtalFreq();
// adclk frequency (kHz)
// 12-14MHz crystal: this reg is set to crystal freq_khz / 2
// 24-28MHz crystal: this reg is set to crystal freq_khz / 4
void setAdcClkFreq(uint16_t freq_kHz);
uint16_t getAdcClkFreq();
// clk mode
// 12-14MHz: set to 1
// 24-28MHz: set to 0
void setClkMode(bool LFClk);
bool getClkMode();
// choose tx or rx
void setTX(bool on_noff);
bool getTX();
void setRX(bool on_noff);
bool getRX();
}; };
#endif /* _HAMSHIELD_H_ */ #endif /* _HAMSHIELD_H_ */