mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-06-19 06:39:49 +03:00
Live DTMF decoder option + possibly fixed AM demodulation
This commit is contained in:
28
app/app.c
28
app/app.c
@ -441,7 +441,6 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||
{
|
||||
gRxVfoIsActive = true;
|
||||
|
||||
gDualWatchCountdown = dual_watch_count_after_2_10ms;
|
||||
gScheduleDualWatch = false;
|
||||
}
|
||||
@ -449,11 +448,20 @@ void APP_StartListening(FUNCTION_Type_t Function)
|
||||
if (gRxVfo->IsAM)
|
||||
{
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8);
|
||||
|
||||
// PGA + MIXER + LNA + LNA_SHORT
|
||||
BK4819_WriteRegister(BK4819_REG_13, 3u | (3u << 3) | (2u << 5) | (3u << 8));
|
||||
|
||||
gNeverUsed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BK4819_WriteRegister(BK4819_REG_48, 0xB000 | (gEeprom.VOLUME_GAIN << 4) | (gEeprom.DAC_GAIN << 0));
|
||||
|
||||
|
||||
// PGA + MIXER + LNA + LNA_SHORT
|
||||
BK4819_WriteRegister(BK4819_REG_13, 0x03BE);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_VOICE
|
||||
if (gVoiceWriteIndex == 0)
|
||||
#endif
|
||||
@ -640,20 +648,24 @@ void APP_CheckRadioInterrupts(void)
|
||||
if (interrupt_status_bits & BK4819_REG_02_DTMF_5TONE_FOUND)
|
||||
{
|
||||
gDTMF_RequestPending = true;
|
||||
gDTMF_RecvTimeout = 5;
|
||||
gDTMF_RecvTimeout = DTMF_RX_timeout_500ms;
|
||||
|
||||
if (gDTMF_WriteIndex > 15)
|
||||
{
|
||||
if (gDTMF_WriteIndex >= ARRAY_SIZE(gDTMF_Received))
|
||||
{ // shift the RX buffer down one
|
||||
unsigned int i;
|
||||
for (i = 0; i < (sizeof(gDTMF_Received) - 1); i++)
|
||||
for (i = 0; i < (ARRAY_SIZE(gDTMF_Received) - 1); i++)
|
||||
gDTMF_Received[i] = gDTMF_Received[i + 1];
|
||||
gDTMF_WriteIndex = 15;
|
||||
gDTMF_WriteIndex--;
|
||||
}
|
||||
|
||||
// save new RX'ed character
|
||||
gDTMF_Received[gDTMF_WriteIndex++] = DTMF_GetCharacter(BK4819_GetDTMF_5TONE_Code());
|
||||
|
||||
if (gCurrentFunction == FUNCTION_RECEIVE)
|
||||
{
|
||||
DTMF_HandleRequest();
|
||||
gUpdateDisplay = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (interrupt_status_bits & BK4819_REG_02_CxCSS_TAIL)
|
||||
@ -1792,7 +1804,7 @@ static void APP_ProcessKey(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
else
|
||||
{
|
||||
if (Key != KEY_PTT)
|
||||
gVoltageMenuCountdown = menu_timeout_10ms;
|
||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
||||
|
||||
BACKLIGHT_TurnOn();
|
||||
|
||||
|
33
app/dtmf.c
33
app/dtmf.c
@ -115,35 +115,10 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
||||
return false;
|
||||
}
|
||||
|
||||
char DTMF_GetCharacter(uint8_t Code)
|
||||
char DTMF_GetCharacter(const uint8_t code)
|
||||
{
|
||||
switch (Code)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
return '0' + (char)Code;
|
||||
case 10:
|
||||
return 'A';
|
||||
case 11:
|
||||
return 'B';
|
||||
case 12:
|
||||
return 'C';
|
||||
case 13:
|
||||
return 'D';
|
||||
case 14:
|
||||
return '*';
|
||||
case 15:
|
||||
return '#';
|
||||
}
|
||||
return 0xFF;
|
||||
const char list[] = "0123456789ABCD*#";
|
||||
return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF;
|
||||
}
|
||||
|
||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, uint8_t Size, bool bCheckGroup)
|
||||
@ -190,7 +165,7 @@ void DTMF_Append(char Code)
|
||||
|
||||
void DTMF_HandleRequest(void)
|
||||
{
|
||||
char String[20];
|
||||
char String[20];
|
||||
uint8_t Offset;
|
||||
|
||||
if (!gDTMF_RequestPending)
|
||||
|
44
app/dtmf.h
44
app/dtmf.h
@ -53,33 +53,33 @@ enum DTMF_CallMode_t {
|
||||
|
||||
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||
|
||||
extern char gDTMF_String[15];
|
||||
extern char gDTMF_InputBox[15];
|
||||
extern char gDTMF_Received[16];
|
||||
extern bool gIsDtmfContactValid;
|
||||
extern char gDTMF_ID[4];
|
||||
extern char gDTMF_Caller[4];
|
||||
extern char gDTMF_Callee[4];
|
||||
extern DTMF_State_t gDTMF_State;
|
||||
extern bool gDTMF_DecodeRing;
|
||||
extern uint8_t gDTMF_DecodeRingCountdown;
|
||||
extern uint8_t gDTMFChosenContact;
|
||||
extern uint8_t gDTMF_WriteIndex;
|
||||
extern uint8_t gDTMF_PreviousIndex;
|
||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
extern uint8_t gDTMF_InputIndex;
|
||||
extern bool gDTMF_InputMode;
|
||||
extern uint8_t gDTMF_RecvTimeout;
|
||||
extern DTMF_CallState_t gDTMF_CallState;
|
||||
extern char gDTMF_String[15];
|
||||
extern char gDTMF_InputBox[15];
|
||||
extern char gDTMF_Received[16];
|
||||
extern bool gIsDtmfContactValid;
|
||||
extern char gDTMF_ID[4];
|
||||
extern char gDTMF_Caller[4];
|
||||
extern char gDTMF_Callee[4];
|
||||
extern DTMF_State_t gDTMF_State;
|
||||
extern bool gDTMF_DecodeRing;
|
||||
extern uint8_t gDTMF_DecodeRingCountdown;
|
||||
extern uint8_t gDTMFChosenContact;
|
||||
extern uint8_t gDTMF_WriteIndex;
|
||||
extern uint8_t gDTMF_PreviousIndex;
|
||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
||||
extern uint8_t gDTMF_InputIndex;
|
||||
extern bool gDTMF_InputMode;
|
||||
extern uint8_t gDTMF_RecvTimeout;
|
||||
extern DTMF_CallState_t gDTMF_CallState;
|
||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||
extern bool gDTMF_IsTx;
|
||||
extern uint8_t gDTMF_TxStopCountdown;
|
||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||
extern bool gDTMF_IsTx;
|
||||
extern uint8_t gDTMF_TxStopCountdown;
|
||||
|
||||
bool DTMF_ValidateCodes(char *pCode, uint8_t Size);
|
||||
bool DTMF_GetContact(const int Index, char *pContact);
|
||||
bool DTMF_FindContact(const char *pContact, char *pResult);
|
||||
char DTMF_GetCharacter(uint8_t Code);
|
||||
char DTMF_GetCharacter(const uint8_t code);
|
||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, uint8_t Size, bool bFlag);
|
||||
bool DTMF_CheckGroupCall(const char *pDTMF, uint32_t Size);
|
||||
void DTMF_Append(char Code);
|
||||
|
@ -1444,5 +1444,5 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||
}
|
||||
|
||||
if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL)
|
||||
gVoltageMenuCountdown = menu_timeout_10ms;
|
||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
||||
}
|
||||
|
Reference in New Issue
Block a user