mirror of
https://github.com/OneOfEleven/uv-k5-firmware-custom.git
synced 2025-04-27 13:51:25 +03:00
added mdc1200 side tone/beeps
This commit is contained in:
parent
465d7333e3
commit
352d529b86
12
Makefile
12
Makefile
@ -14,14 +14,14 @@ ENABLE_LTO := 1
|
||||
ENABLE_UART := 1
|
||||
ENABLE_UART_DEBUG := 0
|
||||
# AirCopy 2.5 kB
|
||||
ENABLE_AIRCOPY := 0
|
||||
ENABLE_AIRCOPY := 1
|
||||
ENABLE_AIRCOPY_REMEMBER_FREQ := 1
|
||||
ENABLE_AIRCOPY_RX_REBOOT := 0
|
||||
# FM Radio 4.2 kB
|
||||
ENABLE_FMRADIO_64_76 := 0
|
||||
ENABLE_FMRADIO_76_90 := 0
|
||||
ENABLE_FMRADIO_76_108 := 0
|
||||
ENABLE_FMRADIO_875_108 := 1
|
||||
ENABLE_FMRADIO_875_108 := 0
|
||||
ENABLE_FMRADIO_64_108 := 0
|
||||
# NOAA 1.2 kB
|
||||
ENABLE_NOAA := 0
|
||||
@ -29,14 +29,14 @@ ENABLE_NOAA := 0
|
||||
ENABLE_VOICE := 0
|
||||
ENABLE_MUTE_RADIO_FOR_VOICE := 0
|
||||
# Tx on Voice 1.0 kB
|
||||
ENABLE_VOX := 1
|
||||
ENABLE_VOX := 0
|
||||
ENABLE_VOX_MORE_SENSITIVE := 1
|
||||
ENABLE_REDUCE_LOW_MID_TX_POWER := 1
|
||||
# Tx Alarm 600 B
|
||||
ENABLE_ALARM := 0
|
||||
ENABLE_TX1750 := 0
|
||||
# MDC1200 2.8 kB
|
||||
ENABLE_MDC1200 := 0
|
||||
ENABLE_MDC1200 := 1
|
||||
ENABLE_MDC1200_SHOW_OP_ARG := 1
|
||||
ENABLE_PWRON_PASSWORD := 0
|
||||
ENABLE_RESET_AES_KEY := 0
|
||||
@ -60,6 +60,7 @@ ENABLE_DTMF_CALL_FLASH_LIGHT := 1
|
||||
ENABLE_FLASH_LIGHT_SOS_TONE := 1
|
||||
ENABLE_SHOW_CHARGE_LEVEL := 0
|
||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
||||
ENABLE_FREQ_SEARCH_LNA := 1
|
||||
ENABLE_FREQ_SEARCH_TIMEOUT := 0
|
||||
ENABLE_CODE_SEARCH_TIMEOUT := 0
|
||||
ENABLE_SCAN_IGNORE_LIST := 1
|
||||
@ -415,6 +416,9 @@ endif
|
||||
ifeq ($(ENABLE_KILL_REVIVE),1)
|
||||
CFLAGS += -DENABLE_KILL_REVIVE
|
||||
endif
|
||||
ifeq ($(ENABLE_FREQ_SEARCH_LNA),1)
|
||||
CFLAGS += -DENABLE_FREQ_SEARCH_LNA
|
||||
endif
|
||||
ifeq ($(ENABLE_FREQ_SEARCH_TIMEOUT),1)
|
||||
CFLAGS += -DENABLE_FREQ_SEARCH_TIMEOUT
|
||||
endif
|
||||
|
@ -77,6 +77,7 @@ ENABLE_DTMF_CALL_FLASH_LIGHT := 1 flash the flash light LED when a DTM
|
||||
ENABLE_FLASH_LIGHT_SOS_TONE := 1 also do SOS in morse
|
||||
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_LNA := 0 keep this disabled
|
||||
ENABLE_FREQ_SEARCH_TIMEOUT := 0 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_SCAN_IGNORE_LIST := 0 ignore selected frequencies when scanning - add freqs to list with short */scan button when scanning, remove freq from list with long press MENU when not scanning
|
||||
|
2
am_fix.c
2
am_fix.c
@ -427,7 +427,7 @@ void AM_fix_10ms(const int vfo)
|
||||
gain_table_index_prev[vfo] = index;
|
||||
|
||||
// set the RF front end gains
|
||||
BK4819_WriteRegister(0x13, gain_table[index].reg_val);
|
||||
BK4819_write_reg(0x13, gain_table[index].reg_val);
|
||||
|
||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||
|
||||
|
@ -164,7 +164,7 @@ void AIRCOPY_start_fsk_tx(const int request_block_num)
|
||||
// 0 = enable
|
||||
// 1 = disable
|
||||
//
|
||||
// BK4819_WriteRegister(0x2B, (1u << 2) | (1u << 0)); // try to improve the TX waveform
|
||||
// BK4819_write_reg(0x2B, (1u << 2) | (1u << 0)); // try to improve the TX waveform
|
||||
|
||||
// REG_59
|
||||
//
|
||||
@ -218,21 +218,21 @@ void AIRCOPY_start_fsk_tx(const int request_block_num)
|
||||
(0u << 0); // 0 ~ 7 ???
|
||||
|
||||
// set the packet size
|
||||
BK4819_WriteRegister(0x5D, (((tx_size * 2) - 1) << 8));
|
||||
BK4819_write_reg(0x5D, (((tx_size * 2) - 1) << 8));
|
||||
|
||||
// clear TX fifo
|
||||
BK4819_WriteRegister(0x59, (1u << 15) | fsk_reg59);
|
||||
BK4819_WriteRegister(0x59, fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 15) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, fsk_reg59);
|
||||
|
||||
// load the packet
|
||||
for (k = 0; k < tx_size; k++)
|
||||
BK4819_WriteRegister(0x5F, g_fsk_buffer[k]);
|
||||
BK4819_write_reg(0x5F, g_fsk_buffer[k]);
|
||||
|
||||
// enable tx interrupt(s)
|
||||
BK4819_WriteRegister(0x3F, BK4819_REG_3F_FSK_TX_FINISHED);
|
||||
BK4819_write_reg(0x3F, BK4819_REG_3F_FSK_TX_FINISHED);
|
||||
|
||||
// enable scramble, enable TX
|
||||
BK4819_WriteRegister(0x59, (1u << 13) | (1u << 11) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 13) | (1u << 11) | fsk_reg59);
|
||||
}
|
||||
|
||||
void AIRCOPY_stop_fsk_tx(void)
|
||||
@ -250,7 +250,7 @@ void AIRCOPY_stop_fsk_tx(void)
|
||||
BK4819_reset_fsk();
|
||||
|
||||
// restore TX/RX filtering
|
||||
BK4819_WriteRegister(0x2B, 0);
|
||||
BK4819_write_reg(0x2B, 0);
|
||||
|
||||
if (g_aircopy_state == AIRCOPY_TX)
|
||||
{
|
||||
@ -303,10 +303,10 @@ void AIRCOPY_process_fsk_tx_10ms(void)
|
||||
|
||||
if (--g_fsk_tx_timeout_10ms > 0)
|
||||
{ // still TX'ing
|
||||
if ((BK4819_ReadRegister(0x0C) & (1u << 0)) == 0)
|
||||
if ((BK4819_read_reg(0x0C) & (1u << 0)) == 0)
|
||||
return;
|
||||
BK4819_WriteRegister(0x02, 0);
|
||||
interrupt_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0);
|
||||
interrupt_bits = BK4819_read_reg(0x02);
|
||||
if ((interrupt_bits & BK4819_REG_02_FSK_TX_FINISHED) == 0)
|
||||
return; // TX not yet finished
|
||||
}
|
||||
@ -378,7 +378,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
//
|
||||
// <2:0> 0 ???
|
||||
//
|
||||
status = BK4819_ReadRegister(0x59);
|
||||
status = BK4819_read_reg(0x59);
|
||||
|
||||
if (status & (1u << 11) || g_fsk_tx_timeout_10ms > 0)
|
||||
return; // FSK TX is busy
|
||||
@ -390,13 +390,13 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
BK4819_start_aircopy_fsk_rx((g_aircopy_state == AIRCOPY_TX) ? AIRCOPY_REQ_PACKET_SIZE : AIRCOPY_DATA_PACKET_SIZE);
|
||||
}
|
||||
|
||||
status = BK4819_ReadRegister(0x0C);
|
||||
status = BK4819_read_reg(0x0C);
|
||||
if ((status & (1u << 0)) == 0)
|
||||
return; // no flagged interrupts
|
||||
|
||||
// read the interrupt flags
|
||||
BK4819_WriteRegister(0x02, 0); // clear them
|
||||
interrupt_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0); // clear them
|
||||
interrupt_bits = BK4819_read_reg(0x02);
|
||||
|
||||
if (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC)
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
|
||||
@ -410,10 +410,10 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, true); // LED on
|
||||
|
||||
{ // fetch RX'ed data
|
||||
const unsigned int count = BK4819_ReadRegister(0x5E) & (7u << 0); // almost full threshold
|
||||
const unsigned int count = BK4819_read_reg(0x5E) & (7u << 0); // almost full threshold
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const uint16_t word = BK4819_ReadRegister(0x5F);
|
||||
const uint16_t word = BK4819_read_reg(0x5F);
|
||||
|
||||
if (g_fsk_write_index < ARRAY_SIZE(g_fsk_buffer))
|
||||
g_fsk_buffer[g_fsk_write_index++] = word;
|
||||
@ -438,7 +438,7 @@ void AIRCOPY_process_fsk_rx_10ms(void)
|
||||
//
|
||||
// <3:0> ???
|
||||
//
|
||||
status = BK4819_ReadRegister(0x0B);
|
||||
status = BK4819_read_reg(0x0B);
|
||||
|
||||
// check to see if it's a REQ/ACK packet
|
||||
if (g_fsk_write_index == req_ack_size)
|
||||
@ -636,10 +636,10 @@ send_req:
|
||||
while (g_fsk_tx_timeout_10ms-- > 0)
|
||||
{
|
||||
SYSTEM_DelayMs(5);
|
||||
if (BK4819_ReadRegister(0x0C) & (1u << 0))
|
||||
if (BK4819_read_reg(0x0C) & (1u << 0))
|
||||
{ // we have interrupt flags
|
||||
BK4819_WriteRegister(0x02, 0);
|
||||
const uint16_t interrupt_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0);
|
||||
const uint16_t interrupt_bits = BK4819_read_reg(0x02);
|
||||
if (interrupt_bits & BK4819_REG_02_FSK_TX_FINISHED)
|
||||
g_fsk_tx_timeout_10ms = 0; // TX is complete
|
||||
}
|
||||
|
16
app/app.c
16
app/app.c
@ -162,10 +162,10 @@ done:
|
||||
|
||||
#ifdef ENABLE_MDC1200
|
||||
{ // reset the FSK receiver
|
||||
//const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
//const uint16_t fsk_reg59 = BK4819_read_reg(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
// BK4819_enable_mdc1200_rx(true);
|
||||
//BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
//BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59);
|
||||
//BK4819_write_reg(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
//BK4819_write_reg(0x59, (1u << 12) | fsk_reg59);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -529,11 +529,11 @@ bool APP_start_listening(void)
|
||||
// AF gain - original QS values
|
||||
// if (g_rx_vfo->channel.am_mode > 0)
|
||||
// {
|
||||
// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||
// }
|
||||
// else
|
||||
{
|
||||
BK4819_WriteRegister(0x48,
|
||||
BK4819_write_reg(0x48,
|
||||
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
||||
( 0u << 10) | // AF Rx Gain-1
|
||||
(g_eeprom.calib.volume_gain << 4) | // AF Rx Gain-2
|
||||
@ -910,12 +910,12 @@ void APP_process_radio_interrupts(void)
|
||||
|
||||
uint16_t int_bits;
|
||||
|
||||
const uint16_t reg_c = BK4819_ReadRegister(0x0C);
|
||||
const uint16_t reg_c = BK4819_read_reg(0x0C);
|
||||
if ((reg_c & 1u) == 0)
|
||||
break;
|
||||
|
||||
BK4819_WriteRegister(0x02, 0);
|
||||
int_bits = BK4819_ReadRegister(0x02);
|
||||
BK4819_write_reg(0x02, 0);
|
||||
int_bits = BK4819_read_reg(0x02);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
#ifdef ENABLE_AIRCOPY
|
||||
|
@ -50,7 +50,7 @@
|
||||
#ifdef ENABLE_F_CAL_MENU
|
||||
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||
{
|
||||
BK4819_WriteRegister(0x3B, 22656 + value);
|
||||
BK4819_write_reg(0x3B, 22656 + value);
|
||||
|
||||
if (update_eeprom)
|
||||
{
|
||||
|
11
app/search.c
11
app/search.c
@ -637,11 +637,14 @@ void SEARCH_Start(void)
|
||||
g_search_css_state = SEARCH_CSS_STATE_OFF;
|
||||
g_search_frequency = 0xFFFFFFFF;
|
||||
|
||||
#if 1
|
||||
// this is why it needs such a strong signal
|
||||
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths - why it needs a strong signal
|
||||
#else
|
||||
#ifdef ENABLE_FREQ_SEARCH_LNA
|
||||
// 1of11
|
||||
// still requires strong signal >= -40dBm at LNA input, but MUCH more sensitive that QS way
|
||||
BK4819_set_rf_filter_path(g_rx_vfo->p_rx->frequency); // lets have a play !
|
||||
#else
|
||||
// QS
|
||||
// this is why it needs such a strong signal
|
||||
BK4819_set_rf_filter_path(0xFFFFFFFF); // disable the LNA filter paths
|
||||
#endif
|
||||
|
||||
BK4819_EnableFrequencyScan();
|
||||
|
@ -386,9 +386,9 @@ static void cmd_0527(void)
|
||||
memset(&reply, 0, sizeof(reply));
|
||||
reply.Header.ID = 0x0528;
|
||||
reply.Header.Size = sizeof(reply.Data);
|
||||
reply.Data.RSSI = BK4819_ReadRegister(0x67) & 0x01FF;
|
||||
reply.Data.ExNoiseIndicator = BK4819_ReadRegister(0x65) & 0x007F;
|
||||
reply.Data.GlitchIndicator = BK4819_ReadRegister(0x63);
|
||||
reply.Data.RSSI = BK4819_read_reg(0x67) & 0x01FF;
|
||||
reply.Data.ExNoiseIndicator = BK4819_read_reg(0x65) & 0x007F;
|
||||
reply.Data.GlitchIndicator = BK4819_read_reg(0x63);
|
||||
|
||||
SendReply(&reply, sizeof(reply));
|
||||
}
|
||||
|
6
audio.c
6
audio.c
@ -93,8 +93,8 @@ void AUDIO_set_mod_mode(const unsigned int mode)
|
||||
|
||||
void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
{
|
||||
const uint16_t tone_val = BK4819_ReadRegister(0x71);
|
||||
// const uint16_t af_val = BK4819_ReadRegister(0x47);
|
||||
const uint16_t tone_val = BK4819_read_reg(0x71);
|
||||
// const uint16_t af_val = BK4819_read_reg(0x47);
|
||||
uint16_t ToneFrequency;
|
||||
uint16_t Duration;
|
||||
|
||||
@ -238,7 +238,7 @@ void AUDIO_PlayBeep(beep_type_t Beep)
|
||||
BK4819_TurnsOffTones_TurnsOnRX();
|
||||
SYSTEM_DelayMs(2);
|
||||
|
||||
BK4819_WriteRegister(0x71, tone_val);
|
||||
BK4819_write_reg(0x71, tone_val);
|
||||
|
||||
#ifdef ENABLE_FMRADIO
|
||||
if (g_fm_radio_mode)
|
||||
|
699
driver/bk4819.c
699
driver/bk4819.c
File diff suppressed because it is too large
Load Diff
@ -62,10 +62,10 @@ typedef enum BK4819_CSS_scan_result_e BK4819_CSS_scan_result_t;
|
||||
extern bool g_rx_idle_mode;
|
||||
|
||||
void BK4819_Init(void);
|
||||
uint16_t BK4819_ReadRegister(const uint8_t Register);
|
||||
void BK4819_WriteRegister(const uint8_t Register, uint16_t Data);
|
||||
void BK4819_WriteU8(uint8_t Data);
|
||||
void BK4819_WriteU16(uint16_t Data);
|
||||
uint16_t BK4819_read_reg(const uint8_t Register);
|
||||
void BK4819_write_reg(const uint8_t Register, uint16_t Data);
|
||||
void BK4819_write_8(uint8_t Data);
|
||||
void BK4819_write_16(uint16_t Data);
|
||||
|
||||
void BK4819_EnableAFC(void);
|
||||
void BK4819_DisableAFC(void);
|
||||
@ -96,7 +96,7 @@ void BK4819_SetupSquelch(
|
||||
|
||||
void BK4819_SetAF(BK4819_af_type_t AF);
|
||||
void BK4819_RX_TurnOn(void);
|
||||
void BK4819_set_rf_filter_path(uint32_t Frequency);
|
||||
void BK4819_set_rf_filter_path(const uint32_t Frequency);
|
||||
|
||||
void BK4819_set_scrambler(const int index);
|
||||
|
||||
|
BIN
firmware.bin
BIN
firmware.bin
Binary file not shown.
Binary file not shown.
20
functions.c
20
functions.c
@ -266,19 +266,15 @@ void FUNCTION_Select(function_type_t Function)
|
||||
#ifdef ENABLE_MDC1200
|
||||
if (g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOT || g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOTH)
|
||||
{
|
||||
BK4819_WriteRegister(0x30,
|
||||
(1u << 15) | // enable VCO calibration
|
||||
(1u << 14) | // enable something or other
|
||||
(0u << 10) | // diable RX link
|
||||
(1u << 9) | // enable AF DAC
|
||||
(1u << 8) | // enable DISC mode, what's DISC mode ?
|
||||
(15u << 4) | // enable PLL/VCO
|
||||
(1u << 3) | // enable PA gain
|
||||
(0u << 2) | // disable MIC ADC
|
||||
(1u << 1) | // enable TX DSP
|
||||
(0u << 0)); // disable RX DSP
|
||||
BK4819_StartTone1(880, 50, false);
|
||||
SYSTEM_DelayMs(120);
|
||||
BK4819_StopTones(true);
|
||||
|
||||
BK4819_send_MDC1200(MDC1200_OP_CODE_PTT_ID, 0x80, g_eeprom.config.setting.mdc1200_id);
|
||||
|
||||
BK4819_StartTone1(880, 50, false);
|
||||
SYSTEM_DelayMs(120);
|
||||
BK4819_StopTones(true);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -288,7 +284,7 @@ void FUNCTION_Select(function_type_t Function)
|
||||
}
|
||||
}
|
||||
/*
|
||||
BK4819_WriteRegister(0x30,
|
||||
BK4819_write_reg(0x30,
|
||||
(1u << 15) | // enable VCO calibration
|
||||
(1u << 14) | // enable something or other
|
||||
(0u << 10) | // diable RX link
|
||||
|
2
main.c
2
main.c
@ -216,7 +216,7 @@ void Main(void)
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_UART)
|
||||
UART_printf("BK4819 id %04X rev %04X\r\n", BK4819_ReadRegister(0x00), BK4819_ReadRegister(0x01));
|
||||
UART_printf("BK4819 id %04X rev %04X\r\n", BK4819_read_reg(0x00), BK4819_read_reg(0x01));
|
||||
#ifdef ENABLE_FMRADIO
|
||||
UART_printf("BK1080 id %04X rev %04X\r\n", BK1080_ReadRegister(0x01), BK1080_ReadRegister(0x00));
|
||||
#endif
|
||||
|
18
mdc1200.c
18
mdc1200.c
@ -626,8 +626,8 @@ uint8_t mdc1200_rx_ready_tick_500ms;
|
||||
|
||||
void MDC1200_process_rx(const uint16_t interrupt_bits)
|
||||
{
|
||||
const uint16_t rx_sync_flags = BK4819_ReadRegister(0x0B);
|
||||
const uint16_t fsk_reg59 = BK4819_ReadRegister(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
const uint16_t rx_sync_flags = BK4819_read_reg(0x0B);
|
||||
const uint16_t fsk_reg59 = BK4819_read_reg(0x59) & ~((1u << 15) | (1u << 14) | (1u << 12) | (1u << 11));
|
||||
|
||||
const bool rx_sync = (interrupt_bits & BK4819_REG_02_FSK_RX_SYNC) ? true : false;
|
||||
const bool rx_sync_neg = (rx_sync_flags & (1u << 7)) ? true : false;
|
||||
@ -677,17 +677,17 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
|
||||
if (rx_fifo_almost_full)
|
||||
{
|
||||
unsigned int i;
|
||||
const unsigned int count = BK4819_ReadRegister(0x5E) & (7u << 0); // almost full threshold
|
||||
const unsigned int count = BK4819_read_reg(0x5E) & (7u << 0); // almost full threshold
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
const unsigned int packet_size = 1 + (BK4819_ReadRegister(0x5D) >> 8);
|
||||
const unsigned int packet_size = 1 + (BK4819_read_reg(0x5D) >> 8);
|
||||
UART_printf("mdc1200 full %2u %2u %2u ", mdc1200_rx_buffer_index, count, packet_size);
|
||||
#endif
|
||||
|
||||
// fetch received packet data
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
const uint16_t word = BK4819_ReadRegister(0x5F) ^ (rx_sync_neg ? 0xFFFF : 0x0000);
|
||||
const uint16_t word = BK4819_read_reg(0x5F) ^ (rx_sync_neg ? 0xFFFF : 0x0000);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_printf(" %04X", word);
|
||||
@ -706,8 +706,8 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
|
||||
|
||||
if (mdc1200_rx_buffer_index >= sizeof(mdc1200_rx_buffer))
|
||||
{
|
||||
BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 12) | fsk_reg59);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
{
|
||||
@ -750,8 +750,8 @@ void MDC1200_process_rx(const uint16_t interrupt_bits)
|
||||
// if (!g_squelch_open)
|
||||
// BK4819_set_GPIO_pin(BK4819_GPIO6_PIN2_GREEN, false); // LED off
|
||||
|
||||
BK4819_WriteRegister(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
BK4819_WriteRegister(0x59, (1u << 12) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 15) | (1u << 14) | fsk_reg59);
|
||||
BK4819_write_reg(0x59, (1u << 12) | fsk_reg59);
|
||||
|
||||
#if defined(ENABLE_UART) && defined(ENABLE_UART_DEBUG)
|
||||
UART_SendText("mdc1200 fin\r\n");
|
||||
|
49
radio.c
49
radio.c
@ -358,7 +358,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
||||
else
|
||||
{ // don't do agc in FM mode
|
||||
BK4819_DisableAGC();
|
||||
BK4819_WriteRegister(0x13, (orig_lnas << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
|
||||
BK4819_write_reg(0x13, (orig_lnas << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
|
||||
}
|
||||
#else
|
||||
if (p_vfo->am_mode > 0)
|
||||
@ -368,7 +368,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
||||
else
|
||||
{ // don't do agc in FM mode
|
||||
BK4819_DisableAGC();
|
||||
BK4819_WriteRegister(0x13, (orig_lnas << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
|
||||
BK4819_write_reg(0x13, (orig_lnas << 8) | (orig_lna << 5) | (orig_mixer << 3) | (orig_pga << 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -402,7 +402,7 @@ void RADIO_configure_channel(const unsigned int VFO, const unsigned int configur
|
||||
|
||||
BK4819_EnableVox(threshold_enable, threshold_disable);
|
||||
|
||||
BK4819_WriteRegister(0x3F, BK4819_ReadRegister(0x3F) | BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST);
|
||||
BK4819_write_reg(0x3F, BK4819_read_reg(0x3F) | BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -428,6 +428,25 @@ void RADIO_ConfigureSquelchAndOutputPower(vfo_info_t *p_vfo)
|
||||
}
|
||||
else
|
||||
{ // squelch >= 1
|
||||
|
||||
// my calibration data
|
||||
//
|
||||
// bands 4567
|
||||
// 0A 4B 53 56 59 5C 5F 62 64 66 FF FF FF FF FF FF // open rssi
|
||||
// 05 46 50 53 56 59 5C 5F 62 64 FF FF FF FF FF FF // close rssi
|
||||
// 5A 2D 29 26 23 20 1D 1A 17 14 FF FF FF FF FF FF // open noise
|
||||
// 64 30 2D 29 26 23 20 1D 1A 17 FF FF FF FF FF FF // close noise
|
||||
// 5A 14 11 0E 0B 08 03 02 02 02 FF FF FF FF FF FF // open glitch
|
||||
// 64 11 0E 0B 08 05 05 04 04 04 FF FF FF FF FF FF // close glitch
|
||||
//
|
||||
// bands 123
|
||||
// 32 68 6B 6E 6F 72 75 77 79 7B FF FF FF FF FF FF // open rssi
|
||||
// 28 64 67 6A 6C 6E 71 73 76 78 FF FF FF FF FF FF // close rssi
|
||||
// 41 32 2D 28 24 21 1E 1A 17 16 FF FF FF FF FF FF // open noise
|
||||
// 46 37 32 2D 28 25 22 1E 1B 19 FF FF FF FF FF FF // close noise
|
||||
// 5A 19 0F 0A 09 08 07 06 05 04 FF FF FF FF FF FF // open glitch
|
||||
// 64 1E 14 0F 0D 0C 0B 0A 09 08 FF FF FF FF FF FF // close glitch
|
||||
|
||||
unsigned int band = (unsigned int)FREQUENCY_GetBand(p_vfo->p_rx->frequency);
|
||||
band = (band < BAND4_174MHz) ? 1 : 0;
|
||||
|
||||
@ -665,8 +684,8 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
break;
|
||||
}
|
||||
|
||||
BK4819_WriteRegister(0x30, 0);
|
||||
BK4819_WriteRegister(0x30,
|
||||
BK4819_write_reg(0x30, 0);
|
||||
BK4819_write_reg(0x30,
|
||||
BK4819_REG_30_ENABLE_VCO_CALIB |
|
||||
// BK4819_REG_30_ENABLE_UNKNOWN |
|
||||
BK4819_REG_30_ENABLE_RX_LINK |
|
||||
@ -685,13 +704,13 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
|
||||
while (1)
|
||||
{ // wait for interrupts to clear
|
||||
const uint16_t int_bits = BK4819_ReadRegister(0x0C);
|
||||
const uint16_t int_bits = BK4819_read_reg(0x0C);
|
||||
if ((int_bits & (1u << 0)) == 0)
|
||||
break;
|
||||
BK4819_WriteRegister(0x02, 0); // clear the interrupt bits
|
||||
BK4819_write_reg(0x02, 0); // clear the interrupt bits
|
||||
SYSTEM_DelayMs(1);
|
||||
}
|
||||
BK4819_WriteRegister(0x3F, 0); // disable interrupts
|
||||
BK4819_write_reg(0x3F, 0); // disable interrupts
|
||||
|
||||
#ifdef ENABLE_NOAA
|
||||
if (IS_NOAA_CHANNEL(g_rx_vfo->channel_save) && g_noaa_mode)
|
||||
@ -714,11 +733,11 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
// AF RX Gain and DAC
|
||||
// if (g_rx_vfo->channel.am_mode > 0)
|
||||
// {
|
||||
// BK4819_WriteRegister(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||
// BK4819_write_reg(0x48, 0xB3A8); // 1011 0011 1010 1000
|
||||
// }
|
||||
// else
|
||||
{
|
||||
BK4819_WriteRegister(0x48,
|
||||
BK4819_write_reg(0x48,
|
||||
(11u << 12) | // ??? .. 0 ~ 15, doesn't seem to make any difference
|
||||
( 0u << 10) | // AF Rx Gain-1
|
||||
(g_eeprom.calib.volume_gain << 4) | // AF Rx Gain-2
|
||||
@ -840,7 +859,7 @@ void RADIO_setup_registers(bool switch_to_function_foreground)
|
||||
#endif
|
||||
|
||||
// enable BK4819 interrupts
|
||||
BK4819_WriteRegister(0x3F, interrupt_mask);
|
||||
BK4819_write_reg(0x3F, interrupt_mask);
|
||||
|
||||
FUNCTION_Init();
|
||||
|
||||
@ -1193,7 +1212,15 @@ void RADIO_tx_eot(void)
|
||||
// if (g_eeprom.config.setting.roger_mode == ROGER_MODE_MDC)
|
||||
if (g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_EOT || g_current_vfo->channel.mdc1200_mode == MDC1200_MODE_BOTH)
|
||||
{
|
||||
// BK4819_StartTone1(880, 50, false);
|
||||
// SYSTEM_DelayMs(120);
|
||||
// BK4819_StopTones(true);
|
||||
|
||||
BK4819_send_MDC1200(MDC1200_OP_CODE_POST_ID, 0x00, g_eeprom.config.setting.mdc1200_id);
|
||||
|
||||
BK4819_StartTone1(880, 50, false);
|
||||
SYSTEM_DelayMs(120);
|
||||
BK4819_StopTones(true);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -382,8 +382,8 @@ void SETTINGS_read_eeprom(void)
|
||||
g_eeprom.calib.volume_gain = (g_eeprom.calib.volume_gain < 64) ? g_eeprom.calib.volume_gain : 58;
|
||||
g_eeprom.calib.dac_gain = (g_eeprom.calib.dac_gain < 16) ? g_eeprom.calib.dac_gain : 8;
|
||||
|
||||
BK4819_WriteRegister(0x3B, 22656 + g_eeprom.calib.bk4819_xtal_freq_low);
|
||||
// BK4819_WriteRegister(0x3C, g_eeprom.calib.BK4819_XTAL_FREQ_HIGH);
|
||||
BK4819_write_reg(0x3B, 22656 + g_eeprom.calib.bk4819_xtal_freq_low);
|
||||
// BK4819_write_reg(0x3C, g_eeprom.calib.BK4819_XTAL_FREQ_HIGH);
|
||||
|
||||
// ****************************************
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user