]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - rpp/include/rpp/sci.h
Fixed an error on main template file in case DEBUG is not defined. Implemented rpp_sc...
[pes-rpp/rpp-lib.git] / rpp / include / rpp / sci.h
1 /**
2  * Serial Communication Interface RPP API header file.
3  *
4  * @file sci.h
5  *
6  * @copyright Copyright (C) 2013 Czech Technical University in Prague
7  *
8  * @author Carlos Jenkins <carlos@jenkins.co.cr>
9  */
10
11
12 #ifndef __RPP_SCI_H
13 #define __RPP_SCI_H
14
15 /**
16  * SCI module initialization.
17  * Call this method before using this module.
18  *
19  * @return SUCCESS if initialization successful.
20  *          FAILURE is module already initialized.
21  */
22 int8_t rpp_sci_init();
23
24
25 /**
26  * SCI module setup.
27  * Configure the SCI module.
28  *
29  * @param[in] baud      Baud rate for the SCI. Tested values are 9600 and FIXME
30  *                      Default is 9600.
31  *
32  * @return TRUE if baud rate is a known value.
33  *          FALSE otherwise.
34  */
35 boolean_t rpp_sci_setup(uint32_t baud);
36
37
38 /**
39  * C's printf using RPP SCI module.
40  * Implementation uses vsnprintf() from stdio.h using a fixed 128 bytes buffer.
41  *
42  * @param[in] format    C string that contains a format string that follows the
43  *                      same specifications as format in printf (see stdio.h's
44  *                      printf for details).
45  * @param[in] ...       (additional arguments) Depending on the format string,
46  *                      the function may expect a sequence of additional
47  *                      arguments, each containing a value to be used to replace
48  *                      a format specifier in the format string (or a pointer to
49  *                      a storage location).
50  *                      There should be at least as many of these arguments as
51  *                      the number of values specified in the format specifiers.
52  *                      Additional arguments are ignored by the function.
53  *
54  * @return The number of characters that would have been written if the buffer
55  *         had been sufficiently large, not counting the terminating null
56  *         character. If an encoding error occurs, a negative number is
57  *         returned. Please note that only when this returned value is
58  *         non-negative and less than the buffer size, the string has been
59  *         completely written.
60  */
61 int rpp_sci_printf(const char *format, ...);
62
63
64 #endif /* __RPP_SCI_H */
65