printf.h
1 KB
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
#ifndef __PRINTF_H__
#define __PRINTF_H__
//#define UART_PRINTF_FIFO_ENABLE
//#define PRINTF_MAX_WAIT_TIME (1000 / OS_MSEC_PER_TICK + 1) //1000ms
#define PRINTF_MAX_WAIT_TIME ( 500 / OS_MSEC_PER_TICK + 1) //500ms
void printf_init( void );
/*
* for simple string output, recommend to use puts instread of printf
* puts is much more efficient than printf in this case
*/
int myputs( const char *str );
/*
*
format = %type
type = {
c - single byte, char type data
s - single byte string
S - wide/2byte string
d/D, - signed int
u/U, - unsigned int
x, - unsigned hexadecimal, lower case
X - unsigned hexadecimal, upper case
}
to print '%', use '%%'
to change output line, add suffix "\r\n"
to output str ended with wide character str, use '%S' & add suffix "\0\0"
*
*/
int myprintf( const char *format, ... );
int myprintf_no_os( const char *format, ... );
int myprintf_for_usbdev( const char *format, ... );
#endif //__PRINTF_H__