basic uart: f4 and f3, prepping tests for usart-v2
use parity to at least test a little more of the common code
This commit is contained in:
parent
cb376f3959
commit
a549503ade
6 changed files with 372 additions and 0 deletions
44
tests/uart-basic/uart-basic.h
Normal file
44
tests/uart-basic/uart-basic.h
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue