1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

New SPI API supporting DMA

Call targetConfiguration() once before config is loaded and again afterwards in case the config needs to be changed to load from SD card etc

Drop SPI clock during binding

Remove debug

Add per device SPI DMA enable

Fix sdioPinConfigure() declaration warning

Reduce clock speed during SPI RX initialisation
This commit is contained in:
Steve Evans 2021-04-20 19:45:56 +01:00 committed by Michael Keller
parent 6d286e25f1
commit 87c8847c13
136 changed files with 3585 additions and 2721 deletions

View file

@ -49,7 +49,7 @@ typedef struct spiHardware_s {
uint8_t af;
#endif
rccPeriphTag_t rcc;
#if defined(USE_DMA) && defined(USE_HAL_DRIVER)
#ifdef USE_DMA
uint8_t dmaIrqHandler;
#endif
} spiHardware_t;
@ -67,23 +67,24 @@ typedef struct SPIDevice_s {
uint8_t mosiAF;
#else
uint8_t af;
#endif
#if defined(HAL_SPI_MODULE_ENABLED)
SPI_HandleTypeDef hspi;
#endif
rccPeriphTag_t rcc;
volatile uint16_t errorCount;
bool leadingEdge;
#if defined(USE_HAL_DRIVER)
SPI_HandleTypeDef hspi;
#ifdef USE_DMA
DMA_HandleTypeDef hdma;
uint8_t dmaIrqHandler;
#endif
#endif
#ifdef USE_SPI_TRANSACTION
uint16_t cr1SoftCopy; // Copy of active CR1 value for this SPI instance
#endif
} spiDevice_t;
extern spiDevice_t spiDevice[SPIDEV_COUNT];
void spiInitDevice(SPIDevice device, bool leadingEdge);
uint32_t spiTimeoutUserCallback(SPI_TypeDef *instance);
void spiInitDevice(SPIDevice device);
void spiInternalInitStream(const extDevice_t *dev, bool preInit);
void spiInternalStartDMA(const extDevice_t *dev);
void spiInternalStopDMA (const extDevice_t *dev);
void spiInternalResetStream(dmaChannelDescriptor_t *descriptor);
void spiInternalResetDescriptors(busDevice_t *bus);