ELEC2645 (2019/20) / Mbed 2 deprecated el18loc_final

Dependencies:   mbed

Committer:
lukeocarwright
Date:
Tue May 05 14:32:04 2020 +0000
Revision:
7:33cb5f2db1ee
Child:
8:f305ea78b2b1
Added initial GUI for front and sorted menu bug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lukeocarwright 7:33cb5f2db1ee 1 #include "mbed.h"
lukeocarwright 7:33cb5f2db1ee 2 #include "Front.h"
lukeocarwright 7:33cb5f2db1ee 3
lukeocarwright 7:33cb5f2db1ee 4 const int fader[35][5] = {
lukeocarwright 7:33cb5f2db1ee 5 { 1,1,1,1,1 },
lukeocarwright 7:33cb5f2db1ee 6 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 7 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 8 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 9 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 10 { 1,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 11 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 12 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 13 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 14 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 15 { 1,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 16 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 17 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 18 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 19 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 20 { 1,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 21 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 22 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 23 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 24 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 25 { 1,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 26 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 27 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 28 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 29 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 30 { 1,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 31 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 32 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 33 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 34 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 35 { 1,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 36 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 37 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 38 { 0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 39 { 1,1,1,1,1 },
lukeocarwright 7:33cb5f2db1ee 40 };
lukeocarwright 7:33cb5f2db1ee 41
lukeocarwright 7:33cb5f2db1ee 42 const int sin_wav[6][28] = {//sub 1
lukeocarwright 7:33cb5f2db1ee 43 { 0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 44 { 0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 45 { 1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0 },
lukeocarwright 7:33cb5f2db1ee 46 { 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1 },
lukeocarwright 7:33cb5f2db1ee 47 { 0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 48 { 0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 49 };
lukeocarwright 7:33cb5f2db1ee 50 const int tri_wav[6][28] = {//sub 2
lukeocarwright 7:33cb5f2db1ee 51 { 0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 52 { 0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 53 { 0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0 },
lukeocarwright 7:33cb5f2db1ee 54 { 1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0 },
lukeocarwright 7:33cb5f2db1ee 55 { 0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1 },
lukeocarwright 7:33cb5f2db1ee 56 { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 57 };
lukeocarwright 7:33cb5f2db1ee 58 const int square_wav[6][28] = {//sub 3
lukeocarwright 7:33cb5f2db1ee 59 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 60 { 1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1 },
lukeocarwright 7:33cb5f2db1ee 61 { 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 62 { 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 63 { 0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 64 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
lukeocarwright 7:33cb5f2db1ee 65 };
lukeocarwright 7:33cb5f2db1ee 66 //constructor/destructor
lukeocarwright 7:33cb5f2db1ee 67 Front::Front()
lukeocarwright 7:33cb5f2db1ee 68 {
lukeocarwright 7:33cb5f2db1ee 69 }
lukeocarwright 7:33cb5f2db1ee 70 Front::~Front()
lukeocarwright 7:33cb5f2db1ee 71 {
lukeocarwright 7:33cb5f2db1ee 72 }
lukeocarwright 7:33cb5f2db1ee 73 //PUBLIC------------------------------------------------------------------------
lukeocarwright 7:33cb5f2db1ee 74 void Front::frontsetup(N5110 &lcd, Gamepad &pad, int submenu)
lukeocarwright 7:33cb5f2db1ee 75 {
lukeocarwright 7:33cb5f2db1ee 76 lcd.clear();
lukeocarwright 7:33cb5f2db1ee 77 lcd.printString("A D S R",3,5);
lukeocarwright 7:33cb5f2db1ee 78 printfader(lcd,3,3);
lukeocarwright 7:33cb5f2db1ee 79 printfader(lcd,15,3);
lukeocarwright 7:33cb5f2db1ee 80 printfader(lcd,27,3);
lukeocarwright 7:33cb5f2db1ee 81 printfader(lcd,39,3);
lukeocarwright 7:33cb5f2db1ee 82 lcd.drawRect(50,3,30,8,FILL_TRANSPARENT);
lukeocarwright 7:33cb5f2db1ee 83 printwav(lcd,submenu);
lukeocarwright 7:33cb5f2db1ee 84 lcd.refresh();
lukeocarwright 7:33cb5f2db1ee 85 frontrun(lcd,pad,submenu);
lukeocarwright 7:33cb5f2db1ee 86 }
lukeocarwright 7:33cb5f2db1ee 87
lukeocarwright 7:33cb5f2db1ee 88 void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu)
lukeocarwright 7:33cb5f2db1ee 89 {
lukeocarwright 7:33cb5f2db1ee 90 lcd.refresh();
lukeocarwright 7:33cb5f2db1ee 91 }
lukeocarwright 7:33cb5f2db1ee 92
lukeocarwright 7:33cb5f2db1ee 93
lukeocarwright 7:33cb5f2db1ee 94 //PRIVATE-----------------------------------------------------------------------
lukeocarwright 7:33cb5f2db1ee 95
lukeocarwright 7:33cb5f2db1ee 96 void Front::printfader(N5110 &lcd, int x, int y)
lukeocarwright 7:33cb5f2db1ee 97 {
lukeocarwright 7:33cb5f2db1ee 98 // x origin, y origin, rows, cols, sprite
lukeocarwright 7:33cb5f2db1ee 99 lcd.drawSprite(x,y,35,5,(int *)fader);
lukeocarwright 7:33cb5f2db1ee 100 }
lukeocarwright 7:33cb5f2db1ee 101
lukeocarwright 7:33cb5f2db1ee 102 void Front::printwav(N5110 &lcd, int submenu)
lukeocarwright 7:33cb5f2db1ee 103 {
lukeocarwright 7:33cb5f2db1ee 104 if (submenu==1) {
lukeocarwright 7:33cb5f2db1ee 105 // x origin, y origin, rows, cols, sprite
lukeocarwright 7:33cb5f2db1ee 106 lcd.drawSprite(51,4,6,28,(int *)sin_wav);
lukeocarwright 7:33cb5f2db1ee 107 }
lukeocarwright 7:33cb5f2db1ee 108 if (submenu==2) {
lukeocarwright 7:33cb5f2db1ee 109 // x origin, y origin, rows, cols, sprite
lukeocarwright 7:33cb5f2db1ee 110 lcd.drawSprite(51,4,6,28,(int *)tri_wav);
lukeocarwright 7:33cb5f2db1ee 111 }
lukeocarwright 7:33cb5f2db1ee 112 if (submenu==3) {
lukeocarwright 7:33cb5f2db1ee 113 // x origin, y origin, rows, cols, sprite
lukeocarwright 7:33cb5f2db1ee 114 lcd.drawSprite(51,4,6,28,(int *)square_wav);
lukeocarwright 7:33cb5f2db1ee 115 }
lukeocarwright 7:33cb5f2db1ee 116 }