f

Dependencies:   mbed 4DGL-uLCD-SE MMA8452

Committer:
lballard9
Date:
Thu Mar 10 05:30:11 2022 +0000
Revision:
1:d57364f0349f
Parent:
0:8e3b9bb1084a
Child:
2:ca5910acbade
built out the main.cpp shell to give more direction

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lballard9 0:8e3b9bb1084a 1 //=================================================================
lballard9 0:8e3b9bb1084a 2 // The main program file.
lballard9 0:8e3b9bb1084a 3 //
lballard9 0:8e3b9bb1084a 4 // Copyright 2022 Georgia Tech. All rights reserved.
lballard9 0:8e3b9bb1084a 5 // The materials provided by the instructor in this course are for
lballard9 0:8e3b9bb1084a 6 // the use of the students currently enrolled in the course.
lballard9 0:8e3b9bb1084a 7 // Copyrighted course materials may not be further disseminated.
lballard9 0:8e3b9bb1084a 8 // This file must not be made publicly available anywhere.
lballard9 0:8e3b9bb1084a 9 //==================================================================
lballard9 0:8e3b9bb1084a 10
lballard9 0:8e3b9bb1084a 11 // External libs
lballard9 0:8e3b9bb1084a 12 #include <stdlib.h>
lballard9 0:8e3b9bb1084a 13
lballard9 0:8e3b9bb1084a 14 // Project includes
lballard9 0:8e3b9bb1084a 15 #include "globals.h"
lballard9 0:8e3b9bb1084a 16 #include "hardware.h"
lballard9 0:8e3b9bb1084a 17 #include "graphics.h"
lballard9 0:8e3b9bb1084a 18 #include "keyboard.h"
lballard9 0:8e3b9bb1084a 19 // ===User implementations start===
lballard9 1:d57364f0349f 20 //For sound components
lballard9 1:d57364f0349f 21 ////AnalogOut DACout(p18);
lballard9 1:d57364f0349f 22 //PwmOut pwmout(p26);
lballard9 1:d57364f0349f 23
lballard9 1:d57364f0349f 24 ////PwmOut speaker(p25); //speaker
lballard9 1:d57364f0349f 25
lballard9 1:d57364f0349f 26
lballard9 1:d57364f0349f 27 ////wave_player waver(&DACout);
lballard9 1:d57364f0349f 28 //SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sck, cs
lballard9 1:d57364f0349f 29 // use the above for the wave player
lballard9 1:d57364f0349f 30
lballard9 1:d57364f0349f 31 DigitalOut myled1(LED1);
lballard9 1:d57364f0349f 32 DigitalOut myled2(LED2);
lballard9 1:d57364f0349f 33 DigitalOut myled3(LED3);
lballard9 1:d57364f0349f 34 DigitalOut myled4(LED4);
lballard9 0:8e3b9bb1084a 35
lballard9 0:8e3b9bb1084a 36 void set_random_seed(Timer);
lballard9 0:8e3b9bb1084a 37
lballard9 0:8e3b9bb1084a 38 /*
lballard9 0:8e3b9bb1084a 39 * This function handles the main logic of the game. You should
lballard9 0:8e3b9bb1084a 40 * initialize the hardware in this function, make calls to
lballard9 0:8e3b9bb1084a 41 * functions that update the keyboard and your guess of
lballard9 0:8e3b9bb1084a 42 * the word.
lballard9 0:8e3b9bb1084a 43 */
lballard9 0:8e3b9bb1084a 44 int main()
lballard9 0:8e3b9bb1084a 45 {
lballard9 1:d57364f0349f 46
lballard9 1:d57364f0349f 47 GameInputs inputs;
lballard9 1:d57364f0349f 48 // First things first: initialize hardware
lballard9 1:d57364f0349f 49 ASSERT_P(hardware_init() == ERROR_NONE, "Hardware init failed!");
lballard9 1:d57364f0349f 50 pc.printf("Program Starting\n");
lballard9 1:d57364f0349f 51 //led1 hardware initialization
lballard9 1:d57364f0349f 52
lballard9 1:d57364f0349f 53 myled1=1;
lballard9 1:d57364f0349f 54 Timer t;
lballard9 1:d57364f0349f 55 int dt; // delta time
lballard9 1:d57364f0349f 56
lballard9 1:d57364f0349f 57 /*
lballard9 1:d57364f0349f 58 Put your code for main menu here, seed random function here as well
lballard9 1:d57364f0349f 59 */
lballard9 1:d57364f0349f 60
lballard9 1:d57364f0349f 61 // initialize the game state, print something to the screen and wait for an input.
lballard9 1:d57364f0349f 62 // do that before entering this game loop
lballard9 1:d57364f0349f 63
lballard9 1:d57364f0349f 64 while(1){
lballard9 1:d57364f0349f 65 t.start(); //start a timer
lballard9 1:d57364f0349f 66 draw_lower_status(); //draw the lower status bar
lballard9 1:d57364f0349f 67 inputs = read_inputs(); //read the inputs of the game
lballard9 1:d57364f0349f 68
lballard9 1:d57364f0349f 69
lballard9 1:d57364f0349f 70 /*
lballard9 1:d57364f0349f 71 your code here, make decisions based on those inputs, update the keyboard
lballard9 1:d57364f0349f 72 make selections, update words etc.
lballard9 1:d57364f0349f 73 */
lballard9 1:d57364f0349f 74
lballard9 1:d57364f0349f 75 t.stop();
lballard9 1:d57364f0349f 76 dt = t.read_ms();
lballard9 1:d57364f0349f 77
lballard9 1:d57364f0349f 78 }
lballard9 0:8e3b9bb1084a 79 }
lballard9 0:8e3b9bb1084a 80
lballard9 1:d57364f0349f 81
lballard9 0:8e3b9bb1084a 82
lballard9 0:8e3b9bb1084a 83 /*
lballard9 0:8e3b9bb1084a 84 * This function sets the random seed for the game.
lballard9 0:8e3b9bb1084a 85 * It also initializes the keyboard. You may choose to
lballard9 0:8e3b9bb1084a 86 * put the start screen in here as well. This should be
lballard9 0:8e3b9bb1084a 87 * called in the main function above.
lballard9 0:8e3b9bb1084a 88 */
lballard9 0:8e3b9bb1084a 89 void set_random_seed(Timer t) {
lballard9 0:8e3b9bb1084a 90
lballard9 0:8e3b9bb1084a 91 }
lballard9 0:8e3b9bb1084a 92 // ===User implementations end===