Warren Gay: ... > inline static int > usart_tx_ready(uint32_t usart) { > return (USART_SR(usart) & USART_SR_TXE) != 0; > } > > static void > uart_task(void *args) { > char ch; > > for (;;) { > /* Receive char to be TX */ > if ( xQueueReceive(uart_txq,&ch,500) == pdPASS ) { > while ( !usart_tx_ready(USART1) ) > taskYIELD(); /* Yield CPU to ready tasks */ > usart_send_blocking(USART1,ch); /* blocking call */ > } > } > }
This is how I'm doing it: http://aspodata.se/git/openhw/libarm/tty_fd_run.c ... > 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); Why not http://aspodata.se/git/openhw/libarm/stm32/tty_ll.h I use the above as in: http://aspodata.se/git/openhw/regulator/regulator.c it is strictly polled, even gives me simple command line editing. Regards, /Karl Hammar ----------------------------------------------------------------------- Aspö Data Lilla Aspö 148 S-742 94 Östhammar Sweden +46 173 140 57 ------------------------------------------------------------------------------ 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