From b1ecce7212f9a28d7c4e4a3412109d7bd3f51c03 Mon Sep 17 00:00:00 2001 From: flo66 Date: Wed, 11 Jan 2017 19:45:47 +0100 Subject: [PATCH] new tests --- src/Sound4Calc.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Sound4Calc.c b/src/Sound4Calc.c index 8f9418c..251fc2f 100755 --- a/src/Sound4Calc.c +++ b/src/Sound4Calc.c @@ -6,6 +6,9 @@ #include #include +#include "string.h" + + //#define DEBUG //#define PI 3.141592653584 @@ -22,12 +25,14 @@ void switchStatePin() } }*/ +const char* bincod = "111010001100100011101" ; + +unsigned char range = 0; void lect440() { -unsigned char range = 1; - if((0xEC88E >> range) & 1) + if(bincod[range]- '0') { if(isSH3()) { @@ -38,7 +43,6 @@ unsigned char range = 1; *(volatile unsigned char*)SH7305_PJDR ^= 0x04; } } - range = (range < 20 ? range + 1 : 1); } @@ -46,8 +50,9 @@ unsigned char range = 1; int main(void) { unsigned int key=0; + unsigned char range = 1; + int freq = 220; - int freq = 440; //unsigned int i=0; setup(); @@ -58,12 +63,12 @@ int main(void) dprint(1, 1, "%d", freq); +range = (range < 20 ? range +1 : 0); // PrintMini(1, 1, itoa(freq, str, 10), 0); dprint(1, 10, "%d", !isSH3()); // dprint(1, 20, "%d", range); - //PrintMini(1, 10, itoa(is_SH4, str, 10), 0); dupdate(); @@ -71,8 +76,11 @@ int main(void) switch(key) { - case KEY_RIGHT : freq+=10; break; - case KEY_LEFT : freq-=10; break; + 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_EXE : timer_start(TIMER_USER, freq, Clock_Hz, lect440, 0);