firmware allow to use button matrix / shift reg. 74HC165 / shift reg. 4021B - with any variants.
first firmware layer just read hardware (buttons matrix/shift reg's and axis sensors), calculate encodres this is second firmware layer - program all the same where and how they are connected.