Added to radio driver interface two functions to enable and disable AF output towards the speaker
This commit is contained in:
parent
714a0dd331
commit
3c65f8834a
|
|
@ -84,6 +84,16 @@ void radio_setOpmode(const enum opmode mode);
|
|||
*/
|
||||
bool radio_checkRxDigitalSquelch();
|
||||
|
||||
/**
|
||||
* Enable AF output towards the speakers.
|
||||
*/
|
||||
void radio_enableAfOutput();
|
||||
|
||||
/**
|
||||
* Disable AF output towards the speakers.
|
||||
*/
|
||||
void radio_disableAfOutput();
|
||||
|
||||
/**
|
||||
* Enable the RX stage.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -318,6 +318,24 @@ public:
|
|||
i2c_writeReg16(0x49, static_cast< uint16_t >(thresh));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mute the RX audio output while keeping the chip in RX mode.
|
||||
*/
|
||||
inline void muteRxOutput()
|
||||
{
|
||||
// Setting bit 7 of register 0x30 mutes the RX audio output
|
||||
maskSetRegister(0x30, 0x0080, 0x0080);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmute the RX audio output.
|
||||
*/
|
||||
inline void unmuteRxOutput()
|
||||
{
|
||||
// Clearing bit 7 of register 0x30 unmutes the RX audio output
|
||||
maskSetRegister(0x30, 0x0080, 0x0000);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ void HR_Cx000< M >::fmMode()
|
|||
writeReg(M::CONFIG, 0x01, 0xB0); // Swap TX IQ, two point mode for TX, IF mode for RX
|
||||
writeReg(M::CONFIG, 0x81, 0x04); // Interrupt mask
|
||||
writeReg(M::CONFIG, 0xE5, 0x1A); // Undocumented register
|
||||
writeReg(M::CONFIG, 0x36, 0x02); // Enable voice channel in FM mode
|
||||
writeReg(M::CONFIG, 0xE4, 0x27); // Lineout gain, first and second stage mic gain
|
||||
writeReg(M::CONFIG, 0xE2, 0x06); // Mic preamp disabled, anti-pop enabled
|
||||
writeReg(M::CONFIG, 0x34, 0x98); // FM bpf enabled, 25kHz bandwidth
|
||||
|
|
|
|||
|
|
@ -79,10 +79,12 @@ void radio_init(const rtxStatus_t *rtxState)
|
|||
| DAC_C0_DACEN_MASK; // Enable DAC
|
||||
|
||||
/*
|
||||
* Enable and configure both AT1846S and HR_C6000
|
||||
* Enable and configure both AT1846S and HR_C6000, keep AF output disabled
|
||||
* at power on.
|
||||
*/
|
||||
at1846s.init();
|
||||
C6000.init();
|
||||
radio_disableAfOutput();
|
||||
}
|
||||
|
||||
void radio_terminate()
|
||||
|
|
@ -132,6 +134,17 @@ bool radio_checkRxDigitalSquelch()
|
|||
return at1846s.rxCtcssDetected();
|
||||
}
|
||||
|
||||
void radio_enableAfOutput()
|
||||
{
|
||||
// TODO: AF output management for DMR mode
|
||||
at1846s.unmuteRxOutput();
|
||||
}
|
||||
|
||||
void radio_disableAfOutput()
|
||||
{
|
||||
at1846s.muteRxOutput();
|
||||
}
|
||||
|
||||
void radio_enableRx()
|
||||
{
|
||||
gpio_clearPin(VHF_LNA_EN);
|
||||
|
|
|
|||
|
|
@ -110,15 +110,14 @@ void radio_init(const rtxStatus_t *rtxState)
|
|||
gpio_setMode(RF_APC_SW, OUTPUT);
|
||||
gpio_setMode(TX_STG_EN, OUTPUT);
|
||||
gpio_setMode(RX_STG_EN, OUTPUT);
|
||||
|
||||
gpio_setMode(FM_MUTE, OUTPUT);
|
||||
gpio_clearPin(FM_MUTE);
|
||||
gpio_setMode(FM_MUTE, OUTPUT);
|
||||
|
||||
gpio_clearPin(PLL_PWR); // PLL off
|
||||
gpio_setPin(VCOVCC_SW); // VCOVCC high enables RX VCO, TX VCO if low
|
||||
#ifndef MDx_ENABLE_SWD
|
||||
gpio_setPin(WN_SW); // 25kHz bandwidth
|
||||
#endif
|
||||
gpio_clearPin(FM_MUTE); // Mute FM AF output
|
||||
gpio_clearPin(DMR_SW); // Disconnect HR_C5000 input IF signal and audio out
|
||||
gpio_clearPin(FM_SW); // Disconnect analog FM audio path
|
||||
gpio_clearPin(RF_APC_SW); // Disable TX power control
|
||||
|
|
@ -229,6 +228,17 @@ bool radio_checkRxDigitalSquelch()
|
|||
return false;
|
||||
}
|
||||
|
||||
void radio_enableAfOutput()
|
||||
{
|
||||
// TODO: AF output management for DMR mode
|
||||
gpio_setPin(FM_MUTE);
|
||||
}
|
||||
|
||||
void radio_disableAfOutput()
|
||||
{
|
||||
gpio_clearPin(FM_MUTE);
|
||||
}
|
||||
|
||||
void radio_enableRx()
|
||||
{
|
||||
gpio_clearPin(TX_STG_EN); // Disable TX PA
|
||||
|
|
@ -252,12 +262,6 @@ void radio_enableRx()
|
|||
DAC->DHR12L1 = vtune_rx * 0xFF;
|
||||
|
||||
gpio_setPin(RX_STG_EN); // Enable RX LNA
|
||||
|
||||
if(config->opMode == OPMODE_FM)
|
||||
{
|
||||
gpio_setPin(FM_MUTE); // In FM mode, unmute audio path towards speaker
|
||||
}
|
||||
|
||||
radioStatus = RX;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,16 @@ bool radio_checkRxDigitalSquelch()
|
|||
return false;
|
||||
}
|
||||
|
||||
void radio_enableAfOutput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void radio_disableAfOutput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void radio_enableRx()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ bool radio_checkRxDigitalSquelch()
|
|||
return false;
|
||||
}
|
||||
|
||||
void radio_enableAfOutput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void radio_disableAfOutput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void radio_enableRx()
|
||||
{
|
||||
radioStatus = RX;
|
||||
|
|
|
|||
|
|
@ -84,10 +84,11 @@ void radio_init(const rtxStatus_t *rtxState)
|
|||
DAC->DHR12R1 = 0;
|
||||
|
||||
/*
|
||||
* Configure AT1846S and HR_C6000
|
||||
* Configure AT1846S and HR_C6000, keep AF output disabled at power on.
|
||||
*/
|
||||
at1846s.init();
|
||||
C6000.init();
|
||||
radio_disableAfOutput();
|
||||
}
|
||||
|
||||
void radio_terminate()
|
||||
|
|
@ -141,6 +142,18 @@ bool radio_checkRxDigitalSquelch()
|
|||
return at1846s.rxCtcssDetected();
|
||||
}
|
||||
|
||||
void radio_enableAfOutput()
|
||||
{
|
||||
// Bit 2 of register 0x36: enable voice channel in FM mode
|
||||
// TODO: AF output management for DMR mode
|
||||
C6000.writeCfgRegister(0x36, 0x02);
|
||||
}
|
||||
|
||||
void radio_disableAfOutput()
|
||||
{
|
||||
C6000.writeCfgRegister(0x36, 0x00);
|
||||
}
|
||||
|
||||
void radio_enableRx()
|
||||
{
|
||||
gpio_clearPin(PA_EN_1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue