-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelperv2.c
64 lines (42 loc) · 912 Bytes
/
helperv2.c
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
57
58
59
60
61
62
63
64
#include "helperv2.h"
struct FILE {int handle;/* Add whatever you need here */};
FILE __stdout;
FILE __stdin;
int fputc(int ch, FILE *f)
{
ITM_SendChar(ch);
return(ch);
}
void log_error(char *p)
{
printf("log Error: ");
printf((char*)p);
printf("\r\n");
}
void log_info(char *p)
{
printf("log info: ");
printf((char*)p);
printf("\r\n");
}
void log_debug(char *p)
{
printf("log debug: ");
printf((char*)p);
printf("\r\n");
}
void log_debug_array(char const * const label, void const *array, uint16_t const len)
{
printf("log debug array: ");
for (uint16_t i = 0; i < len; i++)
{
uint8_t val = *((uint8_t *)(array + i));
printf("0x%02X", val);
// Add ", " after all elements except the last one.
if (i < len - 1)
{
printf(", ");
}
}
printf("}\n");
}