-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
45 lines (37 loc) · 1.31 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
/******************************************************************************
Copyright (c) 2017-2019 Analog Devices, Inc. All Rights Reserved.
This software is proprietary to Analog Devices, Inc. and its licensors.
By using this software you agree to the terms of the associated
Analog Devices Software License Agreement.
*****************************************************************************/
#include "UrtLib.h"
#include "ClkLib.h"
#include "DioLib.h"
#include <stdio.h>
#include "ad5940.h"
void UartInit(void);
void ClockInit(void);
int main(void)
{
void AD5940_Main(void);
ClockInit();
UartInit();
AD5940_MCUResourceInit(0); /* Inialize all peripherals etc. used for AD5940/AFE. */
AD5940_Main();
}
void ClockInit(void)
{
DigClkSel(DIGCLK_SOURCE_HFOSC);
ClkDivCfg(1,1); //HCLK = PCLK = 26MHz
}
// Initialize UART for 230400-8-N-1
void UartInit(void)
{
DioCfgPin(pADI_GPIO0,PIN10|PIN11,1); // Setup P0.10, P0.11 as UART pin
UrtCfg(pADI_UART0,B115200,
(BITM_UART_COMLCR_WLS|3),0); // Configure UART for 57600 baud rate
UrtFifoCfg(pADI_UART0, RX_FIFO_1BYTE, // Configure the UART FIFOs for 8 bytes deep
BITM_UART_COMFCR_FIFOEN);
UrtFifoClr(pADI_UART0, BITM_UART_COMFCR_RFCLR// Clear the Rx/TX FIFOs
|BITM_UART_COMFCR_TFCLR);
}