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:
- 14:9cfe0041cc4e
- Parent:
- 13:27300c533dd1
- Child:
- 15:1c67f064278e
--- a/Front/Front.cpp Sat May 09 13:45:23 2020 +0000 +++ b/Front/Front.cpp Tue May 19 15:04:33 2020 +0000 @@ -1,7 +1,10 @@ #include "mbed.h" #include "Front.h" -//objects +//Objects----------------------------------------------------------------------- +Sound sound; + +//Sprites----------------------------------------------------------------------- const int fader[35][5] = { { 1,1,1,1,1 }, { 0,0,1,0,0 }, @@ -40,7 +43,7 @@ { 1,1,1,1,1 }, }; -const int sin_wav[6][28] = {//sub 1 +const int sin_wav[6][28] = {//sub 1 sin sprite { 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 }, @@ -48,7 +51,7 @@ { 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 +const int tri_wav[6][28] = {//sub 2 tri sprite { 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 }, @@ -56,7 +59,7 @@ { 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 +const int square_wav[6][28] = {//sub 3 sqr sprite { 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 }, @@ -64,6 +67,8 @@ { 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 }, }; +volatile int g_isr_flag; + //constructor/destructor Front::Front() { @@ -74,7 +79,8 @@ //PUBLIC------------------------------------------------------------------------ void Front::frontrun(N5110 &lcd, Gamepad &pad, int submenu) -{ +{ + //printf("G_ISR_FLAG= %d\n",g_isr_flag); frontsetup(lcd, pad, submenu, true); menuflag=1; used=1; @@ -82,7 +88,20 @@ d=17; s=17; r=17; + out=sound.sound_main(true,submenu,440); + while (menuflag==1) { + #ifdef SLOW_TIME + printf(":=:"); + #endif + if (g_isr_flag == 1) { + pad.write_u16(out); + #ifdef SLOW_TIME + printf("out= %u\n",out); + #endif + out=sound.sound_main(false,submenu,440); + g_isr_flag=0; + } dir=pad.get_direction(); if (dir!=dir_1) { printf("dir =%d\n",dir); //debug @@ -128,7 +147,6 @@ } } - if (pad.start_pressed()) { //go back menu // printf("start pressed\n"); printf("Waveforms Sub selected\n"); //debug @@ -140,10 +158,10 @@ wait_ms(200); } dir=dir_1; + sleep(); } } - //PRIVATE----------------------------------------------------------------------- void Front::frontsetup(N5110 &lcd, Gamepad &pad, int submenu, bool initial)