-
Notifications
You must be signed in to change notification settings - Fork 0
/
DesktopUART.c
52 lines (35 loc) · 951 Bytes
/
DesktopUART.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
/*
* David Muller; Germán Alfaro
* davidmuller10@mittymonarch.com; alfaro.germanevera@gmail.com
*/
#include "DesktopUART.h"
#include "StellarisWare.h"
/*
* USE THE MACRO IN THE HEADER TO TURN UART1 OFF!
*
*
* DesktopUART.c allows you to open ("set-up") and close UART1
* which is the UARTstdio module and the main serial line to the
* desktop.
*/
/*
* Set up UART1 as stdio.
* 9600, 8, N, 1
*/
void openUART1(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); //UART1 is on GPIOC
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART1); //it's UART1
ROM_GPIOPinConfigure(GPIO_PC4_U1RX); //configure the pins
ROM_GPIOPinConfigure(GPIO_PC5_U1TX);
ROM_GPIOPinTypeUART(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_5);
//UART1 is the stdio module
UARTStdioInitExpClk(1, 9600);
}
/*
* Disable UART1.
*/
void closeUART1(void)
{
ROM_UARTDisable(UART1_BASE);
}