From 44c6c868380a33106cc482118189a5c4fb4316ff Mon Sep 17 00:00:00 2001 From: Rob French Date: Sun, 3 May 2020 22:00:02 -0500 Subject: [PATCH] Updated CAT to support interoperability with uBITX I/O Processor (IOP). --- ubitx_20/cat_libs.ino | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/ubitx_20/cat_libs.ino b/ubitx_20/cat_libs.ino index 608af79..e467f1b 100644 --- a/ubitx_20/cat_libs.ino +++ b/ubitx_20/cat_libs.ino @@ -48,6 +48,11 @@ #define CAT_MODE_FMN 0x88 #define ACK 0 +// KC4UPR--uBITX IOP: prefixes to determine "mode" of serial transmission +#define CAT_PREFIX 0xC0 +#define IOP_PREFIX 0xD0 +#define EEPROM_READ_PREFIX 0xE0 +#define EEPROM_WRITE_PREFIX 0xF0 unsigned int skipTimeCount = 0; byte CAT_BUFF[5]; @@ -55,6 +60,14 @@ byte CAT_SNDBUFF[5]; void SendCatData(byte sendCount) { + // KC4UPR--uBITX IOP: Adding an additional byte at the beginning that + // indicates that this is a "CAT mode" transmission. Extra byte includes + // a prefix, as well as the number of bytes being sent. + // + // NOTE: Need to do some error checking at some point to ensure we don't + // try to send more than 15 bytes!!! + Serial.write(CAT_PREFIX | sendCount); + for (byte i = 0; i < sendCount; i++) Serial.write(CAT_BUFF[i]); //Serial.flush(); @@ -250,6 +263,15 @@ void ReadEEPRom() //for remove warnings. byte checkSum = 0; byte read1Byte = 0; + // KC4UPR--uBITX IOP: Adding an additional byte at the beginning that + // indicates that this is a "Memory Manager mode" transmission. + // Then we repeat some of the CAT_BUFF data. + Serial.write(EEPROM_READ_PREFIX); + Serial.write(CAT_BUFF[0]); + Serial.write(CAT_BUFF[1]); + Serial.write(CAT_BUFF[2]); + Serial.write(CAT_BUFF[3]); + Serial.write(0x02); //STX checkSum = 0x02; //I2C Scanner @@ -293,6 +315,12 @@ void WriteEEPRom(void) //for remove warning uint16_t eepromStartIndex = CAT_BUFF[0] + CAT_BUFF[1] * 256; byte write1Byte = CAT_BUFF[2]; + // KC4UPR--uBITX IOP: Adding an additional byte at the beginning that + // indicates that this is a "Memory Manager mode" transmission. + // + // Also indicates that we are going to be sending two bytes of data. + Serial.write(EEPROM_WRITE_PREFIX | 2); + //Check Checksum if (CAT_BUFF[3] != ((CAT_BUFF[0] + CAT_BUFF[1] + CAT_BUFF[2]) % 256)) { @@ -890,4 +918,3 @@ void Init_Cat(long baud, int portConfig) Serial.begin(baud, portConfig); Serial.flush(); } -