Add CD LED functionality to MMDVMHost

This commit is contained in:
phl0
2016-11-17 11:48:42 +01:00
parent cb35888d0e
commit 8373dc0b8a
5 changed files with 38 additions and 2 deletions

23
UMP.cpp
View File

@@ -31,6 +31,7 @@ const unsigned char UMP_HELLO = 0x00U;
const unsigned char UMP_SET_MODE = 0x01U;
const unsigned char UMP_SET_TX = 0x02U;
const unsigned char UMP_SET_CD = 0x03U;
const unsigned char UMP_WRITE_SERIAL = 0x10U;
const unsigned char UMP_READ_SERIAL = 0x11U;
@@ -47,7 +48,8 @@ m_length(0U),
m_offset(0U),
m_lockout(false),
m_mode(MODE_IDLE),
m_tx(false)
m_tx(false),
m_cd(false)
{
m_buffer = new unsigned char[BUFFER_LENGTH];
}
@@ -125,6 +127,25 @@ bool CUMP::setTX(bool on)
return m_serial.write(buffer, 4U) == 4;
}
bool CUMP::setCD(bool on)
{
if (on == m_cd)
return true;
m_cd = on;
unsigned char buffer[4U];
buffer[0U] = UMP_FRAME_START;
buffer[1U] = 4U;
buffer[2U] = UMP_SET_CD;
buffer[3U] = on ? 0x01U : 0x00U;
// CUtils::dump(1U, "Transmitted", buffer, 4U);
return m_serial.write(buffer, 4U) == 4;
}
bool CUMP::getLockout() const
{
return m_lockout;