マウスの左ボタンを連打するマウスを作った。
ボタンを押したら左ボタンを連打し、再度ボタンを押したら止まるだけのマウス。
void Emulate_Mouse(void)
{
static BOOL sent_dont_move = FALSE;
buffer[1] = buffer[2] = 0;
if (emulate_mode == TRUE) {
sent_dont_move = FALSE;
if(movement_length > 14) {
buffer[0] = !buffer[0];
movement_length = 0;
}
} else {
buffer[0] = 0;
}
if(HIDTxHandleBusy(lastTransmission) == 0)
{
//copy over the data to the HID buffer
hid_report_in[0] = buffer[0];
hid_report_in[1] = buffer[1];
hid_report_in[2] = buffer[2];
if(((sent_dont_move == FALSE) && (emulate_mode == FALSE)) || (emulate_mode == TRUE))
{
//Send the 3 byte packet over USB to the host.
lastTransmission = HIDTxPacket(HID_EP, (BYTE*)hid_report_in, 0x03);
//increment the counter of when to change the data sent
movement_length++;
sent_dont_move = TRUE;
}
}
}//end Emulate_Mouse