mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-20 22:31:33 +01:00
+ Added support for Tetris paddle, Guitar Hero grip and easy piano controller + Added sdmmc support for reading DSi internal SD card + i2c communication functions for DSi + Added some time handling related examples * Improved timing functions * Some small bug fixes and improvements, both in library and examples - Removed unused SVN macros from header and license infos to save space :) git-svn-id: trunk@16879 -
45 lines
672 B
ObjectPascal
45 lines
672 B
ObjectPascal
program timercallback;
|
|
|
|
|
|
{$mode objfpc}
|
|
|
|
uses
|
|
ctypes, nds9;
|
|
|
|
|
|
procedure waitfor(keys: cint);
|
|
begin
|
|
scanKeys();
|
|
while ((keysDown() and keys) = 0) do
|
|
begin
|
|
swiWaitForVBlank();
|
|
scanKeys();
|
|
end;
|
|
end;
|
|
|
|
var
|
|
channel: cuint = 0;
|
|
play: boolean = true;
|
|
|
|
//this function will be called by the timer.
|
|
procedure timerCallBack();
|
|
begin
|
|
if (play) then
|
|
soundPause(channel)
|
|
else
|
|
soundResume(channel);
|
|
|
|
play := not play;
|
|
end;
|
|
|
|
begin
|
|
soundEnable();
|
|
channel := soundPlayPSG(DutyCycle_50, 10000, 127, 64);
|
|
|
|
//calls the timerCallBack function 5 times per second.
|
|
timerStart(0, ClockDivider_1024, TIMER_FREQ_1024(5), @timerCallBack);
|
|
|
|
waitfor(KEY_A);
|
|
|
|
end.
|