mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +03:00
Added missing 'timer <pin>' command.
This commit is contained in:
parent
8239950c7d
commit
3974df6798
1 changed files with 29 additions and 37 deletions
|
@ -4925,17 +4925,9 @@ static void cliDmaopt(char *cmdline)
|
||||||
pch = strtok_r(NULL, " ", &saveptr);
|
pch = strtok_r(NULL, " ", &saveptr);
|
||||||
if (!pch) {
|
if (!pch) {
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (orgval == DMA_OPT_UNUSED) {
|
printPeripheralDmaoptDetails(entry, index, *optaddr, true, DUMP_MASTER, cliDumpPrintLinef);
|
||||||
cliPrintLinef("%s %d NONE", entry->device, index + 1);
|
|
||||||
} else {
|
} else {
|
||||||
cliPrintLinef("%s %d %d", entry->device, index + 1, *optaddr);
|
printTimerDmaoptDetails(ioTag, timer, orgval, true, DUMP_MASTER, cliDumpPrintLinef);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (orgval == DMA_OPT_UNUSED) {
|
|
||||||
cliPrintLinef("pin %c%02d NONE", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag));
|
|
||||||
} else {
|
|
||||||
cliPrintLinef("pin %c%02d %d", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), orgval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -5110,11 +5102,20 @@ static void cliResource(char *cmdline)
|
||||||
#endif // USE_RESOURCE_MGMT
|
#endif // USE_RESOURCE_MGMT
|
||||||
|
|
||||||
#ifdef USE_TIMER_MGMT
|
#ifdef USE_TIMER_MGMT
|
||||||
|
static void printTimerDetails(const ioTag_t ioTag, const unsigned timerIndex, const bool equalsDefault, const dumpFlags_t dumpMask, printFn *printValue)
|
||||||
static void printTimer(dumpFlags_t dumpMask)
|
|
||||||
{
|
{
|
||||||
const char *format = "timer %c%02d %d";
|
const char *format = "timer %c%02d %d";
|
||||||
|
|
||||||
|
printValue(dumpMask, equalsDefault, format,
|
||||||
|
IO_GPIOPortIdxByTag(ioTag) + 'A',
|
||||||
|
IO_GPIOPinIdxByTag(ioTag),
|
||||||
|
timerIndex - 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void printTimer(dumpFlags_t dumpMask)
|
||||||
|
{
|
||||||
const pgRegistry_t* pg = pgFind(PG_TIMER_IO_CONFIG);
|
const pgRegistry_t* pg = pgFind(PG_TIMER_IO_CONFIG);
|
||||||
const timerIOConfig_t *currentConfig;
|
const timerIOConfig_t *currentConfig;
|
||||||
const timerIOConfig_t *defaultConfig;
|
const timerIOConfig_t *defaultConfig;
|
||||||
|
@ -5150,18 +5151,10 @@ static void printTimer(dumpFlags_t dumpMask)
|
||||||
const bool equalsDefault = defaultTimerIndex == timerIndex;
|
const bool equalsDefault = defaultTimerIndex == timerIndex;
|
||||||
|
|
||||||
if (defaultConfig && defaultTimerIndex) {
|
if (defaultConfig && defaultTimerIndex) {
|
||||||
cliDefaultPrintLinef(dumpMask, equalsDefault, format,
|
printTimerDetails(ioTag, defaultTimerIndex, equalsDefault, dumpMask, cliDefaultPrintLinef);
|
||||||
IO_GPIOPortIdxByTag(ioTag) + 'A',
|
|
||||||
IO_GPIOPinIdxByTag(ioTag),
|
|
||||||
defaultTimerIndex - 1
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cliDumpPrintLinef(dumpMask, equalsDefault, format,
|
printTimerDetails(ioTag, timerIndex, equalsDefault, dumpMask, cliDumpPrintLinef);
|
||||||
IO_GPIOPortIdxByTag(ioTag) + 'A',
|
|
||||||
IO_GPIOPinIdxByTag(ioTag),
|
|
||||||
timerIndex - 1
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5187,10 +5180,12 @@ static void cliTimer(char *cmdline)
|
||||||
char *saveptr;
|
char *saveptr;
|
||||||
int timerIOIndex = -1;
|
int timerIOIndex = -1;
|
||||||
|
|
||||||
ioTag_t ioTag = 0;
|
ioTag_t ioTag = IO_TAG_NONE;
|
||||||
pch = strtok_r(cmdline, " ", &saveptr);
|
pch = strtok_r(cmdline, " ", &saveptr);
|
||||||
if (!pch || !(strToPin(pch, &ioTag) && IOGetByTag(ioTag))) {
|
if (!pch || !(strToPin(pch, &ioTag) && IOGetByTag(ioTag))) {
|
||||||
goto error;
|
cliShowParseError();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find existing entry, or go for next available */
|
/* find existing entry, or go for next available */
|
||||||
|
@ -5228,26 +5223,23 @@ static void cliTimer(char *cmdline)
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (strcasecmp(pch, "none") == 0) {
|
} else if (strcasecmp(pch, "none") == 0) {
|
||||||
goto success;
|
|
||||||
} else {
|
} else {
|
||||||
timerIndex = atoi(pch) + 1;
|
timerIndex = atoi(pch) + 1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
success:
|
|
||||||
timerIOConfigMutable(timerIOIndex)->ioTag = timerIndex == 0 ? IO_TAG_NONE : ioTag;
|
timerIOConfigMutable(timerIOIndex)->ioTag = timerIndex == 0 ? IO_TAG_NONE : ioTag;
|
||||||
timerIOConfigMutable(timerIOIndex)->index = timerIndex;
|
timerIOConfigMutable(timerIOIndex)->index = timerIndex;
|
||||||
timerIOConfigMutable(timerIOIndex)->dmaopt = DMA_OPT_UNUSED;
|
timerIOConfigMutable(timerIOIndex)->dmaopt = DMA_OPT_UNUSED;
|
||||||
|
|
||||||
cliPrintLine("Success");
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
printTimerDetails(ioTag, timerIOConfig(timerIOIndex)->index, false, DUMP_MASTER, cliDumpPrintLinef);
|
||||||
|
|
||||||
error:
|
return;
|
||||||
cliShowParseError();
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue