mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 09:16:07 +03:00
Merge pull request #10952 from blckmn/debug_rename
This commit is contained in:
commit
a11eb8efc5
4 changed files with 19 additions and 20 deletions
|
@ -40,9 +40,11 @@ extern dbgPin_t dbgPins[DEBUG_PIN_COUNT];
|
||||||
// dbgPin_t dbgPins[DEBUG_PIN_COUNT] = {
|
// dbgPin_t dbgPins[DEBUG_PIN_COUNT] = {
|
||||||
// { .tag = IO_TAG(<pin>) },
|
// { .tag = IO_TAG(<pin>) },
|
||||||
// };
|
// };
|
||||||
|
#endif
|
||||||
|
|
||||||
void dbgPinInit(void)
|
void dbgPinInit(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_DEBUG_PIN
|
||||||
for (unsigned i = 0; i < ARRAYLEN(dbgPins); i++) {
|
for (unsigned i = 0; i < ARRAYLEN(dbgPins); i++) {
|
||||||
dbgPin_t *dbgPin = &dbgPins[i];
|
dbgPin_t *dbgPin = &dbgPins[i];
|
||||||
dbgPinState_t *dbgPinState = &dbgPinStates[i];
|
dbgPinState_t *dbgPinState = &dbgPinStates[i];
|
||||||
|
@ -57,10 +59,12 @@ void dbgPinInit(void)
|
||||||
dbgPinState->setBSRR = (1 << pinSrc);
|
dbgPinState->setBSRR = (1 << pinSrc);
|
||||||
dbgPinState->resetBSRR = (1 << (pinSrc + 16));
|
dbgPinState->resetBSRR = (1 << (pinSrc + 16));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbgPinHi(int index)
|
void dbgPinHi(int index)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_DEBUG_PIN
|
||||||
if ((unsigned)index >= ARRAYLEN(dbgPins)) {
|
if ((unsigned)index >= ARRAYLEN(dbgPins)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -73,10 +77,14 @@ void dbgPinHi(int index)
|
||||||
dbgPinState->gpio->BSRRL = dbgPinState->setBSRR;
|
dbgPinState->gpio->BSRRL = dbgPinState->setBSRR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
UNUSED(index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbgPinLo(int index)
|
void dbgPinLo(int index)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_DEBUG_PIN
|
||||||
if ((unsigned)index >= ARRAYLEN(dbgPins)) {
|
if ((unsigned)index >= ARRAYLEN(dbgPins)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +98,7 @@ void dbgPinLo(int index)
|
||||||
dbgPinState->gpio->BSRRL = dbgPinState->resetBSRR;
|
dbgPinState->gpio->BSRRL = dbgPinState->resetBSRR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
#else
|
||||||
|
UNUSED(index);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -29,13 +29,3 @@ typedef struct dbgPin_s {
|
||||||
void dbgPinInit(void);
|
void dbgPinInit(void);
|
||||||
void dbgPinHi(int index);
|
void dbgPinHi(int index);
|
||||||
void dbgPinLo(int index);
|
void dbgPinLo(int index);
|
||||||
|
|
||||||
#ifdef USE_DEBUG_PIN
|
|
||||||
#define DEBUG_LO(index) \
|
|
||||||
dbgPinLo(index);
|
|
||||||
#define DEBUG_HI(index) \
|
|
||||||
dbgPinHi(index);
|
|
||||||
#else
|
|
||||||
#define DEBUG_LO(index)
|
|
||||||
#define DEBUG_HI(index)
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ static void bbSetupDma(bbPort_t *bbPort)
|
||||||
|
|
||||||
void bbDMAIrqHandler(dmaChannelDescriptor_t *descriptor)
|
void bbDMAIrqHandler(dmaChannelDescriptor_t *descriptor)
|
||||||
{
|
{
|
||||||
DEBUG_HI(0);
|
dbgPinHi(0);
|
||||||
|
|
||||||
bbPort_t *bbPort = (bbPort_t *)descriptor->userParam;
|
bbPort_t *bbPort = (bbPort_t *)descriptor->userParam;
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ void bbDMAIrqHandler(dmaChannelDescriptor_t *descriptor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DEBUG_LO(0);
|
dbgPinLo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup bbPorts array elements so that they each have a TIM1 or TIM8 channel
|
// Setup bbPorts array elements so that they each have a TIM1 or TIM8 channel
|
||||||
|
@ -700,8 +700,8 @@ dshotBitbangStatus_e dshotBitbangGetStatus()
|
||||||
|
|
||||||
motorDevice_t *dshotBitbangDevInit(const motorDevConfig_t *motorConfig, uint8_t count)
|
motorDevice_t *dshotBitbangDevInit(const motorDevConfig_t *motorConfig, uint8_t count)
|
||||||
{
|
{
|
||||||
DEBUG_LO(0);
|
dbgPinLo(0);
|
||||||
DEBUG_LO(1);
|
dbgPinLo(1);
|
||||||
|
|
||||||
motorPwmProtocol = motorConfig->motorPwmProtocol;
|
motorPwmProtocol = motorConfig->motorPwmProtocol;
|
||||||
bbDevice.vTable = bbVTable;
|
bbDevice.vTable = bbVTable;
|
||||||
|
|
|
@ -135,7 +135,7 @@ static void bbSaveDMARegs(dmaResource_t *dmaResource, dmaRegCache_t *dmaRegCache
|
||||||
|
|
||||||
void bbSwitchToOutput(bbPort_t * bbPort)
|
void bbSwitchToOutput(bbPort_t * bbPort)
|
||||||
{
|
{
|
||||||
DEBUG_HI(1);
|
dbgPinHi(1);
|
||||||
// Output idle level before switching to output
|
// Output idle level before switching to output
|
||||||
// Use BSRR register for this
|
// Use BSRR register for this
|
||||||
// Normal: Use BR (higher half)
|
// Normal: Use BR (higher half)
|
||||||
|
@ -166,13 +166,13 @@ void bbSwitchToOutput(bbPort_t * bbPort)
|
||||||
|
|
||||||
bbPort->direction = DSHOT_BITBANG_DIRECTION_OUTPUT;
|
bbPort->direction = DSHOT_BITBANG_DIRECTION_OUTPUT;
|
||||||
|
|
||||||
DEBUG_LO(1);
|
dbgPinLo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_DSHOT_TELEMETRY
|
#ifdef USE_DSHOT_TELEMETRY
|
||||||
void bbSwitchToInput(bbPort_t *bbPort)
|
void bbSwitchToInput(bbPort_t *bbPort)
|
||||||
{
|
{
|
||||||
DEBUG_HI(1);
|
dbgPinHi(1);
|
||||||
|
|
||||||
// Set GPIO to input
|
// Set GPIO to input
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ void bbSwitchToInput(bbPort_t *bbPort)
|
||||||
|
|
||||||
bbPort->direction = DSHOT_BITBANG_DIRECTION_INPUT;
|
bbPort->direction = DSHOT_BITBANG_DIRECTION_INPUT;
|
||||||
|
|
||||||
DEBUG_LO(1);
|
dbgPinLo(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue