diff --git a/include/sound4calc.h b/include/sound4calc.h index d9b5ebe..d6903b4 100644 --- a/include/sound4calc.h +++ b/include/sound4calc.h @@ -4,7 +4,7 @@ struct Wave { - char* signal; + char signal[25]; unsigned short length; }; @@ -15,7 +15,6 @@ extern struct Note unsigned int freq; } note; - void CallSequence(); void CallNote(); void PutPinState(char level); diff --git a/src/main.c b/src/main.c index d0ed060..e33a9db 100644 --- a/src/main.c +++ b/src/main.c @@ -12,6 +12,10 @@ int main(void) unsigned short place = 0; //unsigned int i=0; + note.freq = 440; + note.wave.signal[0] = 0; + note.duration = 2000; + InitPorts(); while(1) @@ -37,8 +41,8 @@ int main(void) case KEY_UP : note.freq+=10; break; case KEY_DOWN : note.freq-=10; break; - case KEY_F5 : *(note.wave.signal+place++) = '_'; break; - case KEY_F6 : *(note.wave.signal+place++) = '-'; break; + case KEY_F5 : *(note.wave.signal+place++) = '_'; *(note.wave.signal+place) = 0; break; + case KEY_F6 : *(note.wave.signal+place++) = '-'; *(note.wave.signal+place) = 0; break; case KEY_DEL : place=(place>0 ? place - 1 : 0); *(note.wave.signal+place) = 0; break; case KEY_F1 : CallNote(); break;