|
9 | 9 | * please support Adafruit and open-source hardware by purchasing |
10 | 10 | * products from Adafruit! |
11 | 11 | * |
12 | | - * Copyright (c) Brent Rubell 2020-2024 for Adafruit Industries. |
| 12 | + * @copyright Copyright (c) Brent Rubell 2020-2024 for Adafruit Industries. |
13 | 13 | * |
14 | 14 | * BSD license, all text here must be included in any redistribution. |
15 | | - * |
16 | 15 | */ |
17 | 16 |
|
18 | 17 | #ifndef WIPPERSNAPPER_V2_H |
19 | 18 | #define WIPPERSNAPPER_V2_H |
20 | 19 |
|
21 | 20 | // Debug Flags |
22 | 21 | // #DEBUG_PROFILE 1 ///< Enable debug output for function profiling |
23 | | - |
24 | | -#define WS_DEBUG ///< Define to enable debugging to serial terminal |
25 | | -#define WS_PRINTER Serial ///< Where debug messages will be printed |
| 22 | +// Debug Flags |
| 23 | +#define WS_DEBUG /**< Define to enable debugging to serial terminal */ |
| 24 | +#define WS_PRINTER Serial /**< Where debug messages will be printed */ |
26 | 25 |
|
27 | 26 | /**************************************************************************/ |
28 | 27 | /*! |
29 | | - @brief Debug print macros |
| 28 | + @brief Debug print macros for WipperSnapper debugging output |
| 29 | + @details These macros provide debug output functionality when WS_DEBUG is |
| 30 | + defined |
30 | 31 | */ |
31 | 32 | /**************************************************************************/ |
32 | 33 | #ifdef WS_DEBUG |
33 | 34 | #define WS_DEBUG_PRINT(...) \ |
34 | | - { WS_PRINTER.print(__VA_ARGS__); } ///< Prints debug output. |
| 35 | + { WS_PRINTER.print(__VA_ARGS__); } /**< Print debug message to serial */ |
35 | 36 | #define WS_DEBUG_PRINTLN(...) \ |
36 | | - { WS_PRINTER.println(__VA_ARGS__); } ///< Prints line from debug output. |
| 37 | + { WS_PRINTER.println(__VA_ARGS__); } /**< Print debug message with newline \ |
| 38 | + */ |
37 | 39 | #define WS_DEBUG_PRINTHEX(...) \ |
38 | | - { WS_PRINTER.print(__VA_ARGS__, HEX); } ///< Prints debug output. |
| 40 | + { \ |
| 41 | + WS_PRINTER.print(__VA_ARGS__, HEX); \ |
| 42 | + } /**< Print debug message in hexadecimal */ |
39 | 43 | #else |
40 | 44 | #define WS_DEBUG_PRINT(...) \ |
41 | | - {} ///< Prints debug output |
| 45 | + {} /**< Debug print */ |
42 | 46 | #define WS_DEBUG_PRINTLN(...) \ |
43 | | - {} ///< Prints line from debug output. |
| 47 | + {} /**< Debug println */ |
44 | 48 | #endif |
45 | 49 |
|
| 50 | +/**************************************************************************/ |
| 51 | +/*! |
| 52 | + @brief delay() function for use with a watchdog timer |
| 53 | + @param timeout |
| 54 | + Delay duration in milliseconds |
| 55 | +*/ |
| 56 | +/**************************************************************************/ |
46 | 57 | #define WS_DELAY_WITH_WDT(timeout) \ |
47 | 58 | { \ |
48 | 59 | unsigned long start = millis(); \ |
|
51 | 62 | yield(); \ |
52 | 63 | feedWDT(); \ |
53 | 64 | if (millis() < start) { \ |
54 | | - start = millis(); /* if rollover */ \ |
| 65 | + start = millis(); \ |
55 | 66 | } \ |
56 | 67 | } \ |
57 | | - } ///< Delay function |
| 68 | + } |
58 | 69 |
|
59 | 70 | // Cpp STD |
60 | 71 | #include <functional> |
|
0 commit comments