Developing the ADC DMA driver
In this section, we will develop three distinct DMA drivers – one for transferring ADC data, another for UART data, and a third for transferring data between memory locations. Let’s begin with the ADC DMA driver.
The ADC DMA driver
Create a copy of your previous project in your IDE, following the steps outlined in earlier chapters. Rename this copied project ADC_DMA
. Next, create a new file named adc_dma.c
in the Src
folder and another file named adc_dma.h
in the Inc
folder.
Populate your adc_dma.c
file with the following code:
#include "adc_dma.h" #define GPIOAEN (1U<<0) #define ADC1EN (1U<<8) #define CR1_SCAN (1U<<8) #define CR2_DMA (1U<<...