Телесистемы
 Разработка, производство и продажа радиоэлектронной аппаратуры
На главную   | Карта сайта | Пишите нам | В избранное
Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс.
e-mail:jobsmp@pochta.ru

Телесистемы | Электроника | Конференция «Микроконтроллеры и их применение»

инициализация мыши

Отправлено политрукк 11 июня 2008 г. 17:23
В ответ на: у мышей вообще около 3-4 протоколов, точно не помню отправлено <font color=gray>политрукк</font> 11 июня 2008 г. 11:56


bool InitMouse(UINT8 ch) {
UINT8 res;
int i;
RETAILMSG__(1, (TEXT("InitMouse: ") ));
i=20; do{res = GetScanCode(ch+1); i--; }while((res==0)&&(i>0));
i=20; do{res = GetScanCode(ch+1); i--; }while((res==0)&&(i>0));
if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0xC8)) goto noinit; // decimal 200
if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0x64)) goto noinit; // decimal 100
if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0x50)) goto noinit; // decimal 80

if(!SendPS2CmdCnt(ch,0xF2)) goto noinit; // Read Device Type
if(!GetScanCodeCnt(ch,&res)) goto noinit;
SetMouseType(ch,res);

if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0xC8)) goto noinit; // decimal 200
if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0xC8)) goto noinit; // decimal 200
if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0x50)) goto noinit; // decimal 80

if(!SendPS2CmdCnt(ch,0xF2)) goto noinit; // Read Device Type
if(!GetScanCodeCnt(ch,&res)) goto noinit;
SetMouseType(ch,res);

//initialisation Mouse
if(!SendPS2CmdCnt(ch,0xE8)) goto noinit; // Set resolution
if(!SendPS2CmdCnt(ch,0x03)) goto noinit; // 8 Counts/mm
if(!SendPS2CmdCnt(ch,0xE6)) goto noinit; // Set Scaling 1:1
if(!SendPS2CmdCnt(ch,0xF3)) goto noinit; // Set Sample Rate
if(!SendPS2CmdCnt(ch,0x28)) goto noinit; // decimal 40
//if(!SendPS2CmdCnt(ch,0xF4)) goto noinit; // Enable
noinit:
SendPS2CmdCnt(ch,0xF4);

i=20; do{res = GetScanCode(ch+1); i--; }while((res==0)&&(i>0));
i=20; do{res = GetScanCode(ch+1); i--; }while((res==0)&&(i>0));
i=20; do{res = GetScanCode(ch+1); i--; }while((res==0)&&(i>0));
i=20; do{res = GetScanCode(ch+1); i--; }while((res==0)&&(i>0));

switch(dps2[ch].type) {
case T_MOUSE: RETAILMSG__(1, (TEXT("Microsoft Typern") )); break;
case T_MOUSEI: RETAILMSG__(1, (TEXT("Intel Typern") )); break;
case T_MOUSEI5: RETAILMSG__(1, (TEXT("5 button Typern") )); break;
default: RETAILMSG_(1, (TEXT("None Typern") )); break;
}
return (true);
}



Составить ответ | Вернуться на конференцию

Ответы


Отправка ответа
Имя*: 
Пароль: 
E-mail: 
Тема*:

Сообщение:

Ссылка на URL: 
URL изображения: 

если вы незарегистрированный на форуме пользователь, то
для успешного добавления сообщения заполните поле, как указано ниже:
введите число 123:

Перейти к списку ответов | Конференция | Раздел "Электроника" | Главная страница | Карта сайта

Rambler's Top100 Рейтинг@Mail.ru
 
Web telesys.ru