GlobLib
HAL and API libraries for MCUs and hardware.
string11.h
Go to the documentation of this file.
1 
47 #ifndef STRING11_H
48 #define STRING11_H
49 
50 #include <stdio.h>
51 
55 typedef void(*v_fp_u8)(uint8_t);
56 
60 #define print(X) _Generic((X), \
61  char: print_c, \
62  uint8_t: print_u8, \
63  int8_t: print_8, \
64  uint16_t: print_u16, \
65  int16_t: print_16, \
66  uint32_t: print_u32, \
67  int32_t: print_32, \
68  float: print_f, \
69  int: print_32, \
70  char*: print_s, \
71  default: print_c \
72  )(X)
73 
77 #define prints(X) _Generic((X), \
78  char: prints_c, \
79  uint8_t: prints_u8, \
80  int8_t: prints_8, \
81  uint16_t: prints_u16, \
82  int16_t: prints_16, \
83  uint32_t: prints_u32, \
84  int32_t: prints_32, \
85  float: prints_f, \
86  int: prints_32, \
87  char*: prints_s, \
88  default: prints_c \
89  )(X)
90 
93 #define printc(X) _Generic((X), \
94  char: printc_c, \
95  uint8_t: printc_u8, \
96  int8_t: printc_8, \
97  uint16_t: printc_u16, \
98  int16_t: printc_16, \
99  uint32_t: printc_u32, \
100  int32_t: printc_32, \
101  float: printc_f, \
102  int: printc_32, \
103  char*: printc_s, \
104  default: printc_c \
105  )(X)
106 
110 #define printl(X) _Generic((X), \
111  char: printl_c, \
112  uint8_t: printl_u8, \
113  int8_t: printl_8, \
114  uint16_t: printl_u16, \
115  int16_t: printl_16, \
116  uint32_t: printl_u32, \
117  int32_t: printl_32, \
118  float: printl_f, \
119  int: printl_32, \
120  char*: printl_s, \
121  default: printl_c \
122  )(X)
123 
127 #define printt(X) _Generic((X), \
128  char: printt_c, \
129  uint8_t: printt_u8, \
130  int8_t: printt_8, \
131  uint16_t: printt_u16, \
132  int16_t: printt_16, \
133  uint32_t: printt_u32, \
134  int32_t: printt_32, \
135  float: printt_f, \
136  int: printt_32, \
137  char*: printt_s, \
138  default: printt_c \
139  )(X)
140 
143 #define MAX_DEC 4
144 
150 int32_t str2int(char *buffer);
151 
157 uint32_t str2uint(char *buffer);
163 float str2float(char *buffer);
164 
171 void STRING11_setOutput(void (*out)(uint8_t));
172 
178 
185 void print_c(char x);
192 void print_u8(uint8_t x);
199 void print_8(int8_t x);
206 void print_u16(uint16_t x);
213 void print_16(int16_t x);
220 void print_u32(uint32_t x);
227 void print_32(int32_t x);
234 void print_f(float x);
241 void print_s(char *x);
248 void prints_c(char x);
255 void prints_u8(uint8_t x);
262 void prints_8(int8_t x);
269 void prints_u16(uint16_t x);
276 void prints_16(int16_t x);
283 void prints_u32(uint32_t x);
290 void prints_32(int32_t x);
297 void prints_f(float x);
304 void prints_s(char *x);
311 void printt_c(char x);
318 void printt_u8(uint8_t x);
325 void printt_8(int8_t x);
332 void printt_u16(uint16_t x);
339 void printt_16(int16_t x);
346 void printt_u32(uint32_t x);
353 void printt_32(int32_t x);
360 void printt_f(float x);
367 void printt_s(char *x);
374 void printc_c(char x);
381 void printc_u8(uint8_t x);
388 void printc_8(int8_t x);
395 void printc_u16(uint16_t x);
402 void printc_16(int16_t x);
409 void printc_u32(uint32_t x);
416 void printc_32(int32_t x);
423 void printc_f(float x);
430 void printc_s(char *x);
437 void printl_c(char x);
444 void printl_u8(uint8_t x);
451 void printl_8(int8_t x);
458 void printl_u16(uint16_t x);
465 void printl_16(int16_t x);
472 void printl_u32(uint32_t x);
479 void printl_32(int32_t x);
486 void printl_f(float x);
493 void printl_s(char *x);
494 
498 #endif
void printl_u8(uint8_t x)
Send a unsigned byte plus a new line to the output stream. Implemented internally.
Definition: string11.c:411
void printl_c(char x)
Send a character plus a new line to the output stream. Implemented internally.
Definition: string11.c:404
float str2float(char *buffer)
Convert a null terminated string to a float.
Definition: string11.c:76
void printc_32(int32_t x)
Send a signed integer plus a comma to the output stream. Implemented internally.
Definition: string11.c:386
void printl_16(int16_t x)
Send a signed short plus a new line to the output stream. Implemented internally. ...
Definition: string11.c:433
void printt_8(int8_t x)
Send a signed byte plus a tab to the output stream. Implemented internally.
Definition: string11.c:481
void printt_u8(uint8_t x)
Send a unsigned byte plus a tab to the output stream. Implemented internally.
Definition: string11.c:474
void STRING11_setOutput(void(*out)(uint8_t))
Set the target output stream for print functions.
Definition: string11.c:122
void print_u16(uint16_t x)
Send a unsigned short to the output stream. Implemented internally.
Definition: string11.c:178
void(* v_fp_u8)(uint8_t)
Function pointer typedef for void function with uint8_t parameter.
Definition: string11.h:55
v_fp_u8 STRING11_getOutput(void)
Get the current target output stream.
Definition: string11.c:128
void printt_u16(uint16_t x)
Send a unsigned short plus a tab to the output stream. Implemented internally.
Definition: string11.c:487
void print_16(int16_t x)
Send a signed short to the output stream. Implemented internally.
Definition: string11.c:203
void printc_u16(uint16_t x)
Send a unsigned short plus a comma to the output stream. Implemented internally.
Definition: string11.c:368
void print_c(char x)
Send a character to the output stream. Implemented internally.
Definition: string11.c:137
void printt_u32(uint32_t x)
Send a unsigned integer plus a tab to the output stream. Implemented internally.
Definition: string11.c:499
void printl_f(float x)
Send a float plus a new line to the output stream. Implemented internally.
Definition: string11.c:454
void printt_f(float x)
Send a float plus a tab to the output stream. Implemented internally.
Definition: string11.c:511
void prints_8(int8_t x)
Send a signed byte plus a space to the output stream. Implemented internally.
Definition: string11.c:307
void printl_u32(uint32_t x)
Send a unsigned integer plus a new line to the output stream. Implemented internally.
Definition: string11.c:440
int32_t str2int(char *buffer)
Convert a null terminated string to an integer.
Definition: string11.c:21
void printt_c(char x)
Send a character plus a tab to the output stream. Implemented internally.
Definition: string11.c:468
void printt_32(int32_t x)
Send a signed integer plus a tab to the output stream. Implemented internally.
Definition: string11.c:505
void print_32(int32_t x)
Send a signed integer to the output stream. Implemented internally.
Definition: string11.c:243
void printt_s(char *x)
Send a string literal plus a tab to the output stream. Implemented internally.
Definition: string11.c:517
void prints_16(int16_t x)
Send a signed short plus a space to the output stream. Implemented internally.
Definition: string11.c:319
void prints_u8(uint8_t x)
Send a unsigned byte plus a space to the output stream. Implemented internally.
Definition: string11.c:300
void printc_u32(uint32_t x)
Send a unsigned integer plus a comma to the output stream. Implemented internally.
Definition: string11.c:380
void print_u8(uint8_t x)
Send a unsigned byte to the output stream. Implemented internally.
Definition: string11.c:142
void prints_u32(uint32_t x)
Send a unsigned integer plus a space to the output stream. Implemented internally.
Definition: string11.c:325
void printl_s(char *x)
Send a string literal plus a new line to the output stream. Implemented internally.
Definition: string11.c:461
void print_f(float x)
Send a float to the output stream. Implemented internally.
Definition: string11.c:258
void prints_u16(uint16_t x)
Send a unsigned short plus a space to the output stream. Implemented internally.
Definition: string11.c:313
void printc_f(float x)
Send a float plus a comma to the output stream. Implemented internally.
Definition: string11.c:392
void prints_f(float x)
Send a float plus a space to the output stream. Implemented internally.
Definition: string11.c:337
void prints_s(char *x)
Send a string literal plus a space to the output stream. Implemented internally.
Definition: string11.c:343
void printl_u16(uint16_t x)
Send a unsigned short plus a new line to the output stream. Implemented internally.
Definition: string11.c:426
void printl_8(int8_t x)
Send a signed byte plus a new line to the output stream. Implemented internally.
Definition: string11.c:419
void print_s(char *x)
Send a string literal to the output stream. Implemented internally.
Definition: string11.c:284
void print_8(int8_t x)
Send a signed byte to the output stream. Implemented internally.
Definition: string11.c:165
void printc_8(int8_t x)
Send a signed byte plus a comma to the output stream. Implemented internally.
Definition: string11.c:362
uint32_t str2uint(char *buffer)
Convert a null terminated string to an unsigned integer.
Definition: string11.c:56
void prints_32(int32_t x)
Send a signed integer plus a space to the output stream. Implemented internally.
Definition: string11.c:331
void printc_16(int16_t x)
Send a signed short plus a comma to the output stream. Implemented internally.
Definition: string11.c:374
void prints_c(char x)
Send a character plus a space to the output stream. Implemented internally.
Definition: string11.c:294
void print_u32(uint32_t x)
Send a unsigned integer to the output stream. Implemented internally.
Definition: string11.c:217
void printl_32(int32_t x)
Send a signed integer plus a new line to the output stream. Implemented internally.
Definition: string11.c:447
void printc_c(char x)
Send a character plus a comma to the output stream. Implemented internally.
Definition: string11.c:349
void printc_s(char *x)
Send a string literal plus a comma to the output stream. Implemented internally.
Definition: string11.c:398
void printt_16(int16_t x)
Send a signed short plus a tab to the output stream. Implemented internally.
Definition: string11.c:493
void printc_u8(uint8_t x)
Send a unsigned byte plus a comma to the output stream. Implemented internally.
Definition: string11.c:355