Skip to content

Add support for putget to PIO #935

@horazont

Description

@horazont

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:

  1. Add typestate to PIOBuilder which tracks the configuration.
  2. Add separate RxGet / RxPut / RxPutGet types which provide access to the "fifo" contents.
  3. Depending on the typestate, change the output types of build() to use the correct Rx* 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions