0
mirror of https://github.com/OneOfEleven/uv-k5-firmware-custom.git synced 2025-04-28 22:31:25 +03:00

Added FM radio lower frequency options

This commit is contained in:
OneOfEleven 2023-10-22 23:59:47 +01:00
parent 7aff322458
commit df3d298487
26 changed files with 127 additions and 119 deletions

View File

@ -18,8 +18,9 @@ ENABLE_AIRCOPY := 1
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
ENABLE_AIRCOPY_RX_REBOOT := 0
# FM Radio 4.2 kB
ENABLE_FMRADIO := 1
ENABLE_FMRADIO_64_108 := 0
ENABLE_FMRADIO_68_108 := 0
ENABLE_FMRADIO_76_108 := 0
ENABLE_FMRADIO_875_108 := 1
# NOAA 1.2 kB
ENABLE_NOAA := 0
# Voice 1.7 kB
@ -127,11 +128,11 @@ ifeq ($(ENABLE_UART),1)
OBJS += driver/aes.o
endif
OBJS += driver/backlight.o
ifeq ($(ENABLE_FMRADIO),1)
ifeq ($(filter $(ENABLE_FMRADIO_68_108) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108), 1), 1)
OBJS += driver/bk1080.o
endif
OBJS += driver/bk4819.o
ifeq ($(filter $(ENABLE_AIRCOPY) $(ENABLE_UART),1),1)
ifeq ($(filter $(ENABLE_AIRCOPY) $(ENABLE_UART), 1), 1)
OBJS += driver/crc.o
endif
OBJS += driver/eeprom.o
@ -156,7 +157,7 @@ ifeq ($(ENABLE_AIRCOPY),1)
endif
OBJS += app/app.o
OBJS += app/dtmf.o
ifeq ($(ENABLE_FMRADIO),1)
ifeq ($(filter $(ENABLE_FMRADIO_68_108) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108), 1), 1)
OBJS += app/fm.o
endif
OBJS += app/generic.o
@ -192,7 +193,7 @@ ifeq ($(ENABLE_AIRCOPY),1)
OBJS += ui/aircopy.o
endif
OBJS += ui/battery.o
ifeq ($(ENABLE_FMRADIO),1)
ifeq ($(filter $(ENABLE_FMRADIO_68_108) $(ENABLE_FMRADIO_76_108) $(ENABLE_FMRADIO_875_108), 1), 1)
OBJS += ui/fmradio.o
endif
OBJS += ui/helper.o
@ -282,11 +283,14 @@ endif
ifeq ($(ENABLE_AIRCOPY_RX_REBOOT),1)
CFLAGS += -DENABLE_AIRCOPY_RX_REBOOT
endif
ifeq ($(ENABLE_FMRADIO),1)
CFLAGS += -DENABLE_FMRADIO
ifeq ($(ENABLE_FMRADIO_68_108),1)
CFLAGS += -DENABLE_FMRADIO_68_108
endif
ifeq ($(ENABLE_FMRADIO_64_108),1)
CFLAGS += -DENABLE_FMRADIO_64_108
ifeq ($(ENABLE_FMRADIO_76_108),1)
CFLAGS += -DENABLE_FMRADIO_76_108
endif
ifeq ($(ENABLE_FMRADIO_875_108),1)
CFLAGS += -DENABLE_FMRADIO_875_108
endif
ifeq ($(ENABLE_UART),1)
CFLAGS += -DENABLE_UART

View File

@ -45,8 +45,9 @@ ENABLE_UART_DEBUG := 0 just for code debugging, it sends de
ENABLE_AIRCOPY := 1 clone radio-to-radio via RF
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_FMRADIO_64_108 := 0 '1' = ENABLE FM radio chips full range
ENABLE_FMRADIO_68_108 := 0 enable FM radio 68MHz ~ 108MHz
ENABLE_FMRADIO_76_108 := 0 enable FM radio 76MHz ~ 108MHz
ENABLE_FMRADIO_875_108 := 1 enable FM radio 87.5MHz ~ 108MHz
ENABLE_NOAA := 0 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

View File

@ -19,13 +19,13 @@
#include "app/action.h"
#include "app/app.h"
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/search.h"
#include "audio.h"
#include "bsp/dp32g030/gpio.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -105,7 +105,7 @@ void ACTION_Monitor(void)
RADIO_setup_registers(true);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
{
FM_Start();
@ -118,7 +118,7 @@ void ACTION_Monitor(void)
void ACTION_Scan(bool bRestart)
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
{
if (g_current_function != FUNCTION_RECEIVE &&
@ -304,7 +304,7 @@ void ACTION_Scan(bool bRestart)
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void ACTION_FM(void)
{
if (g_current_function != FUNCTION_TRANSMIT && g_current_function != FUNCTION_MONITOR)
@ -398,7 +398,7 @@ void ACTION_process(const key_code_t Key, const bool key_pressed, const bool key
ACTION_AlarmOr1750(false);
#endif
break;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
case ACTION_OPT_FM:
ACTION_FM();
break;

View File

@ -29,7 +29,7 @@ void ACTION_Scan(bool bFlag);
#ifdef ENABLE_ALARM
//static void ACTION_AlarmOr1750(bool b1750)
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void ACTION_FM(void);
#endif

View File

@ -23,7 +23,7 @@
#endif
#include "app/app.h"
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/generic.h"
@ -36,7 +36,7 @@
#include "board.h"
#include "bsp/dp32g030/gpio.h"
#include "driver/backlight.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -456,7 +456,7 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
if (g_setting_backlight_on_tx_rx >= 2)
backlight_turn_on(backlight_tx_rx_time_500ms);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
BK1080_Init(0, false);
#endif
@ -554,7 +554,7 @@ void APP_start_listening(function_type_t Function, const bool reset_am_fix)
FUNCTION_Select(Function);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (Function == FUNCTION_MONITOR || g_fm_radio_mode)
#else
if (Function == FUNCTION_MONITOR)
@ -1011,7 +1011,7 @@ void APP_end_tx(void)
g_vox_pause_count_down = 0;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
return;
#endif
@ -1104,7 +1104,7 @@ void APP_process(void)
APP_process_function();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
return;
#endif
@ -1172,7 +1172,7 @@ void APP_process(void)
#ifdef ENABLE_VOICE
g_voice_write_index == 0 &&
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
!g_fm_radio_mode &&
#endif
g_dtmf_call_state == DTMF_CALL_STATE_NONE &&
@ -1192,7 +1192,7 @@ void APP_process(void)
g_rx_reception_mode = RX_MODE_NONE;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_schedule_fm &&
g_fm_scan_state != FM_SCAN_OFF &&
g_current_function != FUNCTION_MONITOR &&
@ -1213,7 +1213,7 @@ void APP_process(void)
{
#ifdef ENABLE_NOAA
if (
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_radio_mode ||
#endif
g_ptt_is_pressed ||
@ -1239,7 +1239,7 @@ void APP_process(void)
}
#else
if (
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_radio_mode ||
#endif
g_ptt_is_pressed ||
@ -1561,7 +1561,7 @@ void APP_time_slice_10ms(void)
g_flag_save_settings = false;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_flag_save_fm)
{
SETTINGS_save_fm();
@ -1647,7 +1647,7 @@ void APP_time_slice_10ms(void)
// Skipping authentic device checks
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && g_fm_radio_count_down_500ms > 0)
return;
#endif
@ -1729,7 +1729,7 @@ void APP_time_slice_10ms(void)
}
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && g_fm_restore_count_down_10ms > 0)
{
if (--g_fm_restore_count_down_10ms == 0)
@ -1971,7 +1971,7 @@ void APP_cancel_user_input_modes(void)
if (g_dtmf_input_mode || g_dtmf_input_box_index > 0)
{
DTMF_clear_input_box();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
g_request_display_screen = DISPLAY_FM;
else
@ -2050,7 +2050,7 @@ void APP_time_slice_500ms(void)
// Skipped authentic device check
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_count_down_500ms > 0)
{
g_fm_radio_count_down_500ms--;
@ -2109,7 +2109,7 @@ void APP_time_slice_500ms(void)
#endif
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_scan_state == FM_SCAN_OFF || g_ask_to_save)
#endif
{
@ -2177,7 +2177,7 @@ void APP_time_slice_500ms(void)
{
gui_display_type_t disp = DISPLAY_INVALID;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode &&
g_current_function != FUNCTION_RECEIVE &&
g_current_function != FUNCTION_MONITOR &&
@ -2206,7 +2206,7 @@ void APP_time_slice_500ms(void)
if (g_current_function != FUNCTION_POWER_SAVE && g_current_function != FUNCTION_TRANSMIT)
APP_update_rssi(g_eeprom.rx_vfo);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_ptt_is_pressed && g_fm_resume_count_down_500ms > 0)
{
if (--g_fm_resume_count_down_500ms == 0)
@ -2479,7 +2479,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
g_keypad_locked = 4; // 2 second pop-up
g_update_display = true;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode) // don't beep when the FM radio is on, it cause bad gaps and loud clicks
#endif
g_beep_to_play = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
@ -2672,7 +2672,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
MAIN_process_key(Key, key_pressed, key_held);
break;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
case DISPLAY_FM:
FM_process_key(Key, key_pressed, key_held);
break;
@ -2708,7 +2708,7 @@ static void APP_process_key(const key_code_t Key, const bool key_pressed, const
}
else
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
if (!key_held && key_pressed)
@ -2750,7 +2750,7 @@ Skip:
g_update_status = true;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_request_save_fm)
{
if (!key_held)

View File

@ -17,7 +17,7 @@
#include <string.h>
#include <stdio.h> // NULL
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/search.h"
@ -248,7 +248,7 @@ void DTMF_HandleRequest(void)
g_dtmf_reply_state = DTMF_REPLY_AB;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
{
FM_TurnOff();

View File

@ -17,7 +17,7 @@
#include <string.h>
#include "app/app.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/generic.h"
@ -40,7 +40,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (g_input_box_index > 0)
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
if (!key_held && key_pressed)
@ -74,7 +74,7 @@ void GENERIC_Key_F(bool key_pressed, bool key_held)
if (key_pressed)
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
g_beep_to_play = BEEP_1KHZ_60MS_OPTIONAL;
@ -171,7 +171,7 @@ void GENERIC_Key_PTT(bool key_pressed)
goto cancel_tx;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_scan_state != FM_SCAN_OFF)
{ // FM radio is scanning .. stop
FM_PlayAndUpdate();
@ -181,9 +181,7 @@ void GENERIC_Key_PTT(bool key_pressed)
g_request_display_screen = DISPLAY_FM;
goto cancel_tx;
}
#endif
#ifdef ENABLE_FMRADIO
if (g_screen_to_display == DISPLAY_FM)
goto start_tx; // listening to the FM radio .. start TX'ing
#endif

View File

@ -18,7 +18,7 @@
#include "app/action.h"
#include "app/app.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/generic.h"
@ -186,7 +186,7 @@ void processFKeyFunction(const key_code_t Key)
if (g_scan_state_dir != SCAN_STATE_DIR_OFF)
APP_stop_scan();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
ACTION_FM();
#else
@ -626,7 +626,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
return;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (!g_fm_radio_mode)
#endif
{
@ -656,7 +656,7 @@ void MAIN_Key_EXIT(bool key_pressed, bool key_held)
return;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
ACTION_FM();
#endif
@ -996,7 +996,7 @@ void MAIN_process_key(key_code_t key, bool key_pressed, bool key_held)
// UART_printf(" main 1 key %2u %u %u %u\r\n", key, key_pressed, key_held);
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode && key != KEY_PTT && key != KEY_EXIT)
{
if (!key_held && key_pressed)

View File

@ -21,7 +21,7 @@
#if !defined(ENABLE_OVERLAY)
#include "ARMCM0.h"
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/uart.h"

14
audio.c
View File

@ -17,12 +17,12 @@
#ifdef ENABLE_AIRCOPY
#include "app/aircopy.h"
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "audio.h"
#include "bsp/dp32g030/gpio.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -104,7 +104,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
if (g_current_function == FUNCTION_POWER_SAVE && g_rx_idle_mode)
BK4819_RX_TurnOn();
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#ifdef MUTE_AUDIO_FOR_VOICE
if (g_fm_radio_mode)
BK1080_Mute(true);
@ -223,7 +223,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
if (g_enable_speaker)
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_SPEAKER);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
BK1080_Mute(false);
#endif
@ -290,7 +290,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
BK4819_SetAF(BK4819_AF_MUTE);
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#ifdef MUTE_AUDIO_FOR_VOICE
if (g_fm_radio_mode)
BK1080_Mute(true);
@ -317,7 +317,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR)
BK4819_SetAF(g_rx_vfo->am_mode ? BK4819_AF_AM : BK4819_AF_FM);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
BK1080_Mute(false);
#endif
@ -465,7 +465,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
if (g_current_function == FUNCTION_RECEIVE || g_current_function == FUNCTION_MONITOR)
BK4819_SetAF(g_rx_vfo->am_mode ? BK4819_AF_AM : BK4819_AF_FM);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
BK1080_Mute(false);
#endif

View File

@ -249,7 +249,7 @@ const uint8_t BITMAP_MONITOR[6] =
__extension__ 0b01111111
};
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
const uint8_t BITMAP_FM[12] =
{ // "FM"
__extension__ 0b00000000,

View File

@ -37,7 +37,7 @@ extern const uint8_t BITMAP_TDR_HOLDING[12];
extern const uint8_t BITMAP_MONITOR[6];
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern const uint8_t BITMAP_FM[12];
#endif

13
board.c
View File

@ -17,7 +17,7 @@
#include <string.h>
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "board.h"
@ -27,7 +27,7 @@
#include "bsp/dp32g030/syscon.h"
#include "driver/adc.h"
//#include "driver/backlight.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -121,7 +121,7 @@ void BOARD_GPIO_Init(void)
| GPIO_DIR_5_MASK // INPUT
);
#if defined(ENABLE_FMRADIO)
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BK1080);
#endif
}
@ -508,12 +508,13 @@ void BOARD_Init(void)
{
BOARD_PORTCON_Init();
BOARD_GPIO_Init();
CRC_Init();
BOARD_ADC_Init();
ST7565_Init(true);
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
BK1080_Init(0, false);
#endif
CRC_Init();
}
void BOARD_EEPROM_load(void)
@ -566,7 +567,7 @@ void BOARD_EEPROM_load(void)
g_eeprom.noaa_channel[1] = IS_NOAA_CHANNEL(Data[7]) ? Data[7] : NOAA_CHANNEL_FIRST;
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
{ // 0E88..0E8F
struct
{

View File

@ -25,9 +25,11 @@ uint32_t g_aircopy_freq = 41002500;
const freq_band_table_t AIR_BAND = {10800000, 13700000};
// FM broadcast band lower/upper limit
#ifdef ENABLE_FMRADIO_64_108
#if defined(ENABLE_FMRADIO_68_108)
const freq_band_table_t FM_RADIO_BAND = {680, 1080};
#else
#elif defined(ENABLE_FMRADIO_76_108)
const freq_band_table_t FM_RADIO_BAND = {760, 1080};
#elif defined(ENABLE_FMRADIO_875_108)
const freq_band_table_t FM_RADIO_BAND = {875, 1080};
#endif
@ -39,22 +41,22 @@ const freq_band_table_t FREQ_BAND_TABLE[7] =
{
#ifdef ENABLE_WIDE_RX
// extended range
{ 1800000, 10800000}, // band 1
{ 1800000, 10800000}, // band 1
{AIR_BAND.lower, AIR_BAND.upper}, // band 2
{AIR_BAND.upper, 17400000}, // band 3
{17400000, 35000000}, // band 4
{35000000, 40000000}, // band 5
{40000000, 47000000}, // band 6
{47000000, 130000000} // band 7
{AIR_BAND.upper, 17400000}, // band 3
{17400000, 35000000}, // band 4
{35000000, 40000000}, // band 5
{40000000, 47000000}, // band 6
{47000000, 130000000} // band 7
#else
// QS original
{ 5000000, 7600000}, // band 1
{ 5000000, 7600000}, // band 1
{AIR_BAND.lower, AIR_BAND.upper}, // band 2
{AIR_BAND.upper, 17400000}, // band 3
{17400000, 35000000}, // band 4
{35000000, 40000000}, // band 5
{40000000, 47000000}, // band 6
{47000000, 60000000} // band 7
{AIR_BAND.upper, 17400000}, // band 3
{17400000, 35000000}, // band 4
{35000000, 40000000}, // band 5
{40000000, 47000000}, // band 6
{47000000, 60000000} // band 7
#endif
};

View File

@ -43,7 +43,9 @@ extern uint32_t g_aircopy_freq;
extern const freq_band_table_t AIR_BAND;
extern const freq_band_table_t FM_RADIO_BAND;
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern const freq_band_table_t FM_RADIO_BAND;
#endif
extern const freq_band_table_t BX4819_BAND1;
extern const freq_band_table_t BX4819_BAND2;

View File

@ -17,13 +17,13 @@
#include <string.h>
#include "app/dtmf.h"
#if defined(ENABLE_FMRADIO)
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "bsp/dp32g030/gpio.h"
#include "dcs.h"
#include "driver/backlight.h"
#if defined(ENABLE_FMRADIO)
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "driver/bk1080.h"
#endif
#include "driver/bk4819.h"
@ -116,7 +116,7 @@ void FUNCTION_Select(function_type_t Function)
if (prev_func != FUNCTION_RECEIVE)
break;
#if defined(ENABLE_FMRADIO)
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_radio_mode)
g_fm_restore_count_down_10ms = fm_restore_countdown_10ms;
#endif
@ -198,7 +198,7 @@ void FUNCTION_Select(function_type_t Function)
g_dtmf_rx_live_timeout = 0;
memset(g_dtmf_rx_live, 0, sizeof(g_dtmf_rx_live));
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
// disable the FM radio
if (g_fm_radio_mode)
BK1080_Init(0, false);
@ -281,7 +281,7 @@ void FUNCTION_Select(function_type_t Function)
g_battery_save_count_down_10ms = battery_save_count_10ms;
g_schedule_power_save = false;
#if defined(ENABLE_FMRADIO)
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_restore_count_down_10ms = 0;
#endif

View File

@ -10,11 +10,11 @@
// 24-bit pre-amble
// 40-bit sync
//
//static const uint8_t header[] = {0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x07, 0x09, 0x2a, 0x44, 0x6f};
//static const uint8_t header[] = {0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0x07, 0x09, 0x2a, 0x44, 0x6f};
//static const uint8_t header[] = {0x00, 0x00, 0x05, 0x55, 0x55, 0x55, 0x55, 0x07, 0x09, 0x2a, 0x44, 0x6f};
//static const uint8_t header[] = {0x00, 0x00, 0x0A, 0xAA, 0xAA, 0xAA, 0xAA, 0x07, 0x09, 0x2a, 0x44, 0x6f};
//
//static const uint8_t header[] = {0x00, 0x00, 0x00, 0xAA, 0xAA, 0xAA, 0xA0, 0xb6, 0x8e, 0x03, 0xbb, 0x14};
static const uint8_t header[] = {0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x50, 0x29, 0x71, 0xfc, 0x44, 0xeb};
//static const uint8_t header[] = {0x00, 0x00, 0x0A, 0xAA, 0xAA, 0xAA, 0xA0, 0xb6, 0x8e, 0x03, 0xbb, 0x14};
static const uint8_t header[] = {0x00, 0x00, 0x05, 0x55, 0x55, 0x55, 0x50, 0x29, 0x71, 0xfc, 0x44, 0xeb};
uint8_t bit_reverse_8(uint8_t n)
{

6
misc.c
View File

@ -189,7 +189,7 @@ bool g_flag_reset_vfos;
bool g_request_save_vfo;
uint8_t g_request_save_channel;
bool g_request_save_settings;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
bool g_request_save_fm;
#endif
bool g_flag_prepare_tx;
@ -200,7 +200,7 @@ bool g_flag_refresh_menu;
bool g_flag_save_vfo;
bool g_flag_save_settings;
bool g_flag_save_channel;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
bool g_flag_save_fm;
#endif
bool g_cdcss_lost;
@ -260,7 +260,7 @@ volatile bool g_next_time_slice_40ms;
volatile bool g_schedule_noaa = true;
#endif
volatile bool g_flag_tail_tone_elimination_complete;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
volatile bool g_schedule_fm;
#endif

10
misc.h
View File

@ -240,7 +240,7 @@ extern volatile bool g_tx_timeout_reached;
extern volatile uint16_t g_tail_tone_elimination_count_down_10ms;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern volatile uint16_t g_fm_play_count_down_10ms;
#endif
#ifdef ENABLE_NOAA
@ -275,7 +275,7 @@ extern bool g_flag_reset_vfos;
extern bool g_request_save_vfo;
extern uint8_t g_request_save_channel;
extern bool g_request_save_settings;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern bool g_request_save_fm;
#endif
extern bool g_flag_prepare_tx;
@ -286,7 +286,7 @@ extern bool g_flag_refresh_menu; // refresh menu display
extern bool g_flag_save_vfo;
extern bool g_flag_save_settings;
extern bool g_flag_save_channel;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern bool g_flag_save_fm;
#endif
extern bool g_cdcss_lost;
@ -327,7 +327,7 @@ extern uint8_t g_backup_cross_vfo_rx_tx;
extern volatile bool g_next_time_slice;
extern bool g_update_display;
extern bool g_unhide_hidden;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern uint8_t g_fm_channel_position;
#endif
extern volatile uint8_t g_found_cdcss_count_down_10ms;
@ -341,7 +341,7 @@ extern volatile bool g_next_time_slice_40ms;
extern volatile bool g_schedule_noaa;
#endif
extern volatile bool g_flag_tail_tone_elimination_complete;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
extern volatile bool g_schedule_fm;
#endif
extern int16_t g_current_rssi[2]; // now one per VFO

View File

@ -18,7 +18,7 @@
#include "app/app.h"
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "audio.h"
@ -737,7 +737,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
#ifdef ENABLE_VOX
if (
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
!g_fm_radio_mode &&
#endif
g_eeprom.vox_switch &&
@ -920,7 +920,7 @@ void RADIO_Setg_vfo_state(vfo_state_t State)
g_vfo_state[0] = VFO_STATE_NORMAL;
g_vfo_state[1] = VFO_STATE_NORMAL;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_resume_count_down_500ms = 0;
#endif
}
@ -937,7 +937,7 @@ void RADIO_Setg_vfo_state(vfo_state_t State)
g_vfo_state[vfo] = State;
}
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_resume_count_down_500ms = fm_resume_countdown_500ms;
#endif
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/search.h"
@ -100,7 +100,7 @@ void SystickHandler(void)
DECREMENT_AND_TRIGGER(g_count_down_to_play_next_voice_10ms, g_flag_play_queued_voice);
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
if (g_fm_scan_state != FM_SCAN_OFF && g_current_function != FUNCTION_MONITOR)
if (g_current_function != FUNCTION_TRANSMIT && g_current_function != FUNCTION_RECEIVE)
DECREMENT_AND_TRIGGER(g_fm_play_count_down_10ms, g_schedule_fm);

View File

@ -16,7 +16,7 @@
#include <string.h>
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "driver/eeprom.h"
@ -26,7 +26,7 @@
eeprom_config_t g_eeprom;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void SETTINGS_save_fm(void)
{
unsigned int i;

View File

@ -469,7 +469,7 @@ typedef struct {
uint8_t field7_0xa;
uint8_t field8_0xb;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
uint16_t fm_selected_frequency;
uint8_t fm_selected_channel;
bool fm_is_channel_mode;
@ -565,7 +565,7 @@ typedef struct {
extern eeprom_config_t g_eeprom;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void SETTINGS_save_fm(void);
#endif
void SETTINGS_save_vfo_indices(void);

View File

@ -17,7 +17,7 @@
#ifndef UI_FM_H
#define UI_FM_H
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
void UI_DisplayFM(void);
#endif

View File

@ -17,7 +17,7 @@
#include <string.h>
#include "app/search.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "bitmaps.h"
@ -89,7 +89,7 @@ void UI_DisplayStatus(const bool test_display)
else
#endif
{
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
// FM indicator
if (g_fm_radio_mode || test_display)
{

View File

@ -17,7 +17,7 @@
#include <string.h>
#include "app/dtmf.h"
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "app/fm.h"
#endif
#include "app/search.h"
@ -26,7 +26,7 @@
#ifdef ENABLE_AIRCOPY
#include "ui/aircopy.h"
#endif
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
#include "ui/fmradio.h"
#endif
#include "ui/inputbox.h"
@ -51,7 +51,7 @@ void GUI_DisplayScreen(void)
UI_DisplayMain();
break;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
case DISPLAY_FM:
UI_DisplayFM();
break;
@ -89,7 +89,7 @@ void GUI_SelectNextDisplay(gui_display_type_t Display)
g_in_sub_menu = false;
g_css_scan_mode = CSS_SCAN_MODE_OFF;
g_scan_state_dir = SCAN_STATE_DIR_OFF;
#ifdef ENABLE_FMRADIO
#if defined(ENABLE_FMRADIO_68_108) || defined(ENABLE_FMRADIO_76_108) || defined(ENABLE_FMRADIO_875_108)
g_fm_scan_state = FM_SCAN_OFF;
#endif
g_ask_for_confirmation = 0;