FlashForth SSD 1306

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-ssd1306
marker -ssd1306

: ssd1306_setpos ( x y -- )
  $b0 + contr
  dup $f0 and 4 rshift $10 or contr
  $f and contr
;

: ssd1306_fillp ( p1 p2 -- )
  0 0 ssd1306_setpos
  ssdw $40 i2c!
  #512 for
    over over i2c! i2c!
  next
  spen
  drop drop
;

: ssd1306_fill ( u -- )
  dup ssd1306_fillp
;

: write ( u )
 5 * ssdw $40 i2c! 5 for dup font + 4 r@
 - + c@ i2c! next drop $0 i2c! spen
;

: drawpixel ( x y flag -- )
\ setze pixel in buffer
;

: invert_display
 inverted @ 1 xor dup contr inverted !
;

: main-ssd ( -- )
  %11000 anselc mclr
  i2cinit
  ssd1306_init
  0 ssd1306_fill
;

: zehn ( zehner -- anzeige )
dup #10 / dup write
#10 * - write
;
: hundert ( hundert -- anzeige )
dup #100 / dup write
#100 * - 
zehn
;

: yeard ( n -- adr )
year
dup #1000 / dup write
#1000 * - hundert
;

: rt2
begin
0 0 ssd1306_setpos hour zehn
14 0 ssd1306_setpos minute zehn
28 0 ssd1306_setpos second zehn
55 0 ssd1306_setpos distance@ hundert
#1000 ms key? until
;
16. März 2017 20:24:36
© 2017. Thomas Buschhardt. Some Rights Reserved. Alle hier genannten Marken sind Eigentum der jeweiligen Inhaber.