-
Notifications
You must be signed in to change notification settings - Fork 276
Description
PIOs support changing the FIFO configuration to support random access instead of acting as a FIFO (see for example Section 11.4.8 and 11.4.9. of the reference manual, as well as FJOIN_RX_PUT / FJOIN_RX_GET in the SMx_SHIFTCTRL registers).
As far as I can tell, this is currently not supported by the RP235x HAL.
I was thinking to add support for that (as I am currently bypassing the HAL for one of my PIO uses because of that) and I'd like to get a quick gauge whether I'm heading the right way. Here's what I was planning to do:
- Add typestate to PIOBuilder which tracks the configuration.
- Add separate
RxGet/RxPut/RxPutGettypes which provide access to the "fifo" contents. - Depending on the typestate, change the output types of
build()to use the correctRx*form as mentioned in point 2.
This will increase the complexity of the builder somewhat, but I think this is the only typesafe way of doing it.
While we're at it, we could also move the effect of the buffers() call into typestate, so that the return type of build() wouldn't contain a tx if the tx has been merged into the rx fifo, and vice versa.
Opinions / thoughts?