ubitx-v5x/TeensyDSP/Rig.h

127 lines
3.5 KiB
C++

#ifndef __Rig_h__
#define __Rig_h__
#include "RigState.h"
#define DEFAULT_SSB_LO_CUT 300.0
#define DEFAULT_SSB_HI_CUT 3000.0
#define DEFAULT_CW_WIDTH 500.0
#define DEFAULT_LOW_USB false
#define DEFAULT_LOW_CWU true
#define DEFAULT_HIGH_USB true
#define DEFAULT_HIGH_CWU true
enum HamBand {
BAND_80M = 0,
BAND_60M,
BAND_40M,
BAND_30M,
BAND_20M,
BAND_17M,
BAND_15M,
BAND_12M,
BAND_10M,
NUM_BANDS
};
struct ModeConfig {
bool isUpper;
float dspLo;
float dspHi;
};
struct BandConfig {
ModeConfig cw;
ModeConfig ssb;
};
struct RigConfig {
//bool isData = false;
bool useUSBInput = true; // whether or not to use the USB input for data
};
class UBitxRig {
public:
UBitxRig();
inline void begin() {}
inline void update() {}
inline unsigned getFreqA() const { return radState.getFreqA(); }
inline unsigned getFreqB() const { return radState.getFreqB(); }
inline int getRIT() const { return radState.getRIT(); }
inline int getXIT() const { return radState.getXIT(); }
inline bool isVFOA() const { return radState.isVFOA(); }
inline bool isVFOB() const { return radState.isVFOB(); }
inline bool isSplit() const { return radState.isSplit(); }
inline bool isRIT() const { return radState.isRIT(); }
inline bool isXIT() const { return radState.isXIT(); }
inline bool isModeCWAny() const { return radState.isModeCWAny(); }
inline bool isModeCW() const { return radState.isModeCW(); }
inline bool isModeCWR() const { return radState.isModeCWR(); }
inline bool isModeUSB() const { return radState.isModeUSB(); }
inline bool isModeLSB() const { return radState.isModeLSB(); }
inline float getCWSidetone() const { return static_cast<float>(radState.getSidetone()); }
inline bool isUSBInput() const { return conf.useUSBInput; }
inline bool isLineInput() const { return !conf.useUSBInput; }
inline bool isAI() const { return autoInfo; }
inline void setFreqA(unsigned freq) { catState.setFreqA(freq); }
inline void setFreqB(unsigned freq) { catState.setFreqB(freq); }
inline void setRIT(int freq) { catState.setRIT(freq); }
inline void setXIT(int freq) { catState.setXIT(freq); }
inline void setVFOA() { catState.setVFOA(); }
inline void setVFOB() { catState.setVFOB(); }
inline void setSplitOn() { catState.setSplitOn(); }
inline void setSplitOff() { catState.setSplitOff(); }
inline void setRITOn() { catState.setRITOn(); }
inline void setRITOff() { catState.setRITOff(); }
inline void setXITOn() { catState.setXITOn(); }
inline void setXITOff() { catState.setXITOff(); }
inline void setModeCW() { catState.setModeCW(); }
inline void setModeCWR() { catState.setModeCWR(); }
inline void setModeUSB() { catState.setModeUSB(); }
inline void setModeLSB() { catState.setModeLSB(); }
inline void setCWSidetone(float f) { catState.setSidetone(static_cast<uint16_t>(f)); }
inline void setUSBInput() { conf.useUSBInput = true; }
inline void setLineInput() { conf.useUSBInput = false; }
inline void aiOn() { autoInfo = true; }
inline void aiOff() { autoInfo = false; }
inline UBitxRigState& cat() { return catState; }
inline UBitxRigState& rad() { return radState; }
/********************************************************************/
// New functional/mode-based Rig methods
// AG
//void setVolOut(uint8_t level);
//uint8_t getVolOut();
// BD/BU
//void setBand();
//void getBand();
private:
RigConfig conf;
UBitxRigState catState;
UBitxRigState radState;
bool autoInfo = false;
BandConfig band[NUM_BANDS];
};
extern UBitxRig Rig;
#endif