mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-08-03 09:36:32 +03:00
added mdc1200 side tone/beeps
This commit is contained in:
@@ -164,7 +164,7 @@ void AIRCOPY_start_fsk_tx(const int request_block_num)
|
||||
// 0 = enable
|
||||
// 1 = disable
|
||||
//
|
||||
// BK4819_WriteRegister(0x2B, (1u << 2) | (1u << 0)); // try to improve the TX waveform
|
||||
// BK4819_write_reg(0x2B, (1u << 2) | (1u << 0)); // try to improve the TX waveform
|
||||
|
||||
// REG_59
|
||||
//
|
||||
@@ -218,21 +218,21 @@ void AIRCOPY_start_fsk_tx(const int request_block_num)
|
||||
(0u << 0); // 0 ~ 7 ???
|
||||
|
||||
// set the packet size
|
||||
BK4819_WriteRegister(0x5D, (((tx_size * 2) - 1) << 8));
|
||||
BK4819_write_reg(0x5D, (((tx_size * 2) - 1) << 8));
|
||||
|
||||
// clear TX fifo
|
||||
BK4819_WriteRegister(0x59, (1u << 15) | fsk_reg59);
|
||||
BK4819_WriteRegister(0x59, fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 15) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, fsk_reg59);
|
||||
|
||||
// load the packet
|
||||
for (k = 0; k < tx_size; k++)
|
||||
BK4819_WriteRegister(0x5F, g_fsk_buffer[k]);
|
||||
BK4819_write_reg(0x5F, g_fsk_buffer[k]);
|
||||
|
||||
// enable tx interrupt(s)
|
||||
BK4819_WriteRegister(0x3F, BK4819_REG_3F_FSK_TX_FINISHED);
|
||||
BK4819_write_reg(0x3F, BK4819_REG_3F_FSK_TX_FINISHED);
|
||||
|
||||
// enable scramble, enable TX
|
||||
BK4819_WriteRegister(0x59, (1u << 13) | (1u << 11) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 13) | (1u << 11) | fsk_reg59);
|
||||
}
|
||||
|
||||
void AIRCOPY_stop_fsk_tx(void)
|
||||
@@ -250,7 +250,7 @@ void AIRCOPY_stop_fsk_tx(void)
|
||||
BK4819_reset_fsk();
|
||||
|
||||
// restore TX/RX filtering
|
||||
BK4819_WriteRegister(0x2B, 0);
|
||||
BK4819_write_reg(0x2B, 0);
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{
|
||||
@@ -303,10 +303,10 @@ void AIRCOPY_process_fsk_tx_10ms(void)
|
||||
|
||||
if (--g_fsk_tx_timeout_10ms > 0)
|
||||
{ // still TX'ing
|
||||
if ((BK4819_ReadRegister(0x0C) & (1u << 0)) == 0)
|
||||
if ((BK4819_read_reg(0x0C) & (1u << 0)) == 0)
|
||||
return;
|
||||
BK4819_WriteRegister(0x02, 0);
|
||||
interrupt_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0);
|
||||
interrupt_bits = BK4819_read_reg(0x02);
|
||||
if ((interrupt_bits & BK4819_REG_02_FSK_TX_FINISHED) == 0)
|
||||
return; // TX not yet finished
|
||||
}
|
||||
@@ -378,7 +378,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
//
|
||||
// <2:0> 0 ???
|
||||
//
|
||||
status = BK4819_ReadRegister(0x59);
|
||||
status = BK4819_read_reg(0x59);
|
||||
|
||||
if (status & (1u << 11) || g_fsk_tx_timeout_10ms > 0)
|
||||
return; // FSK TX is busy
|
||||
@@ -390,13 +390,13 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
BK4819_start_aircopy_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
|
||||
status = BK4819_ReadRegister(0x0C);
|
||||
status = BK4819_read_reg(0x0C);
|
||||
if ((status & (1u << 0)) == 0)
|
||||
return; // no flagged interrupts
|
||||
|
||||
// read the interrupt flags
|
||||
BK4819_WriteRegister(0x02, 0); // clear them
|
||||
interrupt_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0); // clear them
|
||||
interrupt_bits = BK4819_read_reg(0x02);
|
||||
|
||||
if (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC)
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
|
||||
@@ -410,10 +410,10 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
|
||||
|
||||
{ // fetch RX'ed data
|
||||
const unsigned int count = BK4819_ReadRegister(0x5E) & (7u << 0); // almost full threshold
|
||||
const unsigned int count = BK4819_read_reg(0x5E) & (7u << 0); // almost full threshold
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const uint16_t word = BK4819_ReadRegister(0x5F);
|
||||
const uint16_t word = BK4819_read_reg(0x5F);
|
||||
|
||||
if (g_fsk_write_index < ARRAY_SIZE(g_fsk_buffer))
|
||||
g_fsk_buffer[g_fsk_write_index++] = word;
|
||||
@@ -438,7 +438,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
//
|
||||
// <3:0> ???
|
||||
//
|
||||
status = BK4819_ReadRegister(0x0B);
|
||||
status = BK4819_read_reg(0x0B);
|
||||
|
||||
// check to see if it's a REQ/ACK packet
|
||||
if (g_fsk_write_index == req_ack_size)
|
||||
@@ -636,10 +636,10 @@ send_req:
|
||||
while (g_fsk_tx_timeout_10ms-- > 0)
|
||||
{
|
||||
SYSTEM_DelayMs(5);
|
||||
if (BK4819_ReadRegister(0x0C) & (1u << 0))
|
||||
if (BK4819_read_reg(0x0C) & (1u << 0))
|
||||
{ // we have interrupt flags
|
||||
BK4819_WriteRegister(0x02, 0);
|
||||
const uint16_t interrupt_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0);
|
||||
const uint16_t interrupt_bits = BK4819_read_reg(0x02);
|
||||
if (interrupt_bits & BK4819_REG_02_FSK_TX_FINISHED)
|
||||
g_fsk_tx_timeout_10ms = 0; // TX is complete
|
||||
}
|
||||
|
16
app/app.c
16
app/app.c
@@ -162,10 +162,10 @@ done:
|
||||
|
||||
#ifdef ENABLE_MDC1200
|
||||
{ // reset the FSK receiver
|
||||
//const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
//const uint16_t fsk_reg59 = BK4819_read_reg(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
// BK4819_enable_mdc1200_rx(true);
|
||||
//BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
//BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59);
|
||||
//BK4819_write_reg(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
//BK4819_write_reg(0x59, (1u << 12) | fsk_reg59);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -529,11 +529,11 @@ bool APP_start_listening(void)
|
||||
// AF gain - original QS values
|
||||
// if (g_rx_vfo->channel.am_mode > 0)
|
||||
// {
|
||||
// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||
// }
|
||||
// else
|
||||
{
|
||||
BK4819_WriteRegister(0x48,
|
||||
BK4819_write_reg(0x48,
|
||||
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
||||
( 0u << 10) | // AF Rx Gain-1
|
||||
(g_eeprom.calib.volume_gain << 4) | // AF Rx Gain-2
|
||||
@@ -910,12 +910,12 @@ void APP_process_radio_interrupts(void)
|
||||
|
||||
uint16_t int_bits;
|
||||
|
||||
const uint16_t reg_c = BK4819_ReadRegister(0x0C);
|
||||
const uint16_t reg_c = BK4819_read_reg(0x0C);
|
||||
if ((reg_c & 1u) == 0)
|
||||
break;
|
||||
|
||||
BK4819_WriteRegister(0x02, 0);
|
||||
int_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0);
|
||||
int_bits = BK4819_read_reg(0x02);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
|
@@ -50,7 +50,7 @@
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||
{
|
||||
BK4819_WriteRegister(0x3B, 22656 + value);
|
||||
BK4819_write_reg(0x3B, 22656 + value);
|
||||
|
||||
if (update_eeprom)
|
||||
{
|
||||
|
11
app/search.c
11
app/search.c
@@ -637,11 +637,14 @@ void SEARCH_Start(void)
|
||||
g_search_css_state = SEARCH_CSS_STATE_OFF;
|
||||
g_search_frequency = 0xFFFFFFFF;
|
||||
|
||||
#if 1
|
||||
// this is why it needs such a strong signal
|
||||
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths - why it needs a strong signal
|
||||
#else
|
||||
#ifdef ENABLE_FREQ_SEARCH_LNA
|
||||
// 1of11
|
||||
// still requires strong signal >= -40dBm at LNA input, but MUCH more sensitive that QS way
|
||||
BK4819_set_rf_filter_path(g_rx_vfo->p_rx->frequency); // lets have a play !
|
||||
#else
|
||||
// QS
|
||||
// this is why it needs such a strong signal
|
||||
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths
|
||||
#endif
|
||||
|
||||
BK4819_EnableFrequencyScan();
|
||||
|
@@ -386,9 +386,9 @@ static void cmd_0527(void)
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
reply.Header.ID = 0x0528;
|
||||
reply.Header.Size = sizeof(reply.Data);
|
||||
reply.Data.RSSI = BK4819_ReadRegister(0x67) & 0x01FF;
|
||||
reply.Data.ExNoiseIndicator = BK4819_ReadRegister(0x65) & 0x007F;
|
||||
reply.Data.GlitchIndicator = BK4819_ReadRegister(0x63);
|
||||
reply.Data.RSSI = BK4819_read_reg(0x67) & 0x01FF;
|
||||
reply.Data.ExNoiseIndicator = BK4819_read_reg(0x65) & 0x007F;
|
||||
reply.Data.GlitchIndicator = BK4819_read_reg(0x63);
|
||||
|
||||
SendReply(&reply, sizeof(reply));
|
||||
}
|
||||
|
Reference in New Issue
Block a user