On Fri, Feb 24, 2017 at 5:39 PM, <k...@aspodata.se> wrote:
> Warren Gay:
> ...
> > inline static int
> > usart_tx_ready(uint32_t usart) {
> > return (USART_SR(usart) & USART_SR_TXE) != 0;
> > }
> ...
> This is how I'm doing it:
> http://aspodata.se/git/openhw/libarm/tty_fd_run.c
>
> Polling is ok for output, for most applications anyway. But for receive I
find that it is pretty much mandatory, unless you're doing simple keyboard
input. If you do any packets (SLIP protocol etc.) you have to have a RX ISR
to avoid losing data.
> ...
> > So it would be a welcome addition to the libopencm3 library to provide
> > routines:
> >
> > int usart_send_ready(uint32_t usart);
> > int usart_recv_ready(uint32_t usart);
>
Like many other folks, I know how to do this myself, but that isn't the
point. Going further ideally, libopencm3 would have an interrupt based RX
driver available. But no matter, it's not rocket science. I have one
nearing completion for my own use.
Warren
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel