A lightweight C++ library for interfacing with the MAKCU ESP32-based HID input device over serial (COM port). Supports mouse movement, button input, and auto-detection of the device via VID/PID.
- Windows 10/11
- MSVC (Visual Studio 2019+)
- MAKCU device (VID
1A86, PID55D3)
- Clone or copy
Makcu.hppandMakcu.cppinto your project. setupapi.libis linked automatically via#pragma commentin the header.- Call
c_Makcu::Initialize()before any other function.
bool c_Makcu::Initialize(); // Auto-detects and opens the MAKCU COM port
void c_Makcu::Shutdown(); // Closes the port
bool c_Makcu::IsInitialized();bool c_Makcu::SendCommand(const std::string& cmd); // Send raw Legacy API command, waits for response
bool c_Makcu::SendNoWait(const std::string& cmd); // Send raw Legacy API command, no response waitbool c_Makcu::Move(int x, int y); // Relative move// Individual down/up
bool c_Makcu::LeftDown(); bool c_Makcu::LeftUp();
bool c_Makcu::RightDown(); bool c_Makcu::RightUp();
bool c_Makcu::MiddleDown(); bool c_Makcu::MiddleUp();
bool c_Makcu::Side1Down(); bool c_Makcu::Side1Up();
bool c_Makcu::Side2Down(); bool c_Makcu::Side2Up();
// Single click (down + up in one call)
bool c_Makcu::LeftClick();
bool c_Makcu::RightClick();
bool c_Makcu::MiddleClick();
bool c_Makcu::Side1Click();
bool c_Makcu::Side2Click();
// Scroll
bool c_Makcu::Scroll(int delta); // +1 = up, -1 = down#include "Makcu.hpp"
#include <iostream>
int main()
{
if (!c_Makcu::Initialize())
{
std::wcout << L"Failed to initialize MAKCU\n";
return 1;
}
while (true)
{
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
break;
if (GetAsyncKeyState('O') & 0x8000)
c_Makcu::Move(5, 0);
Sleep(1);
}
c_Makcu::Shutdown();
return 0;
}- All hot-path functions (
Move, button down/up, click, etc) useSendNoWait— fire-and-forget serial writes with no blocking read. SendCommandblocks waiting for a response — don't call it on a hot path.- The device is auto-detected by VID/PID (
VID_1A86&PID_55D3) so no manual COM port configuration is needed.