Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Front/Front.cpp
- Revision:
- 7:33cb5f2db1ee
- Child:
- 8:f305ea78b2b1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Front/Front.cpp Tue May 05 14:32:04 2020 +0000 @@ -0,0 +1,116 @@ +#include "mbed.h" +#include "Front.h" + +const int fader[35][5] = { + { 1,1,1,1,1 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 0,0,1,0,0 }, + { 1,1,1,1,1 }, +}; + +const int sin_wav[6][28] = {//sub 1 + { 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 }, + { 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 }, + { 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 }, + { 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 }, + { 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 }, + { 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 }, +}; +const int tri_wav[6][28] = {//sub 2 + { 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 }, + { 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 }, + { 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 }, + { 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 }, + { 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 }, + { 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 }, +}; +const int square_wav[6][28] = {//sub 3 + { 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 }, + { 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 }, + { 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 }, + { 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 }, + { 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 }, + { 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 }, +}; +//constructor/destructor +Front::Front() +{ +} +Front::~Front() +{ +} +//PUBLIC------------------------------------------------------------------------ +void Front::frontsetup(N5110 &lcd, Gamepad &pad, int submenu) +{ + lcd.clear(); + lcd.printString("A D S R",3,5); + printfader(lcd,3,3); + printfader(lcd,15,3); + printfader(lcd,27,3); + printfader(lcd,39,3); + lcd.drawRect(50,3,30,8,FILL_TRANSPARENT); + printwav(lcd,submenu); + lcd.refresh(); + frontrun(lcd,pad,submenu); +} + +void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu) +{ + lcd.refresh(); +} + + +//PRIVATE----------------------------------------------------------------------- + +void Front::printfader(N5110 &lcd, int x, int y) +{ + // x origin, y origin, rows, cols, sprite + lcd.drawSprite(x,y,35,5,(int *)fader); +} + +void Front::printwav(N5110 &lcd, int submenu) +{ + if (submenu==1) { + // x origin, y origin, rows, cols, sprite + lcd.drawSprite(51,4,6,28,(int *)sin_wav); + } + if (submenu==2) { + // x origin, y origin, rows, cols, sprite + lcd.drawSprite(51,4,6,28,(int *)tri_wav); + } + if (submenu==3) { + // x origin, y origin, rows, cols, sprite + lcd.drawSprite(51,4,6,28,(int *)square_wav); + } +} \ No newline at end of file