Hi, not sure if this is the right place to be posting this, but I was looking for a library to emulate behaviour of a UART on the Arduino Due which isn’t of AVR architecture (and so unable to use software serial). I came across a library soft_uart written by antodom that seems to fit my use case, but I don’t really understand how the weird object type (my code editor shows its type as
typedef soft_uart::arduino_due::serial<soft_uart::arduino_due::timer_ids::TIMER_TC0, 128U, 128U> soft_uart::arduino_due::serial_tc0_t
in my code snippet
auto &stc0 = soft_uart::arduino_due::serial_tc0;
which is then passed into the Roboclaw constructor which takes in
(*HardwareSerial, uint32_t) like this:
I have trouble understanding why I would need to use the
& operator twice and how this somehow is able to cast into a hardwareserial pointer. My code is able to transmit to the roboclaw but is unable to receive data from the roboclaw(receives -1 when trying to read, which indicates no data is available from the serial port).
Would appreciate any possible leads or snippets of information! thanks
auto &stc0 initializes a reference to the global tc0 object, while passing (&stc0, timeout) is passing the address of the reference to the constructor. My issue was fixed by modifying the serial config of the software uart library to 8N1 serial config, silly me.