mirror of https://github.com/g4klx/MMDVM.git
Add independent transmit levels.
This commit is contained in:
parent
8c96a48b2b
commit
62743345a4
|
@ -104,9 +104,9 @@ void CCWIdTX::process()
|
||||||
while (space > CYCLE_LENGTH) {
|
while (space > CYCLE_LENGTH) {
|
||||||
bool b = READ_BIT1(m_poBuffer, m_poPtr);
|
bool b = READ_BIT1(m_poBuffer, m_poPtr);
|
||||||
if (b)
|
if (b)
|
||||||
io.write(TONE, CYCLE_LENGTH);
|
io.write(STATE_DSTAR, TONE, CYCLE_LENGTH);
|
||||||
else
|
else
|
||||||
io.write(SILENCE, CYCLE_LENGTH);
|
io.write(STATE_DSTAR, SILENCE, CYCLE_LENGTH);
|
||||||
|
|
||||||
space -= CYCLE_LENGTH;
|
space -= CYCLE_LENGTH;
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,7 @@ void CDMRTX::writeByte(uint8_t c, uint8_t control)
|
||||||
|
|
||||||
::arm_fir_fast_q15(&m_modFilter, inBuffer, outBuffer, blockSize);
|
::arm_fir_fast_q15(&m_modFilter, inBuffer, outBuffer, blockSize);
|
||||||
|
|
||||||
io.write(outBuffer, blockSize, controlBuffer);
|
io.write(STATE_DMR, outBuffer, blockSize, controlBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t CDMRTX::getSpace1() const
|
uint16_t CDMRTX::getSpace1() const
|
||||||
|
|
|
@ -452,7 +452,7 @@ void CDStarTX::writeByte(uint8_t c)
|
||||||
|
|
||||||
::arm_fir_fast_q15(&m_modFilter, inBuffer, outBuffer, blockSize);
|
::arm_fir_fast_q15(&m_modFilter, inBuffer, outBuffer, blockSize);
|
||||||
|
|
||||||
io.write(outBuffer, blockSize);
|
io.write(STATE_DSTAR, outBuffer, blockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDStarTX::setTXDelay(uint8_t delay)
|
void CDStarTX::setTXDelay(uint8_t delay)
|
||||||
|
|
34
IO.cpp
34
IO.cpp
|
@ -124,7 +124,9 @@ m_C4FSKState(),
|
||||||
m_GMSKState(),
|
m_GMSKState(),
|
||||||
m_pttInvert(false),
|
m_pttInvert(false),
|
||||||
m_rxLevel(128 * 128),
|
m_rxLevel(128 * 128),
|
||||||
m_txLevel(128 * 128),
|
m_dstarTXLevel(128 * 128),
|
||||||
|
m_dmrTXLevel(128 * 128),
|
||||||
|
m_ysfTXLevel(128 * 128),
|
||||||
m_ledCount(0U),
|
m_ledCount(0U),
|
||||||
m_ledValue(true),
|
m_ledValue(true),
|
||||||
m_dcd(false),
|
m_dcd(false),
|
||||||
|
@ -396,7 +398,7 @@ void CIO::process()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::write(q15_t* samples, uint16_t length, const uint8_t* control)
|
void CIO::write(MMDVM_STATE mode, q15_t* samples, uint16_t length, const uint8_t* control)
|
||||||
{
|
{
|
||||||
if (!m_started)
|
if (!m_started)
|
||||||
return;
|
return;
|
||||||
|
@ -414,8 +416,21 @@ void CIO::write(q15_t* samples, uint16_t length, const uint8_t* control)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
q15_t txLevel = 0;
|
||||||
|
switch (mode) {
|
||||||
|
case STATE_DMR:
|
||||||
|
txLevel = m_dmrTXLevel;
|
||||||
|
break;
|
||||||
|
case STATE_YSF:
|
||||||
|
txLevel = m_ysfTXLevel;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
txLevel = m_dstarTXLevel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint16_t i = 0U; i < length; i++) {
|
for (uint16_t i = 0U; i < length; i++) {
|
||||||
q31_t res1 = samples[i] * m_txLevel;
|
q31_t res1 = samples[i] * txLevel;
|
||||||
q15_t res2 = q15_t(__SSAT((res1 >> 15), 16));
|
q15_t res2 = q15_t(__SSAT((res1 >> 15), 16));
|
||||||
uint16_t res3 = uint16_t(res2 + DC_OFFSET);
|
uint16_t res3 = uint16_t(res2 + DC_OFFSET);
|
||||||
|
|
||||||
|
@ -502,18 +517,23 @@ switch (m_modemState) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t txLevel)
|
void CIO::setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel)
|
||||||
{
|
{
|
||||||
m_pttInvert = pttInvert;
|
m_pttInvert = pttInvert;
|
||||||
|
|
||||||
m_rxLevel = q15_t(rxLevel * 128);
|
m_rxLevel = q15_t(rxLevel * 128);
|
||||||
m_txLevel = q15_t(txLevel * 128);
|
m_dstarTXLevel = q15_t(dstarTXLevel * 128);
|
||||||
|
m_dmrTXLevel = q15_t(dmrTXLevel * 128);
|
||||||
|
m_ysfTXLevel = q15_t(ysfTXLevel * 128);
|
||||||
|
|
||||||
if (rxInvert)
|
if (rxInvert)
|
||||||
m_rxLevel = -m_rxLevel;
|
m_rxLevel = -m_rxLevel;
|
||||||
|
|
||||||
if (txInvert)
|
if (txInvert) {
|
||||||
m_txLevel = -m_txLevel;
|
m_dstarTXLevel = -m_dstarTXLevel;
|
||||||
|
m_dmrTXLevel = -m_dmrTXLevel;
|
||||||
|
m_ysfTXLevel = -m_ysfTXLevel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIO::getOverflow(bool& adcOverflow, bool& dacOverflow)
|
void CIO::getOverflow(bool& adcOverflow, bool& dacOverflow)
|
||||||
|
|
8
IO.h
8
IO.h
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
void write(q15_t* samples, uint16_t length, const uint8_t* control = NULL);
|
void write(MMDVM_STATE mode, q15_t* samples, uint16_t length, const uint8_t* control = NULL);
|
||||||
|
|
||||||
uint16_t getSpace() const;
|
uint16_t getSpace() const;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
|
|
||||||
void interrupt();
|
void interrupt();
|
||||||
|
|
||||||
void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t txLevel);
|
void setParameters(bool rxInvert, bool txInvert, bool pttInvert, uint8_t rxLevel, uint8_t dstarTXLevel, uint8_t dmrTXLevel, uint8_t ysfTXLevel);
|
||||||
|
|
||||||
void getOverflow(bool& adcOverflow, bool& dacOverflow);
|
void getOverflow(bool& adcOverflow, bool& dacOverflow);
|
||||||
|
|
||||||
|
@ -81,7 +81,9 @@ private:
|
||||||
|
|
||||||
bool m_pttInvert;
|
bool m_pttInvert;
|
||||||
q15_t m_rxLevel;
|
q15_t m_rxLevel;
|
||||||
q15_t m_txLevel;
|
q15_t m_dstarTXLevel;
|
||||||
|
q15_t m_dmrTXLevel;
|
||||||
|
q15_t m_ysfTXLevel;
|
||||||
|
|
||||||
uint32_t m_ledCount;
|
uint32_t m_ledCount;
|
||||||
bool m_ledValue;
|
bool m_ledValue;
|
||||||
|
|
|
@ -185,7 +185,7 @@ void CSerialPort::getVersion()
|
||||||
|
|
||||||
uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (length < 9U)
|
if (length < 12U)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
bool rxInvert = (data[0U] & 0x01U) == 0x01U;
|
bool rxInvert = (data[0U] & 0x01U) == 0x01U;
|
||||||
|
@ -212,7 +212,6 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
uint8_t rxLevel = data[4U];
|
uint8_t rxLevel = data[4U];
|
||||||
uint8_t txLevel = data[5U];
|
|
||||||
|
|
||||||
uint8_t colorCode = data[6U];
|
uint8_t colorCode = data[6U];
|
||||||
if (colorCode > 15U)
|
if (colorCode > 15U)
|
||||||
|
@ -232,6 +231,10 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
m_sampleInsert = false;
|
m_sampleInsert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t dstarTXLevel = data[9U];
|
||||||
|
uint8_t dmrTXLevel = data[10U];
|
||||||
|
uint8_t ysfTXLevel = data[11U];
|
||||||
|
|
||||||
m_modemState = modemState;
|
m_modemState = modemState;
|
||||||
|
|
||||||
m_dstarEnable = dstarEnable;
|
m_dstarEnable = dstarEnable;
|
||||||
|
@ -246,7 +249,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
||||||
dmrRX.setDelay(dmrDelay);
|
dmrRX.setDelay(dmrDelay);
|
||||||
dmrIdleRX.setColorCode(colorCode);
|
dmrIdleRX.setColorCode(colorCode);
|
||||||
|
|
||||||
io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, txLevel);
|
io.setParameters(rxInvert, txInvert, pttInvert, rxLevel, dstarTXLevel, dmrTXLevel, ysfTXLevel);
|
||||||
|
|
||||||
io.start();
|
io.start();
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ void CYSFTX::writeByte(uint8_t c)
|
||||||
|
|
||||||
::arm_fir_fast_q15(&m_modFilter, inBuffer, outBuffer, blockSize);
|
::arm_fir_fast_q15(&m_modFilter, inBuffer, outBuffer, blockSize);
|
||||||
|
|
||||||
io.write(outBuffer, blockSize);
|
io.write(STATE_YSF, outBuffer, blockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CYSFTX::setTXDelay(uint8_t delay)
|
void CYSFTX::setTXDelay(uint8_t delay)
|
||||||
|
|
Loading…
Reference in New Issue