Add comments to some FSK parts (#32)

Co-authored-by: Andrej Antunovikj <andrej@case.edu>
This commit is contained in:
Andrej 2023-09-05 19:03:58 -04:00 committed by GitHub
parent 42a6802ea6
commit 39ba550b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,17 +493,18 @@ void BK4819_TurnsOffTones_TurnsOnRX(void)
void BK4819_SetupAircopy(void)
{
BK4819_WriteRegister(BK4819_REG_70, 0x00E0);
BK4819_WriteRegister(BK4819_REG_72, 0x3065);
BK4819_WriteRegister(BK4819_REG_58, 0x00C1);
BK4819_WriteRegister(BK4819_REG_5C, 0x5665);
BK4819_WriteRegister(BK4819_REG_5D, 0x4700);
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone2, tuning gain 48
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Tone2 baudrate 1200
BK4819_WriteRegister(BK4819_REG_58, 0x00C1); // FSK Enable, FSK 1.2K RX Bandwidth, Preamble 0xAA or 0x55, RX Gain 0, RX Mode
// (FSK1.2K, FSK2.4K Rx and NOAA SAME Rx), TX Mode FSK 1.2K and FSK 2.4K Tx
BK4819_WriteRegister(BK4819_REG_5C, 0x5665); // Enable CRC among other things we don't know yet
BK4819_WriteRegister(BK4819_REG_5D, 0x4700); // FSK Data Length 72 Bytes (0xabcd + 2 byte length + 64 byte payload + 2 byte CRC + 0xdcba)
}
void BK4819_ResetFSK(void)
{
BK4819_WriteRegister(BK4819_REG_3F, 0x0000);
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
BK4819_WriteRegister(BK4819_REG_3F, 0x0000); // Disable interrupts
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Sync length 4 bytes, 7 byte preamble
SYSTEM_DelayMs(30);
BK4819_Idle();
}
@ -906,21 +907,23 @@ void BK4819_PlayRogerMDC(void)
uint8_t i;
BK4819_SetAF(BK4819_AF_MUTE);
BK4819_WriteRegister(BK4819_REG_58, 0x37C3);
BK4819_WriteRegister(BK4819_REG_72, 0x3065);
BK4819_WriteRegister(BK4819_REG_70, 0x00E0);
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00);
BK4819_WriteRegister(BK4819_REG_59, 0x8068);
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
BK4819_WriteRegister(BK4819_REG_5A, 0x5555);
BK4819_WriteRegister(BK4819_REG_5B, 0x55AA);
BK4819_WriteRegister(BK4819_REG_5C, 0xAA30);
BK4819_WriteRegister(BK4819_REG_58, 0x37C3); // FSK Enable, RX Bandwidth FFSK1200/1800, 0xAA or 0x55 Preamble, 11 RX Gain,
// 101 RX Mode, FFSK1200/1800 TX
BK4819_WriteRegister(BK4819_REG_72, 0x3065); // Set Tone2 to 1200Hz
BK4819_WriteRegister(BK4819_REG_70, 0x00E0); // Enable Tone2 and Set Tone2 Gain
BK4819_WriteRegister(BK4819_REG_5D, 0x0D00); // Set FSK data length to 13 bytes
BK4819_WriteRegister(BK4819_REG_59, 0x8068); // 4 byte sync length, 6 byte preamble, clear TX FIFO
BK4819_WriteRegister(BK4819_REG_59, 0x0068); // Same, but clear TX FIFO is now unset (clearing done)
BK4819_WriteRegister(BK4819_REG_5A, 0x5555); // First two sync bytes
BK4819_WriteRegister(BK4819_REG_5B, 0x55AA); // End of sync bytes. Total 4 bytes: 555555aa
BK4819_WriteRegister(BK4819_REG_5C, 0xAA30); // Disable CRC
for (i = 0; i < 7; i++) {
BK4819_WriteRegister(BK4819_REG_5F, FSK_RogerTable[i]);
BK4819_WriteRegister(BK4819_REG_5F, FSK_RogerTable[i]); // Send the data from the roger table
}
SYSTEM_DelayMs(20);
BK4819_WriteRegister(BK4819_REG_59, 0x0868);
BK4819_WriteRegister(BK4819_REG_59, 0x0868); // 4 sync bytes, 6 byte preamble, Enable FSK TX
SYSTEM_DelayMs(180);
// Stop FSK TX, reset Tone2, disable FSK.
BK4819_WriteRegister(BK4819_REG_59, 0x0068);
BK4819_WriteRegister(BK4819_REG_70, 0x0000);
BK4819_WriteRegister(BK4819_REG_58, 0x0000);