AP_MSP: add and use AP_MSP_config.h

This commit is contained in:
Peter Barker 2023-05-03 11:24:50 +10:00 committed by Andrew Tridgell
parent 008eec5838
commit da36de3b80
5 changed files with 29 additions and 21 deletions

View File

@ -19,12 +19,13 @@
#pragma once #pragma once
#include <AP_OSD/AP_OSD.h> #include "AP_MSP_config.h"
#include "AP_MSP_Telem_Backend.h"
#if HAL_MSP_ENABLED #if HAL_MSP_ENABLED
#include <AP_OSD/AP_OSD.h>
#include "AP_MSP_Telem_Backend.h"
#define MSP_MAX_INSTANCES 3 #define MSP_MAX_INSTANCES 3
#define MSP_OSD_START 2048 #define MSP_OSD_START 2048
#define MSP_OSD_STEP_X 1 #define MSP_OSD_STEP_X 1

View File

@ -16,6 +16,10 @@
*/ */
#pragma once #pragma once
#include "AP_MSP_config.h"
#if HAL_MSP_ENABLED
#include <AP_RCTelemetry/AP_RCTelemetry.h> #include <AP_RCTelemetry/AP_RCTelemetry.h>
#include <AP_SerialManager/AP_SerialManager.h> #include <AP_SerialManager/AP_SerialManager.h>
#include <AP_OSD/AP_OSD.h> #include <AP_OSD/AP_OSD.h>
@ -24,8 +28,6 @@
#include <time.h> #include <time.h>
#if HAL_MSP_ENABLED
#define MSP_TIME_SLOT_MAX 12 #define MSP_TIME_SLOT_MAX 12
#define CELLFULL 4.35 #define CELLFULL 4.35
#define MSP_TXT_BUFFER_SIZE 15U // 11 + 3 utf8 chars + terminator #define MSP_TXT_BUFFER_SIZE 15U // 11 + 3 utf8 chars + terminator

View File

@ -0,0 +1,17 @@
#pragma once
#include <AP_HAL/AP_HAL_Boards.h>
#ifndef HAL_MSP_ENABLED
#define HAL_MSP_ENABLED !HAL_MINIMIZE_FEATURES
#endif
// define for enabling MSP sensor drivers
#ifndef HAL_MSP_SENSORS_ENABLED
#define HAL_MSP_SENSORS_ENABLED HAL_MSP_ENABLED && !HAL_MINIMIZE_FEATURES && !defined(HAL_BUILD_AP_PERIPH)
#endif
// define for enabling MSP DisplayPort
#ifndef HAL_WITH_MSP_DISPLAYPORT
#define HAL_WITH_MSP_DISPLAYPORT HAL_MSP_ENABLED && !HAL_MINIMIZE_FEATURES && !defined(HAL_BUILD_AP_PERIPH)
#endif

View File

@ -1,20 +1,8 @@
#pragma once #pragma once
#include <AP_HAL/AP_HAL.h> #include "AP_MSP_config.h"
#ifndef HAL_MSP_ENABLED #if HAL_MSP_ENABLED
#define HAL_MSP_ENABLED !HAL_MINIMIZE_FEATURES
#endif
// define for enabling MSP sensor drivers
#ifndef HAL_MSP_SENSORS_ENABLED
#define HAL_MSP_SENSORS_ENABLED HAL_MSP_ENABLED && !HAL_MINIMIZE_FEATURES && !defined(HAL_BUILD_AP_PERIPH)
#endif
// define for enabling MSP DisplayPort
#ifndef HAL_WITH_MSP_DISPLAYPORT
#define HAL_WITH_MSP_DISPLAYPORT HAL_MSP_ENABLED && !HAL_MINIMIZE_FEATURES && !defined(HAL_BUILD_AP_PERIPH)
#endif
#include <AP_HAL/UARTDriver.h> #include <AP_HAL/UARTDriver.h>
@ -24,8 +12,6 @@
#include "msp_version.h" #include "msp_version.h"
#include "msp_sensors.h" #include "msp_sensors.h"
#if HAL_MSP_ENABLED
// betaflight/src/main/common/utils.h // betaflight/src/main/common/utils.h
#define MSP_ARRAYEND(x) (&(x)[ARRAY_SIZE(x)]) #define MSP_ARRAYEND(x) (&(x)[ARRAY_SIZE(x)])
#define MSP_UNUSED(x) (void)(x) #define MSP_UNUSED(x) (void)(x)

View File

@ -1,5 +1,7 @@
#include <stdint.h> #include <stdint.h>
#pragma once
namespace MSP namespace MSP
{ {
// src/main/msp/msp_protocol_v2_sensor_msg.h // src/main/msp/msp_protocol_v2_sensor_msg.h