Day: June 30, 2015

A trick to show Debug messages only in the current file

This trick can be used to avoid showing annoying debug message from all drivers and subsystems supported by NuttX:

#include <nuttx/config.h>

/* Trick to get DEBUG messages only in this file */
#define CONFIG_DEBUG 1
#define CONFIG_DEBUG_I2C 1

#include <debug.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <errno.h>

It is very important to put the “defines CONFIG_DEBUG*” only AFTER the include nuttx/config.h and BEFORE the include debug.h.

Thanks Greg Nutt for this nice tip!