-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathtriceExamples.c
More file actions
80 lines (73 loc) Β· 4.08 KB
/
triceExamples.c
File metadata and controls
80 lines (73 loc) Β· 4.08 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-License-Identifier: MIT
//! \file triceExamples.c
#include "trice.h"
#if !TRICE_OFF
//! TriceHeadLine emits a decorated name. The name length should be 18 characters.
void TriceHeadLine(char * name) {
//! This is usable as the very first trice sequence after restart. Adapt it. Use a UTF-8 capable editor like VS-Code or use pure ASCII.
triceS("w: Hello! ππ \n\n β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨β¨ \n ππππ%sππππ\n πππππππππππππππππ \n\n\n", name);
}
//! SomeExampleTrices generates a few Trice example logs and a burst of Trices.
void SomeExampleTrices(int burstCount) {
// TRICE32_0(ID(0), "att:π Speedy Gonzales A 32-bit time stamp\n");
// TRICE32_0(ID(0), "att:π Speedy Gonzales B 32-bit time stamp\n");
// TRICE32_0(ID(0), "att:π Speedy Gonzales C 32-bit time stamp\n");
// TRICE32_0(ID(0), "att:π Speedy Gonzales D 32-bit time stamp\n");
// TRICE32_0(Id(0), "att:π Speedy Gonzales E 16-bit time stamp\n");
// TRICE32_0(Id(0), "att:π Speedy Gonzales F 16-bit time stamp\n");
// TRICE32_0(Id(0), "att:π Speedy Gonzales G 16-bit time stamp\n");
// TRICE32_0(Id(0), "att:π Speedy Gonzales H 16-bit time stamp\n");
// TRICE32_0(id(0), "att:π Speedy Gonzales I without time stamp\n");
// TRICE32_0(id(0), "att:π Speedy Gonzales J without time stamp\n");
// TRICE32_0(id(0), "att:π Speedy Gonzales K without time stamp\n");
// TRICE32_0(id(0), "att:π Speedy Gonzales L without time stamp\n");
TRice("att:π Speedy Gonzales a 32-bit time stamp\n");
TRice("att:π Speedy Gonzales b 32-bit time stamp\n");
TRice("att:π Speedy Gonzales c 32-bit time stamp\n");
TRice("att:π Speedy Gonzales d 32-bit time stamp\n");
Trice("att:π Speedy Gonzales e 16-bit time stamp\n");
Trice("att:π Speedy Gonzales f 16-bit time stamp\n");
Trice("att:π Speedy Gonzales g 16-bit time stamp\n");
Trice("att:π Speedy Gonzales h 16-bit time stamp\n");
// trice("att:π Speedy Gonzales i without time stamp\n");
// trice("att:π Speedy Gonzales j without time stamp\n");
// trice("att:π Speedy Gonzales k without time stamp\n");
// trice("att:π Speedy Gonzales l without time stamp\n");
char* aString = "2.71828182845904523536";
TriceS("rd:%s <- float number as string\n", aString);
Trice64("msg:%.20f (double with more ciphers than precision)\n", aDouble(2.71828182845904523536));
Trice("msg:%.20f (float with more ciphers than precision)\n", aFloat(2.71828182845904523536f));
Trice("msg:%f (default rounded float)\n", aFloat(2.71828182845904523536f));
Trice("info:A Buffer:\n");
Trice8B("msg:%02x \n", aString, strlen(aString));
Trice32B("msg:%08x \n", aString, strlen(aString) >> 2);
Trice16F("att:ARemoteFunctionName", aString, strlen(aString) >> 1);
trice("info:%d times a 16 byte long Trice messages, which may not be written all if the buffer is too small:\n", burstCount);
for (int i = 0; i < burstCount; i++) {
Trice("i=%x %x\n", 0x44444400 + i, 0xaaaaaa00 + i);
}
}
//! LogTriceConfiguration shows a few configuration settings.
void LogTriceConfiguration(void) {
#ifdef LogConfigInfo
LogConfigInfo();
#endif
trice("deb:TRICE_DIRECT_OUTPUT == %d, TRICE_DEFERRED_OUTPUT == %d\n", TRICE_DIRECT_OUTPUT, TRICE_DEFERRED_OUTPUT);
#if TRICE_BUFFER == TRICE_STACK_BUFFER
trice("deb:TRICE_STACK_BUFFER, ");
#elif TRICE_BUFFER == TRICE_STATIC_BUFFER
trice("deb:TRICE_STATIC_BUFFER, ");
#elif TRICE_BUFFER == TRICE_DOUBLE_BUFFER
trice("deb:TRICE_DOUBLE_BUFFER, ");
#elif TRICE_BUFFER == TRICE_RING_BUFFER
trice("deb:TRICE_RING_BUFFER, ");
#endif
#if TRICE_DEFERRED_TRANSFER_MODE == TRICE_SINGLE_PACK_MODE
trice("deb:TRICE_SINGLE_PACK_MODE\n");
#else
trice("deb:TRICE_MULTI_PACK_MODE\n");
#endif
trice("deb:_CYCLE == %d, _PROTECT == %d, _DIAG == %d, XTEA == %d\n", TRICE_CYCLE_COUNTER, TRICE_PROTECT, TRICE_DIAGNOSTICS, TRICE_DEFERRED_XTEA_ENCRYPT);
trice("d:_SINGLE_MAX_SIZE=%d, _BUFFER_SIZE=%d, _DEFERRED_BUFFER_SIZE=%d\n", TRICE_SINGLE_MAX_SIZE, TRICE_BUFFER_SIZE, TRICE_DEFERRED_BUFFER_SIZE);
}
#endif // #if !TRICE_OFF