; ; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. ; ; SPDX-License-Identifier: BSD-3-Clause ; .program pio_serialiser ; Just serialise a stream of bits. Take 32 bits from each FIFO record. LSB-first. .wrap_target out pins, 1 .wrap % c-sdk { static inline void pio_serialiser_program_init(PIO pio, uint sm, uint offset, uint data_pin, float clk_div) { pio_gpio_init(pio, data_pin); pio_sm_set_consecutive_pindirs(pio, sm, data_pin, 1, true); pio_sm_config c = pio_serialiser_program_get_default_config(offset); sm_config_set_out_pins(&c, data_pin, 1); sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX); sm_config_set_clkdiv(&c, clk_div); sm_config_set_out_shift(&c, true, true, 32); pio_sm_init(pio, sm, offset, &c); pio_sm_set_enabled(pio, sm, true); } %}