我现在正在写一个键盘驱动模块。我想同时按下shift键和其他键将小写改为大写。我需要解析扫描码吗?请提供一些提示,我非常感谢您提供示例代码。
实际上,键盘的每个键有两种不同的关联 - 按下它(键)时的事件和释放键(键)时的不同事件。您只需要使用这些事件。
对于你的问题,你将不得不做一些事情(采取0
为press和1
发布):
/*eventA for shift key*/
if (eventA == 0)
{
Flag = PRESSED;
}
else
{
Flag = RELEASED;
}
...
/*eventX for any character key*/
if (eventX == 0 )
{
if (Flag == PRESSED)
toupper(...)
//print the character
}