1 Star 3 Fork 1

Kono/USBComposite_stm32f1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Mouse.cpp 874 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include "USBComposite.h"
//================================================================================
//================================================================================
// Mouse
void HIDMouse::begin(void){
}
void HIDMouse::end(void){
}
void HIDMouse::click(uint8_t b)
{
_buttons = b;
move(0,0,0);
_buttons = 0;
move(0,0,0);
}
void HIDMouse::move(signed char x, signed char y, signed char wheel)
{
reportBuffer[1] = _buttons;
reportBuffer[2] = x;
reportBuffer[3] = y;
reportBuffer[4] = wheel;
sendReport();
}
void HIDMouse::buttons(uint8_t b)
{
if (b != _buttons)
{
_buttons = b;
move(0,0,0);
}
}
void HIDMouse::press(uint8_t b)
{
buttons(_buttons | b);
}
void HIDMouse::release(uint8_t b)
{
buttons(_buttons & ~b);
}
bool HIDMouse::isPressed(uint8_t b)
{
if ((b & _buttons) > 0)
return true;
return false;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Kono2019/USBComposite_stm32f1.git
git@gitee.com:Kono2019/USBComposite_stm32f1.git
Kono2019
USBComposite_stm32f1
USBComposite_stm32f1
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385