Sound4Calc/src/main.c

53 lines
1.2 KiB
C

#include "main.h"
#include "sound4calc.h"
//#include <timer.h> // add timer fonction
#include <display.h> // add display fonction
#include <keyboard.h>
//#define PI 3.141592653584
int main(void)
{
unsigned int key = 0;
unsigned short place = 2;
//unsigned int i=0;
InitPorts();
while(1)
{
dclear();
dprint(1, 1, "%d", freq);
dprint(1, 10, "%s", wave_signal);
dprint(1, 20, "F1:note/F2:sequence", place);
dtext(1, 50, "F5 _ F6 -");
dupdate();
key = getkey();
switch(key)
{
case KEY_RIGHT : freq+=1; break;
case KEY_LEFT : freq-=1; break;
case KEY_UP : freq+=10; break;
case KEY_DOWN : freq-=10; break;
case KEY_F5 : *(wave_signal+place++) = '_'; break;
case KEY_F6 : *(wave_signal+place++) = '-'; break;
case KEY_DEL : place=(place>0 ? place - 1 : 0); *(wave_signal+place) = 0; break;
case KEY_F1 : CallNote(); break;
case KEY_F2 : CallSequence(); break;
case KEY_EXIT :
timer_stop(TIMER_USER);
return 1;
}
}
return 1; // this point is never reached
}