-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
64 lines (51 loc) · 1.55 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
/**
* main.c
* @author:
* uP2 - Fall 2022
*/
// Include all headers you might need
#include <G8RTOS/G8RTOS_IPC.h>
#include <G8RTOS/G8RTOS_Semaphores.h>
#include <G8RTOS/G8RTOS_Structures.h>
#include "threads.h"
#include <stdbool.h>
#include <stdlib.h>
#include "driverlib/watchdog.h"
#include "inc/hw_memmap.h"
#include "inc/tm4c123gh6pm.h"
#include "BoardSupport/inc/BoardInitialization.h"
#include "inc/RGBLedDriver.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "BoardSupport/inc/ILI9341_lib.h"
#include "BoardSupport/inc/AsciiLib.h"
#include <string.h>
#include <math.h>
void main(void)
{
// your code
// Initialize the G8RTOS
G8RTOS_Init();
// Initialize the BSP
//bool isBoardSetup = InitializeBoard();
// Initialize Sensor semaphore
LEDMutex = (semaphore_t*) malloc(sizeof(semaphore_t));
G8RTOS_InitSemaphore(LEDMutex, 1);
LCDMutex = (semaphore_t*) malloc(sizeof(semaphore_t));
G8RTOS_InitSemaphore(LCDMutex, 1);
joyMutex = (semaphore_t*) malloc(sizeof(semaphore_t));
G8RTOS_InitSemaphore(joyMutex, 1);
// Add background thread 0 to 4
G8RTOS_AddThread(NullThread, 255, "NOP");
G8RTOS_AddThread(startGameT, 50, "startGame");
float num = -14.38;
int yes = fabsf(num) > 4.2;
// Add periodic thread 0
//Add aperiodic threads
G8RTOS_AddAPeriodicEvent(&LCDtapISR, 2, INT_GPIOB);
G8RTOS_AddAPeriodicEvent(&ButtonsISR, 3, INT_GPIOC);
G8RTOS_AddAPeriodicEvent(&JoystickPressISR, 4, INT_GPIOE);
srand(time(NULL));
// Launch the G8RTOS
G8RTOS_Launch();
}