Open peterharperuk opened 5 months ago
don't like the name pio_init
since it doesnt initialize a PIO
pio_load?
pio_load_where_space_available
or pio_load_if_possible
? :wink:
and while we're at it, pio_get_instance like static inline i2c_inst_t *i2c_get_instance(uint instance)
Unfortunately that function doesn't have any doxygen-comments, and thus doesn't appear in the API documentation.
EDIT: And there's also a (similarly un-documented) uart_get_instance function, but SPI is also lacking a _get_instance
function.
(And on a sidenote, it's also slightly inconsistent that I2C uses i2c_hw_index
, whereas the other hardware-wrappers have pio_get_index
, spi_get_index
and uart_get_index
functions.)
some more ideas...
pio_claim_free_sm_add_program pio_unclaim_sm_remove_program
It would be nice to add a pio_init function that picks a free pio, state machine and loads a program, as I keep writing this and it's easy to get wrong.
bool pio_init(const pio_program_t program, PIO pio_hw, uint sm, uint offset); static void pio_deinit(const pio_program_t *program, PIO pio_hw, uint sm, uint offset);
and while we're at it, pio_get_instance like static inline i2c_inst_t *i2c_get_instance(uint instance)