mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-12-25 00:58:33 -07:00
stm32: Clean up SPI code on stm32h7_spi.c
Signed-off-by: Alan.Ma from BigTreeTech tech@biqu3d.com
This commit is contained in:
parent
8db5d254e0
commit
e8e88415ea
1 changed files with 15 additions and 41 deletions
|
|
@ -16,67 +16,41 @@ struct spi_info {
|
|||
uint8_t miso_pin, mosi_pin, sck_pin, function;
|
||||
};
|
||||
|
||||
DECL_ENUMERATION("spi_bus", "spi2", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi2", 0);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi2", "PB14,PB15,PB13");
|
||||
|
||||
DECL_ENUMERATION("spi_bus", "spi1", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi1", 1);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi1", "PA6,PA7,PA5");
|
||||
DECL_ENUMERATION("spi_bus", "spi1a", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi1a", 2);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi1a", "PB4,PB5,PB3");
|
||||
|
||||
#if !CONFIG_MACH_STM32F1
|
||||
DECL_ENUMERATION("spi_bus", "spi2a", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi2a", 3);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi2a", "PC2,PC3,PB10");
|
||||
#endif
|
||||
|
||||
#ifdef SPI3
|
||||
DECL_ENUMERATION("spi_bus", "spi3a", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi3a", 4);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi3a", "PC11,PC12,PC10");
|
||||
#endif
|
||||
|
||||
#ifdef SPI4
|
||||
DECL_ENUMERATION("spi_bus", "spi4", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi4", 5);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi4", "PE13,PE14,PE12");
|
||||
#endif
|
||||
|
||||
DECL_ENUMERATION("spi_bus", "spi5", 6);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi5", "PF8,PF9,PF7");
|
||||
DECL_ENUMERATION("spi_bus", "spi5a", 7);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi5a", "PH7,PF11,PH6");
|
||||
DECL_ENUMERATION("spi_bus", "spi6", 8);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi6", "PG12,PG14,PG13");
|
||||
#ifdef GPIOI
|
||||
DECL_ENUMERATION("spi_bus", "spi2b", __COUNTER__);
|
||||
DECL_ENUMERATION("spi_bus", "spi2b", 9);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi2b", "PI2,PI3,PI1");
|
||||
#endif
|
||||
|
||||
#ifdef SPI5
|
||||
DECL_ENUMERATION("spi_bus", "spi5", __COUNTER__);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi5", "PF8,PF9,PF7");
|
||||
DECL_ENUMERATION("spi_bus", "spi5a", __COUNTER__);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi5a", "PH7,PF11,PH6");
|
||||
#endif
|
||||
|
||||
#ifdef SPI6
|
||||
DECL_ENUMERATION("spi_bus", "spi6", __COUNTER__);
|
||||
DECL_CONSTANT_STR("BUS_PINS_spi6", "PG12,PG14,PG13");
|
||||
#endif
|
||||
|
||||
|
||||
static const struct spi_info spi_bus[] = {
|
||||
{ SPI2, GPIO('B', 14), GPIO('B', 15), GPIO('B', 13), GPIO_FUNCTION(5) },
|
||||
{ SPI1, GPIO('A', 6), GPIO('A', 7), GPIO('A', 5), GPIO_FUNCTION(5) },
|
||||
{ SPI1, GPIO('B', 4), GPIO('B', 5), GPIO('B', 3), GPIO_FUNCTION(5) },
|
||||
#if !CONFIG_MACH_STM32F1
|
||||
{ SPI2, GPIO('C', 2), GPIO('C', 3), GPIO('B', 10), GPIO_FUNCTION(5) },
|
||||
#endif
|
||||
#ifdef SPI3
|
||||
{ SPI3, GPIO('C', 11), GPIO('C', 12), GPIO('C', 10), GPIO_FUNCTION(6) },
|
||||
#endif
|
||||
#ifdef SPI4
|
||||
{ SPI4, GPIO('E', 13), GPIO('E', 14), GPIO('E', 12), GPIO_FUNCTION(5) },
|
||||
#endif
|
||||
{ SPI2, GPIO('I', 2), GPIO('I', 3), GPIO('I', 1), GPIO_FUNCTION(5) },
|
||||
#ifdef SPI5
|
||||
{ SPI5, GPIO('F', 8), GPIO('F', 9), GPIO('F', 7), GPIO_FUNCTION(5) },
|
||||
{ SPI5, GPIO('H', 7), GPIO('F', 11), GPIO('H', 6), GPIO_FUNCTION(5) },
|
||||
#endif
|
||||
#ifdef SPI6
|
||||
{ SPI6, GPIO('G', 12), GPIO('G', 14), GPIO('G', 13), GPIO_FUNCTION(5)},
|
||||
#ifdef GPIOI
|
||||
{ SPI2, GPIO('I', 2), GPIO('I', 3), GPIO('I', 1), GPIO_FUNCTION(5) },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue