From bc111ffe47876cc74dfca44de29269221058282f Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Tue, 21 May 2019 02:33:29 +1200 Subject: [PATCH] Add timer info to CLI 'timer' command. (#8305) Add timer info to CLI 'timer' command. --- src/main/cli/cli.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/cli/cli.c b/src/main/cli/cli.c index e96dfc0f56..ad27c39f84 100644 --- a/src/main/cli/cli.c +++ b/src/main/cli/cli.c @@ -5133,11 +5133,22 @@ static void printTimerDetails(const ioTag_t ioTag, const unsigned timerIndex, co const char *emptyFormat = "timer %c%02d NONE"; if (timerIndex > 0) { - printValue(dumpMask, equalsDefault, format, + const bool printDetails = printValue(dumpMask, equalsDefault, format, IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), timerIndex - 1 ); + if (printDetails) { + const timerHardware_t *timer = timerGetByTagAndIndex(ioTag, timerIndex); + printValue(dumpMask, false, + "# pin %c%02d: TIM%d CH%d%s (AF%d)", + IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), + timerGetTIMNumber(timer->tim), + CC_INDEX_FROM_CHANNEL(timer->channel) + 1, + timer->output & TIMER_OUTPUT_N_CHANNEL ? "N" : "", + timer->alternateFunction + ); + } } else { printValue(dumpMask, equalsDefault, emptyFormat, IO_GPIOPortIdxByTag(ioTag) + 'A', @@ -5267,10 +5278,12 @@ static void cliTimer(char *cmdline) /* output the list of available options */ const timerHardware_t *timer; for (unsigned index = 0; (timer = timerGetByTagAndIndex(ioTag, index + 1)); index++) { - cliPrintLinef("# %d: TIM%d CH%d", + cliPrintLinef("# %d: TIM%d CH%d%s (AF%d)", index, timerGetTIMNumber(timer->tim), - CC_INDEX_FROM_CHANNEL(timer->channel) + 1 + CC_INDEX_FROM_CHANNEL(timer->channel) + 1, + timer->output & TIMER_OUTPUT_N_CHANNEL ? "N" : "", + timer->alternateFunction ); }