; PIO for an SPI interface running at CPUfreq/(2*12). The code waits ; at .origin until it reads a value for y from the fifo a count of ; transfer y+1 bits have been read (should be a multiple of 8) and ; written. It then transfers that many bits of SPI data writing to the ; out pin and reading from the in pin. The side_set pin is used for ; the clock. .program spi .out 1 left auto 8 .in 1 left auto 8 .side_set 1 .origin .wrap_target pull block side 0 out y, 32 side 0 loop: out pins, 1 side 0 [10] nop side 1 in pins, 1 side 1 [10] jmp y-- loop side 0 .wrap