WINCE及MOBLIE中的振动

WINCE及MOBLIE中的振动

关于振动铃音:如果PPC支持振动,那么振动电机也是被当作一个LED来对待的
#include <windows.h>
#include <nled.h>

// from the platform builder <Pwinuser.h>
extern "C" {
BOOL WINAPI NLedGetDeviceInfo( UINT nInfoId, void *pOutput );
BOOL WINAPI NLedSetDevice( UINT nDeviceId, void *pInput );
};

void LedOn(int id)
{
NLED_SETTINGS_INFO settings;
settings.LedNum= id;
settings.OffOnBlink= 1;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}
void LedOff(int id)
{
NLED_SETTINGS_INFO settings;
settings.LedNum= id;
settings.OffOnBlink= 0;
NLedSetDevice(NLED_SETTINGS_INFO_ID, &settings);
}


震动
SetLedS震动
SetLedStatus(1, 1);
闪烁
SetLedStatus(1, 2);
停止
SetLedStatus(1, 0);tatus(1, 1);
闪烁
SetLedStatus(1, 2);
停止
SetLedStatus(1, 0);

//测试
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
for (int i=0 ; i<10 ; i++)
{
LedOn(1);
Sleep(400);
LedOff(1);
Sleep(200);
}

return 0;
}

你可能感兴趣的:(WINCE及MOBLIE中的振动)