-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
67 lines (50 loc) · 1.79 KB
/
main.c
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
#include "main.h"
/* Convolutiefilter-opdracht, STP
* Ian Baak en Luca Panjer
* 19-12-2019
* EV3A
*
* Dit is de main die hoort bij een programma dat een convolutiefilter van
* het ARM-bord maakt.
*/
extern uint32_t G_CLK;
//Prototypes of local functions:
void printinfo();
void initboard();
void printinfo() //Function that writes some info to the UART.
{
char *functionality = //Startup message
" Convolutiefilter-opdracht \r\n"
" Luca Panjer en Ian Baak, EV3A\r\n"
" Vak: STP, Docent: Franc van der Bent & Hubert Schuit\r\n\r\n"
" CLK speed: %d Mhz\r\n\r\n";
UART_printf(256, functionality, G_CLK / 1000000);
}
void initboard() //Function that contains all initialize functions of the board I/O.
{
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIOD->MODER |= (1 << 26);
GPIOD->MODER |= (1 << 30);
static int set = 1; // reset identifier
SystemInit(); // Set SystemCLK
set++; // if this value is > 1 you have made a serious pointer error, reset happened
DELAY_init(); // Initialize Delay functions
UART_init(); // Initialize UART3 Without interrupt.
LCD_init(); // Initialize LCD-display
//Generate default kernel for use by the convolution:
gen_kernel(DEFAULTFREQ, TAPS);
KEYS_INT_init(); //Initialize interrupts for the keys, so that these can be used to reconfigure the sinc function.
buffer_init(); //Initialize circular buffer.
DAC_init(Channel_1); // init channel 1 of DA converter full precision
DAC_init(Channel_2); // init channel 2 of DA converter full precision
DAC_INT_init();
ADC_init(Channel_1); // init channel 1 of AD converter full precision
ADC_init(Channel_2); // init channel 2 of AD converter full precision
}
int main(void)
{
initboard(); //Initialize I/O.
printinfo();
while (1)
; //ADC and DAC will run under interrupt.
}