-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
void api_end(void); | ||
int api_getkey(int mode); | ||
int api_alloctimer(void); | ||
void api_inittimer(int timer, int data); | ||
void api_settimer(int timer, int time); | ||
void api_beep(int tone); | ||
|
||
void HariMain(void) | ||
{ | ||
int i, timer; | ||
timer = api_alloctimer(); | ||
api_inittimer(timer, 128); | ||
for (i = 20000000; i >= 20000; i -= i / 100) { | ||
/* 20KHz~20Hz,即人类可以听到的声音范围*/ | ||
/* i以1%的速度递减*/ | ||
api_beep(i); | ||
api_settimer(timer, 1); /* 0.01秒*/ | ||
if (api_getkey(1) != 128) { | ||
break; | ||
} | ||
} | ||
api_beep(0); | ||
api_end(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
void api_end(void); | ||
int api_getkey(int mode); | ||
int api_alloctimer(void); | ||
void api_inittimer(int timer, int data); | ||
void api_settimer(int timer, int time); | ||
void api_beep(int tone); | ||
|
||
void HariMain(void) | ||
{ | ||
int i, timer; | ||
timer = api_alloctimer(); | ||
api_inittimer(timer, 128); | ||
for (i = 20000; i <= 20000000; i += i / 100) { | ||
api_beep(i); | ||
api_settimer(timer, 1); /* 0.01秒*/ | ||
if (api_getkey(1) != 128) { | ||
break; | ||
} | ||
} | ||
api_beep(0); | ||
api_end(); | ||
} |