mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
[F7] Refactor enableDmaClock with RCC_ClockCmd
This commit is contained in:
parent
f68b0422da
commit
228592049d
1 changed files with 3 additions and 9 deletions
|
@ -28,7 +28,8 @@
|
|||
|
||||
#include "drivers/nvic.h"
|
||||
#include "drivers/dma.h"
|
||||
#include "resource.h"
|
||||
#include "drivers/rcc.h"
|
||||
#include "drivers/resource.h"
|
||||
|
||||
/*
|
||||
* DMA descriptors.
|
||||
|
@ -76,14 +77,7 @@ DEFINE_DMA_IRQ_HANDLER(2, 7, DMA2_ST7_HANDLER)
|
|||
|
||||
static void enableDmaClock(int index)
|
||||
{
|
||||
const uint32_t rcc = dmaDescriptors[index].dma == DMA1 ? RCC_AHB1ENR_DMA1EN : RCC_AHB1ENR_DMA2EN;
|
||||
do {
|
||||
__IO uint32_t tmpreg;
|
||||
SET_BIT(RCC->AHB1ENR, rcc);
|
||||
/* Delay after an RCC peripheral clock enabling */
|
||||
tmpreg = READ_BIT(RCC->AHB1ENR, rcc);
|
||||
UNUSED(tmpreg);
|
||||
} while (0);
|
||||
RCC_ClockCmd(dmaDescriptors[index].dma == DMA1 ? RCC_AHB1(DMA1) : RCC_AHB1(DMA2), ENABLE);
|
||||
}
|
||||
|
||||
void dmaInit(dmaIdentifier_e identifier, resourceOwner_e owner, uint8_t resourceIndex)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue