mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-12 19:10:32 +03:00
Allow for builds with certain features disabled.
Fix build for when the following are disabled: USE_DMA USE_DSHOT_TELEMETRY USE_SERIAL_PASSTHROUGH
This commit is contained in:
parent
8dd081e874
commit
ce5c93f6e9
5 changed files with 15 additions and 5 deletions
|
@ -267,6 +267,7 @@ extiCallbackRec_t bmi160IntCallbackRec;
|
|||
|
||||
// Called in ISR context
|
||||
// Gyro read has just completed
|
||||
#ifdef USE_DMA
|
||||
static busStatus_e bmi160Intcallback(uint32_t arg)
|
||||
{
|
||||
gyroDev_t *gyro = (gyroDev_t *)arg;
|
||||
|
@ -280,6 +281,7 @@ static busStatus_e bmi160Intcallback(uint32_t arg)
|
|||
|
||||
return BUS_READY;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void bmi160ExtiHandler(extiCallbackRec_t *cb)
|
||||
{
|
||||
|
|
|
@ -278,6 +278,7 @@ extiCallbackRec_t bmi270IntCallbackRec;
|
|||
*/
|
||||
// Called in ISR context
|
||||
// Gyro read has just completed
|
||||
#ifdef USE_DMA
|
||||
static busStatus_e bmi270Intcallback(uint32_t arg)
|
||||
{
|
||||
gyroDev_t *gyro = (gyroDev_t *)arg;
|
||||
|
@ -291,6 +292,7 @@ static busStatus_e bmi270Intcallback(uint32_t arg)
|
|||
|
||||
return BUS_READY;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void bmi270ExtiHandler(extiCallbackRec_t *cb)
|
||||
{
|
||||
|
|
|
@ -95,6 +95,8 @@ uint16_t prepareDshotPacket(dshotProtocolControl_t *pcb);
|
|||
extern bool useDshotTelemetry;
|
||||
extern uint8_t dshotMotorCount;
|
||||
|
||||
bool dshotPwmDevInit(motorDevice_t *device, const motorDevConfig_t *motorConfig);
|
||||
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
|
||||
typedef struct dshotTelemetryMotorState_s {
|
||||
|
@ -113,7 +115,6 @@ typedef struct dshotTelemetryState_s {
|
|||
dshotRawValueState_t rawValueState;
|
||||
} dshotTelemetryState_t;
|
||||
|
||||
#ifdef USE_DSHOT_TELEMETRY
|
||||
extern uint32_t readDoneCount;
|
||||
|
||||
FAST_DATA_ZERO_INIT extern uint32_t inputStampUs;
|
||||
|
@ -125,10 +126,6 @@ typedef struct dshotTelemetryCycleCounters_s {
|
|||
|
||||
FAST_DATA_ZERO_INIT extern dshotTelemetryCycleCounters_t dshotDMAHandlerCycleCounters;
|
||||
|
||||
#endif
|
||||
|
||||
bool dshotPwmDevInit(motorDevice_t *device, const motorDevConfig_t *motorConfig);
|
||||
|
||||
extern dshotTelemetryState_t dshotTelemetryState;
|
||||
|
||||
#ifdef USE_DSHOT_TELEMETRY_STATS
|
||||
|
|
|
@ -216,9 +216,11 @@ void dshotCommandWrite(uint8_t index, uint8_t motorCount, uint8_t command, dshot
|
|||
}
|
||||
|
||||
if (commandType == DSHOT_CMD_TYPE_BLOCKING) {
|
||||
#if defined(USE_DSHOT) && defined(USE_DSHOT_TELEMETRY)
|
||||
bool isBitbangActive = false;
|
||||
#ifdef USE_DSHOT_BITBANG
|
||||
isBitbangActive = isDshotBitbangActive(&motorConfig()->dev);
|
||||
#endif
|
||||
#endif
|
||||
// Fake command in queue. Blocking commands are launched from cli, and no inline commands are running
|
||||
for (uint8_t i = 0; i < motorDeviceCount(); i++) {
|
||||
|
|
|
@ -255,6 +255,7 @@ static void mspEscPassthroughFn(serialPort_t *serialPort)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SERIAL_PASSTHROUGH
|
||||
static serialPort_t *mspFindPassthroughSerialPort(void)
|
||||
{
|
||||
serialPortUsage_t *portUsage = NULL;
|
||||
|
@ -284,9 +285,13 @@ static void mspSerialPassthroughFn(serialPort_t *serialPort)
|
|||
serialPassthrough(passthroughPort, serialPort, NULL, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void mspFcSetPassthroughCommand(sbuf_t *dst, sbuf_t *src, mspPostProcessFnPtr *mspPostProcessFn)
|
||||
{
|
||||
#ifndef USE_SERIAL_PASSTHROUGH
|
||||
UNUSED(mspPostProcessFn);
|
||||
#endif
|
||||
const unsigned int dataSize = sbufBytesRemaining(src);
|
||||
if (dataSize == 0) {
|
||||
// Legacy format
|
||||
|
@ -297,6 +302,7 @@ static void mspFcSetPassthroughCommand(sbuf_t *dst, sbuf_t *src, mspPostProcessF
|
|||
}
|
||||
|
||||
switch (mspPassthroughMode) {
|
||||
#ifdef USE_SERIAL_PASSTHROUGH
|
||||
case MSP_PASSTHROUGH_SERIAL_ID:
|
||||
case MSP_PASSTHROUGH_SERIAL_FUNCTION_ID:
|
||||
if (mspFindPassthroughSerialPort()) {
|
||||
|
@ -308,6 +314,7 @@ static void mspFcSetPassthroughCommand(sbuf_t *dst, sbuf_t *src, mspPostProcessF
|
|||
sbufWriteU8(dst, 0);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_SERIAL_4WAY_BLHELI_INTERFACE
|
||||
case MSP_PASSTHROUGH_ESC_4WAY:
|
||||
// get channel number
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue