0% found this document useful (0 votes)
72 views

Main Final

This document contains C code that initializes and runs an events and services framework. It includes header files related to stdint, stdbool, stdio, hardware types/map, system control, GPIO, interrupts, UART, the events and services framework, and port and terminal I/O. It defines some terminal control codes. The main function initializes ports as GPIO, sets the system clock, initializes terminal I/O, clears the screen, prints a startup message, and initializes and runs the events and services framework, catching any errors. It then enters an infinite loop.

Uploaded by

api-340769184
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Main Final

This document contains C code that initializes and runs an events and services framework. It includes header files related to stdint, stdbool, stdio, hardware types/map, system control, GPIO, interrupts, UART, the events and services framework, and port and terminal I/O. It defines some terminal control codes. The main function initializes ports as GPIO, sets the system clock, initializes terminal I/O, clears the screen, prints a startup message, and initializes and runs the events and services framework, catching any errors. It then enters an infinite loop.

Uploaded by

api-340769184
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include

#include
#include
#include
#include
#include
#include
#include
#include

<stdint.h>
<stdbool.h>
<stdio.h>
"inc/hw_types.h"
"inc/hw_memmap.h"
"driverlib/sysctl.h"
"driverlib/gpio.h"
"driverlib/interrupt.h"
"utils/uartstdio.h"

#include
#include
#include
#include

"ES_Configure.h"
"ES_Framework.h"
"ES_Port.h"
"termio.h"

#include "LEDService.h"
#include "EnablePA25_PB23_PD7_PF0.h"
#define clrScrn()
printf("\x1b[2J")
#define goHome() printf("\x1b[1,1H")
#define clrLine() printf("\x1b[K")
int main(void)
{
PortFunctionInit(); // Allow all ports to be used as GPIO
// Set the clock to run at 40MhZ using the PLL and 16MHz external crystal
SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
| SYSCTL_XTAL_16MHZ);
TERMIO_Init();
clrScrn();
ES_Return_t ErrorType;
// When doing testing, it is useful to announce just which program
// is running.
puts("\rStarting Test Harness for \r");
printf("the 2nd Generation Events & Services Framework V2.2\r\n");
printf("%s %s\n",__TIME__, __DATE__);
printf("\n\r\n");
printf("Press any key to post key-stroke events to Service 0\n\r");
printf("Press 'd' to test event deferral \n\r");
printf("Press 'r' to test event recall \n\r");
// Your hardware initialization function calls go here
// now initialize the Events and Services Framework and start it running
ErrorType = ES_Initialize(ES_Timer_RATE_1mS);
if ( ErrorType == Success ) {
ErrorType = ES_Run();
}
//if we got to here, there was an error
switch (ErrorType){
case FailedPost:
printf("Failed on attempt to Post\n");
break;
case FailedPointer:
printf("Failed on NULL pointer\n");
break;
case FailedInit:

printf("Failed Initialization\n");
break;
default:
printf("Other Failure\n");
break;

}
for(;;)
;
}

You might also like