1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-25 09:16:01 +03:00

SDCard & I2C bugfixes (#513)

* Fix usage of uninitialised I2C bus
* Fix SDCard not working issue
* Fix DMA compilation issues on F4
This commit is contained in:
Konstantin Sharlaimov 2016-08-29 12:14:35 +03:00 committed by GitHub
parent de24cd0842
commit b91d37e9c8
6 changed files with 78 additions and 9 deletions

View file

@ -24,6 +24,7 @@
#include "nvic.h"
#include "io.h"
#include "dma.h"
#include "bus_spi.h"
#include "system.h"
@ -31,6 +32,8 @@
#include "sdcard.h"
#include "sdcard_standard.h"
#include "build/debug.h"
#ifdef AFATFS_USE_INTROSPECTIVE_LOGGING
#define SDCARD_PROFILING
#endif
@ -414,9 +417,6 @@ static void sdcard_sendDataBlockBegin(uint8_t *buffer, bool multiBlockWrite)
if (useDMAForTx) {
#ifdef SDCARD_DMA_CHANNEL_TX
// Queue the transmission of the sector payload
#ifdef SDCARD_DMA_CLK
RCC_AHB1PeriphClockCmd(SDCARD_DMA_CLK, ENABLE);
#endif
DMA_InitTypeDef DMA_InitStructure;
DMA_StructInit(&DMA_InitStructure);
@ -544,6 +544,8 @@ void sdcard_init(bool useDMA)
{
#ifdef SDCARD_DMA_CHANNEL_TX
useDMAForTx = useDMA;
dmaEnableClock(dmaFindHandlerIdentifier(SDCARD_DMA_CHANNEL_TX));
DMA_Cmd(SDCARD_DMA_CHANNEL_TX, DISABLE);
#else
// DMA is not available
(void) useDMA;