Hello, I want to thank you for creating the Maple. I've been learning a lot with my RET6.
I've been working on different ways to stream data to and from the maple. One method I've been looking at is the USARTs. I've been testing them at 2Mb/s with both the FT232RL and FT2232H USB-to-serial solutions. The good news is that it seems to work well and in my tests I get around 180KB/s pretty consistently. I had noticed that intermittently I'm getting errors with the FT232RL approaches. I haven't ever seen it happen with the FT2232H but my sample is limited to a few runs with the longest being about 5 hours. I'm not certain what the cause is because the mean failure time is around every 90 million bytes transferred with a wide variation.
Anyway, I'm not seeking to debug the problem in this post (another day), but to motivate why I thought to add hardware flow control. I have taken a stab at it and done some basic tests with it working when specialized to USART3.
Now I am asking for some help with a few questions:
1. I noticed that the HardwareSerial classes in wirish have private members, which seems to make it difficult to subclass them. Is this truly what is desired? Would using the protected attribute make more sense? I ended up creating HardwareSerialFlowControl as a subclass of Print because of this and duplicated a lot of the code in HardwareSerial.
Alternatively, the functionality could be added directly to HardwareSerial
2. In order to enable the rts/cts for the different USARTs I need something that allows the code to select the correct register bits. Right now, I use the "backdoor" to usart_dev in my main.cpp code to activate USART3 on the maple or maple-ret6. The HardwareSerial class relies upon usart_enable(this->usart_device) so should this go in libmaple proper in order to do the right thing.
3. Is there any easy way to allow the user to reference the correct pins for cts and rts for a given board and USART number. I notice that you use macros and the PIN_MAP to do this in HardwareSerial.cpp
I've forked libmaple on github and added my work-in-progress files:
https://github.com/cleemesser/libmaple/blob/master/wirish/include/wirish/HardwareSerialFlowControl.h
https://github.com/cleemesser/libmaple/blob/master/wirish/HardwareSerialFlowControl.cpp
In case someone wants to look at them.
Thanks again
-Chris