Small code cleanup in MD-UV3x0 HR_C6000 driver, temporary workaround to fix #129

pull/147/head
Silvano Seva 2023-07-14 17:28:16 +02:00
rodzic 8019b29947
commit a5b925e76f
2 zmienionych plików z 19 dodań i 12 usunięć

Wyświetl plik

@ -167,7 +167,7 @@ void HR_Cx000< M >::dmrMode()
template< class M >
void HR_Cx000< M >::fmMode()
{
writeReg(M::CONFIG, 0x10, 0xF3); // FM mode, Tier II, TimeSlot, 3rd layer mode, aligned (?)
writeReg(M::CONFIG, 0x10, 0x80); // FM mode, Tier II, TimeSlot, 3rd layer mode, aligned (?)
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
@ -203,24 +203,23 @@ void HR_Cx000< M >::startAnalogTx(const TxAudioSource source, const FmConfig cfg
if(source == TxAudioSource::MIC) audioCfg |= 0x40;
if(source == TxAudioSource::LINE_IN) audioCfg |= 0x02;
writeReg(M::CONFIG, 0xE2, 0x00); // Mic preamp disabled, anti-pop disabled
// writeReg(M::CONFIG, 0xE4, 0x23); // Lineout gain, first and second stage mic gain
// writeReg(M::CONFIG, 0xE2, 0x00); // Mic preamp disabled, anti-pop disabled
writeReg(M::CONFIG, 0xE0, audioCfg);
writeReg(M::CONFIG, 0xC2, 0x00); // Codec AGC gain
writeReg(M::CONFIG, 0xE5, 0x1A); // Unknown (Default value = 0A)
writeReg(M::CONFIG, 0x25, 0x0E); // Undocumented Register
writeReg(M::CONFIG, 0x26, 0xFE); // Undocumented register Turns off FM receive
writeReg(M::CONFIG, 0x83, 0xFF); // Clear all Interrupts
writeReg(M::CONFIG, 0x87, 0x00); // Clear Int Masks
writeReg(M::CONFIG, 0xA1, 0x80); // FM_mod, all modes cleared
writeReg(M::CONFIG, 0x83, 0xFF); // Clear all interrupt flags
writeReg(M::CONFIG, 0x87, 0x00); // Disable all interrupt sources
// writeReg(M::CONFIG, 0x04, 0x24);
// writeReg(M::CONFIG, 0x35, 0x40);
// writeReg(M::CONFIG, 0x3F, 0x04);
writeReg(M::CONFIG, 0x34, static_cast< uint8_t >(cfg));
writeReg(M::CONFIG, 0x3E, 0x08); // FM Modulation frequency deviation coefficient at the receiving end
writeReg(M::AUX, 0x50, 0x00);
writeReg(M::AUX, 0x51, 0x00);
writeReg(M::CONFIG, 0x60, 0x80); // Start analog transmission
writeReg(M::CONFIG, 0x10, 0xF3); // FM mode, Tier II, TimeSlot, 3rd layer mode, aligned (?)
writeReg(M::CONFIG, 0xE0, audioCfg);
writeReg(M::CONFIG, 0x3E, 0x08); // FM Modulation frequency deviation coefficient at the receiving end
writeReg(M::CONFIG, 0x37, 0x8C); // DAC gain
writeReg(M::CONFIG, 0x60, 0x80); // Start analog transmission
}
template< class M >

Wyświetl plik

@ -18,6 +18,7 @@
* along with this program; if not, see <http://www.gnu.org/licenses/> *
***************************************************************************/
#include <interfaces/delays.h>
#include <interfaces/nvmem.h>
#include <interfaces/radio.h>
#include <interfaces/gpio.h>
@ -234,9 +235,15 @@ void radio_enableTx()
break;
}
//
// FIXME: workaround to fix a small carrier-only gap which appears at the
// beginning of each transmission. This problem is particularly evident in
// M17 mode because it causes the truncation of the preamble sequence.
//
sleepFor(0, 50);
at1846s.setFuncMode(AT1846S_FuncMode::TX);
gpio_setPin(PA_EN_1);
if(currTxBand == BND_VHF)
{
@ -247,6 +254,7 @@ void radio_enableTx()
gpio_setPin(PA_SEL_SW);
}
gpio_setPin(PA_EN_1);
gpio_setPin(PA_EN_2);
if(config->txToneEn)