Hardware keyboard/mouse macro v1
Commercial macro tools felt unsafe. This is a DIY USB macro keyboard/mouse:
- ATmega32U4 (Leonardo) emulates HID keyboard/mouse
- Qt + Lua on the host parses automation scripts
Downloads
- leonardo-keyboard-firmware.hex — firmware
- script-runner.zip — host runner + samples
- macro-demo.lua — cleaned-up demo script (also below)
Lua demo
local keymap = {
KEY_LEFT_CTRL = '0x80',
KEY_TAB = '0xB3',
KEY_RETURN = '0xB0',
-- ... full table in macro-demo.lua
}
function this:get_keymap(k)
return tonumber(keymap[k])
end
function this:move(x, y, z)
-- splits moves into 100px steps for the HID protocol
end
function this:alt_tab()
self:call('kpress ' .. self:get_keymap('KEY_LEFT_ALT'))
self:call('kwrite ' .. self:get_keymap('KEY_TAB'))
self:call('krelease ' .. self:get_keymap('KEY_LEFT_ALT'))
end
The macro-demo.lua file includes a sample main() automation loop.