mirror of
https://github.com/g4klx/MMDVM.git
synced 2026-08-21 22:46:22 +02:00
Compare commits
18
Commits
3fd84d5ed4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
046e1df161 | ||
|
|
d70ab85bae | ||
|
|
384c5d559d | ||
|
|
4c7e8fbe46 | ||
|
|
894ba76432 | ||
|
|
8a89804fda | ||
|
|
8bd467598c | ||
|
|
715d3f5839 | ||
|
|
68252f15f5 | ||
|
|
96061a6013 | ||
|
|
90220cbb9d | ||
|
|
2eb6f7fd06 | ||
|
|
a1794b44ed | ||
|
|
57e692ad8c | ||
|
|
841d7505c2 | ||
|
|
549dfd7258 | ||
|
|
30ba4c4c55 | ||
|
|
a696fd454c |
@@ -2,6 +2,7 @@
|
||||
* Copyright (C) 2009-2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2017 by Andy Uribe CA6JAU
|
||||
* Copyright (C) 2022,2023,2026 by Adrian Musceac YO8RZZ
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -42,6 +43,12 @@ const uint8_t IDLE_DATA[] =
|
||||
0x36U, 0x00U, 0x0DU, 0xFFU, 0x57U, 0xD7U, 0x5DU, 0xF5U, 0xD0U, 0x03U, 0xF6U,
|
||||
0xE4U, 0x65U, 0x17U, 0x1BU, 0x48U, 0xCAU, 0x6DU, 0x4FU, 0xC6U, 0x10U, 0xB4U};
|
||||
|
||||
// DT Terminator with LC, empty
|
||||
const uint8_t TERMINATOR_DATA[] =
|
||||
{0x00U, 0xCCU, 0x01U, 0x80U, 0x01U, 0x94U, 0x01U, 0x48U, 0x08U, 0xB0U, 0x08U,
|
||||
0x80U, 0x04U, 0xADU, 0xFFU, 0x57U, 0xD7U, 0x5DU, 0xF5U, 0xD9U, 0x65U, 0x90U,
|
||||
0x01U, 0x78U, 0x00U, 0xD0U, 0x08U, 0x40U, 0x14U, 0x00U, 0x0DU, 0x80U, 0x15U};
|
||||
|
||||
const uint8_t CACH_INTERLEAVE[] =
|
||||
{ 1U, 2U, 3U, 5U, 6U, 7U, 9U, 10U, 11U, 13U, 15U, 16U, 17U, 19U, 20U, 21U, 23U,
|
||||
25U, 26U, 27U, 29U, 30U, 31U, 33U, 34U, 35U, 37U, 39U, 40U, 41U, 43U, 44U, 45U, 47U,
|
||||
@@ -65,6 +72,7 @@ m_modFilter(),
|
||||
m_modState(),
|
||||
m_state(DMRTXSTATE_IDLE),
|
||||
m_idle(),
|
||||
m_aloha(),
|
||||
m_cachPtr(0U),
|
||||
m_shortLC(),
|
||||
m_newShortLC(),
|
||||
@@ -74,7 +82,10 @@ m_poLen(0U),
|
||||
m_poPtr(0U),
|
||||
m_frameCount(0U),
|
||||
m_abortCount(),
|
||||
m_abort()
|
||||
m_abort(),
|
||||
m_controlChannel(false),
|
||||
m_trunking(false),
|
||||
m_colorCode(0U)
|
||||
{
|
||||
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
||||
|
||||
@@ -211,6 +222,23 @@ uint8_t CDMRTX::writeShortLC(const uint8_t* data, uint16_t length)
|
||||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CDMRTX::writeAloha(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != DMR_FRAME_LENGTH_BYTES)
|
||||
return 4U;
|
||||
|
||||
::memcpy(m_aloha, data, length);
|
||||
|
||||
// Stamp the slot type with the current colour code so that the result
|
||||
// doesn't depend on the ordering of the ALOHA and SET_CONFIG commands.
|
||||
CDMRSlotType slotType;
|
||||
slotType.encode(m_colorCode, DT_CSBK, m_aloha);
|
||||
|
||||
m_controlChannel = true;
|
||||
|
||||
return 0U;
|
||||
}
|
||||
|
||||
uint8_t CDMRTX::writeAbort(const uint8_t* data, uint16_t length)
|
||||
{
|
||||
if (length != 1U)
|
||||
@@ -294,7 +322,7 @@ uint8_t CDMRTX::getSpace2() const
|
||||
|
||||
void CDMRTX::createData(uint8_t slotIndex)
|
||||
{
|
||||
if (m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES && m_frameCount >= STARTUP_COUNT && m_abortCount[slotIndex] >= ABORT_COUNT) {
|
||||
if ((m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES) && (m_frameCount >= STARTUP_COUNT) && (m_abortCount[slotIndex] >= ABORT_COUNT)) {
|
||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||
m_fifo[slotIndex].get(m_poBuffer[i]);
|
||||
m_markBuffer[i] = MARK_NONE;
|
||||
@@ -303,7 +331,11 @@ void CDMRTX::createData(uint8_t slotIndex)
|
||||
m_abort[slotIndex] = false;
|
||||
// Transmit an idle message
|
||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||
m_poBuffer[i] = m_idle[i];
|
||||
if ((slotIndex == 0U) && m_controlChannel && m_trunking)
|
||||
m_poBuffer[i] = m_aloha[i];
|
||||
else
|
||||
m_poBuffer[i] = m_idle[i];
|
||||
|
||||
m_markBuffer[i] = MARK_NONE;
|
||||
}
|
||||
}
|
||||
@@ -354,10 +386,14 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
||||
m_cachPtr = 0U;
|
||||
|
||||
if (m_cachPtr == 0U) {
|
||||
if (m_fifo[0U].getData() == 0U && m_fifo[1U].getData() == 0U)
|
||||
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);
|
||||
else
|
||||
if ((m_fifo[0U].getData() == 0U) && (m_fifo[1U].getData() == 0U)) {
|
||||
if (m_trunking)
|
||||
::memcpy(m_shortLC, m_newShortLC, 12U);
|
||||
else
|
||||
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);
|
||||
} else {
|
||||
::memcpy(m_shortLC, m_newShortLC, 12U);
|
||||
}
|
||||
}
|
||||
|
||||
::memcpy(m_poBuffer, m_shortLC + m_cachPtr, 3U);
|
||||
@@ -367,8 +403,8 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
||||
|
||||
bool at = false;
|
||||
if (m_frameCount >= STARTUP_COUNT)
|
||||
at = m_fifo[rxSlotIndex].getData() > 0U;
|
||||
bool tc = txSlotIndex == 1U;
|
||||
at = (m_fifo[rxSlotIndex].getData() > 0U);
|
||||
bool tc = (txSlotIndex == 1U);
|
||||
bool ls0 = true; // For 1 and 2
|
||||
bool ls1 = true;
|
||||
|
||||
@@ -397,10 +433,20 @@ void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
||||
|
||||
void CDMRTX::setColorCode(uint8_t colorCode)
|
||||
{
|
||||
::memcpy(m_idle, IDLE_DATA, DMR_FRAME_LENGTH_BYTES);
|
||||
m_colorCode = colorCode;
|
||||
|
||||
if (m_trunking)
|
||||
::memcpy(m_idle, TERMINATOR_DATA, DMR_FRAME_LENGTH_BYTES);
|
||||
else
|
||||
::memcpy(m_idle, IDLE_DATA, DMR_FRAME_LENGTH_BYTES);
|
||||
|
||||
CDMRSlotType slotType;
|
||||
slotType.encode(colorCode, DT_IDLE, m_idle);
|
||||
if (m_trunking) {
|
||||
slotType.encode(colorCode, DT_TERMINATOR_WITH_LC, m_idle);
|
||||
slotType.encode(colorCode, DT_CSBK, m_aloha);
|
||||
} else {
|
||||
slotType.encode(colorCode, DT_IDLE, m_idle);
|
||||
}
|
||||
}
|
||||
|
||||
void CDMRTX::resetFifo1()
|
||||
@@ -418,5 +464,12 @@ uint32_t CDMRTX::getFrameCount()
|
||||
return m_frameCount;
|
||||
}
|
||||
|
||||
#endif
|
||||
void CDMRTX::setTrunking(bool trunking)
|
||||
{
|
||||
m_trunking = trunking;
|
||||
|
||||
if (!trunking)
|
||||
m_controlChannel = false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015,2016,2017,2020 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2016 by Colin Durbridge G4EML
|
||||
* Copyright (C) 2026 by Adrian Musceac YO8RZZ
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -45,10 +46,12 @@ public:
|
||||
uint8_t writeData2(const uint8_t* data, uint16_t length);
|
||||
|
||||
uint8_t writeShortLC(const uint8_t* data, uint16_t length);
|
||||
uint8_t writeAloha(const uint8_t* data, uint16_t length);
|
||||
uint8_t writeAbort(const uint8_t* data, uint16_t length);
|
||||
|
||||
void setStart(bool start);
|
||||
void setCal(bool start);
|
||||
void setTrunking(bool trunking);
|
||||
|
||||
void process();
|
||||
|
||||
@@ -62,11 +65,12 @@ public:
|
||||
void setColorCode(uint8_t colorCode);
|
||||
|
||||
private:
|
||||
CRingBuffer<uint8_t> m_fifo[2U];
|
||||
CRingBuffer<uint8_t> m_fifo[2U];
|
||||
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||
DMRTXSTATE m_state;
|
||||
uint8_t m_idle[DMR_FRAME_LENGTH_BYTES];
|
||||
uint8_t m_aloha[DMR_FRAME_LENGTH_BYTES];
|
||||
uint8_t m_cachPtr;
|
||||
uint8_t m_shortLC[12U];
|
||||
uint8_t m_newShortLC[12U];
|
||||
@@ -77,6 +81,9 @@ private:
|
||||
uint32_t m_frameCount;
|
||||
uint32_t m_abortCount[2U];
|
||||
bool m_abort[2U];
|
||||
bool m_controlChannel;
|
||||
bool m_trunking;
|
||||
uint8_t m_colorCode;
|
||||
|
||||
void createData(uint8_t slotIndex);
|
||||
void createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex);
|
||||
@@ -87,4 +94,3 @@ private:
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -27,7 +27,8 @@ const uint16_t FM_TX_BLOCK_SIZE = 100U;
|
||||
const uint16_t FM_SERIAL_BLOCK_SIZE = 80U;//this is the number of sample pairs to send over serial. One sample pair is 3bytes.
|
||||
//three times this value shall never exceed 252
|
||||
const uint16_t FM_SERIAL_BLOCK_SIZE_BYTES = FM_SERIAL_BLOCK_SIZE * 3U;
|
||||
|
||||
const uint16_t FM_LINK_EXT_GAP_MS = 60U;// How long a link-mode external-audio underrun is tolerated before it is
|
||||
// treated as a real end of transmission (see linkStateMachine()).
|
||||
const uint8_t FS_LISTENING = 0U;
|
||||
const uint8_t FS_KERCHUNK_RF = 1U;
|
||||
const uint8_t FS_RELAYING_RF = 2U;
|
||||
@@ -62,10 +63,17 @@ m_ackMinTimer(),
|
||||
m_ackDelayTimer(),
|
||||
m_hangTimer(),
|
||||
m_reverseTimer(),
|
||||
m_extGapTimer(),
|
||||
m_needReverse(false),
|
||||
m_filterStage1( 724, 1448, 724, 32768, -37895, 21352),//3rd order Cheby Filter 300 to 2700Hz, 0.2dB passband ripple, sampling rate 24kHz
|
||||
m_filterStage2(32768, 0,-32768, 32768, -50339, 19052),
|
||||
m_filterStage3(32768, -65536, 32768, 32768, -64075, 31460),
|
||||
m_dsFilterStage1(m_filterStage1),//same coefficients, separate state
|
||||
m_dsFilterStage2(m_filterStage2),
|
||||
m_dsFilterStage3(m_filterStage3),
|
||||
m_usFilterStage1(m_filterStage1),//same coefficients, separate state
|
||||
m_usFilterStage2(m_filterStage2),
|
||||
m_usFilterStage3(m_filterStage3),
|
||||
m_blanking(),
|
||||
m_accessMode(1U),
|
||||
m_linkMode(false),
|
||||
@@ -85,6 +93,7 @@ m_rssiAccum(0U),
|
||||
m_rssiCount(0U)
|
||||
{
|
||||
m_reverseTimer.setTimeout(0U, 150U);
|
||||
m_extGapTimer.setTimeout(0U, FM_LINK_EXT_GAP_MS);
|
||||
|
||||
insertDelay(100U);
|
||||
}
|
||||
@@ -119,6 +128,7 @@ void CFM::repeaterSamples(bool cos, q15_t* samples, const uint16_t* rssi, uint8_
|
||||
|
||||
q15_t currentExtSample;
|
||||
bool inputExt = m_inputExtRB.getSample(currentExtSample);//always consume the external input data so it does not overflow
|
||||
currentExtSample = m_usFilterStage3.filter(m_usFilterStage2.filter(m_usFilterStage1.filter(currentExtSample)));
|
||||
inputExt = inputExt && m_extEnabled;
|
||||
|
||||
switch (m_accessMode) {
|
||||
@@ -200,8 +210,10 @@ void CFM::repeaterSamples(bool cos, q15_t* samples, const uint16_t* rssi, uint8_
|
||||
if (m_duplex) {
|
||||
if (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF || m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
||||
currentSample = m_blanking.process(currentSample);
|
||||
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
|
||||
m_downSampler.addSample(currentSample);
|
||||
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF)) {
|
||||
q15_t dsSample = m_dsFilterStage3.filter(m_dsFilterStage2.filter(m_dsFilterStage1.filter(currentSample)));
|
||||
m_downSampler.addSample(dsSample);
|
||||
}
|
||||
|
||||
currentSample *= currentBoost;
|
||||
} else {
|
||||
@@ -211,9 +223,11 @@ void CFM::repeaterSamples(bool cos, q15_t* samples, const uint16_t* rssi, uint8_
|
||||
if (m_state == FS_RELAYING_EXT || m_state == FS_KERCHUNK_EXT) {
|
||||
currentSample *= currentBoost;
|
||||
} else {
|
||||
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF))
|
||||
m_downSampler.addSample(currentSample);
|
||||
continue;
|
||||
if (m_extEnabled && (m_state == FS_RELAYING_RF || m_state == FS_KERCHUNK_RF)) {
|
||||
q15_t dsSample = m_dsFilterStage3.filter(m_dsFilterStage2.filter(m_dsFilterStage1.filter(currentSample)));
|
||||
m_downSampler.addSample(dsSample);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,14 +264,17 @@ void CFM::linkSamples(bool cos, q15_t* samples, uint8_t length)
|
||||
|
||||
uint8_t i = 0U;
|
||||
for (; i < length; i++) {
|
||||
// ARMv7-M has hardware integer division
|
||||
q15_t currentRFSample = q15_t((q31_t(samples[i]) << 8) / m_rxLevel);
|
||||
|
||||
if (m_noiseSquelch)
|
||||
cos = m_squelch.process(currentRFSample);
|
||||
|
||||
q15_t currentExtSample;
|
||||
// Zero-initialized: getSample() leaves this untouched on underrun, and
|
||||
// with the ext-gap debounce below, m_extSignal can now stay true for a
|
||||
// few samples past that point
|
||||
q15_t currentExtSample = 0;
|
||||
bool inputExt = m_inputExtRB.getSample(currentExtSample);//always consume the external input data so it does not overflow
|
||||
currentExtSample = m_usFilterStage3.filter(m_usFilterStage2.filter(m_usFilterStage1.filter(currentExtSample)));
|
||||
inputExt = inputExt && m_extEnabled;
|
||||
|
||||
switch (m_accessMode) {
|
||||
@@ -327,7 +344,8 @@ void CFM::linkSamples(bool cos, q15_t* samples, uint8_t length)
|
||||
|
||||
if (m_rfSignal && m_extEnabled) {
|
||||
q15_t currentSample = m_blanking.process(currentRFSample);
|
||||
m_downSampler.addSample(currentSample);
|
||||
q15_t dsSample = m_dsFilterStage3.filter(m_dsFilterStage2.filter(m_dsFilterStage1.filter(currentSample)));
|
||||
m_downSampler.addSample(dsSample);
|
||||
}
|
||||
|
||||
if (!m_extSignal)
|
||||
@@ -407,6 +425,12 @@ void CFM::reset()
|
||||
m_inputExtRB.reset();
|
||||
|
||||
m_downSampler.reset();
|
||||
m_dsFilterStage1.reset();
|
||||
m_dsFilterStage2.reset();
|
||||
m_dsFilterStage3.reset();
|
||||
m_usFilterStage1.reset();
|
||||
m_usFilterStage2.reset();
|
||||
m_usFilterStage3.reset();
|
||||
m_squelch.reset();
|
||||
|
||||
m_needReverse = false;
|
||||
@@ -601,6 +625,7 @@ void CFM::clock(uint8_t length)
|
||||
m_ackDelayTimer.clock(length);
|
||||
m_hangTimer.clock(length);
|
||||
m_reverseTimer.clock(length);
|
||||
m_extGapTimer.clock(length);
|
||||
}
|
||||
|
||||
void CFM::listeningStateDuplex(bool validRFSignal, bool validExtSignal)
|
||||
@@ -1231,6 +1256,12 @@ void CFM::linkStateMachine(bool validRFSignal, bool validExtSignal)
|
||||
m_extSignal = true;
|
||||
}
|
||||
|
||||
if (validExtSignal && m_extGapTimer.isRunning()) {
|
||||
// Recovered before the gap timer committed to a real loss below --
|
||||
// m_extSignal was never flipped, so there is nothing else to undo.
|
||||
m_extGapTimer.stop();
|
||||
}
|
||||
|
||||
if (!validRFSignal && m_rfSignal) {
|
||||
io.setDecode(false);
|
||||
io.setADCDetection(false);
|
||||
@@ -1248,14 +1279,28 @@ void CFM::linkStateMachine(bool validRFSignal, bool validExtSignal)
|
||||
}
|
||||
|
||||
if (!validExtSignal && m_extSignal) {
|
||||
if (!m_rfSignal) {
|
||||
DEBUG1("State to LISTENING");
|
||||
m_state = FS_LISTENING;
|
||||
serial.writeFMStatus(m_state);
|
||||
}
|
||||
// A missed/late sample used to flip m_extSignal false right here, on
|
||||
// the very first bad sample, with zero debounce -- that is what
|
||||
// actually keys the transmitter off (IO::process() drops PTT the
|
||||
// instant the downstream TX buffer runs dry, see IO.cpp). A gap well
|
||||
// under FM_LINK_EXT_GAP_MS is less offensive than the PTT
|
||||
// drop-and-rekey it triggers. Give it a short grace period
|
||||
// mirroring the RELAYING_EXT/RELAYING_WAIT_EXT pattern the
|
||||
// non-link duplex/simplex paths already use for exactly this
|
||||
// situation (see relayingExtStateDuplex()/relayingExtWaitStateDuplex()).
|
||||
if (!m_extGapTimer.isRunning()) {
|
||||
m_extGapTimer.start();
|
||||
} else if (m_extGapTimer.hasExpired()) {
|
||||
if (!m_rfSignal) {
|
||||
DEBUG1("State to LISTENING");
|
||||
m_state = FS_LISTENING;
|
||||
serial.writeFMStatus(m_state);
|
||||
}
|
||||
|
||||
m_needReverse = true;
|
||||
m_extSignal = false;
|
||||
m_needReverse = true;
|
||||
m_extSignal = false;
|
||||
m_extGapTimer.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,10 +75,17 @@ private:
|
||||
CFMTimer m_ackDelayTimer;
|
||||
CFMTimer m_hangTimer;
|
||||
CFMTimer m_reverseTimer;
|
||||
CFMTimer m_extGapTimer; // debounce for link-mode ext-audio underrun, see linkStateMachine()
|
||||
bool m_needReverse;
|
||||
CFMDirectFormI m_filterStage1;
|
||||
CFMDirectFormI m_filterStage2;
|
||||
CFMDirectFormI m_filterStage3;
|
||||
CFMDirectFormI m_dsFilterStage1; // anti-alias filter for the downsampler, own state
|
||||
CFMDirectFormI m_dsFilterStage2;
|
||||
CFMDirectFormI m_dsFilterStage3;
|
||||
CFMDirectFormI m_usFilterStage1; // reconstruction filter for the upsampler, own state
|
||||
CFMDirectFormI m_usFilterStage2;
|
||||
CFMDirectFormI m_usFilterStage3;
|
||||
CFMBlanking m_blanking;
|
||||
uint8_t m_accessMode;
|
||||
bool m_linkMode;
|
||||
|
||||
@@ -34,6 +34,7 @@ m_sampleIndex(0U)
|
||||
|
||||
void CFMDownSampler::addSample(q15_t sample)
|
||||
{
|
||||
sample = __SSAT(sample, 12);//clamp before packing to 12 bits
|
||||
uint32_t usample = uint32_t(int32_t(sample) + 2048);
|
||||
//only take one of three samples
|
||||
switch(m_sampleIndex){
|
||||
@@ -74,6 +75,8 @@ uint16_t CFMDownSampler::getData()
|
||||
void CFMDownSampler::reset()
|
||||
{
|
||||
m_sampleIndex = 0U;
|
||||
m_samplePack = 0U;
|
||||
m_ringBuffer.reset();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+4
-1
@@ -36,7 +36,8 @@ m_count(0U),
|
||||
m_q0(0),
|
||||
m_q1(0),
|
||||
m_state(false),
|
||||
m_validCount(0U)
|
||||
m_validCount(0U),
|
||||
m_invalidCount(0U)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -127,6 +128,8 @@ void CFMNoiseSquelch::reset()
|
||||
m_q1 = 0;
|
||||
m_state = false;
|
||||
m_count = 0U;
|
||||
m_validCount = 0U;
|
||||
m_invalidCount = 0U;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -110,7 +110,7 @@ void CIO::initInt()
|
||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||
pinMode(PIN_POCSAG, OUTPUT);
|
||||
#endif
|
||||
#if !defined(USE_ALTERNATE_POCSAG_LEDS)
|
||||
#if !defined(USE_ALTERNATE_FM_LEDS)
|
||||
pinMode(PIN_FM, OUTPUT);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+7
-3
@@ -61,7 +61,7 @@ void CSTMUART::handleIRQ()
|
||||
if (USART_GetITStatus(m_usart, USART_IT_RXNE)) {
|
||||
if(!m_rxFifo.isFull())
|
||||
m_rxFifo.put((uint8_t) USART_ReceiveData(m_usart));
|
||||
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
|
||||
USART_ClearITPendingBit(m_usart, USART_IT_RXNE);
|
||||
}
|
||||
|
||||
if (USART_GetITStatus(m_usart, USART_IT_TXE)) {
|
||||
@@ -82,8 +82,12 @@ void CSTMUART::flush()
|
||||
if(m_usart == NULL)
|
||||
return;
|
||||
|
||||
// wait until the TXE shows the shift register is empty
|
||||
while (USART_GetITStatus(m_usart, USART_FLAG_TXE))
|
||||
// wait until the TX FIFO has drained
|
||||
while (!m_txFifo.isEmpty())
|
||||
;
|
||||
|
||||
// wait until the TC flag shows the shift register is empty
|
||||
while (USART_GetFlagStatus(m_usart, USART_FLAG_TC) == RESET)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
+13
-2
@@ -45,6 +45,7 @@ const uint8_t MMDVM_DSTAR_DATA = 0x11U;
|
||||
const uint8_t MMDVM_DSTAR_LOST = 0x12U;
|
||||
const uint8_t MMDVM_DSTAR_EOT = 0x13U;
|
||||
|
||||
const uint8_t MMDVM_DMR_ALOHA = 0x17U;
|
||||
const uint8_t MMDVM_DMR_DATA1 = 0x18U;
|
||||
const uint8_t MMDVM_DMR_LOST1 = 0x19U;
|
||||
const uint8_t MMDVM_DMR_DATA2 = 0x1AU;
|
||||
@@ -466,6 +467,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint16_t length)
|
||||
#endif
|
||||
|
||||
#if defined(MODE_DMR)
|
||||
bool trunking = (data[25U] & 128U) == 128U;
|
||||
uint8_t colorCode = data[26U];
|
||||
if (colorCode > 15U)
|
||||
return 4U;
|
||||
@@ -484,7 +486,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint16_t length)
|
||||
#if defined(MODE_DMR)
|
||||
m_dmrEnable = dmrEnable;
|
||||
dmrDMOTX.setTXDelay(txDelay);
|
||||
|
||||
dmrTX.setTrunking(trunking);
|
||||
dmrTX.setColorCode(colorCode);
|
||||
dmrRX.setColorCode(colorCode);
|
||||
dmrRX.setDelay(dmrDelay);
|
||||
@@ -743,7 +745,7 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
|
||||
DEBUG1("Mode set to FM 20Khz Calibrate");
|
||||
break;
|
||||
case STATE_FMCAL25K:
|
||||
DEBUG1("Mode set to FM 10Khz Calibrate");
|
||||
DEBUG1("Mode set to FM 25Khz Calibrate");
|
||||
break;
|
||||
case STATE_FMCAL30K:
|
||||
DEBUG1("Mode set to FM 30Khz Calibrate");
|
||||
@@ -1123,6 +1125,15 @@ void CSerialPort::processMessage(uint8_t type, const uint8_t* buffer, uint16_t l
|
||||
}
|
||||
break;
|
||||
|
||||
case MMDVM_DMR_ALOHA:
|
||||
if (m_dmrEnable)
|
||||
err = dmrTX.writeAloha(buffer, length);
|
||||
if (err != 0U) {
|
||||
DEBUG2("Received invalid DMR ALOHA", err);
|
||||
sendNAK(type, err);
|
||||
}
|
||||
break;
|
||||
|
||||
case MMDVM_DMR_ABORT:
|
||||
if (m_dmrEnable)
|
||||
err = dmrTX.writeAbort(buffer, length);
|
||||
|
||||
Reference in New Issue
Block a user