Add typestate-based control over the PIO RX buffer access#936
Add typestate-based control over the PIO RX buffer access#936horazont wants to merge 1 commit intorp-rs:mainfrom
Conversation
41e7be5 to
47c08cd
Compare
47c08cd to
5de80b4
Compare
I propose to find out what actually happens in that case. Either experimentally or by asking the Raspberry engineers. If that's true, then our clear_fifos method is not unsound in PUT/GET modes. Instead, it just has no observable effect. In that case, I would not change the code at all. Maybe add an explanation to the docs. |
Fixes #935.
Open Questions:
StateMachine::clear_fifosis probably not sound with a non-FIFO RX buffer. It is not fully clear according to the reference manual though.The reference manual states that enabling the PUT/GET modes will cause the joining (which
clear_fifosuses) to be disabled, but it doesn't say what happens if you enable joining while in non-FIFO mode.My proposal to fix this is to move the
clear_fifosmethod onto theRx<_>struct and constrain it to only be available in RxFifo mode.The other option would be to actually carry the
RxFifoConfigtype state through to theStateMachineto hide theclear_fifosmethod in such cases. That can probably be done, but has implications on the state machine groups (which will also have to carry that typestate).I can do either variant, but I'd like a judgement call from the maintainers on which way to go here.
TODOs:
I will add an example which uses this feature later, as well as fix the existing example.Fixed example and added my original LED matrix code as another example.