Skip to content

Commit c627dcf

Browse files
committed
be consistent
1 parent 5e31466 commit c627dcf

File tree

3 files changed

+15
-29
lines changed

3 files changed

+15
-29
lines changed

src/dmd_interface_sam.pio

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
.define COLLAT 4
55
.define DOTCLK 3
66
.define SDATA 2
7+
.define FRAME_START_IRQ 4
78

89

910
.program dmd_reader_sam
10-
11-
1211
; initialize y with 16383, number of pixels (128x32x4) - 1 because counting starts at 0.
1312
set x, 31 ; x = 31 (max 5-bit value)
1413
in x, 5 ; shift in 5 bits, isr = 31
@@ -20,33 +19,26 @@
2019
mov y, isr ; y = 16383
2120

2221
.wrap_target
23-
2422
mov x, y ; load number of pixels
2523
mov isr, null ; reset shift counter
2624

27-
irq clear 4
28-
wait irq 4
29-
30-
wait 1 gpio RDATA ; raising edge indicates a new frame
25+
irq clear FRAME_START_IRQ
26+
wait irq FRAME_START_IRQ
3127

3228
dotloop:
3329
wait 0 gpio DOTCLK ; falling edge
3430
in null, 3 ; left padding with 3 zeros
3531
wait 1 gpio DOTCLK ; raising edge
3632
in pins 1 ; read pin data
3733
jmp x-- dotloop
38-
3934
.wrap
4035

41-
.program dmd_framedetect_sam
4236

37+
.program dmd_framedetect_sam
4338
.wrap_target
44-
45-
; synchronize on a new frame
4639
wait 0 gpio RDATA
4740
wait 1 gpio RDATA
48-
irq 4
49-
41+
irq FRAME_START_IRQ
5042
.wrap
5143

5244

src/dmd_interface_whitestar.pio

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
.define COLLAT 4
55
.define DOTCLK 3
66
.define SDATA 2
7+
.define FRAME_START_IRQ 4
78

89

910
.program dmd_reader_whitestar
10-
11-
1211
; initialize y with 8191, number of pixels ((128 x LSB + 128 x MSB) x 32) - 1 because counting starts at 0.
1312
set x, 31 ; x = 31 (max 5-bit value)
1413
in x, 5 ; shift in 5 bits, isr = 31
@@ -20,14 +19,11 @@
2019
mov y, isr ; y = 8191
2120

2221
.wrap_target
23-
2422
mov x, y ; load number of pixels
2523
mov isr, null ; reset shift counter
2624

27-
irq clear 4
28-
wait irq 4
29-
30-
wait 1 gpio RDATA ; raising edge indicates a new frame
25+
irq clear FRAME_START_IRQ
26+
wait irq FRAME_START_IRQ
3127

3228
dotloop:
3329
wait 0 gpio DOTCLK ; falling edge
@@ -40,15 +36,12 @@ dotloop:
4036
; It is ignored because we already read the specified amount of dots and now wait for a new frame.
4137
.wrap
4238

43-
.program dmd_framedetect_whitestar
4439

40+
.program dmd_framedetect_whitestar
4541
.wrap_target
46-
47-
; synchronize on a new frame
4842
wait 0 gpio RDATA
4943
wait 1 gpio RDATA
50-
irq 4
51-
44+
irq FRAME_START_IRQ
5245
.wrap
5346

5447

src/dmd_interface_wpc.pio

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.define COLLAT 4
66
.define DOTCLK 3
77
.define SDATA 2
8-
.define PLANE_START 4
8+
.define PLANE_START_IRQ 4
99

1010

1111
.program dmd_reader_wpc
@@ -21,8 +21,8 @@
2121
mov x, y ; load number of pixels per plane (128x32 - 1)
2222
mov isr, null ; reset shift counter
2323

24-
irq clear PLANE_START
25-
wait irq PLANE_START
24+
irq clear PLANE_START_IRQ
25+
wait irq PLANE_START_IRQ
2626

2727
plane_loop:
2828
wait 0 gpio DOTCLK ; no DOTCLK period or faling edge of the previous
@@ -40,9 +40,10 @@ plane_loop:
4040
wait 1 gpio DE
4141
wait 0 gpio DOTCLK
4242
nop [31]
43-
irq PLANE_START
43+
irq PLANE_START_IRQ
4444
.wrap
4545

46+
4647
% c-sdk {
4748
static inline void dmd_reader_wpc_program_init(PIO pio, uint sm, uint offset) {
4849
pio_sm_config c = dmd_reader_wpc_program_get_default_config(offset);

0 commit comments

Comments
 (0)