From a549503ade8bb29d7234c3d4c61ed6cab433dd0b Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Fri, 20 Oct 2017 21:56:28 +0000 Subject: basic uart: f4 and f3, prepping tests for usart-v2 use parity to at least test a little more of the common code --- tests/uart-basic/uart-basic.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/uart-basic/uart-basic.h (limited to 'tests/uart-basic/uart-basic.h') diff --git a/tests/uart-basic/uart-basic.h b/tests/uart-basic/uart-basic.h new file mode 100644 index 0000000..8e3b8f6 --- /dev/null +++ b/tests/uart-basic/uart-basic.h @@ -0,0 +1,44 @@ +/* + * Karl Palsson Oct 2017 + * Considered to be available under your choice of: + * BSD2 clause, Apache2, MIT, X11 or ISC licenses + */ + +#pragma once + +#include +#include + +struct ub_hw { + /** usart itself, eg USART2 */ + uint32_t uart; + /** RCC_xxx flag for this usart, eg RCC_USART2 */ + uint32_t uart_rcc; + /** eg NVIC_USART2_IRQ */ + uint32_t uart_nvic; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Initialise the uart itself. + * gpios are required to have been already configured as needed + * @param ub + */ +void ub_init(struct ub_hw *ub); + +/** + * Call this, it will "do stuff" + */ +void ub_task(void); + +/** + * Call this from your board irq handler, it will "do the right thing" + */ +void ub_irq_handler(void); + +#ifdef __cplusplus +} +#endif -- cgit