-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathstdio_driver.h
56 lines (40 loc) · 1.57 KB
/
stdio_driver.h
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
45
46
47
48
49
50
51
52
53
54
55
56
/**
\file
\brief Driver for connecting standard IO to a serial port
\author Ib Havn
\version 1.0.0
\defgroup stdio_driver Driver for connecting standard IO.
\{
\brief Driver to connect a USART to standard IO.
\defgroup stdio_driver_creation Functions to create and initialize the driver.
\brief How to initialise the driver.
\defgroup stdio_driver_functions Stdio driver common functions.
\brief Normally used functions.
\}
*/
#ifndef STDIO_DRIVER_H_
#define STDIO_DRIVER_H_
#include <stdbool.h>
/* ======================================================================================================================= */
/**
\ingroup stdio_driver_creation
\brief Initialise the stdio driver.
Initialise the driver.
Connects stdin and stdout to the usartNo given.
The USART are setup like this: 57600 baud,
8-bit Data bits, 1 Stop bit and No parity.
After this function is called, it is possible to use printf(), scanf etc.
\note This function must be called before using printf(), scanf etc.
\note Remember to enable global interrupt by calling sei() after the driver is initialised.
\param[in] usartNo no of the USART to setup and connect to stdin and stdout [0..3].
*/
void stdio_initialise(uint8_t usartNo);
/* ======================================================================================================================= */
/**
\ingroup stdio_driver_functions
Check if there is any inputs ready in the input queue.
That can prevent a program from blocking when waiting for stdio.
\return true if input is waiting.
*/
bool stdio_inputIsWaiting(void);
#endif /* STDIO_DRIVER_H_ */