struct Task: public DUNE::Tasks::Task
{
// Serial port handle.
Hardware::SerialPort* m_uart;
// Task arguments.
Arguments m_args;
SerialPort::StopBits StopBits;
Task(const std::string& name, Tasks::Context& ctx):
DUNE::Tasks::Task(name, ctx),
m_uart(NULL) // ====================== Necessary?
{
// Define configuration parameters.
param("Serial Port - Device", m_args.uart_dev)
.defaultValue("")
.description("Serial port device used to communicate with the sensor");
param("Serial Port - Baud Rate", m_args.uart_baud)
.defaultValue("9600")
.description("Serial port baud rate");
/*
param("Serial Port - Stop bits", m_args.StopBits)
.defaultValue("SP_STOPBITS_2")
.description("Serial port stop bits");
*/
...
//! Acquire resources.
void
onResourceAcquisition(void)
{
m_uart = new SerialPort(m_args.uart_dev, m_args.uart_baud);
StopBits = SP_STOPBITS_2; // gives SP_STOPBITS_2 not declared error
m_uart->setStopBits(StopBits);
}
...
sendCommand(void)
{
static uint8_t cmd = 0x13;
uint8_t buf[1];
buf[0] = cmd;
unsigned int len = 1;
m_uart->doWrite(buf,len); // gives "doWrite() is private" error
}
m_uart = new SerialPort(m_args.uart_dev, m_args.uart_baud, Hardware::SerialPort::PARITY_NONE, Hardware::SerialPort::SP_STOPBITS_2);
//! The SerialPort class encapsulates serial port access.
class SerialPort: public IO::Handle
size_t
write(const uint8_t* data, size_t length)
size_t
write(const char* data, size_t length)
find -name "*.hpp" -o -name "*.cpp" | xargs grep "SerialPort"
--
You received this message because you are subscribed to the Google Groups "LSTS Toolchain" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lsts-toolchai...@googlegroups.com.
Visit this group at http://groups.google.com/group/lsts-toolchain.
To view this discussion on the web visit https://groups.google.com/d/msgid/lsts-toolchain/5c27b50f-f986-47d5-837a-c1caf5f4a2f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.