Finally got it working

Still not super happy the line toggling is a little buggy, check on an
oscilloscope. It works fine though.