From 7ba147b06dd918816ae3598fcba0a92d98d774ad Mon Sep 17 00:00:00 2001 From: Rob French Date: Sun, 3 May 2020 23:30:44 -0500 Subject: [PATCH] Added ability to send a command to the IOP, specifically a mode change command (to SSB, DIGI, or CW; although DIGI is currently not actually possible). --- ubitx_20/cat_libs.ino | 26 ++++++++++++++++++++++++++ ubitx_20/ubitx_menu.ino | 2 ++ 2 files changed, 28 insertions(+) diff --git a/ubitx_20/cat_libs.ino b/ubitx_20/cat_libs.ino index e467f1b..13b3ab4 100644 --- a/ubitx_20/cat_libs.ino +++ b/ubitx_20/cat_libs.ino @@ -54,6 +54,32 @@ #define EEPROM_READ_PREFIX 0xE0 #define EEPROM_WRITE_PREFIX 0xF0 +#define IOP_MODE_COMMAND 0x00 +#define IOP_MODE_SSB 0x01 +#define IOP_MODE_DIGI 0x02 +#define IOP_MODE_CW 0x03 + +/* + * KC4UPR - IOP update, 2020-05-03 + * + * Send the current mode to the I/O Processor. + * + * NOTE: This all needs to be expanded to include digital... + * + * NOTE: Not yet called from CAT, only from menu... + */ +void iopSendMode(char is_cw, char is_usb) +{ + byte mode; + + Serial.write(IOP_PREFIX | 2); + Serial.write(IOP_MODE_COMMAND); + if (is_cw) + mode = IOP_MODE_CW; + else + mode = IOP_MODE_SSB; +} + unsigned int skipTimeCount = 0; byte CAT_BUFF[5]; byte CAT_SNDBUFF[5]; diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 502bd94..4bec378 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -960,6 +960,8 @@ void menuSelectMode(int btn){ else if (selectModeType == 3) { cwMode = 2; } + // KC4UPR: sending mode to IOP + iopSendMode(cwMode, isUSB); FrequencyToVFO(1); }