You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-15
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,25 @@
1
-
### ⚠**IMPORTANT**
1
+
### ⚠**IMPORTANT**
2
2
3
3
> Please, before submitting a support request read carefully this README and check if an answer already exists among [previously answered questions](https://github.com/rlogiacco/MicroDebug/discussions): do not abuse of the Github issue tracker.
Whenever you run your projects you want to have some feedback of what's happening on your board, but most of the times you don't want those *debug* instructions to get into your production code, especially considering the limits of the micro controller's memory capacity.
20
+
Whenever you run your projects you want to have some feedback on what's happening on your board, but most of the times you don't want those *debug* instructions to get into your production code, especially considering the limits of the microcontroller's memory capacity.
13
21
14
-
This library provides some means of easily handle this situation, exposing some pre-processor macro directives you can easily turn off to completely remove debug statements and save program memory.
22
+
This library provides some means of easily handling this situation, exposing some pre-processor macro directives you can easily turn off to completely remove debug statements and save program memory.
15
23
16
24
<!-- toc -->
17
25
-[Serial interface](#serial-interface)
@@ -25,11 +33,11 @@ This library provides some means of easily handle this situation, exposing some
25
33
26
34
# Serial interface
27
35
28
-
The simplest and most used way of interfacing to Arduino or other microcontrollers is through the serial connection and I recommend to use this in every case where it is applicable.
36
+
The simplest and most used way of interfacing with Arduino or other microcontrollers is through the serial connection and I recommend using this in every case where it is applicable.
29
37
30
38
There are two versions of this interface: a very basic one (`SerialDebug`) which uses a separator pattern and a more evolved one (`FormattingSerialDebug`) providing format capabilities through `printf` function. You should prefer the latter whenever you have access to `printf`, usually available through `stdio.h`.
31
39
32
-
Please also note both serial implementations support the use of the `F()` macro to reduce the RAM usage whenever necessary by using `PROGMEM` to store strings. To put it simple, the following two statements are both supported and produce the same output, but with different memory impact:
40
+
Please also note both serial implementations support the use of the `F()` macro to reduce the RAM usage whenever necessary by using `PROGMEM` to store strings. To put it simply, the following two statements are both supported and produce the same output, but with different memory impacts:
33
41
34
42
```cpp
35
43
DEBUG("elapsed time is %lums", millis()); // format string stored in RAM
@@ -41,10 +49,10 @@ Please also note both serial implementations support the use of the `F()` macro
41
49
The usage is very simple: include the `SerialDebug.h` header and you get two macros.
42
50
43
51
- one, to include in your `setup()` function, is `SERIAL_DEBUG_SETUP` which activates the serial connection at a specific baud rate
44
-
- another one is instead a set of macros, but for simplicity you can consider them like an overloaded method `DEBUG` capable of accepting 1 to 10 parameters, each one will be printed onto the serial connection
52
+
- another one is instead a set of macros, but for simplicity, you can consider them like an overloaded method `DEBUG` capable of accepting 1 to 10 parameters, each one will be printed onto the serial connection
45
53
46
54
In addition, you get a couple of definitions you can override to customize the output:
47
-
- `SERIAL_DEBUG` defaults to `true` and activated/deactivates the entire library
55
+
- `SERIAL_DEBUG` defaults to `true` and activates/deactivates the entire library
48
56
- `SERIAL_DEBUG_SEPARATOR` defaults to `" | "` (pipe character preceded and followed by space) which is used as a separator between each argument
49
57
- `SERIAL_DEBUG_IMPL` defaults to `Serial` which is the underlying serial target
50
58
@@ -67,13 +75,13 @@ void loop() {
67
75
68
76
## Formatting Serial
69
77
70
-
The formatting version has been modelled on the same usage model of the basic implementation: the two are almost completely swappable by just changing the include statement to `FormattingSerialDebug.h` header:
78
+
The formatting version has been modeled on the same usage model of the basic implementation: the two are almost completely swappable by just changing the include statement to `FormattingSerialDebug.h` header:
71
79
72
80
-`SERIAL_DEBUG_SETUP`, which activates the serial connection at a specific baud rate, should be included in your `setup()`
73
81
-`DEBUG` is capable of accepting 1 or more parameters, the first one being the formatting string in the `printf`[format](http://en.wikipedia.org/wiki/Printf_format_string)
74
82
75
83
As for the basic version you have library control through definitions:
76
-
-`SERIAL_DEBUG` defaults to `true` and activated/deactivates the entire library
84
+
-`SERIAL_DEBUG` defaults to `true` and activates/deactivates the entire library
77
85
-`SERIAL_DEBUG_IMPL` defaults to `Serial` which is the underlying serial target
78
86
79
87
**NOTE** to deactivate the library for final release you must `#define SERIAL_DEBUG false`***before*** including the `FormattingSerialDebug.h` header file.
@@ -96,7 +104,7 @@ void loop() {
96
104
97
105
### Supported notation
98
106
99
-
Due to memory limitation of the devices the general implementations of the `printf` function doesn't support floating point numbers, but in case you really need support for floating points then providing `-Wl,-u,vfprintf -lprintf_flt -lm` compilation options can enable it.
107
+
Due to the memory limitation of the devices, the general implementations of the `printf` function don't support floating point numbers, but in case you really need support for floating points then providing `-Wl,-u,vfprintf -lprintf_flt -lm` compilation options can enable it.
100
108
101
109
Please refer to [this page](http://www.cplusplus.com/reference/cstdio/printf/) for a full reference of the accepted format string.
102
110
@@ -108,7 +116,7 @@ In such cases, you can include the `LedDebug.h` header to get the `PULSE` macro:
108
116
109
117
110
118
In addition, you get a couple of definitions you can override to customize the pulses:
111
-
-`LED_DEBUG` defaults to `true` and activated/deactivates the entire library
119
+
-`LED_DEBUG` defaults to `true` and activates/deactivates the entire library
112
120
-`LED_DEBUG_PIN` defaults to the built-in LED pin on Arduino boards, usually digital pin 13
113
121
-`LED_DEBUG_DELAY` defaults to 50 and indicates the default interval in milliseconds between each PULSE invocation
114
122
-`LED_DEBUG_LENGHT` defaults to 125 and indicates the default duration in milliseconds of a blink
0 commit comments