Skip to content

Commit

Permalink
Add filter bandwidth setting (narrow/wide FM)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrej committed Oct 6, 2024
1 parent 1cf1e27 commit 5277d49
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions platform/drivers/baseband/bk4819.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ void bk4819_rtx_off(void){
WriteRegister(BK4819_REG_30, BK4819_REG_30_ENABLE_AF_DAC);
}

void bk4819_SetFilterBandwidth(uint8_t bandwidth)
{
uint16_t Value = ReadRegister(0x43);
if (bandwidth) { // 25kHz
WriteRegister(0x43, (Value & ~0x30) | 32);
} else { //12.5kHz
WriteRegister(0x43, (Value & ~0x30) | 0);
}
}

// Consolidated function to get the calibration value based on frequency
uint8_t getPaBiasCalValue(uint32_t freq, PowerCalibration calTable) {
if (freq < 130000000) {
Expand Down
5 changes: 5 additions & 0 deletions platform/drivers/baseband/bk4819.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ void bk4819_disable_ctdcss(void);
*/
uint16_t bk4819_get_ctcss(void);

/**
* @brief Set filter bandwidth (0:12.5KHz 1:25KHz)
*/
void bk4819_SetFilterBandwidth(uint8_t bandwidth);

/**
* @brief Enable VOX
*
Expand Down
6 changes: 6 additions & 0 deletions platform/drivers/baseband/radio_A36Plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ void radio_terminate()
{
}

void radio_setBandwidth(const uint8_t bandwidth)
{
bk4819_SetFilterBandwidth(bandwidth);
}

void radio_tuneVcxo(const int16_t vhfOffset, const int16_t uhfOffset)
{
(void)vhfOffset;
Expand Down Expand Up @@ -239,6 +244,7 @@ void radio_updateConfiguration()

if (radioStatus == RX){
radio_setRxFilters(config->rxFrequency / 10);
radio_setBandwidth(config->bandwidth);
}
}

Expand Down

0 comments on commit 5277d49

Please sign in to comment.