代码拉取完成,页面将自动刷新
同步操作将从 pikename/ESP32-BLE-HID 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "BleComboMouse.h"
#define LSB(v) ((v >> 8) & 0xff)
#define MSB(v) (v & 0xff)
void BleComboMouse::click(uint8_t b)
{
_buttons = b;
move(0,0,0,0);
_buttons = 0;
move(0,0,0,0);
}
void BleComboMouse::move(signed char x, signed char y, signed char wheel, signed char hWheel)
{
if (_keyboard->isConnected())
{
uint8_t m[5];
m[0] = _buttons;
m[1] = x;
m[2] = y;
m[3] = wheel;
m[4] = hWheel;
_keyboard->inputMouse->setValue(m, 5);
_keyboard->inputMouse->notify();
}
}
void BleComboMouse::send(int state, int16_t x, int16_t y)
{
if (_keyboard->isConnected())
{
uint8_t m[5];
m[0] = state;
m[1] = MSB(x);
m[2] = LSB(x);
m[3] = MSB(y);
m[4] = LSB(y);
_keyboard->inputMouse->setValue(m, 5);
_keyboard->inputMouse->notify();
}
}
void BleComboMouse::buttons(uint8_t b)
{
if (b != _buttons)
{
_buttons = b;
move(0,0,0,0);
}
}
void BleComboMouse::press(uint8_t b)
{
buttons(_buttons | b);
}
void BleComboMouse::release(uint8_t b)
{
buttons(_buttons & ~b);
}
bool BleComboMouse::isPressed(uint8_t b)
{
if ((b & _buttons) > 0)
return true;
return false;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。