In order to check for changes to the pins, each time we read the pins values, we can compare them to previous values stored in the x or y scratch registers.
So the statemachine records the pin state in y when it starts, pushes y so python has the initial state as well, and then the state machine keeps checking the pins until the pin values cached in x aren't equal to y. Then it pushes x, copies x to y, and starts checking again.
Next step is setting an irq to tell python it's time to pull a value from the fifo.
And maybe later some time, we can implement matrix scanning! I'm not too sure how that would work since we'd need to potentially track the state of more than 32 keys... maybe we'd use separate state machines for each row of the keyboard!