INTERIM COMMIT. For partly working functionality, reference the previous commit.

This commit is contained in:
Rob French
2021-02-21 00:16:01 -06:00
parent 119902b1e0
commit cc94f89cfe
8 changed files with 451 additions and 54 deletions

View File

@@ -15,6 +15,9 @@
#define UBITX_USB_FLAG 0x00000020
#define UBITX_TX_FLAG 0x00000040
#define UBITX_SIDETONE_MASK 0x000007FF
#define UBITX_KEYER_MODE_MASK 0x00003800
#ifdef TEENSYDUINO
#define DISABLEINTS(CMD) do { noInterrupts(); CMD; interrupts(); } while (0)
#else
@@ -27,6 +30,7 @@ enum RigStateWord {
VFOB_WORD,
OFFSETS_WORD,
FLAGS_WORD,
KEYER_WORD,
NUM_WORDS
};
@@ -255,25 +259,25 @@ struct UBitxRigState {
return result;
}
inline void setUSB(bool mark = true) {
inline void setModeUSB(bool mark = true) {
DISABLEINTS( data[FLAGS_WORD] |= UBITX_USB_FLAG;
data[FLAGS_WORD] &= ~UBITX_CW_FLAG;
if (mark) setDirty(FLAGS_WORD) );
}
inline void setLSB(bool mark = true) {
inline void setModeLSB(bool mark = true) {
DISABLEINTS( data[FLAGS_WORD] &= ~UBITX_USB_FLAG;
data[FLAGS_WORD] &= ~UBITX_CW_FLAG;
if (mark) setDirty(FLAGS_WORD) );
}
inline void setCW(bool mark = true) {
inline void setModeCW(bool mark = true) {
DISABLEINTS( data[FLAGS_WORD] |= UBITX_USB_FLAG;
data[FLAGS_WORD] |= UBITX_CW_FLAG;
if (mark) setDirty(FLAGS_WORD) );
}
inline void setCWR(bool mark = true) {
inline void setModeCWR(bool mark = true) {
DISABLEINTS( data[FLAGS_WORD] &= ~UBITX_USB_FLAG;
data[FLAGS_WORD] |= UBITX_CW_FLAG;
if (mark) setDirty(FLAGS_WORD) );
@@ -309,6 +313,18 @@ struct UBitxRigState {
return result;
}
inline void setSidetone(uint16_t f, bool mark = true) {
DISABLEINTS( data[KEYER_WORD] &= ~UBITX_SIDETONE_MASK;
data[KEYER_WORD] |= (uint32_t(f) & UBITX_SIDETONE_MASK);
if (mark) setDirty(KEYER_WORD) );
}
inline uint16_t getSidetone() {
uint32_t result;
DISABLEINTS( result = data[KEYER_WORD] & UBITX_SIDETONE_MASK );
return uint16_t(result);
}
#ifdef DEBUG
void serialHexState(const char* label);
void serialPrettyState(const char* label);
@@ -319,6 +335,9 @@ struct UBitxRigState {
// RigState, not in the TeensyDSP (Teensy) case.
void writeDirty(); // write fields FROM RigState TO Raduino
void readDirty(); // read variables FROM Raduino TO RigState
#else
// These methods are only defined (currently) in the TeensyDSP case.
void processDirty();
#endif
};