mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
updates
This commit is contained in:
@ -411,6 +411,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
const uint16_t word = BK4819_ReadRegister(0x5F);
|
||||
|
||||
if (g_fsk_write_index < ARRAY_SIZE(g_fsk_buffer))
|
||||
g_fsk_buffer[g_fsk_write_index++] = word;
|
||||
}
|
||||
|
37
app/app.c
37
app/app.c
@ -1040,12 +1040,15 @@ void APP_process_radio_interrupts(void)
|
||||
#ifdef ENABLE_MDC1200
|
||||
{
|
||||
const uint16_t rx_sync_flags = BK4819_ReadRegister(0x0B);
|
||||
const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
|
||||
const bool rx_sync_neg = (rx_sync_flags & (1u << 7)) ? true : false;
|
||||
const bool rx_sync_pos = (rx_sync_flags & (1u << 6)) ? true : false;
|
||||
const bool rx_sync = (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC) ? true : false;
|
||||
const bool rx_finished = (interrupt_bits & BK4819_REG_02_FSK_RX_FINISHED) ? true : false;
|
||||
const bool rx_fifo_almost_full = (interrupt_bits & BK4819_REG_02_FSK_FIFO_ALMOST_FULL) ? true : false;
|
||||
|
||||
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
|
||||
|
||||
if (rx_sync_neg)
|
||||
@ -1069,20 +1072,6 @@ void APP_process_radio_interrupts(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rx_fifo_almost_full)
|
||||
{
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("fsk rx almost full\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rx_finished)
|
||||
{
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("fsk rx finished\r\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rx_fifo_almost_full)
|
||||
{
|
||||
uint8_t buffer[sizeof(mdc1200_sync_suc_xor) + 14];
|
||||
@ -1090,11 +1079,15 @@ void APP_process_radio_interrupts(void)
|
||||
uint8_t op;
|
||||
uint8_t arg;
|
||||
uint16_t unit_id;
|
||||
const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
|
||||
const unsigned int sync_size = (fsk_reg59 & (1u << 3)) ? 4 : 2;
|
||||
// const unsigned int size = 1 + ((BK4819_ReadRegister(0x5D) >> 8) & 0xffff);
|
||||
const unsigned int size = sizeof(buffer) - sync_size;
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("fsk rx almost full\r\n");
|
||||
#endif
|
||||
|
||||
// 40 C4 B0 32 BA F9 33 18 35 08 83 F6 0C C9
|
||||
// 0100000011000100101100000011001010111010111110010011001100011000001101010000100010000011111101100000110011001001
|
||||
|
||||
@ -1109,13 +1102,13 @@ void APP_process_radio_interrupts(void)
|
||||
|
||||
// precede the data with the missing sync pattern
|
||||
for (i = 0; i < sync_size; i++)
|
||||
buffer[k++] = mdc1200_sync_suc_xor[i] ^ (rx_sync_neg ? 0xff : 0);
|
||||
buffer[k++] = mdc1200_sync_suc_xor[i] ^ (rx_sync_neg ? 0x00 : 0xFF);
|
||||
|
||||
for (i = 0; i < (size / 2); i++)
|
||||
{
|
||||
const uint16_t word = BK4819_ReadRegister(0x5F);
|
||||
buffer[k++] = (word >> 8) & 0xff;
|
||||
buffer[k++] = (word >> 0) & 0xff;
|
||||
buffer[k++] = (word >> 8) & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1153,6 +1146,16 @@ void APP_process_radio_interrupts(void)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (rx_finished)
|
||||
{
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf("fsk rx finished\r\n");
|
||||
#endif
|
||||
|
||||
BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user