baseline features - a little buggy

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Committer:
DCchico
Date:
Mon Mar 29 21:17:26 2021 -0400
Revision:
0:95264f964374
Child:
1:4421c1e849e9
inital commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DCchico 0:95264f964374 1 // This header has all the (extern) declarations of the globals.
DCchico 0:95264f964374 2 // "extern" means "this is instantiated somewhere, but here's what the name
DCchico 0:95264f964374 3 // means.
DCchico 0:95264f964374 4 #include "globals.h"
DCchico 0:95264f964374 5
DCchico 0:95264f964374 6 #include "hardware.h"
DCchico 0:95264f964374 7
DCchico 0:95264f964374 8 // We need to actually instantiate all of the globals (i.e. declare them once
DCchico 0:95264f964374 9 // without the extern keyword). That's what this file does!
DCchico 0:95264f964374 10
DCchico 0:95264f964374 11 // Hardware initialization: Instantiate all the things!
DCchico 0:95264f964374 12 uLCD_4DGL uLCD(p9,p10,p11); // LCD Screen (tx, rx, reset)
DCchico 0:95264f964374 13 //SDFileSystem sd(p5, p6, p7, p8, "sd"); // SD Card(mosi, miso, sck, cs)
DCchico 0:95264f964374 14 Serial pc(USBTX,USBRX); // USB Console (tx, rx)
DCchico 0:95264f964374 15 MMA8452 acc(p28, p27, 100000); // Accelerometer (sda, sdc, rate)
DCchico 0:95264f964374 16 DigitalIn button1(p21); // Pushbuttons (pin)
DCchico 0:95264f964374 17 DigitalIn button2(p22);
DCchico 0:95264f964374 18 DigitalIn button3(p23);
DCchico 0:95264f964374 19 AnalogOut DACout(p18); // Speaker (pin)
DCchico 0:95264f964374 20 PwmOut speaker(p25);
DCchico 0:95264f964374 21 wave_player waver(&DACout);
DCchico 0:95264f964374 22
DCchico 0:95264f964374 23
DCchico 0:95264f964374 24 // Some hardware also needs to have functions called before it will set up
DCchico 0:95264f964374 25 // properly. Do that here.
DCchico 0:95264f964374 26 int hardware_init()
DCchico 0:95264f964374 27 {
DCchico 0:95264f964374 28 // Initialize pushbuttons
DCchico 0:95264f964374 29 button1.mode(PullUp);
DCchico 0:95264f964374 30 button2.mode(PullUp);
DCchico 0:95264f964374 31 button3.mode(PullUp);
DCchico 0:95264f964374 32 return ERROR_NONE;
DCchico 0:95264f964374 33 }
DCchico 0:95264f964374 34
DCchico 0:95264f964374 35 // Implement this function.
DCchico 0:95264f964374 36 // HINT: lookup your accelerometer under mbed site > Hardware> Components
DCchico 0:95264f964374 37 // and look at demo code
DCchico 0:95264f964374 38 GameInputs read_inputs()
DCchico 0:95264f964374 39 {
DCchico 0:95264f964374 40 GameInputs in;
DCchico 0:95264f964374 41 return in;
DCchico 0:95264f964374 42 }