0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 06:11:24 +03:00

fix mdc side beeps

This commit is contained in:
OneOfEleven 2023-11-06 01:46:51 +00:00
parent b8e7d11bfc
commit f494b8565b
6 changed files with 25 additions and 20 deletions

View File

@ -173,7 +173,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
break;
}
BK4819_StartTone1(ToneFrequency, 96, false, false);
BK4819_StartTone1(ToneFrequency, 10, false, false);
SYSTEM_DelayMs(2);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);

View File

@ -816,19 +816,16 @@ void BK4819_EnableDTMF(void)
void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const bool tx, const bool tx_unmute)
{
// (void)tx_unmute;
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
SYSTEM_DelayMs(2);
// BK4819_SetAF(BK4819_AF_MUTE);
BK4819_SetAF(BK4819_AF_BEEP);
// BK4819_SetAF(BK4819_AF_TONE);
SYSTEM_DelayMs(1);
BK4819_EnterTxMute();
// mute TX
BK4819_write_reg(0x50, (1u << 15) | 0x3B20);
if (level > 0)
BK4819_write_reg(0x70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
else
BK4819_write_reg(0x70, 0);
BK4819_write_reg(0x70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
BK4819_write_reg(0x30, 0);
@ -865,23 +862,29 @@ void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const
BK4819_write_reg(0x71, scale_freq(frequency));
SYSTEM_DelayMs(1);
// BK4819_SetAF(tx ? BK4819_AF_BEEP : BK4819_AF_TONE);
BK4819_SetAF(BK4819_AF_TONE); // RX
// BK4819_SetAF(BK4819_AF_BEEP); // TX
if (tx_unmute)
BK4819_ExitTxMute();
BK4819_write_reg(0x50, 0x3B20); // 0011 1011 0010 0000
SYSTEM_DelayMs(2);
if (!tx && level > 0)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
}
void BK4819_StopTones(const bool tx)
{
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
SYSTEM_DelayMs(2);
SYSTEM_DelayMs(1);
BK4819_SetAF(BK4819_AF_MUTE);
BK4819_EnterTxMute();
// BK4819_EnterTxMute();
SYSTEM_DelayMs(1);
BK4819_write_reg(0x70, 0);
@ -917,6 +920,8 @@ void BK4819_StopTones(const bool tx)
0);
}
SYSTEM_DelayMs(1);
BK4819_ExitTxMute();
}

Binary file not shown.

Binary file not shown.

View File

@ -267,7 +267,7 @@ void FUNCTION_Select(function_type_t Function)
if (g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOT || g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOTH)
{
#ifdef ENABLE_MDC1200_SIDE_BEEP
// BK4819_StartTone1(880, 20, true, false);
// BK4819_StartTone1(880, 10, true, false);
// SYSTEM_DelayMs(120);
// BK4819_StopTones(true);
#endif
@ -276,7 +276,7 @@ void FUNCTION_Select(function_type_t Function)
BK4819_send_MDC1200(MDC1200_OP_CODE_PTT_ID, 0x80, g_eeprom.config.setting.mdc1200_id, true);
#ifdef ENABLE_MDC1200_SIDE_BEEP
BK4819_StartTone1(880, 20, true, false);
BK4819_StartTone1(880, 10, true, false);
SYSTEM_DelayMs(120);
BK4819_StopTones(true);
#endif

View File

@ -1215,7 +1215,7 @@ void RADIO_tx_eot(void)
BK4819_send_MDC1200(MDC1200_OP_CODE_POST_ID, 0x00, g_eeprom.config.setting.mdc1200_id, false);
#ifdef ENABLE_MDC1200_SIDE_BEEP
BK4819_StartTone1(880, 30, true, false);
BK4819_StartTone1(880, 10, true, false);
SYSTEM_DelayMs(120);
BK4819_StopTones(true);
#endif