1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

Simplified platform.h (#12355)

As targets are limited to MCU now, we can use this fact to remove the #ifdef statements related to MCU. This is implied by the target.h and can be used for including MCU platform specific includes.
This commit is contained in:
J Blackman 2023-02-15 02:50:47 +11:00 committed by GitHub
parent 2dbbd1882c
commit 25b3b58385
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 36 additions and 34 deletions

View file

@ -44,6 +44,7 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#endif #endif
#define USE_TIMER_MGMT #define USE_TIMER_MGMT
#define USE_TIMER_AF
#define USE_DMA_SPEC #define USE_DMA_SPEC
#define USE_PERSISTENT_OBJECTS #define USE_PERSISTENT_OBJECTS
#define USE_CUSTOM_DEFAULTS_ADDRESS #define USE_CUSTOM_DEFAULTS_ADDRESS

View file

@ -124,7 +124,6 @@
#define USE_PERSISTENT_MSC_RTC #define USE_PERSISTENT_MSC_RTC
#define USE_MCO #define USE_MCO
#define USE_DMA_SPEC #define USE_DMA_SPEC
#define USE_TIMER_MGMT
#define USE_PERSISTENT_OBJECTS #define USE_PERSISTENT_OBJECTS
#define USE_CUSTOM_DEFAULTS_ADDRESS #define USE_CUSTOM_DEFAULTS_ADDRESS
#define USE_LATE_TASK_STATISTICS #define USE_LATE_TASK_STATISTICS
@ -148,7 +147,6 @@
#define USE_PERSISTENT_MSC_RTC #define USE_PERSISTENT_MSC_RTC
#define USE_MCO #define USE_MCO
#define USE_DMA_SPEC #define USE_DMA_SPEC
#define USE_TIMER_MGMT
#define USE_PERSISTENT_OBJECTS #define USE_PERSISTENT_OBJECTS
#define USE_CUSTOM_DEFAULTS_ADDRESS #define USE_CUSTOM_DEFAULTS_ADDRESS
#define USE_LATE_TASK_STATISTICS #define USE_LATE_TASK_STATISTICS
@ -168,7 +166,6 @@
#define USE_ADC_INTERNAL #define USE_ADC_INTERNAL
#define USE_USB_CDC_HID #define USE_USB_CDC_HID
#define USE_DMA_SPEC #define USE_DMA_SPEC
#define USE_TIMER_MGMT
#define USE_PERSISTENT_OBJECTS #define USE_PERSISTENT_OBJECTS
#define USE_DMA_RAM #define USE_DMA_RAM
#define USE_USB_MSC #define USE_USB_MSC
@ -187,7 +184,6 @@
#define USE_USB_CDC_HID #define USE_USB_CDC_HID
#define USE_MCO #define USE_MCO
#define USE_DMA_SPEC #define USE_DMA_SPEC
#define USE_TIMER_MGMT
#define USE_LATE_TASK_STATISTICS #define USE_LATE_TASK_STATISTICS
#endif #endif
@ -255,3 +251,6 @@ extern uint8_t _dmaram_end__;
#define DMA_RAM_W #define DMA_RAM_W
#define DMA_RAM_RW #define DMA_RAM_RW
#endif #endif
#define USE_TIMER_MGMT
#define USE_TIMER_AF

View file

@ -26,35 +26,6 @@
#pragma GCC poison sprintf snprintf #pragma GCC poison sprintf snprintf
#endif #endif
// common to all
#define USE_TIMER_AF
#if defined(STM32)
#include "drivers/stm32/platform_stm32.h"
#elif defined(AT32)
#include "drivers/at32/platform_at32.h"
#elif defined(SIMULATOR_BUILD)
// Nop
#undef USE_TIMER_AF
#define DEFAULT_CPU_OVERCLOCK 1
#define DMA_RAM
#define DMA_RW_AXI
#define DMA_RAM_R
#define DMA_RAM_W
#define DMA_RAM_RW
#define DMA_DATA_ZERO_INIT
#define DMA_DATA
#define STATIC_DMA_DATA_AUTO
#else
#error "Invalid chipset specified. Update platform.h"
#endif
#include "target/common_pre.h" #include "target/common_pre.h"
#ifdef USE_CONFIG #ifdef USE_CONFIG

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/at32/platform_at32.h"
#define TARGET_BOARD_IDENTIFIER "A435" #define TARGET_BOARD_IDENTIFIER "A435"
#define USBD_PRODUCT_STRING "Betaflight AT32F435" #define USBD_PRODUCT_STRING "Betaflight AT32F435"
@ -84,7 +86,6 @@
//#define USE_ADC //#define USE_ADC
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_TIMER_MGMT
#define USE_PWM_OUTPUT #define USE_PWM_OUTPUT
#undef USE_BEEPER #undef USE_BEEPER

View file

@ -31,6 +31,17 @@
#define SIMULATOR_MULTITHREAD #define SIMULATOR_MULTITHREAD
#define DEFAULT_CPU_OVERCLOCK 1
#define DMA_RAM
#define DMA_RW_AXI
#define DMA_RAM_R
#define DMA_RAM_W
#define DMA_RAM_RW
#define DMA_DATA_ZERO_INIT
#define DMA_DATA
#define STATIC_DMA_DATA_AUTO
// use simulatior's attitude directly // use simulatior's attitude directly
// disable this if wants to test AHRS algorithm // disable this if wants to test AHRS algorithm
#undef USE_IMU_CALC #undef USE_IMU_CALC

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#define TARGET_BOARD_IDENTIFIER "S405" #define TARGET_BOARD_IDENTIFIER "S405"
#define USBD_PRODUCT_STRING "Betaflight STM32F405" #define USBD_PRODUCT_STRING "Betaflight STM32F405"

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#define TARGET_BOARD_IDENTIFIER "S411" #define TARGET_BOARD_IDENTIFIER "S411"
#define USBD_PRODUCT_STRING "Betaflight STM32F411" #define USBD_PRODUCT_STRING "Betaflight STM32F411"

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#define TARGET_BOARD_IDENTIFIER "S745" #define TARGET_BOARD_IDENTIFIER "S745"
#define USBD_PRODUCT_STRING "Betaflight STM32F745" #define USBD_PRODUCT_STRING "Betaflight STM32F745"

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#define TARGET_BOARD_IDENTIFIER "S7X2" #define TARGET_BOARD_IDENTIFIER "S7X2"
#define USBD_PRODUCT_STRING "Betaflight STM32F7x2" #define USBD_PRODUCT_STRING "Betaflight STM32F7x2"

View file

@ -19,6 +19,9 @@
*/ */
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#define TARGET_BOARD_IDENTIFIER "SG47" #define TARGET_BOARD_IDENTIFIER "SG47"
#define USBD_PRODUCT_STRING "Betaflight STM32G47x" #define USBD_PRODUCT_STRING "Betaflight STM32G47x"

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#ifndef TARGET_BOARD_IDENTIFIER #ifndef TARGET_BOARD_IDENTIFIER
#define TARGET_BOARD_IDENTIFIER "SH72" #define TARGET_BOARD_IDENTIFIER "SH72"
#endif #endif

View file

@ -35,6 +35,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#ifndef TARGET_BOARD_IDENTIFIER #ifndef TARGET_BOARD_IDENTIFIER
#define TARGET_BOARD_IDENTIFIER "S730" #define TARGET_BOARD_IDENTIFIER "S730"
#endif #endif

View file

@ -20,6 +20,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#define TARGET_BOARD_IDENTIFIER "SH74" #define TARGET_BOARD_IDENTIFIER "SH74"
#define USBD_PRODUCT_STRING "Betaflight STM32H743" #define USBD_PRODUCT_STRING "Betaflight STM32H743"

View file

@ -35,6 +35,8 @@
#pragma once #pragma once
#include "drivers/stm32/platform_stm32.h"
#ifndef TARGET_BOARD_IDENTIFIER #ifndef TARGET_BOARD_IDENTIFIER
#define TARGET_BOARD_IDENTIFIER "S750" #define TARGET_BOARD_IDENTIFIER "S750"
#endif #endif