Skip to content

Commit 79cdd0d

Browse files
authored
Merge pull request #610 from matthijskooijman/printf-readme
Better document printf support
2 parents 89c28c5 + a672109 commit 79cdd0d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,18 +329,21 @@ The remaining variables are rarely used, but we list them here for completeness.
329329

330330
`#define LMIC_PRINTF_TO SerialLikeObject`
331331

332-
This variable should be set to the name of a `Serial`-like object, used for printing messages. If not defined, `Serial`
333-
is assumed.
332+
This variable should be set to the name of a `Serial`-like object (any subclass of Arduino's `Print` class), used for printing messages. If this variable is set, any calls to the standard `printf` function (or more generally all writes to the global `stdout` file descriptor) will redirected to the specified stream.
333+
334+
When this is not defined, `printf` and `stdout` are untouched and their behavior might vary among boards (and could print to somewhere, but also throw away output or crash). So *if* you want to use `printf` or `LMIC_DEBUG_LEVEL`, make sure to also define this.
334335

335336
#### Getting debug from the RF library
336337

337338
`#define LMIC_DEBUG_LEVEL number /* 0, 1, or 2 */`
338339

339340
This variable determines the amount of debug output to be produced by the library. The default is `0`.
340341

341-
If `LMIC_DEBUG_LEVEL` is zero, no output is produced. If `1`, limited output is produced. If `2`, more extensive
342-
output is produced. If non-zero, `printf()` is used, and the Arduino environment must be configured to support it,
343-
otherwise the sketch will crash at runtime.
342+
If `LMIC_DEBUG_LEVEL` is zero, no output is produced. If `1`, limited output is produced. If `2`, more extensive output is produced.
343+
344+
Note that debug output will influence the timing of various parts of the library and could introduce timing problems (especially in the RX window timing), so use it carefully.
345+
346+
Debug output is generated using the standard `printf` function, so unless your environment already redirects `printf` / `stdout` somewhere, you should also configure `LIMC_PRINTF_TO`.
344347

345348
#### Selecting the AES library
346349

0 commit comments

Comments
 (0)