From 101d2534f40d4068db128bf68798293907945d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 25 Feb 2018 13:40:47 +0100 Subject: [PATCH] tsc disable debug --- units/touch/_touch_init.c | 14 +++++++------- units/touch/_touch_internal.h | 8 ++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/units/touch/_touch_init.c b/units/touch/_touch_init.c index af00611..51ee6f0 100644 --- a/units/touch/_touch_init.c +++ b/units/touch/_touch_init.c @@ -44,7 +44,7 @@ error_t UTOUCH_init(Unit *unit) if (cap == 0) { if (ch != 0) { - dbg("TSC group %d has no cap!", (int)(gi+1)); + dbg_touch("TSC group %d has no cap!", (int)(gi+1)); return E_BAD_CONFIG; } continue; @@ -53,12 +53,12 @@ error_t UTOUCH_init(Unit *unit) if (ch == 0) continue; // if no channels, don't bother setting up anything if (cap != 2 && cap != 4 && cap != 8 && cap != 16) { - dbg("TSC group %d has more than 1 cap!", (int)(gi+1)); + dbg_touch("TSC group %d has more than 1 cap!", (int)(gi+1)); return E_BAD_CONFIG; } if (cap & ch) { - dbg("TSC pin can't be both channel and cap! (gpr %d)", (int)(gi+1)); + dbg_touch("TSC pin can't be both channel and cap! (gpr %d)", (int)(gi+1)); return E_BAD_CONFIG; } @@ -74,8 +74,8 @@ error_t UTOUCH_init(Unit *unit) // 7 and 8 (1-based) use AF1, else AF3 TRY(hw_configure_gpiorsc_af(r, gi >= 6 ? LL_GPIO_AF_1 : LL_GPIO_AF_3)); - if (iscap) dbg("TSC *cap @ %s", rsc_get_name(r)); - else dbg("TSC -ch @ %s", rsc_get_name(r)); + if (iscap) dbg_touch("TSC *cap @ %s", rsc_get_name(r)); + else dbg_touch("TSC -ch @ %s", rsc_get_name(r)); } // Sampling cap @@ -93,9 +93,9 @@ error_t UTOUCH_init(Unit *unit) } } - dbg("TSC phases:"); + dbg_touch("TSC phases:"); for (int i = 0; i < 3; i++) { - dbg(" %d: ch %08"PRIx32", g %02"PRIx32, i+1, priv->channels_phase[i], (uint32_t)priv->pgen_phase[i]); + dbg_touch(" %d: ch %08"PRIx32", g %02"PRIx32, i+1, priv->channels_phase[i], (uint32_t)priv->pgen_phase[i]); } return E_SUCCESS; diff --git a/units/touch/_touch_internal.h b/units/touch/_touch_internal.h index 9ce0e40..0a1bbca 100644 --- a/units/touch/_touch_internal.h +++ b/units/touch/_touch_internal.h @@ -11,6 +11,14 @@ #include "unit_base.h" +#define TSC_DEBUG 0 + +#if TSC_DEBUG +#define dbg_touch(...) dbg(...) +#else +#define dbg_touch(...) do{}while(0) +#endif + /** Private data structure */ struct priv { // settings