This commit is contained in:
flo66 2017-01-08 11:57:20 +01:00
parent cfb3fb08b0
commit c940d5ad9d
1 changed files with 22 additions and 4 deletions

View File

@ -8,13 +8,25 @@
//#define DEBUG
//#define PI 3.14159265358
//#define PI 3.141592653584
void switchStatePin()
{
if(isSH3())
{
*(volatile unsigned char*)SH7337_SCPDR ^= 0x01;
}
else
{
*(volatile unsigned char*)SH7305_PJDR ^= 0x04;
}
}
int main(void)
{
unsigned int key=0;
int sleep = 200;
int sleep = 440;
//unsigned int i=0;
setup();
@ -38,8 +50,7 @@ int main(void)
case KEY_RIGHT : sleep+=5; break;
case KEY_LEFT : sleep-=5; break;
case KEY_EXE :
timer_start(TIMER_USER, sleep, Clock_Hz, ResetPin, 0);
SetPin();
timer_start(TIMER_USER, sleep, Clock_Hz, switchStatePin, 2*sleep);
break;
case KEY_EXIT :
timer_stop(TIMER_USER);
@ -54,6 +65,9 @@ void setup()
if(isSH3())
{
// initialisation of pin
*(volatile unsigned char*)SH7337_SCPDR |= 0x01;
// SCIF2 clock on (STBCR3.MSTP31)
*(volatile unsigned char*)SH7337_STBCR3 &= ~0x02;
// switch off SCSMR_2.TE and SCSMR_2.RE
@ -69,6 +83,9 @@ void setup()
}
else
{
// initialisation of pin
*(volatile unsigned char*)SH7305_PJDR |= 0x04;
// SCIF2 clock on (MSTPCR0.MSTP007)
*(volatile unsigned int*)SH7305_MSTPCR0 &= ~0x00000080;
// switch off SCSMR_2.TE and SCSMR_2.RE
@ -93,6 +110,7 @@ void setup()
*(unsigned short*)0xA4050110 = ( *(unsigned short*)0xA4050110 & ~0x00C0 ) | 0x0080;*/
}
void SetPin()
{
if(isSH3())