Created
February 3, 2025 05:38
-
-
Save Irdroid/0116a07727f090fd0292c8ab73857930 to your computer and use it in GitHub Desktop.
Debug macro in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================================ | |
// Libraries, Definitions and Macros | |
// ============================================================================ | |
#ifdef DEBUG | |
#include "stdio.h" | |
__xdata uint8_t buffer[20]; | |
#define DBG(fmt, ...) sprintf(buffer, "%s: " fmt "\r\n", __func__, ##__VA_ARGS__); OLED_print(buffer); | |
#else | |
#define DBG(fmt, ...); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: DBG("This is debug text %d\n", variable);