yincheng zhong
2018-05-12 307c639db1993394c83013231bedb941c3e951b3
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
/*------------------------------------------------------------------------*/
/* Universal string handler for user console interface  (C)ChaN, 2011     */
/*------------------------------------------------------------------------*/
 
#ifndef _STRFUNC
#define _STRFUNC
 
#define _USE_XFUNC_OUT    1    /* 1: Use output functions */
#define    _CR_CRLF        0    /* 1: Convert \n ==> \r\n in the output char */
 
#define _USE_XFUNC_IN    1    /* 1: Use input function */
#define    _LINE_ECHO        1    /* 1: Echo back input chars in xgets function */
 
 
#if _USE_XFUNC_OUT
void xPrintf_Init(void);
unsigned char xUSART1_putchar(unsigned char ch);
unsigned char xUSART2_putchar(unsigned char ch);
 
#define xdev_out(func) xfunc_out = (void(*)(unsigned char))(func)
extern void (*xfunc_out)(unsigned char);
void xputc (char c);
void xputs (const char* str);
void xfputs (void (*func)(unsigned char), const char* str);
void xprintf (const char* fmt, ...);
void xsprintf (char* buff, const char* fmt, ...);
void xfprintf (void (*func)(unsigned char), const char*    fmt, ...);
void put_dump (const void* buff, unsigned long addr, int len, int width);
#define DW_CHAR        sizeof(char)
#define DW_SHORT    sizeof(short)
#define DW_LONG        sizeof(long)
#endif
 
#if _USE_XFUNC_IN
unsigned char xUSART1_getchar(void);
unsigned char xUSART2_getchar(void);
 
 
#define xdev_in(func) xfunc_in = (unsigned char(*)(void))(func)
extern unsigned char (*xfunc_in)(void);
int xgets (char* buff, int len);
uint32_t xgets_nowait (uint8_t * buffP, uint32_t length);
int xfgets (unsigned char (*func)(void), char* buff, int len);
int xatoi (char** str, long* res);
#endif
 
#endif