1010
1111; Send using an external clock on the SPI interface
1212
13- ; initialize y with 4096 = number of pixels (128x32 )
13+ ; initialize y with 8192 = number of pixels ((128 x LSB + 128 x MSB) x 32 )
1414 set x, 1
1515 in x, 1
16- in null, 13
16+ in null, 14
1717 mov y, isr
1818
1919.wrap_target
2424 irq clear 4
2525 wait irq 4
2626
27+ wait 1 gpio RDATA ; raising edge indicates a new frame
2728
28- ; this is the loop for the most significant bit
29- dotloop1:
29+ dotloop:
3030 wait 0 gpio DOTCLK ; falling edge
31+ in null 1 ; left padding
3132 wait 1 gpio DOTCLK ; raising edge
3233 in pins 1 ; read pin data
33- in null 1 ; right padding
34- jmp x-- dotloop1
34+ jmp x-- dotloop
3535
3636 mov x, y ; load number of pixels
3737 mov isr, null ; reset shift counter
3838
39- ; There's an empty line between LSB and HSB plane
40- wait 0 gpio RCLK
41- wait 1 gpio RCLK
42-
43- ; this is the loop for the least significant bit
44- ; in this loop, the bit value is multipled by 2 by shiting it one bit
45- dotloop2:
46- wait 0 gpio DOTCLK ; falling edge
47- in null 1 ; left padding
48- wait 1 gpio DOTCLK ; raising edge
49- in pins 1 ; read pin data
50- jmp x-- dotloop2
51-
52-
39+ ; There's an empty row with 256 gots at the end of a frame.
40+ ; it is ignored because we already read the specified amount of dots and now wait for a new frame.
5341.wrap
5442
5543.program dmd_framedetect_whitestar
5644
5745.wrap_target
5846
59- ; synchronize on the least significant plane
47+ ; synchronize on a new frame
6048 wait 0 gpio RDATA
6149 wait 1 gpio RDATA
6250 irq 4
@@ -109,4 +97,4 @@ static inline void dmd_framedetect_whitestar_program_init(PIO pio, uint sm, uint
10997 // Load our configuration, do not yet start the program
11098 pio_sm_init(pio, sm, offset, &c);
11199}
112- %}
100+ %}
0 commit comments