Skip to content

Commit 0a2fbb0

Browse files
committed
Allow logging to be overridden
1 parent 03ec34e commit 0a2fbb0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/rp2_common/pico_cyw43_driver/cybt_shared_bus/cybt_logging.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,50 @@
88
#define CYBT_LOGGING_H
99

1010
// Error messages only enabled in debug by default
11+
#ifndef CYBT_ERROR_ENABLED
1112
#ifndef NDEBUG
1213
#define CYBT_ERROR_ENABLED 1
1314
#else
1415
#define CYBT_ERROR_ENABLED 0
1516
#endif
17+
#endif
1618

1719
// Info messages only enabled in debug by default
20+
#ifndef CYBT_INFO_ENABLED
1821
#ifndef NDEBUG
1922
#define CYBT_INFO_ENABLED 1
2023
#else
2124
#define CYBT_INFO_ENABLED 0
2225
#endif
26+
#endif
2327

2428
// Debug messages disabled by default
29+
#ifndef CYBT_DEBUG_ENABLED
2530
#define CYBT_DEBUG_ENABLED 0
26-
27-
#if CYBT_DEBUG_ENABLED || CYBT_ERROR_ENABLED
28-
#include <stdio.h>
2931
#endif
3032

33+
#ifndef cybt_error
3134
#if CYBT_ERROR_ENABLED
3235
#define cybt_error CYW43_WARN
3336
#else
3437
#define cybt_error(...)
3538
#endif
39+
#endif
3640

41+
#ifndef cybt_info
3742
#if CYBT_INFO_ENABLED
3843
#define cybt_info CYW43_PRINTF
3944
#else
4045
#define cybt_info(...)
4146
#endif
47+
#endif
4248

49+
#ifndef cybt_debug
4350
#if CYBT_DEBUG_ENABLED
4451
#define cybt_debug CYW43_PRINTF
4552
#else
4653
#define cybt_debug(...)
4754
#endif
55+
#endif
4856

4957
#endif // CYBT_LOGGING_H

0 commit comments

Comments
 (0)