PWM
This commit is contained in:
parent
01b7c62b8b
commit
d8e725275a
|
@ -9,7 +9,7 @@
|
|||
//#define DEBUG
|
||||
|
||||
//#define PI 3.141592653584
|
||||
|
||||
/*
|
||||
void switchStatePin()
|
||||
{
|
||||
if(isSH3())
|
||||
|
@ -20,8 +20,29 @@ void switchStatePin()
|
|||
{
|
||||
*(volatile unsigned char*)SH7305_PJDR ^= 0x04;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
void lect440()
|
||||
{
|
||||
unsigned char range = 1;
|
||||
|
||||
if((0xEC88E >> range) & 1)
|
||||
{
|
||||
if(isSH3())
|
||||
{
|
||||
*(volatile unsigned char*)SH7337_SCPDR ^= 0x01;
|
||||
}
|
||||
else
|
||||
{
|
||||
*(volatile unsigned char*)SH7305_PJDR ^= 0x04;
|
||||
}
|
||||
}
|
||||
range = (range < 20 ? range + 1 : 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned int key=0;
|
||||
|
@ -40,6 +61,9 @@ int main(void)
|
|||
// 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();
|
||||
|
||||
|
@ -50,7 +74,8 @@ int main(void)
|
|||
case KEY_RIGHT : freq+=10; break;
|
||||
case KEY_LEFT : freq-=10; break;
|
||||
case KEY_EXE :
|
||||
timer_start(TIMER_USER, 2*freq, Clock_Hz, switchStatePin, 4*freq);
|
||||
timer_start(TIMER_USER, freq, Clock_Hz, lect440, 0);
|
||||
|
||||
break;
|
||||
case KEY_EXIT :
|
||||
timer_stop(TIMER_USER);
|
||||
|
|
Loading…
Reference in New Issue