initial commit of firmware with somewhat-working encoder logic