mirror of https://github.com/g4klx/MMDVM.git
Add the transmit function.
This commit is contained in:
parent
f65d52bf2f
commit
54745130c2
16
CalM17.cpp
16
CalM17.cpp
|
@ -33,7 +33,8 @@ const uint8_t PREAMBLE[] = {0x00U,
|
||||||
0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U,
|
0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U,
|
||||||
0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U};
|
0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U, 0x77U};
|
||||||
|
|
||||||
CCalM17::CCalM17()
|
CCalM17::CCalM17() :
|
||||||
|
m_transmit(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +42,9 @@ void CCalM17::process()
|
||||||
{
|
{
|
||||||
m17TX.process();
|
m17TX.process();
|
||||||
|
|
||||||
|
if (!m_transmit)
|
||||||
|
return;
|
||||||
|
|
||||||
uint16_t space = m17TX.getSpace();
|
uint16_t space = m17TX.getSpace();
|
||||||
if (space < 2U)
|
if (space < 2U)
|
||||||
return;
|
return;
|
||||||
|
@ -48,5 +52,15 @@ void CCalM17::process()
|
||||||
m17TX.writeData(PREAMBLE, M17_FRAME_LENGTH_BYTES + 1U);
|
m17TX.writeData(PREAMBLE, M17_FRAME_LENGTH_BYTES + 1U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t CCalM17::write(const uint8_t* data, uint16_t length)
|
||||||
|
{
|
||||||
|
if (length != 1U)
|
||||||
|
return 4U;
|
||||||
|
|
||||||
|
m_transmit = data[0U] == 1U;
|
||||||
|
|
||||||
|
return 0U;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
3
CalM17.h
3
CalM17.h
|
@ -31,7 +31,10 @@ public:
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
uint8_t write(const uint8_t* data, uint16_t length);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_transmit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ void CSerialPort::processMessage(uint8_t type, const uint8_t* buffer, uint16_t l
|
||||||
#endif
|
#endif
|
||||||
#if defined(MODE_M17)
|
#if defined(MODE_M17)
|
||||||
if (m_modemState == STATE_M17CAL)
|
if (m_modemState == STATE_M17CAL)
|
||||||
err = 0U;
|
err = calM17.write(buffer, length);
|
||||||
#endif
|
#endif
|
||||||
#if defined(MODE_POCSAG)
|
#if defined(MODE_POCSAG)
|
||||||
if (m_modemState == STATE_POCSAGCAL)
|
if (m_modemState == STATE_POCSAGCAL)
|
||||||
|
|
Loading…
Reference in New Issue