mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 20:10:18 +03:00
To enable display of pin mapping for config.h (#12363)
This commit is contained in:
parent
44abae2965
commit
17c7816a52
2 changed files with 38 additions and 2 deletions
|
@ -5850,6 +5850,28 @@ static void alternateFunctionToString(const ioTag_t ioTag, const int index, char
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_TIMER_MAP_PRINT
|
||||||
|
static void showTimerMap(void)
|
||||||
|
{
|
||||||
|
cliPrintLinefeed();
|
||||||
|
cliPrintLine("Timer Mapping:");
|
||||||
|
for (unsigned int i = 0; i < MAX_TIMER_PINMAP_COUNT; i++) {
|
||||||
|
const ioTag_t ioTag = timerIOConfig(i)->ioTag;
|
||||||
|
|
||||||
|
if (!ioTag) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cliPrintLinef(" TIMER_PIN_MAP(%d, P%c%d, %d, %d)",
|
||||||
|
i,
|
||||||
|
IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag),
|
||||||
|
timerIOConfig(i)->index,
|
||||||
|
timerIOConfig(i)->dmaopt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void showTimers(void)
|
static void showTimers(void)
|
||||||
{
|
{
|
||||||
cliPrintLinefeed();
|
cliPrintLinefeed();
|
||||||
|
@ -5901,6 +5923,12 @@ static void cliTimer(const char *cmdName, char *cmdline)
|
||||||
cliPrintErrorLinef(cmdName, "NOT IMPLEMENTED YET");
|
cliPrintErrorLinef(cmdName, "NOT IMPLEMENTED YET");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
#ifdef USE_TIMER_MAP_PRINT
|
||||||
|
} else if (strncasecmp(cmdline, "map", len) == 0) {
|
||||||
|
showTimerMap();
|
||||||
|
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
} else if (strncasecmp(cmdline, "show", len) == 0) {
|
} else if (strncasecmp(cmdline, "show", len) == 0) {
|
||||||
showTimers();
|
showTimers();
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,16 @@
|
||||||
|
|
||||||
#include "timerio.h"
|
#include "timerio.h"
|
||||||
|
|
||||||
#define TIMER_PIN_MAP(idx, pin, pos, dmaOpt) \
|
/*
|
||||||
{ config[idx].ioTag = IO_TAG(pin); config[idx].index = pos; config[idx].dmaopt = dmaOpt; }
|
Details of the TIMER_PIN_MAP macro:
|
||||||
|
i => is the index in the PG timer IO config array,
|
||||||
|
p => is the hardware pin to be mapped,
|
||||||
|
o => is the hardware pin occurrence (1 based index) within timerHardware (full) that should be used
|
||||||
|
e.g. 1 = first occurence of the pin, 2 = second occurence, etc.
|
||||||
|
d => the configured dma opt for the pin
|
||||||
|
*/
|
||||||
|
#define TIMER_PIN_MAP(i, p, o, d) \
|
||||||
|
{ config[i].ioTag = IO_TAG(p); config[i].index = o; config[i].dmaopt = d; }
|
||||||
|
|
||||||
PG_REGISTER_ARRAY_WITH_RESET_FN(timerIOConfig_t, MAX_TIMER_PINMAP_COUNT, timerIOConfig, PG_TIMER_IO_CONFIG, 0);
|
PG_REGISTER_ARRAY_WITH_RESET_FN(timerIOConfig_t, MAX_TIMER_PINMAP_COUNT, timerIOConfig, PG_TIMER_IO_CONFIG, 0);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue