Updated CAT to support interoperability with uBITX I/O Processor (IOP).

This commit is contained in:
Rob French 2020-05-03 22:00:02 -05:00
parent 913f1d0781
commit 44c6c86838

View File

@ -48,6 +48,11 @@
#define CAT_MODE_FMN 0x88 #define CAT_MODE_FMN 0x88
#define ACK 0 #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; unsigned int skipTimeCount = 0;
byte CAT_BUFF[5]; byte CAT_BUFF[5];
@ -55,6 +60,14 @@ byte CAT_SNDBUFF[5];
void SendCatData(byte sendCount) 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++) for (byte i = 0; i < sendCount; i++)
Serial.write(CAT_BUFF[i]); Serial.write(CAT_BUFF[i]);
//Serial.flush(); //Serial.flush();
@ -250,6 +263,15 @@ void ReadEEPRom() //for remove warnings.
byte checkSum = 0; byte checkSum = 0;
byte read1Byte = 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 Serial.write(0x02); //STX
checkSum = 0x02; checkSum = 0x02;
//I2C Scanner //I2C Scanner
@ -293,6 +315,12 @@ void WriteEEPRom(void) //for remove warning
uint16_t eepromStartIndex = CAT_BUFF[0] + CAT_BUFF[1] * 256; uint16_t eepromStartIndex = CAT_BUFF[0] + CAT_BUFF[1] * 256;
byte write1Byte = CAT_BUFF[2]; 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 //Check Checksum
if (CAT_BUFF[3] != ((CAT_BUFF[0] + CAT_BUFF[1] + CAT_BUFF[2]) % 256)) 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.begin(baud, portConfig);
Serial.flush(); Serial.flush();
} }