From d4cd3d8227d48bedfffd5c2f443dd346311efa0d Mon Sep 17 00:00:00 2001 From: mikeller Date: Mon, 20 May 2019 00:54:06 +1200 Subject: [PATCH] Added selection by alternate function to CLI 'timer'. --- src/main/cli/cli.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/cli/cli.c b/src/main/cli/cli.c index b45dc05970..6f8200fda3 100644 --- a/src/main/cli/cli.c +++ b/src/main/cli/cli.c @@ -5376,6 +5376,23 @@ static void cliTimer(char *cmdline) return; } else if (strcasecmp(pch, "none") == 0) { timerIndex = TIMER_INDEX_UNDEFINED; + } else if (strncasecmp(pch, "af", 2) == 0) { + unsigned alternateFunction = atoi(&pch[2]); + + const timerHardware_t *timer; + for (unsigned index = 0; (timer = timerGetByTagAndIndex(ioTag, index + 1)); index++) { + if (timer->alternateFunction == alternateFunction) { + timerIndex = index; + + break; + } + } + + if (!timer) { + cliPrintErrorLinef("INVALID ALTERNATE FUNCTION FOR %c%02d: '%s'", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), pch); + + return; + } } else { timerIndex = atoi(pch); @@ -5870,7 +5887,7 @@ const clicmd_t cmdTable[] = { CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks), #endif #ifdef USE_TIMER_MGMT - CLI_COMMAND_DEF("timer", "show/set timers", "<> | list | [