SRV_Channel: adds SRV_Channel_config to simplify dependent includes in other libraries

Adding of SRV_Channel_config allows defining the number of servo channels for inclusion in other libraries without pulling in all the other SRV_Channel logic.

Co-authored-by: Simon Maddison <81274690+Sypaq-MadMan@users.noreply.github.com>
This commit is contained in:
James O'Shannessy 2022-11-29 20:46:28 +11:00 committed by Peter Barker
parent e6b3028007
commit cd76aa3cff
2 changed files with 19 additions and 13 deletions

View File

@ -23,19 +23,8 @@
#include <AP_BLHeli/AP_BLHeli.h>
#include <AP_FETtecOneWire/AP_FETtecOneWire.h>
#ifndef NUM_SERVO_CHANNELS
#if defined(HAL_BUILD_AP_PERIPH) && defined(HAL_PWM_COUNT)
#define NUM_SERVO_CHANNELS HAL_PWM_COUNT
#elif defined(HAL_BUILD_AP_PERIPH)
#define NUM_SERVO_CHANNELS 0
#else
#if !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024
#define NUM_SERVO_CHANNELS 32
#else
#define NUM_SERVO_CHANNELS 16
#endif
#endif
#endif
#include "SRV_Channel_config.h"
static_assert(NUM_SERVO_CHANNELS <= 32, "More than 32 servos not supported");
class SRV_Channels;

View File

@ -0,0 +1,17 @@
#pragma once
#include <AP_HAL/AP_HAL.h>
#ifndef NUM_SERVO_CHANNELS
#if defined(HAL_BUILD_AP_PERIPH) && defined(HAL_PWM_COUNT)
#define NUM_SERVO_CHANNELS HAL_PWM_COUNT
#elif defined(HAL_BUILD_AP_PERIPH)
#define NUM_SERVO_CHANNELS 0
#else
#if !HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024
#define NUM_SERVO_CHANNELS 32
#else
#define NUM_SERVO_CHANNELS 16
#endif
#endif
#endif