blob: 8e3b8f6c9627cefed725160767fc014dc502b375 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
|