forked from raspberrypi/pico-extras
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtiming.pio
34 lines (32 loc) · 1.07 KB
/
timing.pio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;
; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
;
; SPDX-License-Identifier: BSD-3-Clause
;
.program video_htiming
.side_set 1 ; used for clock
public entry_point:
; todo we can do this with one off setup via pio_exec
pull block side 0
.wrap_target
new_state:
out exec, 16 side 1 ; this does any per state inline work (or it can be a JMP to entry_point to sleep..
; note the EXECed instruction should have a side set 0
out x, 13 side 1
out pins, 3 side 0 ; we want an OUT EXEC above which sets an IRQ to start scanline output
; to cause this out and the pixel out in the same cycle (this would be positive clk edge latch)
loop:
nop side 1
jmp x-- loop side 0
.wrap
; these are the values used in the out exec in video_htiming
.program video_htiming_states
.side_set 1
; state 0 = set irq 0
irq 0 side 0
; state 1 = set irq 1
irq 1 side 0
; state 2 = set irq 4
irq 4 side 0
; state 3 = clear irq 4
irq clear 4 side 0