Fix missing SPI5 and SPI6 configuration.

* Missing SPI5/SPI6 devices.
* Support SPI5/6 on the STMH743 unified target.

There were no defaults for the `SPI_FULL_RECONFIGURABILITY` option.
This commit is contained in:
Dominic Clifton 2021-04-15 18:42:01 +02:00 committed by Dominic Clifton
parent 0b3a5a651b
commit b8c4f7308a
3 changed files with 53 additions and 4 deletions

View File

@ -46,23 +46,39 @@ busDevice_t spiBusDevice[SPIDEV_COUNT];
SPIDevice spiDeviceByInstance(SPI_TypeDef *instance)
{
#ifdef USE_SPI_DEVICE_1
if (instance == SPI1)
if (instance == SPI1) {
return SPIDEV_1;
}
#endif
#ifdef USE_SPI_DEVICE_2
if (instance == SPI2)
if (instance == SPI2) {
return SPIDEV_2;
}
#endif
#ifdef USE_SPI_DEVICE_3
if (instance == SPI3)
if (instance == SPI3) {
return SPIDEV_3;
}
#endif
#ifdef USE_SPI_DEVICE_4
if (instance == SPI4)
if (instance == SPI4) {
return SPIDEV_4;
}
#endif
#ifdef USE_SPI_DEVICE_5
if (instance == SPI5) {
return SPIDEV_5;
}
#endif
#ifdef USE_SPI_DEVICE_6
if (instance == SPI6) {
return SPIDEV_6;
}
#endif
return SPIINVALID;

View File

@ -52,6 +52,12 @@ const spiDefaultConfig_t spiDefaultConfig[] = {
#ifdef USE_SPI_DEVICE_4
{ SPIDEV_4, IO_TAG(SPI4_SCK_PIN), IO_TAG(SPI4_MISO_PIN), IO_TAG(SPI4_MOSI_PIN), SPI4_TX_DMA_OPT, SPI4_RX_DMA_OPT },
#endif
#ifdef USE_SPI_DEVICE_5
{ SPIDEV_5, IO_TAG(SPI5_SCK_PIN), IO_TAG(SPI5_MISO_PIN), IO_TAG(SPI5_MOSI_PIN), SPI5_TX_DMA_OPT, SPI5_RX_DMA_OPT },
#endif
#ifdef USE_SPI_DEVICE_6
{ SPIDEV_6, IO_TAG(SPI6_SCK_PIN), IO_TAG(SPI6_MISO_PIN), IO_TAG(SPI6_MOSI_PIN), SPI6_TX_DMA_OPT, SPI6_RX_DMA_OPT },
#endif
};
PG_REGISTER_ARRAY_WITH_RESET_FN(spiPinConfig_t, SPIDEV_COUNT, spiPinConfig, PG_SPI_PIN_CONFIG, 1);

View File

@ -224,6 +224,17 @@
#define SPI4_MOSI_PIN NONE
#endif
#ifdef USE_SPI_DEVICE_5
#define SPI5_SCK_PIN NONE
#define SPI5_MISO_PIN NONE
#define SPI5_MOSI_PIN NONE
#endif
#ifdef USE_SPI_DEVICE_6
#define SPI6_SCK_PIN NONE
#define SPI6_MISO_PIN NONE
#define SPI6_MOSI_PIN NONE
#endif
#else
// Pin defaults for backward compatibility
@ -556,6 +567,22 @@
#define SPI4_RX_DMA_OPT (DMA_OPT_UNUSED)
#endif
#endif
#ifdef USE_SPI_DEVICE_5
#ifndef SPI5_TX_DMA_OPT
#define SPI5_TX_DMA_OPT (DMA_OPT_UNUSED)
#endif
#ifndef SPI5_RX_DMA_OPT
#define SPI5_RX_DMA_OPT (DMA_OPT_UNUSED)
#endif
#endif
#ifdef USE_SPI_DEVICE_6
#ifndef SPI6_TX_DMA_OPT
#define SPI6_TX_DMA_OPT (DMA_OPT_UNUSED)
#endif
#ifndef SPI6_RX_DMA_OPT
#define SPI6_RX_DMA_OPT (DMA_OPT_UNUSED)
#endif
#endif
#endif
#ifdef USE_UART1