/* Enable the transmit interrupt. Called when data is ready to be sent. This routine should be ISR safe. */ void uart_hw_enable_tx_int(PUART_INFO uinfo) { uinfo = uinfo; EnableTx(); LastInterrupt = UART_OUTPUT_INTERRUPT; uart_interrupt(0); }
bool UartDevice::SendBuffer(vector<Byte> &&buf) { if (buf.size() == 0) { return true; } if(m_tx_buf->PushBlock(TxBuffer::Block(new vector<Byte>(std::move(buf))))) { EnableTx(); return true; } else { return false; } }
bool UartDevice::SendBuffer(unique_ptr<Byte[]> &&buf, const size_t len) { if (len == 0) { return true; } if(m_tx_buf->PushBlock(TxBuffer::Block(buf.release(), len))) { EnableTx(); return true; } else { return false; } }
bool UartDevice::SendStr(string &&str) { if (str.size() == 0) { return true; } if(m_tx_buf->PushBlock(TxBuffer::Block(new string(std::move(str))))) { EnableTx(); return true; } else { return false; } }
bool UartDevice::SendStrLiteral(const char *str) { const size_t size = strlen(str); if (size == 0) { return true; } if (m_tx_buf->PushBlock(TxBuffer::Block((Byte*)str, size, false))) { EnableTx(); return true; } else { return false; } }
bool UartDevice::SendBuffer(const Byte *buf, const size_t len) { if (len == 0) { return true; } Byte *data = new Byte[len]; memcpy(data, buf, len); if(m_tx_buf->PushBlock(TxBuffer::Block(data, len))) { EnableTx(); return true; } else { return false; } }
bool UartDevice::SendStr(unique_ptr<char[]> &&str) { const size_t size = strlen(str.get()); if (size == 0) { return true; } if(m_tx_buf->PushBlock(TxBuffer::Block(reinterpret_cast<Byte*>(str.release()), size))) { EnableTx(); return true; } else { return false; } }
bool UartDevice::SendStr(const char *str) { const size_t size = strlen(str); if (size == 0) { return true; } Byte *data = new Byte[size]; memcpy(data, str, size); if(m_tx_buf->PushBlock(TxBuffer::Block(data, size))) { EnableTx(); return true; } else { return false; } }