-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy pathADC_DMA.cpp
More file actions
68 lines (61 loc) · 1.48 KB
/
ADC_DMA.cpp
File metadata and controls
68 lines (61 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "Arduino.h"
void setup()
{
Serial.begin(115200);
pinMode(PA0, INPUT_ANALOG_DMA);
pinMode(PA1, INPUT_ANALOG_DMA);
pinMode(PA2, INPUT_ANALOG_DMA);
pinMode(PA3, INPUT_ANALOG_DMA);
pinMode(PA4, INPUT_ANALOG_DMA);
pinMode(PA5, INPUT_ANALOG_DMA);
pinMode(PA6, INPUT_ANALOG_DMA);
pinMode(PA7, INPUT_ANALOG_DMA);
pinMode(PB0, INPUT_ANALOG_DMA);
pinMode(PB1, INPUT_ANALOG_DMA);
pinMode(PC0, INPUT_ANALOG_DMA);
pinMode(PC1, INPUT_ANALOG_DMA);
pinMode(PC2, INPUT_ANALOG_DMA);
pinMode(PC3, INPUT_ANALOG_DMA);
pinMode(PC4, INPUT_ANALOG_DMA);
pinMode(PC5, INPUT_ANALOG_DMA);
ADC_DMA_Init();
}
void loop()
{
Serial.printf(
"PA0=%d,PA1=%d,PA2=%d,PA3=%d,PA4=%d,PA5=%d,PA6=%d,PA7=%d ",
analogRead_DMA(PA0),
analogRead_DMA(PA1),
analogRead_DMA(PA2),
analogRead_DMA(PA3),
analogRead_DMA(PA4),
analogRead_DMA(PA5),
analogRead_DMA(PA6),
analogRead_DMA(PA7)
);
Serial.printf(
"-- PB0=%d,PB1=%d ",
analogRead_DMA(PB0),
analogRead_DMA(PB1)
);
Serial.printf(
"-- PC0=%d,PC1=%d,PC2=%d,PC3=%d,PC4=%d,PC5=%d\r\n",
analogRead_DMA(PC0),
analogRead_DMA(PC1),
analogRead_DMA(PC2),
analogRead_DMA(PC3),
analogRead_DMA(PC4),
analogRead_DMA(PC5)
);
}
/**
* @brief Main Function
* @param None
* @retval None
*/
int main(void)
{
Delay_Init();
setup();
for(;;)loop();
}