Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

triceExamples.c 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*!
  2. * \file triceExamples.c
  3. \author Thomas.Hoehenleitner [at] seerose.net
  4. * *****************************************************************************
  5. */
  6. #include "trice.h"
  7. #if !TRICE_OFF
  8. //! TriceHeadLine emits a decorated name. The name length should be 18 characters.
  9. void TriceHeadLine(char *name)
  10. {
  11. //! 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.
  12. //TriceS("w: Hello! 👋🙂\n\n ✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨ \n 🎈🎈🎈🎈%s🎈🎈🎈🎈\n 🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃 \n\n\n", name);
  13. }
  14. //! SomeExampleTrices generates a few Trice example logs and a burst of Trices.
  15. void SomeExampleTrices(int burstCount)
  16. {
  17. // TRICE32_0(ID(0), "att:🐁 Speedy Gonzales A 32-bit time stamp\n");
  18. // TRICE32_0(ID(0), "att:🐁 Speedy Gonzales B 32-bit time stamp\n");
  19. // TRICE32_0(ID(0), "att:🐁 Speedy Gonzales C 32-bit time stamp\n");
  20. // TRICE32_0(ID(0), "att:🐁 Speedy Gonzales D 32-bit time stamp\n");
  21. // TRICE32_0(Id(0), "att:🐁 Speedy Gonzales E 16-bit time stamp\n");
  22. // TRICE32_0(Id(0), "att:🐁 Speedy Gonzales F 16-bit time stamp\n");
  23. // TRICE32_0(Id(0), "att:🐁 Speedy Gonzales G 16-bit time stamp\n");
  24. // TRICE32_0(Id(0), "att:🐁 Speedy Gonzales H 16-bit time stamp\n");
  25. // TRICE32_0(id(0), "att:🐁 Speedy Gonzales I without time stamp\n");
  26. // TRICE32_0(id(0), "att:🐁 Speedy Gonzales J without time stamp\n");
  27. // TRICE32_0(id(0), "att:🐁 Speedy Gonzales K without time stamp\n");
  28. // TRICE32_0(id(0), "att:🐁 Speedy Gonzales L without time stamp\n");
  29. TRICE32_0(id(0), "att:🐁 Speedy Gonzales L without time stamp\n");
  30. #if 0
  31. TRice("att:🐁 Speedy Gonzales a 32-bit time stamp\n");
  32. TRice("att:🐁 Speedy Gonzales b 32-bit time stamp\n");
  33. TRice("att:🐁 Speedy Gonzales c 32-bit time stamp\n");
  34. TRice("att:🐁 Speedy Gonzales d 32-bit time stamp\n");
  35. Trice("att:🐁 Speedy Gonzales e 16-bit time stamp\n");
  36. Trice("att:🐁 Speedy Gonzales f 16-bit time stamp\n");
  37. Trice("att:🐁 Speedy Gonzales g 16-bit time stamp\n");
  38. Trice("att:🐁 Speedy Gonzales h 16-bit time stamp\n");
  39. // trice("att:🐁 Speedy Gonzales i without time stamp\n");
  40. // trice("att:🐁 Speedy Gonzales j without time stamp\n");
  41. // trice("att:🐁 Speedy Gonzales k without time stamp\n");
  42. // trice("att:🐁 Speedy Gonzales l without time stamp\n");
  43. char *aString = "2.71828182845904523536";
  44. TriceS("rd:%s <- float number as string\n", aString);
  45. Trice64("msg:%.20f (double with more ciphers than precision)\n", aDouble(2.71828182845904523536));
  46. Trice("msg:%.20f (float with more ciphers than precision)\n", aFloat(2.71828182845904523536));
  47. Trice("msg:%f (default rounded float)\n", aFloat(2.71828182845904523536));
  48. Trice("info:A Buffer:\n");
  49. Trice8B("msg:%02x \n", aString, strlen(aString));
  50. Trice32B("msg:%08x \n", aString, strlen(aString) >> 2);
  51. Trice16F("att:ARemoteFunctionName", aString, strlen(aString) >> 1);
  52. trice("info:%d times a 16 byte long Trice messages, which may not be written all if the buffer is too small:\n", burstCount);
  53. for (int i = 0; i < burstCount; i++)
  54. {
  55. Trice("i=%x %x\n", 0x44444400 + i, 0xaaaaaa00 + i);
  56. }
  57. #endif
  58. }
  59. //! LogTriceConfiguration shows a few configuration settings.
  60. void LogTriceConfiguration(void)
  61. {
  62. #ifdef LogConfigInfo
  63. LogConfigInfo();
  64. #endif
  65. #if 0
  66. trice("deb:TRICE_DIRECT_OUTPUT == %d, TRICE_DEFERRED_OUTPUT == %d\n", TRICE_DIRECT_OUTPUT, TRICE_DEFERRED_OUTPUT);
  67. #if TRICE_BUFFER == TRICE_STACK_BUFFER
  68. trice("deb:TRICE_STACK_BUFFER, ");
  69. #elif TRICE_BUFFER == TRICE_STATIC_BUFFER
  70. trice("deb:TRICE_STATIC_BUFFER, ");
  71. #elif TRICE_BUFFER == TRICE_DOUBLE_BUFFER
  72. trice("deb:TRICE_DOUBLE_BUFFER, ");
  73. #elif TRICE_BUFFER == TRICE_RING_BUFFER
  74. trice("deb:TRICE_RING_BUFFER, ");
  75. #endif
  76. #if TRICE_DEFERRED_TRANSFER_MODE == TRICE_SINGLE_PACK_MODE
  77. trice("deb:TRICE_SINGLE_PACK_MODE\n");
  78. #else
  79. trice("deb:TRICE_MULTI_PACK_MODE\n");
  80. #endif
  81. trice("deb:_CYCLE == %d, _PROTECT == %d, _DIAG == %d, XTEA == %d\n", TRICE_CYCLE_COUNTER, TRICE_PROTECT, TRICE_DIAGNOSTICS, TRICE_DEFERRED_XTEA_ENCRYPT);
  82. 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);
  83. #endif
  84. }
  85. #endif // #if !TRICE_OFF