File tree Expand file tree Collapse file tree 2 files changed +73
-0
lines changed
Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ # Display controller for printing text from a UART port.
2+
3+ reset:
4+ draw clear 0 0 0
5+ drawflush display1
6+
7+ reset_loop:
8+ sensor enabled switch1 @enabled
9+ jump reset_loop equal enabled false
10+
11+ setrate 5000
12+
13+ set CONFIG processor1
14+ set UART bank1
15+
16+ read UART_FIFO_MODULO CONFIG "UART_FIFO_MODULO"
17+
18+ read rptr UART 510
19+
20+ draw color 255 255 255 255
21+
22+ set LF 10
23+
24+ set CHAR_WIDTH 7
25+ set CHAR_HEIGHT 13
26+ set BASE_X 8
27+ set BASE_Y 508
28+
29+ set cur_x 0
30+ set next_x 0
31+
32+ set cur_y 0
33+ set next_y 0
34+
35+ main:
36+ sensor enabled switch1 @enabled
37+ jump reset equal enabled false
38+ read wptr UART 511
39+ jump main equal rptr wptr
40+
41+ loop:
42+ op add index rptr 256
43+ read char UART index
44+
45+ jump loop__newline equal char LF
46+
47+ op add next_x next_x CHAR_WIDTH
48+ jump loop__same_line lessThanEq next_x 497
49+ print "\n"
50+ loop__newline:
51+ set next_x 0
52+ op add next_y next_y CHAR_HEIGHT
53+ loop__same_line:
54+ printchar char
55+
56+ op add rptr rptr 1
57+ op mod rptr rptr UART_FIFO_MODULO
58+ write rptr UART 510
59+
60+ read wptr UART 511
61+ jump loop notEqual rptr wptr
62+
63+ op add x BASE_X cur_x
64+ op sub y BASE_Y cur_y
65+ draw print x y topLeft
66+
67+ set cur_x next_x
68+ set cur_y next_y
69+
70+ drawflush display1
71+
72+ jump main always
73+
File renamed without changes.
You can’t perform that action at this time.
0 commit comments