mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +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] = {
|
||||
// { .tag = IO_TAG(<pin>) },
|
||||
// };
|
||||
#endif
|
||||
|
||||
void dbgPinInit(void)
|
||||
{
|
||||
#ifdef USE_DEBUG_PIN
|
||||
for (unsigned i = 0; i < ARRAYLEN(dbgPins); i++) {
|
||||
dbgPin_t *dbgPin = &dbgPins[i];
|
||||
dbgPinState_t *dbgPinState = &dbgPinStates[i];
|
||||
|
@ -57,10 +59,12 @@ void dbgPinInit(void)
|
|||
dbgPinState->setBSRR = (1 << pinSrc);
|
||||
dbgPinState->resetBSRR = (1 << (pinSrc + 16));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void dbgPinHi(int index)
|
||||
{
|
||||
#ifdef USE_DEBUG_PIN
|
||||
if ((unsigned)index >= ARRAYLEN(dbgPins)) {
|
||||
return;
|
||||
}
|
||||
|
@ -73,10 +77,14 @@ void dbgPinHi(int index)
|
|||
dbgPinState->gpio->BSRRL = dbgPinState->setBSRR;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
UNUSED(index);
|
||||
#endif
|
||||
}
|
||||
|
||||
void dbgPinLo(int index)
|
||||
{
|
||||
#ifdef USE_DEBUG_PIN
|
||||
if ((unsigned)index >= ARRAYLEN(dbgPins)) {
|
||||
return;
|
||||
}
|
||||
|
@ -90,6 +98,7 @@ void dbgPinLo(int index)
|
|||
dbgPinState->gpio->BSRRL = dbgPinState->resetBSRR;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
UNUSED(index);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -29,13 +29,3 @@ typedef struct dbgPin_s {
|
|||
void dbgPinInit(void);
|
||||
void dbgPinHi(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)
|
||||
{
|
||||
DEBUG_HI(0);
|
||||
dbgPinHi(0);
|
||||
|
||||
bbPort_t *bbPort = (bbPort_t *)descriptor->userParam;
|
||||
|
||||
|
@ -326,7 +326,7 @@ void bbDMAIrqHandler(dmaChannelDescriptor_t *descriptor)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
DEBUG_LO(0);
|
||||
dbgPinLo(0);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
DEBUG_LO(0);
|
||||
DEBUG_LO(1);
|
||||
dbgPinLo(0);
|
||||
dbgPinLo(1);
|
||||
|
||||
motorPwmProtocol = motorConfig->motorPwmProtocol;
|
||||
bbDevice.vTable = bbVTable;
|
||||
|
|
|
@ -135,7 +135,7 @@ static void bbSaveDMARegs(dmaResource_t *dmaResource, dmaRegCache_t *dmaRegCache
|
|||
|
||||
void bbSwitchToOutput(bbPort_t * bbPort)
|
||||
{
|
||||
DEBUG_HI(1);
|
||||
dbgPinHi(1);
|
||||
// Output idle level before switching to output
|
||||
// Use BSRR register for this
|
||||
// Normal: Use BR (higher half)
|
||||
|
@ -166,13 +166,13 @@ void bbSwitchToOutput(bbPort_t * bbPort)
|
|||
|
||||
bbPort->direction = DSHOT_BITBANG_DIRECTION_OUTPUT;
|
||||
|
||||
DEBUG_LO(1);
|
||||
dbgPinLo(1);
|
||||
}
|
||||
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
void bbSwitchToInput(bbPort_t *bbPort)
|
||||
{
|
||||
DEBUG_HI(1);
|
||||
dbgPinHi(1);
|
||||
|
||||
// Set GPIO to input
|
||||
|
||||
|
@ -201,7 +201,7 @@ void bbSwitchToInput(bbPort_t *bbPort)
|
|||
|
||||
bbPort->direction = DSHOT_BITBANG_DIRECTION_INPUT;
|
||||
|
||||
DEBUG_LO(1);
|
||||
dbgPinLo(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue