mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-28 14:21:25 +03:00
Renames, some code changes
This commit is contained in:
parent
a60fc80296
commit
bf7a837485
54
Makefile
54
Makefile
@ -1,25 +1,25 @@
|
||||
|
||||
# compile options (see README.md for descriptions)
|
||||
# 0 = disable
|
||||
# 1 = enable
|
||||
# 0 = remove code
|
||||
# 1 = include code
|
||||
|
||||
ENABLE_CLANG := 0
|
||||
ENABLE_SWD := 0
|
||||
ENABLE_OVERLAY := 0
|
||||
ENABLE_LTO := 1
|
||||
ENABLE_UART := 1
|
||||
ENABLE_UART_DEBUG := 1
|
||||
ENABLE_UART_DEBUG := 0
|
||||
ENABLE_AIRCOPY := 1
|
||||
ENABLE_AIRCOPY_FREQ := 1
|
||||
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
|
||||
ENABLE_AIRCOPY_RX_REBOOT := 0
|
||||
ENABLE_FMRADIO := 1
|
||||
ENABLE_NOAA := 0
|
||||
ENABLE_VOICE := 0
|
||||
ENABLE_MUTE_RADIO_FOR_VOICE := 1
|
||||
ENABLE_VOX := 0
|
||||
ENABLE_LOWER_LOW_MID_TX := 1
|
||||
ENABLE_ALARM := 1
|
||||
ENABLE_TX1750 := 1
|
||||
ENABLE_REDUCE_LOW_MID_TX_POWER := 1
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 0
|
||||
ENABLE_PWRON_PASSWORD := 0
|
||||
ENABLE_RESET_AES_KEY := 1
|
||||
ENABLE_BIG_FREQ := 0
|
||||
@ -30,7 +30,8 @@ ENABLE_1250HZ_STEP := 1
|
||||
ENABLE_TX_WHEN_AM := 0
|
||||
ENABLE_F_CAL_MENU := 0
|
||||
ENABLE_TX_UNLOCK := 0
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
|
||||
ENABLE_CONTRAST := 0
|
||||
ENABLE_BOOT_BEEPS := 0
|
||||
ENABLE_DTMF_CALL_FLASH_LIGHT := 1
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 0
|
||||
@ -39,13 +40,13 @@ ENABLE_FREQ_SEARCH_TIMEOUT := 0
|
||||
ENABLE_CODE_SEARCH_TIMEOUT := 0
|
||||
ENABLE_KILL_REVIVE := 0
|
||||
ENABLE_AM_FIX := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
||||
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||
ENABLE_RSSI_BAR := 1
|
||||
ENABLE_SHOW_TX_TIMEOUT := 0
|
||||
ENABLE_AUDIO_BAR := 1
|
||||
ENABLE_RX_SIGNAL_BAR := 1
|
||||
ENABLE_TX_TIMEOUT_BAR := 0
|
||||
ENABLE_TX_AUDIO_BAR := 1
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||
#ENABLE_PANADAPTER := 0
|
||||
#ENABLE_SINGLE_VFO_CHAN := 0
|
||||
@ -76,9 +77,9 @@ ifeq ($(ENABLE_LTO),1)
|
||||
ENABLE_OVERLAY := 0
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_SHOW_TX_TIMEOUT),1)
|
||||
# can't have ENABLE_SHOW_TX_TIMEOUT and ENABLE_AUDIO_BAR enabled at same time
|
||||
ENABLE_AUDIO_BAR := 0
|
||||
ifeq ($(ENABLE_TX_TIMEOUT_BAR),1)
|
||||
# can't have ENABLE_TX_TIMEOUT_BAR and ENABLE_TX_AUDIO_BAR enabled at same time
|
||||
ENABLE_TX_AUDIO_BAR := 0
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE_VOICE),1)
|
||||
@ -249,8 +250,8 @@ endif
|
||||
ifeq ($(ENABLE_AIRCOPY),1)
|
||||
CFLAGS += -DENABLE_AIRCOPY
|
||||
endif
|
||||
ifeq ($(ENABLE_AIRCOPY_FREQ),1)
|
||||
CFLAGS += -DENABLE_AIRCOPY_FREQ
|
||||
ifeq ($(ENABLE_AIRCOPY_REMEMBER_FREQ),1)
|
||||
CFLAGS += -DENABLE_AIRCOPY_REMEMBER_FREQ
|
||||
endif
|
||||
ifeq ($(ENABLE_AIRCOPY_RX_REBOOT),1)
|
||||
CFLAGS += -DENABLE_AIRCOPY_RX_REBOOT
|
||||
@ -282,8 +283,8 @@ endif
|
||||
ifeq ($(ENABLE_VOX),1)
|
||||
CFLAGS += -DENABLE_VOX
|
||||
endif
|
||||
ifeq ($(ENABLE_LOWER_LOW_MID_TX),1)
|
||||
CFLAGS += -DENABLE_LOWER_LOW_MID_TX
|
||||
ifeq ($(ENABLE_REDUCE_LOW_MID_TX_POWER),1)
|
||||
CFLAGS += -DENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
endif
|
||||
ifeq ($(ENABLE_ALARM),1)
|
||||
CFLAGS += -DENABLE_ALARM
|
||||
@ -318,6 +319,9 @@ endif
|
||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||
endif
|
||||
ifeq ($(ENABLE_CONTRAST),1)
|
||||
CFLAGS += -DENABLE_CONTRAST
|
||||
endif
|
||||
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
||||
CFLAGS += -DENABLE_BOOT_BEEPS
|
||||
endif
|
||||
@ -360,14 +364,14 @@ endif
|
||||
ifeq ($(ENABLE_backlight_ON_RX),1)
|
||||
CFLAGS += -DENABLE_backlight_ON_RX
|
||||
endif
|
||||
ifeq ($(ENABLE_RSSI_BAR),1)
|
||||
CFLAGS += -DENABLE_RSSI_BAR
|
||||
ifeq ($(ENABLE_RX_SIGNAL_BAR),1)
|
||||
CFLAGS += -DENABLE_RX_SIGNAL_BAR
|
||||
endif
|
||||
ifeq ($(ENABLE_AUDIO_BAR),1)
|
||||
CFLAGS += -DENABLE_AUDIO_BAR
|
||||
ifeq ($(ENABLE_TX_AUDIO_BAR),1)
|
||||
CFLAGS += -DENABLE_TX_AUDIO_BAR
|
||||
endif
|
||||
ifeq ($(ENABLE_SHOW_TX_TIMEOUT),1)
|
||||
CFLAGS += -DENABLE_SHOW_TX_TIMEOUT
|
||||
ifeq ($(ENABLE_TX_TIMEOUT_BAR),1)
|
||||
CFLAGS += -DENABLE_TX_TIMEOUT_BAR
|
||||
endif
|
||||
ifeq ($(ENABLE_COPY_CHAN_TO_VFO),1)
|
||||
CFLAGS += -DENABLE_COPY_CHAN_TO_VFO
|
||||
|
23
README.md
23
README.md
@ -31,7 +31,7 @@ But, they are nice toys for the price, fun to play with.
|
||||
|
||||
You can customize the firmware by enabling/disabling various compile options, this allows
|
||||
us to remove certain firmware features in order to make room in the flash for others.
|
||||
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
|
||||
You'll find the options at the top of "Makefile" ('0' = remove code, '1' = include code) ..
|
||||
|
||||
```
|
||||
ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this)
|
||||
@ -41,17 +41,17 @@ ENABLE_LTO := 0 **experimental, reduces size of compil
|
||||
ENABLE_UART := 1 without this you can't configure radio via PC
|
||||
ENABLE_UART_DEBUG := 0 just for code debugging, it sends debug info along the USB serial connection (programming lead)
|
||||
ENABLE_AIRCOPY := 1 clone radio-to-radio via RF
|
||||
ENABLE_AIRCOPY_FREQ := 1 remember what you use for the aircopy frequency
|
||||
ENABLE_AIRCOPY_REMEMBER_FREQ := 1 remember the aircopy frequency
|
||||
ENABLE_AIRCOPY_RX_REBOOT := 0 auto reboot on an aircopy successful RX completion
|
||||
ENABLE_FMRADIO := 1 WBFM VHF broadcast band receiver
|
||||
ENABLE_NOAA := 1 everything NOAA (only of any use in the USA)
|
||||
ENABLE_VOICE := 0 want to hear voices ?
|
||||
ENABLE_MUTE_RADIO_FOR_VOICE := 1 mute the radios audio when a voice is playing
|
||||
ENABLE_VOX := 1 voice operated transmission
|
||||
ENABLE_LOWER_LOW_MID_TX := 1 reduce the low and mid TX power levels (high remains unchanged)
|
||||
ENABLE_REDUCE_LOW_MID_TX_POWER := 1 reduce the low and mid TX power levels (high remains unchanged)
|
||||
ENABLE_ALARM := 1 TX alarms
|
||||
ENABLE_1750HZ := 1 side key 1750Hz TX tone (older style repeater access)
|
||||
ENABLE_PWRON_PASSWORD := 0 '1' = allow power-on password
|
||||
ENABLE_PWRON_PASSWORD := 0 include power-on password code
|
||||
ENABLE_RESET_AES_KEY := 1 '1' = reset/clear the AES key stored in the eeprom (only if it's set)
|
||||
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
||||
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
||||
@ -60,23 +60,24 @@ ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though fro
|
||||
ENABLE_1250HZ_STEP := 1 enable smaller 1.25kHz frequency steps
|
||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
||||
ENABLE_TX_UNLOCK := 0 '1' = allow TX everywhere EXCEPT airband (108~136) .. TX harmonic content will cause interference to other services, do so entirely at your own risk !
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_TX_UNLOCK := 0 allow TX everywhere EXCEPT airband (108~136) .. TX harmonic content will cause interference to other services, do so entirely at your own risk !
|
||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||
ENABLE_CONTRAST := 0 add contrast menu
|
||||
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||
ENABLE_DTMF_CALL_FLASH_LIGHT := 1 flash the flash light LED when a DTMF call is received
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||
ENABLE_FREQ_SEARCH_TIMEOUT := 1 timeout if FREQ not found when using F+4 search function
|
||||
ENABLE_CODE_SEARCH_TIMEOUT := 0 timeout if CTCSS/CDCSS not found when using F+* search function
|
||||
ENABLE_KILL_REVIVE := 0 '1' = include kill and revive code
|
||||
ENABLE_KILL_REVIVE := 0 include kill and revive code
|
||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_AM_FIX_SHOW_DATA := 0 show debug data for the AM fix (still tweaking it)
|
||||
ENABLE_SQUELCH_MORE_SENSITIVE := 1 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||
ENABLE_SQ_OPEN_WITH_UP_DN_BUTTS := 1 open the squelch when holding down UP or DN buttons when in frequency mode
|
||||
ENABLE_FASTER_CHANNEL_SCAN := 1 increases the channel scan speed, but the squelch is also made more twitchy
|
||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||
ENABLE_SHOW_TX_TIMEOUT := 0 show the remainng TX time
|
||||
ENABLE_AUDIO_BAR := 1 experimental, display an audo bar level when TX'ing, includes remaining TX time (in seconds)
|
||||
ENABLE_RX_SIGNAL_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||
ENABLE_TX_TIMEOUT_BAR := 0 show the remainng TX time
|
||||
ENABLE_TX_AUDIO_BAR := 1 enable TX audio level bar, includes remaining TX time (in seconds)
|
||||
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
|
||||
#ENABLE_BAND_SCOPE := 0 not yet implemented - spectrum/pan-adapter
|
||||
#ENABLE_SINGLE_VFO_CHAN := 0 not yet implemented - single VFO on display when possible
|
||||
|
@ -283,10 +283,10 @@ void ACTION_Scan(bool bRestart)
|
||||
|
||||
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||
g_alarm_state = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
||||
g_alarm_running_counter = 0;
|
||||
g_alarm_running_counter_10ms = 0;
|
||||
#elif defined(ENABLE_ALARM)
|
||||
g_alarm_state = ALARM_STATE_TXALARM;
|
||||
g_alarm_running_counter = 0;
|
||||
g_alarm_running_counter_10ms = 0;
|
||||
#else
|
||||
g_alarm_state = ALARM_STATE_TX1750;
|
||||
#endif
|
||||
|
@ -649,7 +649,7 @@ static void AIRCOPY_Key_DIGITS(key_code_t Key, bool key_pressed, bool key_held)
|
||||
Frequency = ((Frequency + (g_rx_vfo->step_freq / 2)) / g_rx_vfo->step_freq) * g_rx_vfo->step_freq;
|
||||
|
||||
g_aircopy_freq = Frequency;
|
||||
#ifdef ENABLE_AIRCOPY_FREQ
|
||||
#ifdef ENABLE_AIRCOPY_REMEMBER_FREQ
|
||||
SETTINGS_SaveSettings(); // remeber the frequency for the next time
|
||||
#endif
|
||||
|
||||
|
50
app/app.c
50
app/app.c
@ -394,7 +394,7 @@ Skip:
|
||||
case END_OF_RX_MODE_TTE:
|
||||
if (g_eeprom.tail_note_elimination)
|
||||
{
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_tail_tone_elimination_count_down_10ms = 20;
|
||||
g_flag_tail_tone_elimination_complete = false;
|
||||
@ -464,8 +464,7 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
|
||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||
g_vfo_rssi_bar_level[(chan + 1) & 1u] = 0;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = true;
|
||||
|
||||
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
|
||||
@ -970,7 +969,7 @@ void APP_process_radio_interrupts(void)
|
||||
void APP_end_tx(void)
|
||||
{ // back to RX mode
|
||||
|
||||
RADIO_SendEndOfTransmission();
|
||||
RADIO_tx_eot();
|
||||
|
||||
if (g_current_vfo->p_tx->code_type != CODE_TYPE_NONE)
|
||||
{ // CTCSS/DCS is enabled
|
||||
@ -1632,7 +1631,7 @@ void APP_time_slice_10ms(void)
|
||||
|
||||
if (g_current_function == FUNCTION_TRANSMIT)
|
||||
{ // transmitting
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
if (g_setting_mic_bar && (g_flash_light_blink_counter % (150 / 10)) == 0) // once every 150ms
|
||||
UI_DisplayAudioBar(true);
|
||||
#endif
|
||||
@ -1666,24 +1665,25 @@ void APP_time_slice_10ms(void)
|
||||
{
|
||||
#ifdef ENABLE_ALARM
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM || g_alarm_state == ALARM_STATE_ALARM)
|
||||
{
|
||||
{ // TX alarm tone
|
||||
|
||||
uint16_t Tone;
|
||||
|
||||
g_alarm_running_counter++;
|
||||
g_alarm_tone_counter++;
|
||||
g_alarm_running_counter_10ms++;
|
||||
|
||||
Tone = 500 + (g_alarm_tone_counter * 25);
|
||||
if (Tone > 1500)
|
||||
// loop alarm tone frequency 300Hz ~ 1500Hz ~ 300Hz
|
||||
Tone = 300 + (g_alarm_tone_counter_10ms++ * 50);
|
||||
if (Tone >= ((1500 * 2) - 300))
|
||||
{
|
||||
Tone = 500;
|
||||
g_alarm_tone_counter = 0;
|
||||
Tone = 300;
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
}
|
||||
|
||||
BK4819_SetScrambleFrequencyControlWord(Tone);
|
||||
BK4819_SetScrambleFrequencyControlWord((Tone <= 1500) ? Tone : (1500 * 2) - Tone);
|
||||
|
||||
if (g_eeprom.alarm_mode == ALARM_MODE_TONE && g_alarm_running_counter == 512)
|
||||
if (g_eeprom.alarm_mode == ALARM_MODE_TONE && g_alarm_running_counter_10ms == 512)
|
||||
{
|
||||
g_alarm_running_counter = 0;
|
||||
g_alarm_running_counter_10ms = 0;
|
||||
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM)
|
||||
{
|
||||
@ -1706,10 +1706,10 @@ void APP_time_slice_10ms(void)
|
||||
RADIO_enableTX(false);
|
||||
BK4819_TransmitTone(true, 500);
|
||||
SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = true;
|
||||
g_alarm_tone_counter = 0;
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2022,7 +2022,7 @@ void APP_time_slice_500ms(void)
|
||||
|
||||
if (g_dtmf_rx_live_timeout > 0)
|
||||
{
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
if (center_line == CENTER_LINE_DTMF_DEC ||
|
||||
center_line == CENTER_LINE_NONE) // wait till the center line is free for us to use before timing out
|
||||
#endif
|
||||
@ -2324,7 +2324,7 @@ void APP_time_slice_500ms(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SHOW_TX_TIMEOUT
|
||||
#ifdef ENABLE_TX_TIMEOUT_BAR
|
||||
if (g_current_function == FUNCTION_TRANSMIT && (g_tx_timer_count_down_500ms & 1))
|
||||
UI_DisplayTXCountdown(true);
|
||||
#endif
|
||||
@ -2333,14 +2333,12 @@ void APP_time_slice_500ms(void)
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
static void APP_alarm_off(void)
|
||||
{
|
||||
g_alarm_state = ALARM_STATE_OFF;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = false;
|
||||
|
||||
if (g_eeprom.alarm_mode == ALARM_MODE_TONE)
|
||||
{
|
||||
RADIO_SendEndOfTransmission();
|
||||
RADIO_tx_eot();
|
||||
RADIO_EnableCxCSS();
|
||||
}
|
||||
|
||||
@ -2348,6 +2346,8 @@ void APP_time_slice_500ms(void)
|
||||
g_vox_resume_count_down = 80;
|
||||
#endif
|
||||
|
||||
g_alarm_state = ALARM_STATE_OFF;
|
||||
|
||||
SYSTEM_DelayMs(5);
|
||||
|
||||
RADIO_setup_registers(true);
|
||||
@ -2608,7 +2608,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
{
|
||||
if (!key_pressed)
|
||||
{
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
@ -2624,7 +2624,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
|
||||
{
|
||||
if (g_eeprom.dtmf_side_tone)
|
||||
{ // user will here the DTMF tones in speaker
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = true;
|
||||
}
|
||||
|
||||
|
12
app/dtmf.c
12
app/dtmf.c
@ -389,7 +389,7 @@ void DTMF_HandleRequest(void)
|
||||
}
|
||||
}
|
||||
|
||||
void DTMF_Reply(void)
|
||||
bool DTMF_Reply(void)
|
||||
{
|
||||
uint16_t Delay;
|
||||
char String[20];
|
||||
@ -426,7 +426,7 @@ void DTMF_Reply(void)
|
||||
g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN)
|
||||
{
|
||||
g_dtmf_reply_state = DTMF_REPLY_NONE;
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// send TX-UP DTMF
|
||||
@ -437,13 +437,13 @@ void DTMF_Reply(void)
|
||||
g_dtmf_reply_state = DTMF_REPLY_NONE;
|
||||
|
||||
if (pString == NULL)
|
||||
return;
|
||||
return false;
|
||||
|
||||
Delay = (g_eeprom.dtmf_preload_time < 200) ? 200 : g_eeprom.dtmf_preload_time;
|
||||
|
||||
if (g_eeprom.dtmf_side_tone)
|
||||
{ // the user will also hear the transmitted tones
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = true;
|
||||
}
|
||||
|
||||
@ -459,9 +459,11 @@ void DTMF_Reply(void)
|
||||
g_eeprom.dtmf_code_persist_time,
|
||||
g_eeprom.dtmf_code_interval_time);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
BK4819_ExitDTMF_TX(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -104,6 +104,6 @@ dtmf_call_mode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size)
|
||||
void DTMF_clear_input_box(void);
|
||||
void DTMF_Append(const char vode);
|
||||
void DTMF_HandleRequest(void);
|
||||
void DTMF_Reply(void);
|
||||
bool DTMF_Reply(void);
|
||||
|
||||
#endif
|
||||
|
10
app/fm.c
10
app/fm.c
@ -99,7 +99,7 @@ void FM_TurnOff(void)
|
||||
g_fm_scan_state = FM_SCAN_OFF;
|
||||
g_fm_restore_count_down_10ms = 0;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
@ -122,7 +122,7 @@ void FM_EraseChannels(void)
|
||||
|
||||
void FM_Tune(uint16_t Frequency, int8_t Step, bool flag)
|
||||
{
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
@ -169,7 +169,7 @@ void FM_PlayAndUpdate(void)
|
||||
g_schedule_fm = false;
|
||||
g_ask_to_save = false;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = true;
|
||||
}
|
||||
@ -659,7 +659,7 @@ void FM_Play(void)
|
||||
if (!g_eeprom.fm_is_channel_mode)
|
||||
g_eeprom.fm_selected_frequency = g_eeprom.fm_frequency_playing;
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = true;
|
||||
|
||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||
@ -693,7 +693,7 @@ void FM_Start(void)
|
||||
|
||||
BK1080_Init(g_eeprom.fm_frequency_playing, true);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = true;
|
||||
g_update_status = true;
|
||||
|
46
app/menu.c
46
app/menu.c
@ -145,7 +145,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
|
||||
case MENU_SCAN_HOLD:
|
||||
*pMin = 2;
|
||||
*pMax = 20;
|
||||
*pMax = 20; // 10 seconds
|
||||
break;
|
||||
|
||||
case MENU_CROSS_VFO:
|
||||
@ -219,12 +219,14 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
*pMax = ARRAY_SIZE(g_sub_menu_rx_tx) - 1;
|
||||
break;
|
||||
|
||||
case MENU_CONTRAST:
|
||||
// *pMin = 0;
|
||||
// *pMax = 63;
|
||||
*pMin = 26;
|
||||
*pMax = 45;
|
||||
break;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
case MENU_CONTRAST:
|
||||
//*pMin = 0;
|
||||
//*pMax = 63;
|
||||
*pMin = 26;
|
||||
*pMax = 45;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
case MENU_AM_FIX_TEST1:
|
||||
@ -236,10 +238,10 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
||||
#ifdef ENABLE_AM_FIX
|
||||
case MENU_AM_FIX:
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
case MENU_TX_BAR:
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
case MENU_RX_BAR:
|
||||
#endif
|
||||
case MENU_BUSY_CHAN_LOCK:
|
||||
@ -552,10 +554,12 @@ void MENU_AcceptSetting(void)
|
||||
g_setting_backlight_on_tx_rx = g_sub_menu_selection;
|
||||
break;
|
||||
|
||||
case MENU_CONTRAST:
|
||||
g_setting_contrast = g_sub_menu_selection;
|
||||
ST7565_SetContrast(g_setting_contrast);
|
||||
break;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
case MENU_CONTRAST:
|
||||
g_setting_contrast = g_sub_menu_selection;
|
||||
ST7565_SetContrast(g_setting_contrast);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_DUAL_WATCH:
|
||||
// g_eeprom.dual_watch = g_sub_menu_selection;
|
||||
@ -636,13 +640,13 @@ void MENU_AcceptSetting(void)
|
||||
g_flag_reconfigure_vfos = true;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
case MENU_TX_BAR:
|
||||
g_setting_mic_bar = g_sub_menu_selection;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
case MENU_RX_BAR:
|
||||
g_setting_rssi_bar = g_sub_menu_selection;
|
||||
break;
|
||||
@ -1033,9 +1037,11 @@ void MENU_ShowCurrentSetting(void)
|
||||
g_sub_menu_selection = g_setting_backlight_on_tx_rx;
|
||||
break;
|
||||
|
||||
case MENU_CONTRAST:
|
||||
g_sub_menu_selection = g_setting_contrast;
|
||||
break;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
case MENU_CONTRAST:
|
||||
g_sub_menu_selection = g_setting_contrast;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case MENU_DUAL_WATCH:
|
||||
// g_sub_menu_selection = g_eeprom.dual_watch;
|
||||
@ -1096,13 +1102,13 @@ void MENU_ShowCurrentSetting(void)
|
||||
g_sub_menu_selection = g_eeprom.mic_sensitivity;
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
case MENU_TX_BAR:
|
||||
g_sub_menu_selection = g_setting_mic_bar;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
case MENU_RX_BAR:
|
||||
g_sub_menu_selection = g_setting_rssi_bar;
|
||||
break;
|
||||
|
@ -346,9 +346,9 @@ bool IsTXAllowed() { return g_setting_ALL_TX != 2; }
|
||||
|
||||
static void ToggleAudio(bool on) {
|
||||
if (on) {
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
} else {
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ static void ToggleTX(bool on) {
|
||||
}
|
||||
else
|
||||
{
|
||||
RADIO_SendEndOfTransmission();
|
||||
RADIO_tx_eot();
|
||||
RADIO_EnableCxCSS();
|
||||
|
||||
BK4819_SetupPowerAmplifier(0, 0);
|
||||
|
16
audio.c
16
audio.c
@ -98,7 +98,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
|
||||
ToneConfig = BK4819_ReadRegister(BK4819_REG_71);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
if (g_current_function == FUNCTION_POWER_SAVE && g_rx_idle_mode)
|
||||
BK4819_RX_TurnOn();
|
||||
@ -137,11 +137,11 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
break;
|
||||
}
|
||||
|
||||
BK4819_PlayTone(ToneFrequency, true);
|
||||
BK4819_StartTone1(ToneFrequency, 96, true);
|
||||
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
|
||||
@ -193,7 +193,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
BK4819_EnterTxMute();
|
||||
SYSTEM_DelayMs(20);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
g_vox_resume_count_down = 80;
|
||||
@ -205,7 +205,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
BK4819_WriteRegister(BK4819_REG_71, ToneConfig);
|
||||
|
||||
if (g_enable_speaker)
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
@ -281,7 +281,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#ifdef ENABLE_VOX
|
||||
g_vox_resume_count_down = 2000;
|
||||
@ -307,7 +307,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
#endif
|
||||
|
||||
if (!g_enable_speaker)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_voice_write_index = 0;
|
||||
g_voice_read_index = 0;
|
||||
@ -455,7 +455,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
#endif
|
||||
|
||||
if (!g_enable_speaker)
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
// **********************
|
||||
|
||||
|
10
board.c
10
board.c
@ -540,7 +540,9 @@ void BOARD_EEPROM_load(void)
|
||||
|
||||
// 0E78..0E7F
|
||||
EEPROM_ReadBuffer(0x0E78, Data, 8);
|
||||
g_setting_contrast = (Data[0] > 45) ? 31 : (Data[0] < 26) ? 31 : Data[0];
|
||||
#ifdef ENABLE_CONTRAST
|
||||
g_setting_contrast = (Data[0] > 45) ? 31 : (Data[0] < 26) ? 31 : Data[0];
|
||||
#endif
|
||||
g_eeprom.channel_display_mode = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode
|
||||
g_eeprom.cross_vfo_rx_tx = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
||||
g_eeprom.battery_save = (Data[3] < 5) ? Data[3] : 4;
|
||||
@ -627,7 +629,7 @@ void BOARD_EEPROM_load(void)
|
||||
g_eeprom.repeater_tail_tone_elimination = (array.repeater_tail_tone_elimination < 11) ? array.repeater_tail_tone_elimination : 0;
|
||||
g_eeprom.tx_vfo = (array.tx_vfo < 2) ? array.tx_vfo : 0;
|
||||
|
||||
#ifdef ENABLE_AIRCOPY_FREQ
|
||||
#ifdef ENABLE_AIRCOPY_REMEMBER_FREQ
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < ARRAY_SIZE(FREQ_BAND_TABLE); i++)
|
||||
@ -736,13 +738,13 @@ void BOARD_EEPROM_load(void)
|
||||
g_setting_470_tx_enable = (Data[4] < 2) ? Data[4] : false;
|
||||
g_setting_350_enable = (Data[5] < 2) ? Data[5] : true;
|
||||
g_setting_scramble_enable = (Data[6] & (1u << 0)) ? true : false;
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
g_setting_rssi_bar = (Data[6] & (1u << 1)) ? true : false;
|
||||
#endif
|
||||
g_setting_tx_enable = (Data[7] & (1u << 0)) ? true : false;
|
||||
g_setting_live_dtmf_decoder = (Data[7] & (1u << 1)) ? true : false;
|
||||
g_setting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
g_setting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
|
@ -329,21 +329,26 @@ enum {
|
||||
BK4819_REG_51_AUTO_CTCSS_BW_ENABLE = (0U << BK4819_REG_51_SHIFT_AUTO_CTCSS_BW),
|
||||
};
|
||||
|
||||
// *****************
|
||||
// REG 70
|
||||
|
||||
#define BK4819_REG_70_SHIFT_ENABLE_TONE1 15
|
||||
#define BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN 8
|
||||
#define BK4819_REG_70_SHIFT_ENABLE_TONE2 7
|
||||
#define BK4819_REG_70_SHIFT_TONE2_TUNING_GAIN 0
|
||||
#define BK4819_REG_70_SHIFT_ENABLE_TONE1 15
|
||||
#define BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN 8
|
||||
|
||||
#define BK4819_REG_70_MASK_ENABLE_TONE1 (0x01U << BK4819_REG_70_SHIFT_ENABLE_TONE1)
|
||||
#define BK4819_REG_70_MASK_TONE1_TUNING_GAIN (0x7FU << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)
|
||||
#define BK4819_REG_70_MASK_ENABLE_TONE2 (0x01U << BK4819_REG_70_SHIFT_ENABLE_TONE2)
|
||||
#define BK4819_REG_70_MASK_TONE2_TUNING_GAIN (0x7FU << BK4819_REG_70_SHIFT_TONE2_TUNING_GAIN)
|
||||
#define BK4819_REG_70_SHIFT_ENABLE_TONE2 7
|
||||
#define BK4819_REG_70_SHIFT_TONE2_TUNING_GAIN 0
|
||||
|
||||
#define BK4819_REG_70_MASK_ENABLE_TONE1 (0x01u << BK4819_REG_70_SHIFT_ENABLE_TONE1)
|
||||
#define BK4819_REG_70_MASK_TONE1_TUNING_GAIN (0x7Fu << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN)
|
||||
|
||||
#define BK4819_REG_70_MASK_ENABLE_TONE2 (0x01u << BK4819_REG_70_SHIFT_ENABLE_TONE2)
|
||||
#define BK4819_REG_70_MASK_TONE2_TUNING_GAIN (0x7Fu << BK4819_REG_70_SHIFT_TONE2_TUNING_GAIN)
|
||||
|
||||
enum {
|
||||
BK4819_REG_70_ENABLE_TONE1 = (1U << BK4819_REG_70_SHIFT_ENABLE_TONE1),
|
||||
BK4819_REG_70_ENABLE_TONE2 = (1U << BK4819_REG_70_SHIFT_ENABLE_TONE2),
|
||||
BK4819_REG_70_ENABLE_TONE1 = (1u << BK4819_REG_70_SHIFT_ENABLE_TONE1),
|
||||
BK4819_REG_70_ENABLE_TONE2 = (1u << BK4819_REG_70_SHIFT_ENABLE_TONE2)
|
||||
};
|
||||
|
||||
// *****************
|
||||
|
||||
#endif
|
||||
|
193
driver/bk4819.c
193
driver/bk4819.c
@ -22,6 +22,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/system.h"
|
||||
#include "driver/systick.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
@ -952,14 +953,11 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
//
|
||||
// <6:0> 64 Compress (AF Tx) noise point (dB)
|
||||
//
|
||||
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 2 : 0; // 2:1
|
||||
const uint16_t compress_0dB = 86;
|
||||
const uint16_t compress_noise_dB = 64;
|
||||
// AB40 10 1010110 1000000
|
||||
const uint16_t compress_ratio = (mode == 1 || mode >= 3) ? 2 : 0; // 2:1
|
||||
BK4819_WriteRegister(BK4819_REG_29, // (BK4819_ReadRegister(BK4819_REG_29) & ~(3u << 14)) | (compress_ratio << 14));
|
||||
(compress_ratio << 14) |
|
||||
(compress_0dB << 7) |
|
||||
(compress_noise_dB << 0));
|
||||
(compress_ratio << 14) |
|
||||
(86u << 7) | // compress 0dB
|
||||
(64u << 0)); // compress noise dB
|
||||
|
||||
// REG_28
|
||||
//
|
||||
@ -973,14 +971,11 @@ void BK4819_SetCompander(const unsigned int mode)
|
||||
//
|
||||
// <6:0> 56 Expander (AF Rx) noise point (dB)
|
||||
//
|
||||
const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
|
||||
const uint16_t expand_0dB = 86;
|
||||
const uint16_t expand_noise_dB = 56;
|
||||
// 6B38 01 1010110 0111000
|
||||
const uint16_t expand_ratio = (mode >= 2) ? 1 : 0; // 1:2
|
||||
BK4819_WriteRegister(BK4819_REG_28, // (BK4819_ReadRegister(BK4819_REG_28) & ~(3u << 14)) | (expand_ratio << 14));
|
||||
(expand_ratio << 14) |
|
||||
(expand_0dB << 7) |
|
||||
(expand_noise_dB << 0));
|
||||
(expand_ratio << 14) |
|
||||
(86u << 7) | // expander 0dB
|
||||
(56u << 0)); // expander noise dB
|
||||
|
||||
// enable
|
||||
BK4819_WriteRegister(BK4819_REG_31, r31 | (1u << 3));
|
||||
@ -1029,65 +1024,72 @@ void BK4819_EnableDTMF(void)
|
||||
(1u << BK4819_REG_24_SHIFT_UNKNOWN_6) |
|
||||
BK4819_REG_24_ENABLE |
|
||||
BK4819_REG_24_SELECT_DTMF |
|
||||
// (14u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
|
||||
(15u << BK4819_REG_24_SHIFT_MAX_SYMBOLS)); // 0 ~ 15
|
||||
}
|
||||
|
||||
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch)
|
||||
void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const bool set_dac)
|
||||
{
|
||||
uint16_t ToneConfig;
|
||||
|
||||
BK4819_EnterTxMute();
|
||||
// BK4819_SetAF(BK4819_AF_MUTE);
|
||||
BK4819_SetAF(BK4819_AF_BEEP);
|
||||
|
||||
if (bTuningGainSwitch == 0)
|
||||
ToneConfig = BK4819_REG_70_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN);
|
||||
else
|
||||
ToneConfig = BK4819_REG_70_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN);
|
||||
BK4819_WriteRegister(BK4819_REG_70, ToneConfig);
|
||||
BK4819_EnterTxMute();
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_30, BK4819_REG_30_ENABLE_AF_DAC | BK4819_REG_30_ENABLE_DISC_MODE | BK4819_REG_30_ENABLE_TX_DSP);
|
||||
// SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER); // enable speaker
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(Frequency));
|
||||
if (set_dac)
|
||||
{
|
||||
//BK4819_WriteRegister(BK4819_REG_30, 0);
|
||||
//BK4819_WriteRegister(BK4819_REG_30, BK4819_REG_30_ENABLE_AF_DAC | BK4819_REG_30_ENABLE_DISC_MODE | BK4819_REG_30_ENABLE_TX_DSP);
|
||||
BK4819_EnableTXLink();
|
||||
}
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(frequency));
|
||||
BK4819_ExitTxMute();
|
||||
}
|
||||
|
||||
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker)
|
||||
void BK4819_StopTones(void)
|
||||
{
|
||||
BK4819_EnterTxMute();
|
||||
|
||||
if (play_speaker)
|
||||
{
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
BK4819_SetAF(BK4819_AF_BEEP);
|
||||
}
|
||||
else
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
|
||||
// level 0 ~ 127
|
||||
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | ((level & 0x7f) << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
|
||||
BK4819_EnableTXLink();
|
||||
SYSTEM_DelayMs(50);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(tone_Hz));
|
||||
|
||||
BK4819_ExitTxMute();
|
||||
SYSTEM_DelayMs(delay);
|
||||
BK4819_EnterTxMute();
|
||||
|
||||
if (play_speaker)
|
||||
{
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
// BK4819_SetAF(g_rx_vfo->am_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||
}
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE); // 1100 0001 1111 1110
|
||||
BK4819_ExitTxMute();
|
||||
|
||||
// if (!g_enable_speaker)
|
||||
// GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
}
|
||||
|
||||
void BK4819_PlayTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level)
|
||||
{
|
||||
const uint16_t prev_af = BK4819_ReadRegister(BK4819_REG_47);
|
||||
BK4819_StartTone1(tone_Hz, level, true);
|
||||
SYSTEM_DelayMs(delay - 2);
|
||||
BK4819_StopTones();
|
||||
BK4819_WriteRegister(BK4819_REG_47, prev_af);
|
||||
}
|
||||
|
||||
void BK4819_PlayRoger(void)
|
||||
{
|
||||
#if 0
|
||||
const uint32_t tone1_Hz = 500;
|
||||
const uint32_t tone2_Hz = 700;
|
||||
#else
|
||||
// motorola
|
||||
const uint32_t tone1_Hz = 1540;
|
||||
const uint32_t tone2_Hz = 1310;
|
||||
#endif
|
||||
|
||||
const uint16_t prev_af = BK4819_ReadRegister(BK4819_REG_47);
|
||||
|
||||
BK4819_StartTone1(tone1_Hz, 96, true);
|
||||
SYSTEM_DelayMs(80 - 2);
|
||||
BK4819_StartTone1(tone2_Hz, 96, false);
|
||||
SYSTEM_DelayMs(80);
|
||||
BK4819_StopTones();
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_47, prev_af);
|
||||
}
|
||||
|
||||
void BK4819_EnterTxMute(void)
|
||||
@ -1918,42 +1920,6 @@ void BK4819_start_fsk_rx(const unsigned int packet_size)
|
||||
BK4819_WriteRegister(BK4819_REG_59, (1u << 13) | (1u << 12) | fsk_reg59); // enable scrambler, enable RX
|
||||
}
|
||||
|
||||
void BK4819_PlayRoger(void)
|
||||
{
|
||||
#if 0
|
||||
const uint32_t tone1_Hz = 500;
|
||||
const uint32_t tone2_Hz = 700;
|
||||
#else
|
||||
// motorola type
|
||||
const uint32_t tone1_Hz = 1540;
|
||||
const uint32_t tone2_Hz = 1310;
|
||||
#endif
|
||||
|
||||
BK4819_EnterTxMute();
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
|
||||
// BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (96u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
BK4819_WriteRegister(BK4819_REG_70, BK4819_REG_70_ENABLE_TONE1 | (28u << BK4819_REG_70_SHIFT_TONE1_TUNING_GAIN));
|
||||
|
||||
BK4819_EnableTXLink();
|
||||
SYSTEM_DelayMs(50);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(tone1_Hz));
|
||||
|
||||
BK4819_ExitTxMute();
|
||||
SYSTEM_DelayMs(80);
|
||||
BK4819_EnterTxMute();
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_71, scale_freq(tone2_Hz));
|
||||
|
||||
BK4819_ExitTxMute();
|
||||
SYSTEM_DelayMs(80);
|
||||
BK4819_EnterTxMute();
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0);
|
||||
BK4819_WriteRegister(BK4819_REG_30, 0xC1FE); // 1 1 0000 0 1 1111 1 1 1 0
|
||||
}
|
||||
|
||||
void BK4819_PlayRogerMDC1200(void)
|
||||
{
|
||||
static const uint8_t MDC1200_DATA[] = {
|
||||
@ -1962,10 +1928,13 @@ void BK4819_PlayRogerMDC1200(void)
|
||||
// this needs properly computing for MDC1200
|
||||
0xA2, 0xF1, 0x46, 0x74, 0xA4, 0x61, 0x44, 0x65, 0x8A, 0x4E, 0x44, 0xE0, 0x84, 0xEA
|
||||
};
|
||||
uint16_t fsk_reg59;
|
||||
unsigned int timeout;
|
||||
uint16_t fsk_reg59;
|
||||
|
||||
BK4819_SetAF(BK4819_AF_MUTE);
|
||||
// BK4819_SetAF(BK4819_AF_BEEP);
|
||||
|
||||
BK4819_EnableTXLink();
|
||||
SYSTEM_DelayMs(10);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_58, // 0x37C3); // 001 101 11 11 00 001 1
|
||||
(1u << 13) | // 1 FSK TX mode selection
|
||||
@ -2144,18 +2113,17 @@ void BK4819_PlayRogerMDC1200(void)
|
||||
// enable TX
|
||||
BK4819_WriteRegister(BK4819_REG_59, (1u << 11) | fsk_reg59);
|
||||
|
||||
// packet is 175ms long
|
||||
timeout = 250 / 5; // allow up to 250ms for the TX to complete
|
||||
while (timeout-- > 0)
|
||||
{
|
||||
SYSTEM_DelayMs(5);
|
||||
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0))
|
||||
{ // we have interrupt flags
|
||||
uint16_t interrupt_bits;
|
||||
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||
interrupt_bits = BK4819_ReadRegister(BK4819_REG_02);
|
||||
if (interrupt_bits & BK4819_REG_02_FSK_TX_FINISHED)
|
||||
timeout = 0; // TX is complete
|
||||
{ // packet is 175ms long
|
||||
unsigned int timeout = 250 / 5; // allow up to 250ms for the TX to complete
|
||||
while (timeout-- > 0)
|
||||
{
|
||||
SYSTEM_DelayMs(5);
|
||||
if (BK4819_ReadRegister(BK4819_REG_0C) & (1u << 0))
|
||||
{ // we have interrupt flags
|
||||
BK4819_WriteRegister(BK4819_REG_02, 0);
|
||||
if (BK4819_ReadRegister(BK4819_REG_02) & BK4819_REG_02_FSK_TX_FINISHED)
|
||||
timeout = 0; // TX is complete
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2187,15 +2155,10 @@ void BK4819_PlayDTMFEx(bool bLocalLoopback, char Code)
|
||||
{
|
||||
BK4819_EnableDTMF();
|
||||
BK4819_EnterTxMute();
|
||||
|
||||
BK4819_SetAF(bLocalLoopback ? BK4819_AF_BEEP : BK4819_AF_MUTE);
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0xD3D3);
|
||||
|
||||
BK4819_WriteRegister(BK4819_REG_70, 0xD3D3); // 1101 0011 1101 0011
|
||||
BK4819_EnableTXLink();
|
||||
|
||||
SYSTEM_DelayMs(50);
|
||||
|
||||
BK4819_PlayDTMF(Code);
|
||||
|
||||
BK4819_ExitTxMute();
|
||||
}
|
||||
|
@ -98,8 +98,9 @@ void BK4819_SetCompander(const unsigned int mode);
|
||||
void BK4819_DisableVox(void);
|
||||
void BK4819_DisableDTMF(void);
|
||||
void BK4819_EnableDTMF(void);
|
||||
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
|
||||
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker);
|
||||
void BK4819_StartTone1(const uint16_t frequency, const unsigned int level, const bool set_dac);
|
||||
void BK4819_StopTones(void);
|
||||
void BK4819_PlayTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level);
|
||||
void BK4819_EnterTxMute(void);
|
||||
void BK4819_ExitTxMute(void);
|
||||
void BK4819_Sleep(void);
|
||||
|
@ -54,7 +54,7 @@ enum GPIOC_PINS {
|
||||
GPIOC_PIN_BK4819_SDA = 2,
|
||||
|
||||
GPIOC_PIN_FLASHLIGHT = 3,
|
||||
GPIOC_PIN_AUDIO_PATH = 4,
|
||||
GPIOC_PIN_SPEAKER = 4,
|
||||
GPIOC_PIN_PTT = 5
|
||||
};
|
||||
|
||||
|
@ -27,7 +27,10 @@
|
||||
|
||||
uint8_t g_status_line[128];
|
||||
uint8_t g_frame_buffer[7][128];
|
||||
uint8_t contrast = 31; // 0 ~ 63
|
||||
|
||||
#ifdef ENABLE_CONTRAST
|
||||
uint8_t contrast = 31; // 0 ~ 63
|
||||
#endif
|
||||
|
||||
void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const unsigned int Size, const uint8_t *pBitmap)
|
||||
{
|
||||
@ -179,7 +182,11 @@ void ST7565_Init(const bool full)
|
||||
ST7565_WriteByte(0x24); // ???
|
||||
|
||||
ST7565_WriteByte(0x81); //
|
||||
ST7565_WriteByte(contrast); // brightness 0 ~ 63
|
||||
#ifdef ENABLE_CONTRAST
|
||||
ST7565_WriteByte(contrast); // brightness 0 ~ 63
|
||||
#else
|
||||
ST7565_WriteByte(31); // brightness 0 ~ 63
|
||||
#endif
|
||||
|
||||
if (full)
|
||||
{
|
||||
@ -235,12 +242,14 @@ void ST7565_WriteByte(const uint8_t Value)
|
||||
SPI0->WDR = Value;
|
||||
}
|
||||
|
||||
void ST7565_SetContrast(const uint8_t value)
|
||||
{
|
||||
contrast = (value <= 63) ? value : 63;
|
||||
}
|
||||
#ifdef ENABLE_CONTRAST
|
||||
void ST7565_SetContrast(const uint8_t value)
|
||||
{
|
||||
contrast = (value <= 63) ? value : 63;
|
||||
}
|
||||
|
||||
uint8_t ST7565_GetContrast(void)
|
||||
{
|
||||
return contrast;
|
||||
}
|
||||
uint8_t ST7565_GetContrast(void)
|
||||
{
|
||||
return contrast;
|
||||
}
|
||||
#endif
|
||||
|
@ -34,8 +34,10 @@ void ST7565_Init(const bool full);
|
||||
void ST7565_HardwareReset(void);
|
||||
void ST7565_SelectColumnAndLine(const uint8_t Column, const uint8_t Line);
|
||||
void ST7565_WriteByte(const uint8_t Value);
|
||||
void ST7565_SetContrast(const uint8_t value);
|
||||
uint8_t ST7565_GetContrast(void);
|
||||
#ifdef ENABLE_CONTRAST
|
||||
void ST7565_SetContrast(const uint8_t value);
|
||||
uint8_t ST7565_GetContrast(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
98
functions.c
98
functions.c
@ -177,6 +177,16 @@ void FUNCTION_Select(function_type_t Function)
|
||||
UART_SendText("func transmit\r\n");
|
||||
#endif
|
||||
|
||||
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
|
||||
backlight_turn_on(backlight_tx_rx_time_500ms);
|
||||
|
||||
if (g_eeprom.dual_watch != DUAL_WATCH_OFF)
|
||||
{ // dual-RX is enabled
|
||||
g_dual_watch_delay_10ms = dual_watch_delay_after_tx_10ms;
|
||||
if (g_dual_watch_delay_10ms < (g_eeprom.scan_hold_time_500ms * 50))
|
||||
g_dual_watch_delay_10ms = g_eeprom.scan_hold_time_500ms * 50;
|
||||
}
|
||||
|
||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering ! .. 1of11
|
||||
// so MAKE SURE that DTMF is disabled - until needed
|
||||
BK4819_DisableDTMF();
|
||||
@ -186,50 +196,49 @@ void FUNCTION_Select(function_type_t Function)
|
||||
|
||||
// clear the DTMF RX live decoder buffer
|
||||
g_dtmf_rx_live_timeout = 0;
|
||||
g_dtmf_rx_live_timeout = 0;
|
||||
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
|
||||
|
||||
#if defined(ENABLE_FMRADIO)
|
||||
#ifdef ENABLE_FMRADIO
|
||||
// disable the FM radio
|
||||
if (g_fm_radio_mode)
|
||||
BK1080_Init(0, false);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM && g_eeprom.alarm_mode != ALARM_MODE_TONE)
|
||||
{
|
||||
g_alarm_state = ALARM_STATE_ALARM;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
SYSTEM_DelayMs(20);
|
||||
BK4819_PlayTone(500, 0);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
g_enable_speaker = true;
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_ExitTxMute();
|
||||
|
||||
g_alarm_tone_counter = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
g_update_status = true;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM && g_eeprom.alarm_mode != ALARM_MODE_TONE)
|
||||
{ // enable the alarm tone but not the TX
|
||||
|
||||
g_alarm_state = ALARM_STATE_ALARM;
|
||||
|
||||
GUI_DisplayScreen();
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
SYSTEM_DelayMs(20);
|
||||
BK4819_StartTone1(500, 28, true);
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = true;
|
||||
|
||||
SYSTEM_DelayMs(60);
|
||||
BK4819_ExitTxMute();
|
||||
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_current_vfo->scrambling_type == 0 || !g_setting_scramble_enable)
|
||||
BK4819_DisableScramble();
|
||||
|
||||
RADIO_enableTX(false);
|
||||
|
||||
DTMF_Reply();
|
||||
|
||||
if (g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
||||
BK4819_PlaySingleTone(APOLLO_TONE1_HZ, APOLLO_TONE_MS, 0, g_eeprom.dtmf_side_tone);
|
||||
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (g_alarm_state != ALARM_STATE_OFF)
|
||||
{
|
||||
@ -241,30 +250,27 @@ void FUNCTION_Select(function_type_t Function)
|
||||
if (g_alarm_state == ALARM_STATE_TXALARM)
|
||||
BK4819_TransmitTone(true, 500);
|
||||
#endif
|
||||
|
||||
SYSTEM_DelayMs(2);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
#ifdef ENABLE_ALARM
|
||||
g_alarm_tone_counter = 0;
|
||||
g_alarm_tone_counter_10ms = 0;
|
||||
#endif
|
||||
|
||||
g_enable_speaker = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (!DTMF_Reply())
|
||||
if (g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
||||
BK4819_PlayTone(APOLLO_TONE1_HZ, APOLLO_TONE_MS, 0);
|
||||
|
||||
if (g_current_vfo->scrambling_type > 0 && g_setting_scramble_enable)
|
||||
BK4819_EnableScramble(g_current_vfo->scrambling_type - 1);
|
||||
else
|
||||
BK4819_DisableScramble();
|
||||
|
||||
if (g_setting_backlight_on_tx_rx == 1 || g_setting_backlight_on_tx_rx == 3)
|
||||
backlight_turn_on(backlight_tx_rx_time_500ms);
|
||||
|
||||
if (g_eeprom.dual_watch != DUAL_WATCH_OFF)
|
||||
{ // dual-RX is enabled
|
||||
g_dual_watch_delay_10ms = dual_watch_delay_after_tx_10ms;
|
||||
if (g_dual_watch_delay_10ms < (g_eeprom.scan_hold_time_500ms * 50))
|
||||
g_dual_watch_delay_10ms = g_eeprom.scan_hold_time_500ms * 50;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
4
main.c
4
main.c
@ -104,7 +104,9 @@ void Main(void)
|
||||
|
||||
BATTERY_GetReadings(false);
|
||||
|
||||
ST7565_SetContrast(g_setting_contrast);
|
||||
#ifdef ENABLE_CONTRAST
|
||||
ST7565_SetContrast(g_setting_contrast);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AM_FIX
|
||||
AM_fix_init();
|
||||
|
12
misc.c
12
misc.c
@ -106,16 +106,18 @@ uint8_t g_setting_backlight_on_tx_rx;
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
uint8_t g_setting_am_fix_test1 = 0;
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
bool g_setting_mic_bar;
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
bool g_setting_rssi_bar;
|
||||
#endif
|
||||
bool g_setting_live_dtmf_decoder;
|
||||
uint8_t g_setting_battery_text;
|
||||
|
||||
uint8_t g_setting_contrast;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
uint8_t g_setting_contrast;
|
||||
#endif
|
||||
|
||||
uint8_t g_setting_side1_short;
|
||||
uint8_t g_setting_side1_long;
|
||||
@ -227,8 +229,8 @@ scan_state_dir_t g_scan_state_dir;
|
||||
|
||||
bool g_rx_vfo_is_active;
|
||||
#ifdef ENABLE_ALARM
|
||||
uint8_t g_alarm_tone_counter;
|
||||
uint16_t g_alarm_running_counter;
|
||||
uint16_t g_alarm_tone_counter_10ms;
|
||||
uint16_t g_alarm_running_counter_10ms;
|
||||
#endif
|
||||
uint8_t g_menu_list_count;
|
||||
uint8_t g_backup_cross_vfo_rx_tx;
|
||||
|
12
misc.h
12
misc.h
@ -187,16 +187,18 @@ extern uint8_t g_setting_backlight_on_tx_rx;
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
extern uint8_t g_setting_am_fix_test1;
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
extern bool g_setting_mic_bar;
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
extern bool g_setting_rssi_bar;
|
||||
#endif
|
||||
extern bool g_setting_live_dtmf_decoder;
|
||||
extern uint8_t g_setting_battery_text;
|
||||
|
||||
extern uint8_t g_setting_contrast;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
extern uint8_t g_setting_contrast;
|
||||
#endif
|
||||
|
||||
extern uint8_t g_setting_side1_short;
|
||||
extern uint8_t g_setting_side1_long;
|
||||
@ -307,8 +309,8 @@ extern scan_state_dir_t g_scan_state_dir; // the direction we're sc
|
||||
|
||||
|
||||
extern bool g_rx_vfo_is_active;
|
||||
extern uint8_t g_alarm_tone_counter;
|
||||
extern uint16_t g_alarm_running_counter;
|
||||
extern uint16_t g_alarm_tone_counter_10ms;
|
||||
extern uint16_t g_alarm_running_counter_10ms;
|
||||
extern uint8_t g_menu_list_count;
|
||||
extern uint8_t g_backup_cross_vfo_rx_tx;
|
||||
#ifdef ENABLE_NOAA
|
||||
|
42
radio.c
42
radio.c
@ -552,7 +552,7 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *pInfo)
|
||||
|
||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->output_power * 3), TX_power, 3);
|
||||
|
||||
#ifdef ENABLE_LOWER_LOW_MID_TX
|
||||
#ifdef ENABLE_REDUCE_LOW_MID_TX_POWER
|
||||
// make low and mid even lower
|
||||
if (pInfo->output_power == OUTPUT_POWER_LOW)
|
||||
{
|
||||
@ -628,8 +628,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
uint16_t interrupt_mask;
|
||||
uint32_t Frequency;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = false;
|
||||
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false);
|
||||
@ -880,7 +879,7 @@ void RADIO_enableTX(const bool fsk_tx)
|
||||
{
|
||||
BK4819_filter_bandwidth_t Bandwidth = g_current_vfo->channel_bandwidth;
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
|
||||
g_enable_speaker = false;
|
||||
|
||||
@ -1122,29 +1121,27 @@ void RADIO_PrepareCssTX(void)
|
||||
RADIO_setup_registers(true);
|
||||
}
|
||||
|
||||
void RADIO_SendEndOfTransmission(void)
|
||||
void RADIO_tx_eot(void)
|
||||
{
|
||||
if (g_eeprom.roger_mode == ROGER_MODE_ROGER)
|
||||
BK4819_PlayRoger();
|
||||
else
|
||||
if (g_eeprom.roger_mode == ROGER_MODE_MDC)
|
||||
BK4819_PlayRogerMDC1200();
|
||||
|
||||
if (g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
||||
BK4819_PlaySingleTone(APOLLO_TONE2_HZ, APOLLO_TONE_MS, 28, g_eeprom.dtmf_side_tone);
|
||||
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||
if (g_alarm_state != ALARM_STATE_OFF)
|
||||
{ // don't send EOT if TX'ing tone/alarm
|
||||
BK4819_ExitDTMF_TX(true);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_dtmf_call_state == DTMF_CALL_STATE_NONE &&
|
||||
(g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_TX_DOWN || g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_BOTH))
|
||||
{ // end-of-tx
|
||||
if (g_eeprom.dtmf_side_tone)
|
||||
{
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = true;
|
||||
SYSTEM_DelayMs(60);
|
||||
// SYSTEM_DelayMs(60);
|
||||
SYSTEM_DelayMs(5);
|
||||
}
|
||||
|
||||
BK4819_EnterDTMF_TX(g_eeprom.dtmf_side_tone);
|
||||
|
||||
BK4819_PlayDTMFString(
|
||||
g_eeprom.dtmf_key_down_code,
|
||||
0,
|
||||
@ -1153,9 +1150,18 @@ void RADIO_SendEndOfTransmission(void)
|
||||
g_eeprom.dtmf_code_persist_time,
|
||||
g_eeprom.dtmf_code_interval_time);
|
||||
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
|
||||
g_enable_speaker = false;
|
||||
}
|
||||
else
|
||||
if (g_eeprom.roger_mode == ROGER_MODE_ROGER)
|
||||
BK4819_PlayRoger();
|
||||
else
|
||||
if (g_eeprom.roger_mode == ROGER_MODE_MDC)
|
||||
BK4819_PlayRogerMDC1200();
|
||||
else
|
||||
if (g_current_vfo->dtmf_ptt_id_tx_mode == PTT_ID_APOLLO)
|
||||
BK4819_PlayTone(APOLLO_TONE2_HZ, APOLLO_TONE_MS, 28);
|
||||
|
||||
BK4819_ExitDTMF_TX(true);
|
||||
}
|
||||
|
2
radio.h
2
radio.h
@ -143,6 +143,6 @@ void RADIO_Setg_vfo_state(vfo_state_t State);
|
||||
void RADIO_PrepareTX(void);
|
||||
void RADIO_EnableCxCSS(void);
|
||||
void RADIO_PrepareCssTX(void);
|
||||
void RADIO_SendEndOfTransmission(void);
|
||||
void RADIO_tx_eot(void);
|
||||
|
||||
#endif
|
||||
|
13
settings.c
13
settings.c
@ -211,8 +211,11 @@ void SETTINGS_SaveSettings(void)
|
||||
State[7] = g_eeprom.mic_sensitivity;
|
||||
EEPROM_WriteBuffer(0x0E70, State);
|
||||
|
||||
//State[0] = 0xFF;
|
||||
State[0] = g_setting_contrast;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
State[0] = g_setting_contrast;
|
||||
#else
|
||||
State[0] = 0xFF;
|
||||
#endif
|
||||
State[1] = g_eeprom.channel_display_mode;
|
||||
State[2] = g_eeprom.cross_vfo_rx_tx;
|
||||
State[3] = g_eeprom.battery_save;
|
||||
@ -273,7 +276,7 @@ void SETTINGS_SaveSettings(void)
|
||||
array.roger_mode = g_eeprom.roger_mode;
|
||||
array.repeater_tail_tone_elimination = g_eeprom.repeater_tail_tone_elimination;
|
||||
array.tx_vfo = g_eeprom.tx_vfo;
|
||||
#ifdef ENABLE_AIRCOPY_FREQ
|
||||
#ifdef ENABLE_AIRCOPY_REMEMBER_FREQ
|
||||
// remember the AIRCOPY frequency
|
||||
array.air_copy_freq = g_aircopy_freq;
|
||||
#endif
|
||||
@ -319,13 +322,13 @@ void SETTINGS_SaveSettings(void)
|
||||
State[4] = g_setting_470_tx_enable;
|
||||
State[5] = g_setting_350_enable;
|
||||
if (!g_setting_scramble_enable) State[6] &= ~(1u << 0);
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
if (!g_setting_rssi_bar) State[6] &= ~(1u << 1);
|
||||
#endif
|
||||
if (!g_setting_tx_enable) State[7] &= ~(1u << 0);
|
||||
if (!g_setting_live_dtmf_decoder) State[7] &= ~(1u << 1);
|
||||
State[7] = (State[7] & ~(3u << 2)) | ((g_setting_battery_text & 3u) << 2);
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
if (!g_setting_mic_bar) State[7] &= ~(1u << 4);
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
|
18
settings.h
18
settings.h
@ -290,7 +290,7 @@ typedef struct {
|
||||
uint8_t vox_switch; //
|
||||
uint8_t vox_level; //
|
||||
uint8_t mic_sensitivity; //
|
||||
#if 1
|
||||
#ifdef ENABLE_CONTRAST
|
||||
uint8_t lcd_contrast; // 1of11
|
||||
#else
|
||||
uint8_t unused4; // 0xff's
|
||||
@ -385,18 +385,18 @@ typedef struct {
|
||||
|
||||
// 0x0F40
|
||||
uint8_t freq_lock; //
|
||||
uint8_t enable_tx_350:1; // 350MHz ~ 400MHz
|
||||
uint8_t enable_tx_350:1; // 1 = 350MHz ~ 400MHz TX is enabled
|
||||
uint8_t unused11a:7; //
|
||||
uint8_t radio_disabled:1; // 0 = not radio is not disabled
|
||||
uint8_t radio_disabled:1; // 1 = radio is disabled
|
||||
uint8_t unused11b:7; //
|
||||
uint8_t enable_tx_200:1; // 174MHz ~ 350MHz
|
||||
uint8_t enable_tx_200:1; // 1 = 174MHz ~ 350MHz TX enabled
|
||||
uint8_t unused11c:7; //
|
||||
uint8_t enable_tx_470:1; // >= 470MHz disabled
|
||||
uint8_t enable_tx_470:1; // 1 = >= 470MHz TX enabled
|
||||
uint8_t unused11d:7; //
|
||||
uint8_t enable_350:1; // 0 = 350HMz ~ 400MHz RX/TX disabled
|
||||
uint8_t enable_350:1; // 1 = 350HMz ~ 400MHz enabled
|
||||
uint8_t unused11e:7; //
|
||||
uint8_t enable_scrambler:1; // 0 = scrambler disabled, 1 = enabled
|
||||
uint8_t enable_rssi_bar:1; // 0 = disabled .. 1of11
|
||||
uint8_t enable_scrambler:1; //
|
||||
uint8_t enable_rssi_bar:1; // 1of11
|
||||
uint8_t unused11f:6; //
|
||||
#if 0
|
||||
// QS
|
||||
@ -410,7 +410,7 @@ typedef struct {
|
||||
uint8_t am_fix:1; // 1 = RX AM fix
|
||||
uint8_t backlight_on_tx_rx:2; // 0 = no backlight when TX/RX, 1 = when TX, 2 = when RX, 3 = both RX/TX
|
||||
|
||||
uint8_t scan_hold_time; //
|
||||
uint8_t scan_hold_time; // ticks we stay paused on a signal when scanning
|
||||
|
||||
uint8_t unused12[7]; // 0xff's
|
||||
#endif
|
||||
|
16
ui/main.c
16
ui/main.c
@ -77,7 +77,7 @@ void draw_bar(uint8_t *line, const int len, const int max_width)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SHOW_TX_TIMEOUT
|
||||
#ifdef ENABLE_TX_TIMEOUT_BAR
|
||||
bool UI_DisplayTXCountdown(const bool now)
|
||||
{
|
||||
unsigned int timeout_secs = 0;
|
||||
@ -152,7 +152,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
|
||||
uint32_t sqrt16(uint32_t value)
|
||||
{ // return square root of 'value'
|
||||
@ -233,7 +233,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
bool UI_DisplayRSSIBar(const int16_t rssi, const bool now)
|
||||
{
|
||||
if (g_setting_rssi_bar)
|
||||
@ -300,6 +300,7 @@ void UI_drawBars(uint8_t *p, const unsigned int level)
|
||||
|
||||
void UI_update_rssi(const int16_t rssi, const int vfo)
|
||||
{
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
if (center_line == CENTER_LINE_RSSI)
|
||||
{ // optional larger RSSI dBm, S-point and bar level
|
||||
if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR)
|
||||
@ -307,6 +308,7 @@ void UI_update_rssi(const int16_t rssi, const int vfo)
|
||||
UI_DisplayRSSIBar(rssi, true);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // original little RS bars
|
||||
|
||||
@ -754,7 +756,7 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
if (mode == 2)
|
||||
{ // RX signal level
|
||||
//#ifndef ENABLE_RSSI_BAR
|
||||
//#ifndef ENABLE_RX_SIGNAL_BAR
|
||||
// antenna bar graph
|
||||
if (g_vfo_rssi_bar_level[vfo_num] > 0)
|
||||
Level = g_vfo_rssi_bar_level[vfo_num];
|
||||
@ -834,7 +836,7 @@ void UI_DisplayMain(void)
|
||||
g_current_function == FUNCTION_MONITOR ||
|
||||
g_current_function == FUNCTION_INCOMING);
|
||||
|
||||
#ifdef ENABLE_SHOW_TX_TIMEOUT
|
||||
#ifdef ENABLE_TX_TIMEOUT_BAR
|
||||
// show the TX timeout count down
|
||||
if (UI_DisplayTXCountdown(false))
|
||||
{
|
||||
@ -843,7 +845,7 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
// show the TX audio level
|
||||
if (UI_DisplayAudioBar(false))
|
||||
{
|
||||
@ -866,7 +868,7 @@ void UI_DisplayMain(void)
|
||||
else
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
// show the RX RSSI dBm, S-point and signal strength bar graph
|
||||
if (rx && g_setting_rssi_bar)
|
||||
{
|
||||
|
@ -31,10 +31,10 @@ typedef enum center_line_e center_line_t;
|
||||
|
||||
extern center_line_t center_line;
|
||||
|
||||
#ifdef ENABLE_SHOW_TX_TIMEOUT
|
||||
#ifdef ENABLE_TX_TIMEOUT_BAR
|
||||
bool UI_DisplayTXCountdown(const bool now);
|
||||
#endif
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
bool UI_DisplayAudioBar(const bool now);
|
||||
#endif
|
||||
void UI_update_rssi(const int16_t rssi, const int vfo);
|
||||
|
26
ui/menu.c
26
ui/menu.c
@ -72,7 +72,9 @@ const t_menu_item g_menu_list[] =
|
||||
#endif
|
||||
{"BL ", VOICE_ID_INVALID, MENU_AUTO_BACKLITE }, // was "ABR"
|
||||
{"BL TRX", VOICE_ID_INVALID, MENU_AUTO_BACKLITE_ON_TX_RX},
|
||||
#ifdef ENABLE_CONTRAST
|
||||
{"CTRAST", VOICE_ID_INVALID, MENU_CONTRAST },
|
||||
#endif
|
||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||
#ifdef ENABLE_VOICE
|
||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||
@ -85,10 +87,10 @@ const t_menu_item g_menu_list[] =
|
||||
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||
{"MIC GN", VOICE_ID_INVALID, MENU_MIC_GAIN },
|
||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
{"Tx BAR", VOICE_ID_INVALID, MENU_TX_BAR },
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
{"Rx BAR", VOICE_ID_INVALID, MENU_RX_BAR },
|
||||
#endif
|
||||
{"1 CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
||||
@ -712,18 +714,20 @@ void UI_DisplayMenu(void)
|
||||
strcpy(String, g_sub_menu_rx_tx[g_sub_menu_selection]);
|
||||
break;
|
||||
|
||||
case MENU_CONTRAST:
|
||||
strcpy(String, "CONTRAST\n");
|
||||
sprintf(String + strlen(String), "%d", g_sub_menu_selection);
|
||||
//g_setting_contrast = g_sub_menu_selection
|
||||
ST7565_SetContrast(g_sub_menu_selection);
|
||||
g_update_display = true;
|
||||
break;
|
||||
#ifdef ENABLE_CONTRAST
|
||||
case MENU_CONTRAST:
|
||||
strcpy(String, "CONTRAST\n");
|
||||
sprintf(String + strlen(String), "%d", g_sub_menu_selection);
|
||||
//g_setting_contrast = g_sub_menu_selection
|
||||
ST7565_SetContrast(g_sub_menu_selection);
|
||||
g_update_display = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
case MENU_TX_BAR:
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
case MENU_RX_BAR:
|
||||
#endif
|
||||
#ifdef ENABLE_AM_FIX
|
||||
|
30
ui/menu.h
30
ui/menu.h
@ -66,36 +66,32 @@ enum
|
||||
#endif
|
||||
MENU_AUTO_BACKLITE,
|
||||
MENU_AUTO_BACKLITE_ON_TX_RX,
|
||||
#ifdef ENABLE_CONTRAST
|
||||
MENU_CONTRAST,
|
||||
MENU_BEEP,
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
MENU_SCAN_CAR_RESUME,
|
||||
MENU_AUTO_KEY_LOCK,
|
||||
MENU_S_ADD1,
|
||||
MENU_S_ADD2,
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_SCAN,
|
||||
#endif
|
||||
MENU_1_CALL,
|
||||
MENU_STE,
|
||||
MENU_RP_STE,
|
||||
MENU_MIC_GAIN,
|
||||
MENU_COMPAND,
|
||||
#ifdef ENABLE_AUDIO_BAR
|
||||
#ifdef ENABLE_TX_AUDIO_BAR
|
||||
MENU_TX_BAR,
|
||||
#endif
|
||||
#ifdef ENABLE_RSSI_BAR
|
||||
#ifdef ENABLE_RX_SIGNAL_BAR
|
||||
MENU_RX_BAR,
|
||||
#endif
|
||||
MENU_1_CALL,
|
||||
MENU_S_LIST,
|
||||
MENU_SLIST1,
|
||||
MENU_SLIST2,
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_ALARM_MODE,
|
||||
#endif
|
||||
MENU_ANI_ID,
|
||||
MENU_UP_CODE,
|
||||
MENU_DN_CODE,
|
||||
MENU_PTT_ID,
|
||||
MENU_DTMF_ST,
|
||||
MENU_DTMF_RSP,
|
||||
MENU_DTMF_HOLD,
|
||||
@ -103,8 +99,12 @@ enum
|
||||
MENU_DTMF_DCD,
|
||||
MENU_DTMF_LIST,
|
||||
MENU_DTMF_LIVE_DEC,
|
||||
MENU_PON_MSG,
|
||||
MENU_PTT_ID,
|
||||
MENU_ROGER_MODE,
|
||||
#ifdef ENABLE_ALARM
|
||||
MENU_ALARM_MODE,
|
||||
#endif
|
||||
MENU_PON_MSG,
|
||||
MENU_VOLTAGE,
|
||||
MENU_BAT_TXT,
|
||||
MENU_MOD_MODE,
|
||||
@ -114,9 +114,11 @@ enum
|
||||
#ifdef ENABLE_AM_FIX_TEST1
|
||||
MENU_AM_FIX_TEST1,
|
||||
#endif
|
||||
#ifdef ENABLE_NOAA
|
||||
MENU_NOAA_SCAN,
|
||||
MENU_BEEP,
|
||||
#ifdef ENABLE_VOICE
|
||||
MENU_VOICE,
|
||||
#endif
|
||||
MENU_AUTO_KEY_LOCK,
|
||||
MENU_SIDE1_SHORT,
|
||||
MENU_SIDE1_LONG,
|
||||
MENU_SIDE2_SHORT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user