diff options
author | Karl Palsson <karlp@tweak.net.au> | 2017-10-20 21:56:28 +0000 |
---|---|---|
committer | Karl Palsson <karlp@tweak.net.au> | 2017-10-24 23:48:28 +0000 |
commit | a549503ade8bb29d7234c3d4c61ed6cab433dd0b (patch) | |
tree | e572c727dfabff11842b91eb064d468077d44ca1 /tests/uart-basic/uart-basic.h | |
parent | cb376f395911d6face5a107cd4c543d7a03249b8 (diff) | |
download | olsndot-a549503ade8bb29d7234c3d4c61ed6cab433dd0b.tar.gz olsndot-a549503ade8bb29d7234c3d4c61ed6cab433dd0b.tar.bz2 olsndot-a549503ade8bb29d7234c3d4c61ed6cab433dd0b.zip |
basic uart: f4 and f3, prepping tests for usart-v2
use parity to at least test a little more of the common code
Diffstat (limited to 'tests/uart-basic/uart-basic.h')
-rw-r--r-- | tests/uart-basic/uart-basic.h | 44 |
1 files changed, 44 insertions, 0 deletions
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 <karlp@tweak.net.au> Oct 2017 + * Considered to be available under your choice of: + * BSD2 clause, Apache2, MIT, X11 or ISC licenses + */ + +#pragma once + +#include <stdint.h> +#include <libopencm3/stm32/usart.h> + +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 |