123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- \ lcd test patterns
- decimal
- : eye ( -- )
- \ lcd-cls
- 76 0 ?do 75 i -
- 120 over - 100 lcd-move-to
- 120 over 25 + lcd-line-to
- 120 over + 100 lcd-line-to
- 120 i 100 + lcd-line-to
- 120 over - 100 lcd-line-to
- drop
- 5 +loop
- ;
- 250000 constant stripe-delay
- : stripe ( -- )
- lcd-vram lcd-vram-size $80 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $40 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $20 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $10 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $08 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $04 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $02 fill
- stripe-delay delay-us
- lcd-vram lcd-vram-size $01 fill
- ;
- : charset-test ( -- )
- lcd-cls
- 256 0 ?do
- i lcd-emit
- loop
- ;
- : character-X-test ( -- )
- lcd-cls
- lcd-text-rows lcd-text-columns * 0 ?do
- [char] X lcd-emit
- loop
- ;
- : test-lcd-menu ( -- flag )
- button-flush
- ctp-flush
- key-flush
- 200000 delay-us
- 10 lcd-text-rows 1- lcd-at-xy
- s" PASS FAIL" lcd-type
- button-flush
- begin
- button? if
- button
- case
- button-left of
- true exit
- endof
- button-centre of
- endof
- button-right of
- false exit
- endof
- endcase
- then
- ctp-pos? if
- ctp-flush
- then
- key? if
- key-flush
- then
- wait-for-event
- again
- ;
- : test-lcd-pass-fail ( c-addr u -- flag )
- test-lcd-menu
- if
- s" PASS: "
- true >r
- else
- s" FAIL: "
- false >r
- then
- type type cr
- r>
- ;
- : test-lcd-sequence ( -- flag )
- eye
- s" LCD eye test"
- test-lcd-pass-fail
- lcd-set-all
- s" LCD all black pixels"
- test-lcd-pass-fail
- and
- character-X-test
- s" LCD text"
- test-lcd-pass-fail
- and
- ;
- : test-lcd-main
- lcd-cls
- test-lcd-sequence if
- s" PASS"
- else
- s" FAIL"
- then
- lcd-cls
- s" LCD Test" lcd-type
- lcd-text-columns 2/ lcd-text-rows 2/ lcd-at-xy
- 2dup lcd-type
- 500000 delay-us
- type ." : LCD test" cr
- ;
|