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

Move STM (and clone) related SPI implementation to platform (#14124)

This commit is contained in:
Jay Blackman 2025-01-06 04:40:36 +11:00 committed by GitHub
parent 60d35fa886
commit 926c21ce7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 487 additions and 428 deletions

View file

@ -118,7 +118,8 @@ MCU_COMMON_SRC = \
drivers/adc.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
common/stm32/bus_spi_pinconfig.c \
common/stm32/bus_spi_hw.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c \
@ -129,6 +130,7 @@ MCU_COMMON_SRC = \
msc/usbd_storage_sd_spi.c
SPEED_OPTIMISED_SRC += \
common/stm32/bus_spi_hw.c \
common/stm32/system.c
SIZE_OPTIMISED_SRC += \
@ -136,7 +138,7 @@ SIZE_OPTIMISED_SRC += \
drivers/inverter.c \
drivers/bus_i2c_config.c \
drivers/bus_spi_config.c \
drivers/bus_spi_pinconfig.c \
common/stm32/bus_spi_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
drivers/serial_uart_pinconfig.c

View file

@ -127,4 +127,18 @@ typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
#define IO_CONFIG_GET_OTYPE(cfg) (((cfg) >> 4) & 0x01)
#define IO_CONFIG_GET_PULL(cfg) (((cfg) >> 5) & 0x03)
#define SPI_IO_AF_CFG IO_CONFIG(GPIO_MODE_MUX, GPIO_DRIVE_STRENGTH_STRONGER, GPIO_OUTPUT_PUSH_PULL, GPIO_PULL_NONE)
#define SPI_IO_AF_SCK_CFG_HIGH IO_CONFIG(GPIO_MODE_MUX, GPIO_DRIVE_STRENGTH_STRONGER, GPIO_OUTPUT_PUSH_PULL, GPIO_PULL_UP)
#define SPI_IO_AF_SCK_CFG_LOW IO_CONFIG(GPIO_MODE_MUX, GPIO_DRIVE_STRENGTH_STRONGER, GPIO_OUTPUT_PUSH_PULL, GPIO_PULL_DOWN)
#define SPI_IO_AF_SDI_CFG IO_CONFIG(GPIO_MODE_MUX, GPIO_DRIVE_STRENGTH_STRONGER, GPIO_OUTPUT_PUSH_PULL, GPIO_PULL_UP)
#define SPI_IO_CS_CFG IO_CONFIG(GPIO_MODE_OUTPUT, GPIO_DRIVE_STRENGTH_STRONGER, GPIO_OUTPUT_PUSH_PULL, GPIO_PULL_NONE)
#define SPI_IO_CS_HIGH_CFG IO_CONFIG(GPIO_MODE_INPUT, GPIO_DRIVE_STRENGTH_STRONGER, GPIO_OUTPUT_PUSH_PULL, GPIO_PULL_UP)
#define SPIDEV_COUNT 4
#define CHECK_SPI_RX_DATA_AVAILABLE(instance) LL_SPI_IsActiveFlag_RXNE(instance)
#define SPI_RX_DATA_REGISTER(base) ((base)->DR)
#define MAX_SPI_PIN_SEL 4
#endif