forked from Mirrors/Marlin
Compare commits
1766 Commits
1.0.0-beta
...
1.0.2-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbde473433 | ||
|
|
8fa34d8858 | ||
|
|
637f14eab1 | ||
|
|
8906c93ce5 | ||
|
|
b3e60b4c62 | ||
|
|
fbd2709604 | ||
|
|
cfb118eb3c | ||
|
|
f538520af3 | ||
|
|
154c5a7d2b | ||
|
|
f00da2c49f | ||
|
|
67d7ced009 | ||
|
|
e4d911dd5e | ||
|
|
fff4f29dfc | ||
|
|
4bc50553d0 | ||
|
|
9b7ca2157b | ||
|
|
ea05d60c13 | ||
|
|
0c9d142c4f | ||
|
|
5db22a3da5 | ||
|
|
ddf77aa68a | ||
|
|
5adb162204 | ||
|
|
6aeeb4e61f | ||
|
|
559f4f1cba | ||
|
|
0b8858fc60 | ||
|
|
f874fc8b63 | ||
|
|
a7d4d04c33 | ||
|
|
45dd199c28 | ||
|
|
b1dc722c83 | ||
|
|
04df544571 | ||
|
|
32d431fe63 | ||
|
|
8375b82c2e | ||
|
|
453cbfe550 | ||
|
|
1e7b286add | ||
|
|
4ccf7c5e9a | ||
|
|
788cb980fa | ||
|
|
eaeccf2699 | ||
|
|
9f4201b96d | ||
|
|
7824047422 | ||
|
|
de70315dc7 | ||
|
|
fed690d9ac | ||
|
|
df46297c6d | ||
|
|
77fc28c761 | ||
|
|
c411cb18d3 | ||
|
|
5ce0bf057e | ||
|
|
ac36cd7258 | ||
|
|
0d8c6f8673 | ||
|
|
da192c521f | ||
|
|
0f5cccca4f | ||
|
|
3a30d45c2e | ||
|
|
269ec9f87f | ||
|
|
3d2b471c1a | ||
|
|
72912851b8 | ||
|
|
8d7bfd03d8 | ||
|
|
3c9e6b7b62 | ||
|
|
0e760274bd | ||
|
|
b291a422e9 | ||
|
|
8813978766 | ||
|
|
7ae548cf34 | ||
|
|
8f9067faa6 | ||
|
|
addf52fd4a | ||
|
|
e9ddd21aef | ||
|
|
2d7d43b64c | ||
|
|
5cfe13f240 | ||
|
|
9852252bca | ||
|
|
1c33310363 | ||
|
|
380c9abf16 | ||
|
|
501fe97c00 | ||
|
|
c7e2d73039 | ||
|
|
422a958a34 | ||
|
|
038fccd7a1 | ||
|
|
6730335657 | ||
|
|
1a57644b0c | ||
|
|
80afded132 | ||
|
|
028fe129a5 | ||
|
|
d7a2dd676e | ||
|
|
b3f2b30347 | ||
|
|
4ffecdbf7d | ||
|
|
2dfdf4b55c | ||
|
|
358759cb52 | ||
|
|
93c8b2a40b | ||
|
|
672f764b4d | ||
|
|
5a5b95edbf | ||
|
|
f25e793cff | ||
|
|
df17a6a1b4 | ||
|
|
f7e65935fb | ||
|
|
4e02aff9b5 | ||
|
|
81363bc441 | ||
|
|
95f4a55820 | ||
|
|
21205cc3d8 | ||
|
|
fb0996b5db | ||
|
|
538231edfd | ||
|
|
067b509479 | ||
|
|
a19f2f8ae7 | ||
|
|
f24dda9700 | ||
|
|
ec4681ab6b | ||
|
|
dd7e4ee97f | ||
|
|
2b9722f387 | ||
|
|
00e4bc9f54 | ||
|
|
9472bbe51d | ||
|
|
d2b6e62996 | ||
|
|
30248214c7 | ||
|
|
c5f138ea07 | ||
|
|
efca4afab2 | ||
|
|
3d9f4ac757 | ||
|
|
9d57c376db | ||
|
|
04fb34c7ff | ||
|
|
f8aa5ff771 | ||
|
|
07b85f8b92 | ||
|
|
be81dfa3de | ||
|
|
b5c6f11e41 | ||
|
|
206b7f4e92 | ||
|
|
9d9a2d75ef | ||
|
|
21cc188272 | ||
|
|
86cc22d639 | ||
|
|
3f9707aa33 | ||
|
|
f36fd3ddec | ||
|
|
912ed155c5 | ||
|
|
b5e50cdd4e | ||
|
|
eed451e034 | ||
|
|
f3209bba34 | ||
|
|
1f520a5a8c | ||
|
|
b32be2dc64 | ||
|
|
edac64e7d2 | ||
|
|
ecda6cdc0a | ||
|
|
f3e503e725 | ||
|
|
1d5d853c9a | ||
|
|
63da6900b0 | ||
|
|
a18b625534 | ||
|
|
975810fb4a | ||
|
|
ae12ad0d6c | ||
|
|
80b17ab573 | ||
|
|
625860f086 | ||
|
|
6583bb781d | ||
|
|
2701dd8a17 | ||
|
|
217186d7bc | ||
|
|
6b82415c81 | ||
|
|
692a01b1c7 | ||
|
|
878b5557a1 | ||
|
|
2ec2bf1564 | ||
|
|
6c591a97a1 | ||
|
|
e7db8ee9e5 | ||
|
|
10e1b6ef8b | ||
|
|
d1f21d1189 | ||
|
|
449dad71f2 | ||
|
|
a2109cb492 | ||
|
|
3d1da45f3e | ||
|
|
d02daec08f | ||
|
|
0268c03a75 | ||
|
|
991a74b75b | ||
|
|
2bf6d804c4 | ||
|
|
9453bb13c2 | ||
|
|
67fd8f0727 | ||
|
|
2309c9f43a | ||
|
|
236db44669 | ||
|
|
e6774fb7d2 | ||
|
|
f4ce235589 | ||
|
|
cb047e9070 | ||
|
|
5b336a4cdb | ||
|
|
10ad9f1062 | ||
|
|
f24c5d82e3 | ||
|
|
053b541de8 | ||
|
|
8a6f098cc6 | ||
|
|
78167ce439 | ||
|
|
d1995aec7a | ||
|
|
4122de9d17 | ||
|
|
d60efc3b5d | ||
|
|
cb12161191 | ||
|
|
c1df713e4d | ||
|
|
ec33df0554 | ||
|
|
a5ed3e96f2 | ||
|
|
60959f196f | ||
|
|
95429a4108 | ||
|
|
a0959366af | ||
|
|
b2000b7055 | ||
|
|
0468f81950 | ||
|
|
6e42c9e305 | ||
|
|
0504c02153 | ||
|
|
3afe66bb0c | ||
|
|
73b7b08f2c | ||
|
|
9eb6df17a7 | ||
|
|
c9f60183a9 | ||
|
|
0d957872a0 | ||
|
|
9c07d28bd6 | ||
|
|
23e768dffa | ||
|
|
f7ffd53bac | ||
|
|
2f467e2797 | ||
|
|
050ca9ca13 | ||
|
|
cf52c48d19 | ||
|
|
984177c40c | ||
|
|
c9b8435749 | ||
|
|
f00a202246 | ||
|
|
6efc4f3abf | ||
|
|
45336bb6c0 | ||
|
|
5f555140be | ||
|
|
7ecb7cbd46 | ||
|
|
7667949aca | ||
|
|
529c937943 | ||
|
|
7250ec4337 | ||
|
|
f05225a271 | ||
|
|
d080027ff4 | ||
|
|
bdf2c94bff | ||
|
|
e83ecec809 | ||
|
|
f80a602783 | ||
|
|
f390b3f314 | ||
|
|
d254651146 | ||
|
|
7db943b147 | ||
|
|
fe8d8beb7a | ||
|
|
5f36ed2c4c | ||
|
|
af7fbcc026 | ||
|
|
203df3533d | ||
|
|
b792b74036 | ||
|
|
dc64175d77 | ||
|
|
a8d8ef7534 | ||
|
|
d74aabf259 | ||
|
|
60628864ca | ||
|
|
889d7ba218 | ||
|
|
5e7bd2dc87 | ||
|
|
1e865e5df7 | ||
|
|
b086394178 | ||
|
|
39d28a9bbf | ||
|
|
6325968a39 | ||
|
|
e99f24ff2f | ||
|
|
ac204028e7 | ||
|
|
4315c2547a | ||
|
|
f21c65918f | ||
|
|
58c4473bea | ||
|
|
825c46024d | ||
|
|
cfe80e1def | ||
|
|
7464d3c96a | ||
|
|
81568c3c6d | ||
|
|
4ebeb14026 | ||
|
|
03e489aaad | ||
|
|
acc0e75279 | ||
|
|
a5c059dcf5 | ||
|
|
17de96ace7 | ||
|
|
7458bfe297 | ||
|
|
6880e93b75 | ||
|
|
61d8e40712 | ||
|
|
3b1f186c0c | ||
|
|
f83d0f2a68 | ||
|
|
bd25e7393b | ||
|
|
d201fe74c6 | ||
|
|
0e23105e1e | ||
|
|
72da53c613 | ||
|
|
174f8d3631 | ||
|
|
e970461adb | ||
|
|
0c06e97e98 | ||
|
|
a9c334e8bc | ||
|
|
842da54e68 | ||
|
|
07c6b5ab71 | ||
|
|
1857e611d3 | ||
|
|
63e1665fa9 | ||
|
|
e69313fc2b | ||
|
|
bd22405412 | ||
|
|
49791949af | ||
|
|
140ce06692 | ||
|
|
28c3ad291a | ||
|
|
0450e83fa5 | ||
|
|
f21cce0b28 | ||
|
|
39b47ef5b0 | ||
|
|
e4b98011cf | ||
|
|
60598b4cdd | ||
|
|
f074706d2e | ||
|
|
b726511a3b | ||
|
|
4d61287807 | ||
|
|
b17b8583af | ||
|
|
280504e2e0 | ||
|
|
341c7d080d | ||
|
|
31ca3de72f | ||
|
|
e83cfc0a62 | ||
|
|
3ac8bd8de7 | ||
|
|
0b310ab6c5 | ||
|
|
91d740e128 | ||
|
|
00f279376f | ||
|
|
ab355a90d3 | ||
|
|
4297bcc89f | ||
|
|
d088b5f30f | ||
|
|
1fad8e6a81 | ||
|
|
467f0ea6b7 | ||
|
|
29e854c535 | ||
|
|
6599adc184 | ||
|
|
a12eec33e2 | ||
|
|
c9486ebb85 | ||
|
|
b6ffea612a | ||
|
|
8196b36ad9 | ||
|
|
cf749dbeda | ||
|
|
ae081d0fe0 | ||
|
|
785143a013 | ||
|
|
0cbbba08bd | ||
|
|
af0549bfd2 | ||
|
|
ae1a698263 | ||
|
|
600b4f0590 | ||
|
|
3ebfd29312 | ||
|
|
2ef0669b19 | ||
|
|
485ca10bc3 | ||
|
|
599530902d | ||
|
|
1ba7c31395 | ||
|
|
64139f5e5a | ||
|
|
2f9ed1777d | ||
|
|
edfcf3b527 | ||
|
|
c429a4b3ec | ||
|
|
e5a334b83a | ||
|
|
f05928d886 | ||
|
|
b4e287fe8e | ||
|
|
de725bd408 | ||
|
|
061c1fcd93 | ||
|
|
181e487f13 | ||
|
|
ff38d7c293 | ||
|
|
1977b4490f | ||
|
|
7562183efc | ||
|
|
5a8b3a84ae | ||
|
|
1b7c065055 | ||
|
|
433ac29d31 | ||
|
|
2427d0b683 | ||
|
|
8ebefe6d35 | ||
|
|
725ba8d01e | ||
|
|
2b54eeb897 | ||
|
|
14187dae6c | ||
|
|
662fe8288b | ||
|
|
aad336eb81 | ||
|
|
5874852501 | ||
|
|
12b51d6060 | ||
|
|
d12b24758a | ||
|
|
3f54c9ba33 | ||
|
|
92e21d3ee2 | ||
|
|
5714f64927 | ||
|
|
d407a43ac1 | ||
|
|
eaa788e076 | ||
|
|
6901445592 | ||
|
|
0d35b1d0b8 | ||
|
|
87fc00c182 | ||
|
|
7681711e7e | ||
|
|
aa4160ba62 | ||
|
|
cd769781a1 | ||
|
|
f40cff59f3 | ||
|
|
90eb266139 | ||
|
|
d078c7c29f | ||
|
|
3dc9e478ad | ||
|
|
0d97dec434 | ||
|
|
1651ccc0cc | ||
|
|
3b1ab84536 | ||
|
|
d84934d8c5 | ||
|
|
4ffdbcbd4e | ||
|
|
5c8107bcdd | ||
|
|
df7c80335a | ||
|
|
b014fd1ad2 | ||
|
|
443b648863 | ||
|
|
377dfb182f | ||
|
|
b81021f475 | ||
|
|
724197454c | ||
|
|
058e446531 | ||
|
|
110c5dcf23 | ||
|
|
256c25a843 | ||
|
|
ca30aee903 | ||
|
|
0733825fb1 | ||
|
|
af3e4d7510 | ||
|
|
aaaf8fe8dd | ||
|
|
b360306881 | ||
|
|
ce85515428 | ||
|
|
764921bdbf | ||
|
|
c40c7b589b | ||
|
|
0f2e0525df | ||
|
|
5ae02a361b | ||
|
|
83037542aa | ||
|
|
fb34265d75 | ||
|
|
6e343ef2f0 | ||
|
|
2f6c57eadc | ||
|
|
f989bd5435 | ||
|
|
6c5a460e65 | ||
|
|
d1e4237e1d | ||
|
|
a664763e6f | ||
|
|
b5dc228a7a | ||
|
|
3cbb2f56c6 | ||
|
|
c35736a140 | ||
|
|
cb4a6dd2dc | ||
|
|
5b66810580 | ||
|
|
01e9b536cb | ||
|
|
58eabd21fb | ||
|
|
88d12a762a | ||
|
|
bf0ecedf60 | ||
|
|
9bc7aec349 | ||
|
|
40ba644bb4 | ||
|
|
3b8216bdd1 | ||
|
|
37799f70ba | ||
|
|
1632e5e38a | ||
|
|
fe3a09bbcf | ||
|
|
1d62309d2a | ||
|
|
1e9dc85148 | ||
|
|
cf325ba240 | ||
|
|
018b68a5c4 | ||
|
|
dde61d8886 | ||
|
|
0fbfb1bf82 | ||
|
|
8340ca6e05 | ||
|
|
9887555192 | ||
|
|
105571ec68 | ||
|
|
68dd5e635e | ||
|
|
25069ed4e9 | ||
|
|
8b52eff2c1 | ||
|
|
75b3a68b65 | ||
|
|
e3c88a5120 | ||
|
|
62db9848d3 | ||
|
|
5908fd5cec | ||
|
|
0adbc79571 | ||
|
|
0091865583 | ||
|
|
85649a4549 | ||
|
|
1d0fe035f3 | ||
|
|
e7707aedbc | ||
|
|
0a8dc0e96b | ||
|
|
d2fcb3ee56 | ||
|
|
3cd7dbcc45 | ||
|
|
c13a831ea1 | ||
|
|
2d22902d08 | ||
|
|
ad3b770c1a | ||
|
|
2f4a20257c | ||
|
|
1bd0dd04e3 | ||
|
|
aacff0d361 | ||
|
|
8bf3139bc8 | ||
|
|
50b4e86f75 | ||
|
|
2096188ac3 | ||
|
|
f9f54019ab | ||
|
|
c51a6f94e0 | ||
|
|
89abf07faa | ||
|
|
17aa67e4ea | ||
|
|
c7273d521f | ||
|
|
1fd9a7d476 | ||
|
|
3f2c771d90 | ||
|
|
bcd039aa81 | ||
|
|
82606354dd | ||
|
|
253cf0f427 | ||
|
|
32a6451ad8 | ||
|
|
b5417be109 | ||
|
|
f244045245 | ||
|
|
ce517df702 | ||
|
|
2242a84218 | ||
|
|
6e3406d228 | ||
|
|
43c298a7a9 | ||
|
|
4c823224b0 | ||
|
|
d86c3cf43c | ||
|
|
f0cab611db | ||
|
|
269a068032 | ||
|
|
fae7d08698 | ||
|
|
512f2a3136 | ||
|
|
cd3220d055 | ||
|
|
86b4b805d2 | ||
|
|
1875ab3bd7 | ||
|
|
6e6e4e2143 | ||
|
|
9d11b70436 | ||
|
|
ea9bffdc48 | ||
|
|
0de826160e | ||
|
|
3c927901a4 | ||
|
|
c8d0ca9337 | ||
|
|
8a32c5395b | ||
|
|
29e7639933 | ||
|
|
5a18324030 | ||
|
|
07c0eeee99 | ||
|
|
b7aac49995 | ||
|
|
09b84faa00 | ||
|
|
efb6d61413 | ||
|
|
38192cb5f3 | ||
|
|
aed5ec008a | ||
|
|
cfb98ef682 | ||
|
|
88b494678f | ||
|
|
92e14298b0 | ||
|
|
9db9842aea | ||
|
|
e541323741 | ||
|
|
1c9a70cee9 | ||
|
|
2acd3792fc | ||
|
|
8b4c4aa5c3 | ||
|
|
ce76843dc3 | ||
|
|
ad5c8cbba9 | ||
|
|
6460709d92 | ||
|
|
105bebb466 | ||
|
|
97ead2eccb | ||
|
|
d85411f13a | ||
|
|
7c7f2d094e | ||
|
|
e2d703377a | ||
|
|
2715f6ddbf | ||
|
|
39e9b133f3 | ||
|
|
da6b536182 | ||
|
|
3a8e36f19e | ||
|
|
eea3ba5588 | ||
|
|
1cbcbb0971 | ||
|
|
2fa514e88a | ||
|
|
b9126ab497 | ||
|
|
a33f099547 | ||
|
|
21ec6b88c3 | ||
|
|
e4dc80d3d3 | ||
|
|
6adbdf42e0 | ||
|
|
5107018414 | ||
|
|
27d544ac25 | ||
|
|
013793bbe9 | ||
|
|
a23a5395f9 | ||
|
|
e5b70237c7 | ||
|
|
ed6f4a71c5 | ||
|
|
3161740df9 | ||
|
|
086ff1644f | ||
|
|
3ffc9651b1 | ||
|
|
357b87b498 | ||
|
|
95ad6ec9a1 | ||
|
|
2fa51f8920 | ||
|
|
27a7cf9fcf | ||
|
|
d3f305332a | ||
|
|
b0aeac117f | ||
|
|
73b380d8d2 | ||
|
|
fe4930212c | ||
|
|
dca9790f42 | ||
|
|
c23376f2e7 | ||
|
|
dfb98101e4 | ||
|
|
f1501317ca | ||
|
|
9a5d23d96f | ||
|
|
303ee67896 | ||
|
|
8759508319 | ||
|
|
a65564eef6 | ||
|
|
aeaf9b9312 | ||
|
|
89f78b0b80 | ||
|
|
b0093a1513 | ||
|
|
a3530d1141 | ||
|
|
990e770e15 | ||
|
|
f643f4d674 | ||
|
|
bbe8fbe13d | ||
|
|
51c6bd6b72 | ||
|
|
c8cdd1fc6f | ||
|
|
7395dafc1e | ||
|
|
fad2a60ce6 | ||
|
|
eecda434fb | ||
|
|
944ced87c5 | ||
|
|
06709ad60e | ||
|
|
084134d3c7 | ||
|
|
3906f27c46 | ||
|
|
8613a74443 | ||
|
|
a38c90ee84 | ||
|
|
a00cec8b71 | ||
|
|
1f895844ac | ||
|
|
af8be9013b | ||
|
|
0ddee3c7db | ||
|
|
272072fa20 | ||
|
|
aab61e63c3 | ||
|
|
6cd85e6008 | ||
|
|
09af1b90b8 | ||
|
|
765b2da3d4 | ||
|
|
881e348eed | ||
|
|
5a332df47e | ||
|
|
040357fd1b | ||
|
|
15d1b8d719 | ||
|
|
7325d7102e | ||
|
|
7f76a0e064 | ||
|
|
4f3eb6bec8 | ||
|
|
fcd8524b6e | ||
|
|
8c98690e1d | ||
|
|
8ea5665ee2 | ||
|
|
8c4377dd63 | ||
|
|
661e378ce9 | ||
|
|
fde8c2c310 | ||
|
|
1aa10a5f18 | ||
|
|
fdce91192e | ||
|
|
d819c55395 | ||
|
|
fd4542f33a | ||
|
|
e8291ed728 | ||
|
|
465b654d24 | ||
|
|
88506a80c3 | ||
|
|
b514d3c87f | ||
|
|
77df0d689a | ||
|
|
cc5f1d475c | ||
|
|
91759dede6 | ||
|
|
557217fc05 | ||
|
|
aee63afccd | ||
|
|
d3fcc28e64 | ||
|
|
99f6326544 | ||
|
|
ea669cb504 | ||
|
|
b46a1b6360 | ||
|
|
3cc7626d1f | ||
|
|
174b8d99d5 | ||
|
|
3b718b816c | ||
|
|
34fd59c370 | ||
|
|
541155ea87 | ||
|
|
9fa328e5c8 | ||
|
|
73f0ee9345 | ||
|
|
f308a8af91 | ||
|
|
357e31270a | ||
|
|
d2d7d186b5 | ||
|
|
2ccdf4f36d | ||
|
|
c00383f286 | ||
|
|
60f72a78a9 | ||
|
|
abba7a0003 | ||
|
|
b868d668fa | ||
|
|
8212d8d543 | ||
|
|
46bae30573 | ||
|
|
51ae4881ab | ||
|
|
498d76fd79 | ||
|
|
af9395ac2e | ||
|
|
fd42f0d226 | ||
|
|
96217bf36a | ||
|
|
cf5c3b6610 | ||
|
|
d1c64b9dc4 | ||
|
|
5d50819791 | ||
|
|
3f455889d0 | ||
|
|
4ddedb3b27 | ||
|
|
d4ba23bc28 | ||
|
|
bbb424bd2f | ||
|
|
8f0cee2a14 | ||
|
|
08263ae66e | ||
|
|
3b193d1b5f | ||
|
|
5bd09d26e2 | ||
|
|
b45beeffd6 | ||
|
|
306588925d | ||
|
|
c43838bb1e | ||
|
|
99f0e44864 | ||
|
|
66e3869138 | ||
|
|
2f2459c0db | ||
|
|
8c5675c290 | ||
|
|
a466c8ef68 | ||
|
|
0f7393a13e | ||
|
|
c4fbb44d6d | ||
|
|
ad2c6488c7 | ||
|
|
c9c83a4560 | ||
|
|
ab0d3c4fb3 | ||
|
|
477b6fa1df | ||
|
|
831fc2a952 | ||
|
|
7dcd350941 | ||
|
|
c31bb2b7ad | ||
|
|
46f5bea19f | ||
|
|
d16a770855 | ||
|
|
71bb3a8133 | ||
|
|
9b7d87e885 | ||
|
|
816f0a678a | ||
|
|
6e43398509 | ||
|
|
d6c5c503d4 | ||
|
|
15d6116188 | ||
|
|
0b9ecf3824 | ||
|
|
b5ba5c1465 | ||
|
|
78e7654601 | ||
|
|
3f6d44d40b | ||
|
|
363dc2f0e8 | ||
|
|
5f797ca29f | ||
|
|
1a6d21bb60 | ||
|
|
0778f5f028 | ||
|
|
54bab3e0d0 | ||
|
|
b18b40feff | ||
|
|
bdd0211aeb | ||
|
|
c8e5a82d49 | ||
|
|
f64592e362 | ||
|
|
ac74f45dc0 | ||
|
|
8ebcc9dc3a | ||
|
|
19530c9945 | ||
|
|
6f76066ab3 | ||
|
|
8b67f6f3e8 | ||
|
|
36086d3ca4 | ||
|
|
1781031f2d | ||
|
|
d485988bec | ||
|
|
8a1fd25363 | ||
|
|
5097c57d3a | ||
|
|
b819fc53ca | ||
|
|
e1ae7952eb | ||
|
|
1cc9212c05 | ||
|
|
a5f53f0cf3 | ||
|
|
c2b3e88787 | ||
|
|
8d162e5bd7 | ||
|
|
430dcb65a7 | ||
|
|
3ec0d110bd | ||
|
|
f303129fb6 | ||
|
|
b2c11ba980 | ||
|
|
a864d9d4ab | ||
|
|
28aca76c4d | ||
|
|
61059385a3 | ||
|
|
856edfcc0d | ||
|
|
0d81ae77bc | ||
|
|
84df13f7d1 | ||
|
|
4c7e9502ad | ||
|
|
652a0f6b5a | ||
|
|
96a0cdc541 | ||
|
|
d24df7af2c | ||
|
|
f0b8d5ba3d | ||
|
|
50f44d9249 | ||
|
|
f5b5dd8038 | ||
|
|
76cf07c3f7 | ||
|
|
476c7193d8 | ||
|
|
adbf226de1 | ||
|
|
5bf73b86ff | ||
|
|
9b2576e5de | ||
|
|
f08bb8bb6a | ||
|
|
b1f8f492c6 | ||
|
|
8a5eaa3c9b | ||
|
|
61a7256d42 | ||
|
|
c724c762a2 | ||
|
|
fdac8f6cec | ||
|
|
05932e4458 | ||
|
|
7216583b8b | ||
|
|
e8e0697e48 | ||
|
|
75f39fadfc | ||
|
|
df194f75e1 | ||
|
|
380144c20f | ||
|
|
89a304fd98 | ||
|
|
6ae7f7870d | ||
|
|
17d6d965dc | ||
|
|
8f195844dd | ||
|
|
ce8b9c4fc5 | ||
|
|
000b710c5f | ||
|
|
8e48e24c7f | ||
|
|
46d2443c7d | ||
|
|
eed053dffb | ||
|
|
3e568efe67 | ||
|
|
8349fc89a4 | ||
|
|
da2a6f9a31 | ||
|
|
532289e851 | ||
|
|
d29615dc0c | ||
|
|
5bde7fcb28 | ||
|
|
20faff5935 | ||
|
|
e5d3044801 | ||
|
|
b7eadb9f37 | ||
|
|
e016a720f4 | ||
|
|
e8786bf110 | ||
|
|
cc2925b705 | ||
|
|
b64661070e | ||
|
|
5c44f6c434 | ||
|
|
b33375d438 | ||
|
|
35905ea4f9 | ||
|
|
ad588e8990 | ||
|
|
a94e588765 | ||
|
|
69af392554 | ||
|
|
48a185d004 | ||
|
|
24d1f480b6 | ||
|
|
95b41413e6 | ||
|
|
59b96e323e | ||
|
|
2433ee6fc8 | ||
|
|
3455a2bac2 | ||
|
|
ec1cf6e7f8 | ||
|
|
dc887ef99b | ||
|
|
c244eb860c | ||
|
|
7b556d2e96 | ||
|
|
a5e8575829 | ||
|
|
cab84e0e5b | ||
|
|
5b3f60ea2e | ||
|
|
62d0b79023 | ||
|
|
c184f808f7 | ||
|
|
c886f5cb13 | ||
|
|
b5a964fcc5 | ||
|
|
4382068f92 | ||
|
|
f941203172 | ||
|
|
47854ff5ce | ||
|
|
c79e3967b3 | ||
|
|
5b8b939a1f | ||
|
|
d69822ed51 | ||
|
|
2fb2a0a119 | ||
|
|
39d88bcccb | ||
|
|
ab965376ff | ||
|
|
b2cc27e5ea | ||
|
|
8a08cca0f2 | ||
|
|
667d278f54 | ||
|
|
bf27e79e74 | ||
|
|
87e28c0599 | ||
|
|
24c6b2ab35 | ||
|
|
6a803ba9c5 | ||
|
|
457d8a0acb | ||
|
|
6f85a8c7aa | ||
|
|
dd3086d3f2 | ||
|
|
7fad13a1e2 | ||
|
|
73c82e7ad8 | ||
|
|
b832f5b9f6 | ||
|
|
c38b0855c8 | ||
|
|
d147a057ac | ||
|
|
bca353cc12 | ||
|
|
253dfc4bc1 | ||
|
|
1bda6bf862 | ||
|
|
c80aac1518 | ||
|
|
314fd13c39 | ||
|
|
4f7c6dfe35 | ||
|
|
57173739a1 | ||
|
|
0dca49a7c0 | ||
|
|
d8c2c810b4 | ||
|
|
9bc88f8bab | ||
|
|
3ca1ca6869 | ||
|
|
97b0da0c2e | ||
|
|
61db046b32 | ||
|
|
77df2ab0e7 | ||
|
|
ed1ab42186 | ||
|
|
f4a59e4ce5 | ||
|
|
7ee275b620 | ||
|
|
6a1e980c6d | ||
|
|
20076a8bd3 | ||
|
|
3626b5ad8b | ||
|
|
bf7007d02f | ||
|
|
f17506c504 | ||
|
|
59e36f1d27 | ||
|
|
acd8619809 | ||
|
|
7c35be7fd8 | ||
|
|
595580556c | ||
|
|
88dfeefca3 | ||
|
|
5350faf2a2 | ||
|
|
7016cc9511 | ||
|
|
d78db12abd | ||
|
|
3b315b3da0 | ||
|
|
f26f26b7bd | ||
|
|
a447e76fdf | ||
|
|
f8d173bd0b | ||
|
|
9aa2229077 | ||
|
|
aa6c58ad37 | ||
|
|
221286c10a | ||
|
|
9547fb9dfb | ||
|
|
62aab66299 | ||
|
|
d7b1a8ba33 | ||
|
|
53614e5144 | ||
|
|
b42d24e31e | ||
|
|
07f029c2d5 | ||
|
|
b0c8120fcc | ||
|
|
a54fe2d73c | ||
|
|
7ea63d08df | ||
|
|
4187b637a5 | ||
|
|
07e7de3600 | ||
|
|
c0c4c97db6 | ||
|
|
2ca983568d | ||
|
|
3700f688f5 | ||
|
|
a504c88346 | ||
|
|
c6cb93d38c | ||
|
|
394ed08f88 | ||
|
|
9bf1cf1b22 | ||
|
|
4623e78ce0 | ||
|
|
d7f384f680 | ||
|
|
abc8320a68 | ||
|
|
f4c3135c6d | ||
|
|
aae42c68f9 | ||
|
|
4d435c38a6 | ||
|
|
6c42a3a339 | ||
|
|
376d8af2c8 | ||
|
|
434b6a05c1 | ||
|
|
bdc2621119 | ||
|
|
6965bd4e15 | ||
|
|
a55b33e613 | ||
|
|
8b34351537 | ||
|
|
735e556724 | ||
|
|
d80aecda0a | ||
|
|
be2dea1dc6 | ||
|
|
55c287a69e | ||
|
|
1902d339b0 | ||
|
|
eb23a68e92 | ||
|
|
7ced55b97c | ||
|
|
e019197b32 | ||
|
|
1561c6df51 | ||
|
|
374bc99fa3 | ||
|
|
ab624eac2a | ||
|
|
52f79ffeca | ||
|
|
b9d7ccf1cd | ||
|
|
c323fced9a | ||
|
|
d4d1540727 | ||
|
|
01ed99143c | ||
|
|
e578f988d3 | ||
|
|
76841450c8 | ||
|
|
44f327d738 | ||
|
|
326d2db025 | ||
|
|
2cb716f513 | ||
|
|
34da3a0a3f | ||
|
|
18199ff960 | ||
|
|
a105e10075 | ||
|
|
fb5334f428 | ||
|
|
c5bf8298d3 | ||
|
|
c3568398b5 | ||
|
|
96a773fa48 | ||
|
|
39cd3dbdbe | ||
|
|
fb20ceabce | ||
|
|
d01ee7e7b5 | ||
|
|
d7390e13d9 | ||
|
|
f3aa2a48e7 | ||
|
|
460751503e | ||
|
|
5ab872de1f | ||
|
|
9da94c247a | ||
|
|
59004023fd | ||
|
|
461dad6e05 | ||
|
|
c4a2077951 | ||
|
|
8a2a3ef91d | ||
|
|
6397b3339c | ||
|
|
cdaaad3df1 | ||
|
|
e3bdefd873 | ||
|
|
a5be0c52c6 | ||
|
|
e73611f5fa | ||
|
|
e509cdbeb0 | ||
|
|
99b7e926e7 | ||
|
|
68be33b1fc | ||
|
|
acb3271c9a | ||
|
|
61fe430d4f | ||
|
|
d77f5ee722 | ||
|
|
fde17d5720 | ||
|
|
aa65c20d1f | ||
|
|
ecf3ab5de4 | ||
|
|
2daa85918e | ||
|
|
2015989f84 | ||
|
|
1c86adc760 | ||
|
|
648d45cfb2 | ||
|
|
171719f18c | ||
|
|
b519af4f05 | ||
|
|
7d03c52511 | ||
|
|
312b4aa7c2 | ||
|
|
02dee80fa5 | ||
|
|
73569d891f | ||
|
|
47dc70e3ec | ||
|
|
1d258903bb | ||
|
|
e34c9981ab | ||
|
|
26a441fc7d | ||
|
|
ac975ed8c2 | ||
|
|
58d12aad73 | ||
|
|
caa848f943 | ||
|
|
7ad12be763 | ||
|
|
408169aef4 | ||
|
|
bd96d22bfb | ||
|
|
73f21cd5d6 | ||
|
|
6f4a6e531c | ||
|
|
01edf22a10 | ||
|
|
ff6fa09ecf | ||
|
|
c8dcc7c208 | ||
|
|
8b0d82e9db | ||
|
|
1e05d192ab | ||
|
|
373f3ecab3 | ||
|
|
e36d31a3b7 | ||
|
|
f295712008 | ||
|
|
5c70c785f5 | ||
|
|
69b02031ca | ||
|
|
2ca6c5fbd7 | ||
|
|
6a81291c57 | ||
|
|
15b1b896e8 | ||
|
|
c1cb5977ee | ||
|
|
8a5bd8a808 | ||
|
|
3dea417c25 | ||
|
|
c1d7cf939e | ||
|
|
4c7d1436e9 | ||
|
|
6588933c04 | ||
|
|
5dabc95409 | ||
|
|
a733537ddd | ||
|
|
f4f30c9d64 | ||
|
|
79374f0b93 | ||
|
|
1520de0093 | ||
|
|
da05b3ba94 | ||
|
|
4b19c8552e | ||
|
|
971ec35135 | ||
|
|
4de419e26e | ||
|
|
a0729f0c3a | ||
|
|
5090c56651 | ||
|
|
16b9239a26 | ||
|
|
a964b3cf3d | ||
|
|
34fb4831a2 | ||
|
|
e8572c5239 | ||
|
|
7ee70c2248 | ||
|
|
b78fa6bb70 | ||
|
|
9be61cdc02 | ||
|
|
7231a20dba | ||
|
|
7296de34cb | ||
|
|
e2ff536b03 | ||
|
|
df776f36a4 | ||
|
|
40eb07bad4 | ||
|
|
440cf2bc10 | ||
|
|
bd33cf4a9f | ||
|
|
567291e734 | ||
|
|
68f9f2521e | ||
|
|
8d80cbbf4c | ||
|
|
273502a172 | ||
|
|
98d0d48191 | ||
|
|
bbe67fca5a | ||
|
|
9eeb711c96 | ||
|
|
424101110c | ||
|
|
b2eeebd9c3 | ||
|
|
0d4a9444c4 | ||
|
|
86cce025f4 | ||
|
|
1a18a487f9 | ||
|
|
03141a5ef4 | ||
|
|
28ada096e2 | ||
|
|
4121311b9d | ||
|
|
dfa549f268 | ||
|
|
64360164ad | ||
|
|
86405cdd11 | ||
|
|
6c45c3f4e7 | ||
|
|
96624f0f31 | ||
|
|
dc59f07d24 | ||
|
|
b668cb0516 | ||
|
|
95dff34b73 | ||
|
|
4cc6f9f6de | ||
|
|
61a48cc662 | ||
|
|
9cc15876be | ||
|
|
c9cf2174dd | ||
|
|
bd2cd4903e | ||
|
|
37f3199df3 | ||
|
|
fbd899a37d | ||
|
|
29bb8d7d4f | ||
|
|
015d0594b0 | ||
|
|
90664d20a4 | ||
|
|
2739c26c4f | ||
|
|
6fb9573157 | ||
|
|
594193c908 | ||
|
|
1fa61c297e | ||
|
|
b27a59f41e | ||
|
|
2c0fa34c9e | ||
|
|
a65a26d6b4 | ||
|
|
db2f157a22 | ||
|
|
a5cd582665 | ||
|
|
e3bc420daa | ||
|
|
fc4ab05157 | ||
|
|
0ef54f2f85 | ||
|
|
a200521eab | ||
|
|
727aa2a051 | ||
|
|
1a397825f9 | ||
|
|
289c02eda4 | ||
|
|
d5ad7a0814 | ||
|
|
c3cdaceab3 | ||
|
|
1c127217df | ||
|
|
7f57f28ccc | ||
|
|
788d62bcc4 | ||
|
|
4f96ad5621 | ||
|
|
d71f1e9bf6 | ||
|
|
db5bb8546d | ||
|
|
4b2ece159b | ||
|
|
d5ee2a5a62 | ||
|
|
7ac6d7f78e | ||
|
|
13596e8722 | ||
|
|
3a6abe1d6e | ||
|
|
16afbf9bfa | ||
|
|
c83863d5d6 | ||
|
|
34bca48b98 | ||
|
|
ac52dcc174 | ||
|
|
84920e9c58 | ||
|
|
31bb3fb297 | ||
|
|
c80a78bb70 | ||
|
|
5d5909fc25 | ||
|
|
93f0463b21 | ||
|
|
1f74ef4157 | ||
|
|
4fa2260a59 | ||
|
|
038d405254 | ||
|
|
2438b34df9 | ||
|
|
443aaa30bf | ||
|
|
7f622467fc | ||
|
|
86867928ac | ||
|
|
9a38cad6f0 | ||
|
|
7a5c474d91 | ||
|
|
4e448b700a | ||
|
|
fa58be3cb8 | ||
|
|
9f2862ce48 | ||
|
|
9fb8bd5685 | ||
|
|
aa816ee81c | ||
|
|
0d075378d5 | ||
|
|
9a1c90471f | ||
|
|
1a0f889803 | ||
|
|
9322c408c6 | ||
|
|
fd5b7e0cec | ||
|
|
e5a853a3d0 | ||
|
|
72419f69a9 | ||
|
|
91bea43332 | ||
|
|
d2b00fe486 | ||
|
|
6c66cae694 | ||
|
|
f3e0e5184d | ||
|
|
5d3862f9d1 | ||
|
|
0b320f75e9 | ||
|
|
5f1cd70122 | ||
|
|
a49c09a776 | ||
|
|
26d8863111 | ||
|
|
4a141a694f | ||
|
|
83c790a020 | ||
|
|
c28e71a1bf | ||
|
|
ee8feb9dee | ||
|
|
c8e2f44087 | ||
|
|
7417423691 | ||
|
|
590225be25 | ||
|
|
a0e41c0970 | ||
|
|
233df9cca0 | ||
|
|
bb0de75a92 | ||
|
|
7c47e7162d | ||
|
|
af78d0cbfa | ||
|
|
9a78f321a4 | ||
|
|
5de25ccd20 | ||
|
|
d6ce63c49c | ||
|
|
f036be7c4e | ||
|
|
07e11c7cf5 | ||
|
|
92782f9252 | ||
|
|
6a61a3c0b4 | ||
|
|
f0aee4101a | ||
|
|
aba67e2449 | ||
|
|
6504e96165 | ||
|
|
86bf911139 | ||
|
|
7bad72359c | ||
|
|
1daf2f3256 | ||
|
|
f1263d3f88 | ||
|
|
140e095c6e | ||
|
|
b2c1c64fb1 | ||
|
|
ceb5ee38af | ||
|
|
8efd4cfd73 | ||
|
|
b3ebb71704 | ||
|
|
372e12f83f | ||
|
|
6beb42cdf6 | ||
|
|
f991bf23b2 | ||
|
|
5bfba7720e | ||
|
|
a069d30a4b | ||
|
|
839bef6d5d | ||
|
|
1292d735ba | ||
|
|
4eb81a69e6 | ||
|
|
3e9cd334a4 | ||
|
|
67710df9f3 | ||
|
|
b6209c86dd | ||
|
|
2b567d1df5 | ||
|
|
06272f463d | ||
|
|
83e33bdd26 | ||
|
|
de3dec7215 | ||
|
|
73d41c10b9 | ||
|
|
63da4dc59a | ||
|
|
7eb9811958 | ||
|
|
82e28851bd | ||
|
|
aed5965ad8 | ||
|
|
d360846dd4 | ||
|
|
2f60e324dc | ||
|
|
5e2abfcdcd | ||
|
|
fa5c45f515 | ||
|
|
a0d4e8e78e | ||
|
|
bbf0cc1379 | ||
|
|
c8f1fbd9d8 | ||
|
|
be91fb9b47 | ||
|
|
71ddb8dc60 | ||
|
|
d2c547c407 | ||
|
|
70871715e4 | ||
|
|
49b2ddc8c1 | ||
|
|
f8876a7958 | ||
|
|
18fcc367d2 | ||
|
|
6b78edf7c5 | ||
|
|
19ce90fe02 | ||
|
|
00fed0a703 | ||
|
|
e06d820909 | ||
|
|
01541ee64c | ||
|
|
f24f02e212 | ||
|
|
12c41423ad | ||
|
|
0995eaa492 | ||
|
|
1d06b10962 | ||
|
|
408b349a84 | ||
|
|
236bb2c110 | ||
|
|
9ecb267b63 | ||
|
|
3cf59f6f9a | ||
|
|
c1730e2b08 | ||
|
|
86358dd6cd | ||
|
|
0f3f5d083d | ||
|
|
6ec56fa923 | ||
|
|
965baf2683 | ||
|
|
4fde836d83 | ||
|
|
3d91bd486c | ||
|
|
3f2f94ef28 | ||
|
|
7f30039d2a | ||
|
|
14e1d495ef | ||
|
|
bbe7d3d0fe | ||
|
|
7ce509b9a7 | ||
|
|
9c34c4f05b | ||
|
|
442ade15a6 | ||
|
|
5fd4582cc8 | ||
|
|
8b88e3b386 | ||
|
|
27843388c6 | ||
|
|
bfa5bb86e4 | ||
|
|
921273baa0 | ||
|
|
7d20ec706e | ||
|
|
437eb3bafc | ||
|
|
f3c1fc70a9 | ||
|
|
dad7691df9 | ||
|
|
6752cb2d9c | ||
|
|
0ac452e252 | ||
|
|
3a1cd30ce1 | ||
|
|
69582042d7 | ||
|
|
9e7b5056a0 | ||
|
|
5f82f03ff3 | ||
|
|
5e3873c8db | ||
|
|
01aac2a142 | ||
|
|
b69cb9fbd9 | ||
|
|
30254e3388 | ||
|
|
38ee395ac7 | ||
|
|
5df5e4c4a2 | ||
|
|
a95dcd74e7 | ||
|
|
ab318beaaf | ||
|
|
8caf5d252d | ||
|
|
1c2ecddae4 | ||
|
|
6dfb8a2187 | ||
|
|
3b2e5027e5 | ||
|
|
b39f5d614a | ||
|
|
ab09fa4bbf | ||
|
|
83ea7dc5b9 | ||
|
|
5697451c72 | ||
|
|
58e806f3fa | ||
|
|
50a5ce1dc4 | ||
|
|
6123a00e64 | ||
|
|
7c21716886 | ||
|
|
ae1bc83350 | ||
|
|
596a7e1904 | ||
|
|
b264317fa0 | ||
|
|
673577a31b | ||
|
|
23022f1a82 | ||
|
|
96e9db8919 | ||
|
|
08356361ac | ||
|
|
047d037f8c | ||
|
|
0908458381 | ||
|
|
16fbb455ef | ||
|
|
f30b46b2a8 | ||
|
|
65c3f1ffcd | ||
|
|
7577717b59 | ||
|
|
1a8f54cea1 | ||
|
|
6731c094ee | ||
|
|
b99a928a80 | ||
|
|
55ba90ac19 | ||
|
|
5ff5cee8ce | ||
|
|
8b58edc70e | ||
|
|
d0319d45af | ||
|
|
ca409e5531 | ||
|
|
1f45cb0a51 | ||
|
|
931a0052ea | ||
|
|
46ec4b648c | ||
|
|
724f5aa36b | ||
|
|
6d9dfa96c3 | ||
|
|
3fb07d9b8d | ||
|
|
8e2519e88b | ||
|
|
cec7283b21 | ||
|
|
2292441f0c | ||
|
|
c430906d3b | ||
|
|
82c8724b33 | ||
|
|
9b160972a1 | ||
|
|
e036750bdf | ||
|
|
fcd9de72ef | ||
|
|
32d4373e0f | ||
|
|
b3ddbcee2a | ||
|
|
29435dfb4b | ||
|
|
52158dffcc | ||
|
|
ca7acbe6d9 | ||
|
|
33247733e0 | ||
|
|
621c24a10f | ||
|
|
6cba11f087 | ||
|
|
4d351b4846 | ||
|
|
a30007caa4 | ||
|
|
6aa87a7b67 | ||
|
|
b1c38d4c82 | ||
|
|
42e21bb06e | ||
|
|
ce4b5bbeaa | ||
|
|
f413aa33b3 | ||
|
|
587154c01b | ||
|
|
1f27870d41 | ||
|
|
c5d4225804 | ||
|
|
529748894c | ||
|
|
4e26ecc940 | ||
|
|
c421774422 | ||
|
|
16078e47d4 | ||
|
|
6a9bee27cc | ||
|
|
94ea26ff46 | ||
|
|
6c51fe5039 | ||
|
|
34b2de4cd8 | ||
|
|
57429cb9fe | ||
|
|
97fa2a9c30 | ||
|
|
c94ca24adc | ||
|
|
99e9554edd | ||
|
|
dbbf050005 | ||
|
|
f934d0ef5b | ||
|
|
e48dfcc2b3 | ||
|
|
b98fb17fe9 | ||
|
|
bce67ec2c9 | ||
|
|
9b1d2483a0 | ||
|
|
b1adc567da | ||
|
|
0807d82af0 | ||
|
|
5cd7a90b32 | ||
|
|
bb119739b0 | ||
|
|
df8dd5ac21 | ||
|
|
b7c8e5bbcf | ||
|
|
2b7b1e52b1 | ||
|
|
2f771b3979 | ||
|
|
9bebe9b631 | ||
|
|
a2032afa3a | ||
|
|
6a55ca8370 | ||
|
|
8f20562f49 | ||
|
|
43018a48c4 | ||
|
|
72586eb30a | ||
|
|
7a02ba361c | ||
|
|
f4a89ec776 | ||
|
|
57834776ad | ||
|
|
caa2b25b40 | ||
|
|
a27fef8750 | ||
|
|
789be03b4f | ||
|
|
40ce057a3e | ||
|
|
625ac81acc | ||
|
|
ffc69537aa | ||
|
|
71efcfc648 | ||
|
|
04be9d6001 | ||
|
|
c17da4b707 | ||
|
|
ccd9fd0dc3 | ||
|
|
46b9988e26 | ||
|
|
0f73afb0b0 | ||
|
|
36b452c7ac | ||
|
|
a394ac9f95 | ||
|
|
332344bd43 | ||
|
|
e6c1cadea0 | ||
|
|
faea7d72b8 | ||
|
|
12a4d60e18 | ||
|
|
08337e01f7 | ||
|
|
9606f4d04f | ||
|
|
3cbaad9288 | ||
|
|
99692dc99e | ||
|
|
5a998558a9 | ||
|
|
f6ff0ab767 | ||
|
|
5d471e0f34 | ||
|
|
d3ebc34958 | ||
|
|
b6ff45254e | ||
|
|
7e348fcb5f | ||
|
|
06b58a9c4f | ||
|
|
539f3b3fe4 | ||
|
|
2f20df3f55 | ||
|
|
65c9a0728f | ||
|
|
ab9d183024 | ||
|
|
f5631a89e8 | ||
|
|
a4f9e1ebf2 | ||
|
|
2873d67b17 | ||
|
|
a7e40b2903 | ||
|
|
23b0f8ed4b | ||
|
|
6ed02c86be | ||
|
|
2a67363e27 | ||
|
|
205304ddee | ||
|
|
58bca87c72 | ||
|
|
febeb43197 | ||
|
|
8178dec4c3 | ||
|
|
70f57a6844 | ||
|
|
ff14199e58 | ||
|
|
bfdf0932c1 | ||
|
|
695938ba3f | ||
|
|
cb02c2f9d8 | ||
|
|
e4a5e333ef | ||
|
|
e10d3136c8 | ||
|
|
9f089756b7 | ||
|
|
654387297f | ||
|
|
326423719f | ||
|
|
d07b6e93d5 | ||
|
|
efcc28d347 | ||
|
|
cfc193cdac | ||
|
|
24bcc9647d | ||
|
|
bc27d809fb | ||
|
|
bf7e453d02 | ||
|
|
36a746d7d5 | ||
|
|
ca811156a0 | ||
|
|
50daf27e5a | ||
|
|
df09e2adce | ||
|
|
ddf6603d81 | ||
|
|
4bf8b1aeee | ||
|
|
be1e099f1b | ||
|
|
7afd202b89 | ||
|
|
ebc4601185 | ||
|
|
c8ea9b0e58 | ||
|
|
ca7ca4572e | ||
|
|
c0aad4c28a | ||
|
|
8016f058bc | ||
|
|
d197f8504b | ||
|
|
eb06a886c4 | ||
|
|
04631d2250 | ||
|
|
0a5ad3ab85 | ||
|
|
8ac5b29e02 | ||
|
|
0a31ccb1d1 | ||
|
|
c6caa45ae2 | ||
|
|
dc566d654f | ||
|
|
ba898faa7d | ||
|
|
0152ee71a5 | ||
|
|
348d543425 | ||
|
|
6ccbfeb80c | ||
|
|
c433142abf | ||
|
|
1d389ad3a8 | ||
|
|
5bfccab650 | ||
|
|
9698f4ea64 | ||
|
|
769796ed4c | ||
|
|
e5c39b7c2a | ||
|
|
e8c92e0a95 | ||
|
|
bf2071871c | ||
|
|
fc32e20881 | ||
|
|
abf0693e8e | ||
|
|
47319cf64e | ||
|
|
e358a2d7af | ||
|
|
044a64a1fb | ||
|
|
cd91e0e3e1 | ||
|
|
d728e35658 | ||
|
|
1c1fddc7ac | ||
|
|
dcd3e8a211 | ||
|
|
ddd9d0cfd4 | ||
|
|
0e58ef6805 | ||
|
|
0e89022cc3 | ||
|
|
47d4f55bc0 | ||
|
|
6cd150842f | ||
|
|
299c18596f | ||
|
|
b86336c3f5 | ||
|
|
b69e75c89a | ||
|
|
825adbd67b | ||
|
|
1d224cc031 | ||
|
|
06c03fe2f0 | ||
|
|
87ff61a8a6 | ||
|
|
8c94ad0d26 | ||
|
|
aacbebbebe | ||
|
|
31873ec707 | ||
|
|
de0448343f | ||
|
|
69961dbba3 | ||
|
|
f67feea093 | ||
|
|
6c050b8440 | ||
|
|
b9f9f8f7d3 | ||
|
|
d38b96fff1 | ||
|
|
9f7f7354f5 | ||
|
|
d3b8edb6a2 | ||
|
|
aee475aa55 | ||
|
|
9083966c22 | ||
|
|
5406c533db | ||
|
|
f92dc91c3d | ||
|
|
35a1dd081f | ||
|
|
5131ab19ca | ||
|
|
96f4f90cb3 | ||
|
|
e10355500d | ||
|
|
a97c006bbf | ||
|
|
f062794a0d | ||
|
|
57468d3c21 | ||
|
|
22aae62ccd | ||
|
|
6b45e9f167 | ||
|
|
adee81170d | ||
|
|
1dba212e18 | ||
|
|
7bb326d389 | ||
|
|
957e966d2d | ||
|
|
faccb35850 | ||
|
|
3f15b7c7b8 | ||
|
|
0c35facc94 | ||
|
|
71404eef29 | ||
|
|
a873541ef6 | ||
|
|
50cde90324 | ||
|
|
603a5e25b3 | ||
|
|
538189cc19 | ||
|
|
686011a548 | ||
|
|
cd57bf305b | ||
|
|
ea2c19f978 | ||
|
|
aa65fe22ed | ||
|
|
12de8fff81 | ||
|
|
b67dacdc8f | ||
|
|
d3002ef741 | ||
|
|
0c123950e9 | ||
|
|
bf077125b9 | ||
|
|
88d2a671cc | ||
|
|
0e5e249ab5 | ||
|
|
e792d62f47 | ||
|
|
6b14f95b3e | ||
|
|
c7ce99d495 | ||
|
|
b7fc14bc65 | ||
|
|
9e1021efbe | ||
|
|
e9bec9b6fe | ||
|
|
fbd282b3ba | ||
|
|
2e8c5049c5 | ||
|
|
2d0d8e5272 | ||
|
|
4d7fe7115f | ||
|
|
9e9db65c3f | ||
|
|
bd966ef389 | ||
|
|
775da3f103 | ||
|
|
96a4baa0be | ||
|
|
2aa9f7b131 | ||
|
|
c4490f5f3d | ||
|
|
dd9144994e | ||
|
|
4c37d0d9f1 | ||
|
|
b59724e42b | ||
|
|
16413bb8f2 | ||
|
|
b3941fce5c | ||
|
|
d494688565 | ||
|
|
516ec90242 | ||
|
|
7244aa7eb7 | ||
|
|
de2ca3b2e8 | ||
|
|
c2fc466e1b | ||
|
|
241f5a4c0e | ||
|
|
9f9f498491 | ||
|
|
e31bef31ad | ||
|
|
b2a9ccdb97 | ||
|
|
d459fb41b7 | ||
|
|
804e0d6117 | ||
|
|
bb499421e9 | ||
|
|
ba96059203 | ||
|
|
fbd91ab0b5 | ||
|
|
b51c06e2b3 | ||
|
|
159ae90874 | ||
|
|
e48f5aa6a7 | ||
|
|
1efe9ab497 | ||
|
|
602c8ee02b | ||
|
|
279d00da9f | ||
|
|
830972ce3c | ||
|
|
451f9cc6d1 | ||
|
|
e3fe1f0d00 | ||
|
|
d88205d89d | ||
|
|
5aa80e6c05 | ||
|
|
b657a18449 | ||
|
|
108011085b | ||
|
|
d188ae4c9d | ||
|
|
3682d9bd5b | ||
|
|
032df0b2c6 | ||
|
|
bd1ad7c76a | ||
|
|
060b38de5c | ||
|
|
789ba02d43 | ||
|
|
1874cb71a6 | ||
|
|
6a5a34e0ff | ||
|
|
e3821bd86f | ||
|
|
02af69911e | ||
|
|
e203b8c754 | ||
|
|
362ddc4efc | ||
|
|
58cad83253 | ||
|
|
c27081aa4a | ||
|
|
e11e072eca | ||
|
|
8e68c6cf89 | ||
|
|
8503b78876 | ||
|
|
8446c9dc92 | ||
|
|
3eacb4c16d | ||
|
|
e4d2138dbd | ||
|
|
464b755918 | ||
|
|
44fd8d46d2 | ||
|
|
33bb044d7c | ||
|
|
ffea8008ca | ||
|
|
c2557abc03 | ||
|
|
67cf105bc6 | ||
|
|
8aee9d51b6 | ||
|
|
939f1fab46 | ||
|
|
414408b2d0 | ||
|
|
77d503fa13 | ||
|
|
cf7c8c458f | ||
|
|
325f0651ac | ||
|
|
03b0850e63 | ||
|
|
2a019a53d2 | ||
|
|
ad8bc71d3e | ||
|
|
46feae79c6 | ||
|
|
4ca2f336f0 | ||
|
|
ae0bf8068b | ||
|
|
0c1b863755 | ||
|
|
63aec3c56e | ||
|
|
8b785f75a6 | ||
|
|
5b8758f42b | ||
|
|
520f1a54a8 | ||
|
|
5550e893d5 | ||
|
|
aa6e6e914e | ||
|
|
0183e6332a | ||
|
|
1532200435 | ||
|
|
7f775c142c | ||
|
|
b985e4a134 | ||
|
|
2e749d60c3 | ||
|
|
33f5697888 | ||
|
|
b44055cc51 | ||
|
|
f5eae52098 | ||
|
|
19a47dae4a | ||
|
|
910f4e77a2 | ||
|
|
7cefad3744 | ||
|
|
87ff2f8867 | ||
|
|
387fe51a56 | ||
|
|
421264e58a | ||
|
|
15ad923310 | ||
|
|
61e09e6be2 | ||
|
|
87c4e06c24 | ||
|
|
7b1e295f34 | ||
|
|
c077316b2b | ||
|
|
49b228c4b3 | ||
|
|
96509494f0 | ||
|
|
6d7e6a11fc | ||
|
|
f3095493b0 | ||
|
|
ce07c9186d | ||
|
|
116dc86b8a | ||
|
|
02ee9e3d30 | ||
|
|
e056bf8081 | ||
|
|
4deeffbc88 | ||
|
|
632528aa95 | ||
|
|
aac7aa3bf0 | ||
|
|
fde51084f3 | ||
|
|
21e2bae063 | ||
|
|
e509bbf636 | ||
|
|
072011a3ef | ||
|
|
2422a857a1 | ||
|
|
f598077af3 | ||
|
|
cb0c84e075 | ||
|
|
1d5809d458 | ||
|
|
ed951b1977 | ||
|
|
4879de08e8 | ||
|
|
f278e1c00f | ||
|
|
046a8e0039 | ||
|
|
79a466ca26 | ||
|
|
5f3a422e68 | ||
|
|
fa2e3a40e9 | ||
|
|
a92b3afe64 | ||
|
|
9fa586bbed | ||
|
|
00d33e6b82 | ||
|
|
7d124478fa | ||
|
|
3d83109028 | ||
|
|
cb02914687 | ||
|
|
10bf2bb8e1 | ||
|
|
d47b666630 | ||
|
|
88d289caa1 | ||
|
|
b4833d55c2 | ||
|
|
c6f2ec3c82 | ||
|
|
b48d67ce10 | ||
|
|
071eec7aa7 | ||
|
|
1ebe7d1ab6 | ||
|
|
de37b2264a | ||
|
|
b65ef8d66c | ||
|
|
740f0c7690 | ||
|
|
ba8500a236 | ||
|
|
09469add55 | ||
|
|
f3101e96d9 | ||
|
|
245dca4bee | ||
|
|
97d42ca2b2 | ||
|
|
2faa0852b9 | ||
|
|
7b14953c99 | ||
|
|
286d5003fa | ||
|
|
66d50562b6 | ||
|
|
27f595a444 | ||
|
|
018c567abf | ||
|
|
4fbda5c3f5 | ||
|
|
ce714fe306 | ||
|
|
35e57bf149 | ||
|
|
84ea2d61e8 | ||
|
|
adc108d79e | ||
|
|
5aa9c41ab1 | ||
|
|
00690f7ffd | ||
|
|
01d28c18ab | ||
|
|
2fd8c248fe | ||
|
|
d9f2f509d5 | ||
|
|
ae3e7586c6 | ||
|
|
df1437bd86 | ||
|
|
8816ef1c64 | ||
|
|
d298dd121f | ||
|
|
2cc9a89830 | ||
|
|
a0a1f81913 | ||
|
|
8a8ea50f33 | ||
|
|
b976692d0f | ||
|
|
fe940a142d | ||
|
|
b3fb09a20c | ||
|
|
6a3f8cf23f | ||
|
|
a05a261b72 | ||
|
|
1b6765ed12 | ||
|
|
1ff99ae25f | ||
|
|
234fe8ea67 | ||
|
|
e661578c84 | ||
|
|
73344e69c1 | ||
|
|
d309565b56 | ||
|
|
3f20f37c78 | ||
|
|
0e3631ff4b | ||
|
|
fa2e1be0ca | ||
|
|
7699f250e3 | ||
|
|
11518a987f | ||
|
|
b447815de5 | ||
|
|
bde30b2b48 | ||
|
|
13e185d330 | ||
|
|
b58eae7657 | ||
|
|
3e7fcb813e | ||
|
|
2a77c84c8f | ||
|
|
d47a3e5950 | ||
|
|
f87c80889f | ||
|
|
154de69c02 | ||
|
|
6ef8459494 | ||
|
|
598eb1d4f1 | ||
|
|
9173a5713b | ||
|
|
da040fd393 | ||
|
|
bdb70c0509 | ||
|
|
5113513cb2 | ||
|
|
d8a0c6450f | ||
|
|
4cc8e37bf1 | ||
|
|
b5fae1104b | ||
|
|
f9c5333f97 | ||
|
|
292ddd2edb | ||
|
|
25cd8af536 | ||
|
|
14702089ee | ||
|
|
b51e8bf7e5 | ||
|
|
3183a14755 | ||
|
|
5edef148fe | ||
|
|
13e2ad2831 | ||
|
|
59cc5f889e | ||
|
|
a11f3b2d2f | ||
|
|
b0070a244a | ||
|
|
abb7e63906 | ||
|
|
9f139d6e0e | ||
|
|
e45e5c68bb | ||
|
|
7c6141ebc4 | ||
|
|
9c918a497b | ||
|
|
ab01658fd2 | ||
|
|
42bedb3f60 | ||
|
|
a991bde523 | ||
|
|
3e575533c5 | ||
|
|
2ae2ead97b | ||
|
|
71dc82e0b4 | ||
|
|
5aadc2f5ca | ||
|
|
8d0916af13 | ||
|
|
6cc6029d7a | ||
|
|
157aa7f2fd | ||
|
|
7aeb45303d | ||
|
|
cee5f9020a | ||
|
|
3814bbb529 | ||
|
|
729cde4475 | ||
|
|
396270a0de | ||
|
|
11f2dafc4e | ||
|
|
8463e39a4a | ||
|
|
2bc160a978 | ||
|
|
57f9359a41 | ||
|
|
3c1a4aac2b | ||
|
|
212515148e | ||
|
|
6735025428 | ||
|
|
415aadf704 | ||
|
|
4bababf5b0 | ||
|
|
f312216e97 | ||
|
|
651cde8b98 | ||
|
|
554cc1718d | ||
|
|
617968ab76 | ||
|
|
84d9cf7339 | ||
|
|
e017228569 | ||
|
|
3320a5b37d | ||
|
|
06411d5c9e | ||
|
|
82c99625fa | ||
|
|
01001b89d2 | ||
|
|
88ee053af0 | ||
|
|
b1d84d879b | ||
|
|
f6fe7143e4 | ||
|
|
dde4b40fa9 | ||
|
|
2bc5e7ec9e | ||
|
|
aa4f9a6474 | ||
|
|
87fd249c43 | ||
|
|
1ec0c3b68a | ||
|
|
5b4625f79c | ||
|
|
cc4a9cdb69 | ||
|
|
61c943b4bf | ||
|
|
bae1e422f6 | ||
|
|
754d2d69b2 | ||
|
|
986f0ba76c | ||
|
|
460b788d78 | ||
|
|
3664ed6aad | ||
|
|
43f5c3e82b | ||
|
|
4fd75dc813 | ||
|
|
12e8edcac3 | ||
|
|
cf50ba140f | ||
|
|
89e832c295 | ||
|
|
b99c49ec3b | ||
|
|
95a0b28acb | ||
|
|
af22e9cd38 | ||
|
|
7714b98da7 | ||
|
|
dfd240b260 | ||
|
|
4f909963e4 | ||
|
|
6b86f15686 | ||
|
|
0bc9daa4f7 | ||
|
|
b0c3871750 | ||
|
|
9c57453168 | ||
|
|
59205ac5fc | ||
|
|
7a4be21b4f | ||
|
|
716e89b87c | ||
|
|
d00b7e5587 | ||
|
|
e4ab0e5982 | ||
|
|
8cb29921a0 | ||
|
|
044886b4a0 | ||
|
|
b19c8b74b9 | ||
|
|
6d95644c0d | ||
|
|
311627141b | ||
|
|
7216a12856 | ||
|
|
98805c9228 | ||
|
|
85da81e673 | ||
|
|
b9ad0bb2ce | ||
|
|
dd5ca68c87 | ||
|
|
dd5296ad4d | ||
|
|
f75f426dfa | ||
|
|
2d9a715655 | ||
|
|
d2f034ba84 | ||
|
|
6aecf80278 | ||
|
|
b128d25f27 | ||
|
|
26a1de1e44 | ||
|
|
f8e170a44b | ||
|
|
aad4b75b94 | ||
|
|
a0dc66f7bf | ||
|
|
6d6f323535 | ||
|
|
4d6a5c29df | ||
|
|
74d0032e25 | ||
|
|
191f36b493 | ||
|
|
c54a807824 | ||
|
|
a6823a84e1 | ||
|
|
57e163e989 | ||
|
|
b58787a367 | ||
|
|
71ca78982b | ||
|
|
235051253a | ||
|
|
27654bfe69 | ||
|
|
cdf0bd4e63 | ||
|
|
6ac9b2e761 | ||
|
|
ac8adabb2b | ||
|
|
0e0e4945d8 | ||
|
|
c0f8c9fd72 | ||
|
|
0db97b9c7f | ||
|
|
c9005865ed | ||
|
|
1022a5eaa7 |
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
*.o
|
||||
applet/
|
||||
*~
|
||||
*.orig
|
||||
*.rej
|
||||
*.bak
|
||||
*.DS_Store
|
||||
*.idea
|
||||
BIN
.pioenvs/.sconsign.dblite
Normal file
BIN
.pioenvs/.sconsign.dblite
Normal file
Binary file not shown.
3
.pioenvs/do-not-modify-files-here.url
Normal file
3
.pioenvs/do-not-modify-files-here.url
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
[InternetShortcut]
|
||||
URL=http://docs.platformio.org/page/projectconf.html#envs-dir
|
||||
BIN
.pioenvs/megaatmega2560/firmware.elf
Executable file
BIN
.pioenvs/megaatmega2560/firmware.elf
Executable file
Binary file not shown.
6937
.pioenvs/megaatmega2560/firmware.hex
Normal file
6937
.pioenvs/megaatmega2560/firmware.hex
Normal file
File diff suppressed because it is too large
Load Diff
BIN
.pioenvs/megaatmega2560/lib/libLiquidCrystal.a
Normal file
BIN
.pioenvs/megaatmega2560/lib/libLiquidCrystal.a
Normal file
Binary file not shown.
BIN
.pioenvs/megaatmega2560/lib/libSPI.a
Normal file
BIN
.pioenvs/megaatmega2560/lib/libSPI.a
Normal file
Binary file not shown.
BIN
.pioenvs/megaatmega2560/lib/libU8glib_ID7.a
Normal file
BIN
.pioenvs/megaatmega2560/lib/libU8glib_ID7.a
Normal file
Binary file not shown.
BIN
.pioenvs/megaatmega2560/lib/libWire.a
Normal file
BIN
.pioenvs/megaatmega2560/lib/libWire.a
Normal file
Binary file not shown.
BIN
.pioenvs/megaatmega2560/libFrameworkArduino.a
Normal file
BIN
.pioenvs/megaatmega2560/libFrameworkArduino.a
Normal file
Binary file not shown.
1
.pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
Normal file
1
.pioenvs/megaatmega2560/libFrameworkArduinoVariant.a
Normal file
@@ -0,0 +1 @@
|
||||
!<arch>
|
||||
1
.pioenvs/structure.hash
Normal file
1
.pioenvs/structure.hash
Normal file
@@ -0,0 +1 @@
|
||||
7139b6316d7ee09825c8b66954eab4443fcf0d83
|
||||
40
.piolibdeps/U8glib_ID7/.library.json
Normal file
40
.piolibdeps/U8glib_ID7/.library.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"description": "A library for monochrome TFTs and OLEDs",
|
||||
"repository": {
|
||||
"url": "https://github.com/olikraus/U8glib_Arduino",
|
||||
"type": "git"
|
||||
},
|
||||
"platforms": [
|
||||
"atmelavr",
|
||||
"atmelsam"
|
||||
],
|
||||
"export": {
|
||||
"exclude": [
|
||||
"extras",
|
||||
"docs",
|
||||
"tests",
|
||||
"test",
|
||||
"*.doxyfile",
|
||||
"*.pdf"
|
||||
],
|
||||
"include": null
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"maintainer": true,
|
||||
"name": "oliver",
|
||||
"url": null,
|
||||
"email": "olikraus@gmail.com"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"display"
|
||||
],
|
||||
"id": 7,
|
||||
"name": "U8glib",
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"version": "1.19.1",
|
||||
"homepage": "https://github.com/olikraus/u8glib"
|
||||
}
|
||||
30
.piolibdeps/U8glib_ID7/README.md
Normal file
30
.piolibdeps/U8glib_ID7/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
# U8glib
|
||||
|
||||
A graphics library with support for many different monochrome displays.
|
||||
|
||||
 
|
||||
|
||||
Left: NHD-2.7-12864 OLED (SSD1325), right: EA DOGS102 LCD (UC1701)
|
||||
|
||||
* [Gallery](https://github.com/olikraus/u8glib/wiki/gallery)
|
||||
* [Bintray](https://bintray.com/olikraus/u8glib) download links:
|
||||
* [U8glib for Arduino](https://bintray.com/olikraus/u8glib/Arduino)
|
||||
* [U8glib for AVR](https://bintray.com/olikraus/u8glib/AVR)
|
||||
* [U8glib for ARM](https://bintray.com/olikraus/u8glib/ARM)
|
||||
* Converter for BDF fonts: [bdf2u8g_101.exe on google drive](https://drive.google.com/folderview?id=0B5b6Dv0wCeCRLWJkYTh2TUlYVDg&usp=sharing).
|
||||
* Supported environments:
|
||||
* [Arduino (ATMEGA and ARM)](http://www.arduino.cc/)
|
||||
* [AVR (ATMEGA)](https://github.com/olikraus/u8glib/wiki/avr)
|
||||
* [ARM (with example for LPC1114)](https://github.com/olikraus/u8glib/wiki/lpc1114)
|
||||
* Library for graphic LCDs and OLEDs
|
||||
* [U8glib documentation and tutorials](https://github.com/olikraus/u8glib/wiki)
|
||||
* Graphical user interface library (GUI) available: [M2tklib](http://code.google.com/p/m2tklib/)
|
||||
* COM interfaces: Software SPI, Hardware SPI, 8Bit parallel
|
||||
* Large number of [fonts](https://github.com/olikraus/u8glib/wiki/fontsize)
|
||||
* Monospaced and proportional fonts
|
||||
* Mouse-Cursor support
|
||||
* Landscape and portrait mode
|
||||
* Many supported [devices](https://github.com/olikraus/u8glib/wiki/device) (SSD1325, ST7565, ST7920, UC1608, UC1610, UC1701, PCD8544, PCF8812, KS0108, LC7981, SBN1661, SSD1306, SH1106, T6963, LD7032)
|
||||
* Well-defined interface to the device subsystem
|
||||
|
||||
131
.piolibdeps/U8glib_ID7/examples/A2Printer/A2Printer.ino
Normal file
131
.piolibdeps/U8glib_ID7/examples/A2Printer/A2Printer.ino
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
|
||||
A2Printer.pde
|
||||
|
||||
Special example code for the A2 Mciro Printer (https://www.sparkfun.com/products/10438)
|
||||
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2013, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// use this serial interface
|
||||
#define PRINTER_SERIAL Serial
|
||||
// #define PRINTER_SERIAL Serial1
|
||||
|
||||
|
||||
uint8_t u8g_com_uart(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch(msg) {
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
PRINTER_SERIAL.write(arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
|
||||
// half resolution
|
||||
//U8GLIB u8g(&u8g_dev_a2_micro_printer_192x120_ds, (u8g_com_fnptr)u8g_com_uart);
|
||||
|
||||
// full resolution, requires to uncomment U8G_16BIT in u8g.h
|
||||
//U8GLIB u8g(&u8g_dev_a2_micro_printer_384x240, (u8g_com_fnptr)u8g_com_uart);
|
||||
|
||||
// half resolution, extra log, requires to uncomment U8G_16BIT in u8g.h
|
||||
//U8GLIB u8g(&u8g_dev_a2_micro_printer_192x360_ds, (u8g_com_fnptr)u8g_com_uart);
|
||||
U8GLIB u8g(&u8g_dev_a2_micro_printer_192x720_ds, (u8g_com_fnptr)u8g_com_uart);
|
||||
|
||||
|
||||
|
||||
void drawLogo(uint8_t d) {
|
||||
u8g.setFont(u8g_font_gdr25r);
|
||||
u8g.drawStr(0+d, 30+d, "U");
|
||||
u8g.setFont(u8g_font_gdr30n);
|
||||
u8g.drawStr90(23+d,10+d,"8");
|
||||
u8g.setFont(u8g_font_gdr25r);
|
||||
u8g.drawStr(53+d,30+d,"g");
|
||||
|
||||
u8g.drawHLine(2+d, 35+d, 47);
|
||||
u8g.drawVLine(45+d, 32+d, 12);
|
||||
}
|
||||
|
||||
void drawURL(void) {
|
||||
u8g.setFont(u8g_font_4x6);
|
||||
if ( u8g.getHeight() < 59 ) {
|
||||
u8g.drawStr(53,9,"code.google.com");
|
||||
u8g.drawStr(77,18,"/p/u8glib");
|
||||
}
|
||||
else {
|
||||
u8g.drawStr(1,54,"code.google.com/p/u8glib");
|
||||
}
|
||||
}
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
|
||||
drawLogo(0);
|
||||
drawURL();
|
||||
u8g.drawFrame(0,0,u8g.getWidth(), u8g.getHeight());
|
||||
|
||||
u8g.setFont(u8g_font_helvR24r);
|
||||
u8g.setPrintPos(0, 100);
|
||||
u8g.print(u8g.getWidth(), DEC);
|
||||
u8g.print("x");
|
||||
u8g.print(u8g.getHeight(), DEC);
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
PRINTER_SERIAL.begin(19200);
|
||||
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
|
||||
// assign default color value
|
||||
u8g.setColorIndex(1); // pixel on
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
||||
// picture loop: This will print the picture
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// send manual CR to the printer
|
||||
PRINTER_SERIAL.write('\n');
|
||||
|
||||
// reprint the picture after 10 seconds
|
||||
delay(10000);
|
||||
}
|
||||
|
||||
172
.piolibdeps/U8glib_ID7/examples/Bitmap/Bitmap.ino
Normal file
172
.piolibdeps/U8glib_ID7/examples/Bitmap/Bitmap.ino
Normal file
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
|
||||
Bitmap.pde
|
||||
|
||||
Show simple bitmap
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
const uint8_t rook_bitmap[] PROGMEM = {
|
||||
0x00, // 00000000
|
||||
0x55, // 01010101
|
||||
0x7f, // 01111111
|
||||
0x3e, // 00111110
|
||||
0x3e, // 00111110
|
||||
0x3e, // 00111110
|
||||
0x3e, // 00111110
|
||||
0x7f // 01111111
|
||||
};
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
u8g.drawBitmapP( 0, 0, 1, 8, rook_bitmap);
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
221
.piolibdeps/U8glib_ID7/examples/Chess/Chess.ino
Normal file
221
.piolibdeps/U8glib_ID7/examples/Chess/Chess.ino
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
|
||||
Chess.pde
|
||||
|
||||
Little Rook Chess
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
|
||||
// DOGS102 shield configuration values
|
||||
// uint8_t uiKeyPrev = 2;
|
||||
// uint8_t uiKeyNext = 4;
|
||||
// uint8_t uiKeySelect = 5;
|
||||
// uint8_t uiKeyBack = 3;
|
||||
|
||||
// DOGM128-Shield configuration values
|
||||
// DOGXL60-Shield configuration values
|
||||
uint8_t uiKeyPrev = 7;
|
||||
uint8_t uiKeyNext = 3;
|
||||
uint8_t uiKeySelect = 2;
|
||||
uint8_t uiKeyBack = 8;
|
||||
|
||||
uint8_t uiKeyCodeFirst = CHESS_KEY_NONE;
|
||||
uint8_t uiKeyCodeSecond = CHESS_KEY_NONE;
|
||||
uint8_t uiKeyCode = CHESS_KEY_NONE;
|
||||
|
||||
|
||||
void uiSetup(void) {
|
||||
// configure input keys
|
||||
#if defined(ARDUINO)
|
||||
pinMode(uiKeyPrev, INPUT_PULLUP); // set pin to input
|
||||
pinMode(uiKeyNext, INPUT_PULLUP); // set pin to input
|
||||
pinMode(uiKeySelect, INPUT_PULLUP); // set pin to input
|
||||
pinMode(uiKeyBack, INPUT_PULLUP); // set pin to input
|
||||
#endif
|
||||
}
|
||||
|
||||
void uiStep(void)
|
||||
{
|
||||
uiKeyCodeSecond = uiKeyCodeFirst;
|
||||
#if defined(ARDUINO)
|
||||
if ( digitalRead(uiKeyPrev) == LOW )
|
||||
uiKeyCodeFirst = CHESS_KEY_PREV;
|
||||
else if ( digitalRead(uiKeyNext) == LOW )
|
||||
uiKeyCodeFirst = CHESS_KEY_NEXT;
|
||||
else if ( digitalRead(uiKeySelect) == LOW )
|
||||
uiKeyCodeFirst = CHESS_KEY_SELECT;
|
||||
else if ( digitalRead(uiKeyBack) == LOW )
|
||||
uiKeyCodeFirst = CHESS_KEY_BACK;
|
||||
else
|
||||
#endif
|
||||
uiKeyCodeFirst = CHESS_KEY_NONE;
|
||||
|
||||
if ( uiKeyCodeSecond == uiKeyCodeFirst )
|
||||
uiKeyCode = uiKeyCodeFirst;
|
||||
else
|
||||
uiKeyCode = CHESS_KEY_NONE;
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
// rotate screen, if required
|
||||
u8g.setRot180();
|
||||
|
||||
uiSetup();
|
||||
chess_Init(u8g.getU8g(), 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
uint8_t keyCode = CHESS_KEY_NONE;
|
||||
|
||||
u8g.firstPage();
|
||||
do {
|
||||
chess_Draw();
|
||||
uiStep();
|
||||
if ( uiKeyCode != CHESS_KEY_NONE )
|
||||
keyCode = uiKeyCode;
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
u8g_Delay(10);
|
||||
chess_Step(keyCode);
|
||||
uiStep();
|
||||
keyCode = uiKeyCode;
|
||||
}
|
||||
|
||||
|
||||
272
.piolibdeps/U8glib_ID7/examples/Console/Console.ino
Normal file
272
.piolibdeps/U8glib_ID7/examples/Console/Console.ino
Normal file
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
|
||||
Console.pde
|
||||
|
||||
Read from serial monitor, output to display
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
|
||||
// setup input buffer
|
||||
#define LINE_MAX 30
|
||||
uint8_t line_buf[LINE_MAX] = "U8GLIB Console";
|
||||
uint8_t line_pos = 0;
|
||||
|
||||
// setup a text screen to support scrolling
|
||||
#define ROW_MAX 12
|
||||
|
||||
|
||||
uint8_t screen[ROW_MAX][LINE_MAX];
|
||||
uint8_t rows, cols;
|
||||
|
||||
// line height, which matches the selected font (5x7)
|
||||
#define LINE_PIXEL_HEIGHT 7
|
||||
|
||||
// clear entire screen, called during setup
|
||||
void clear_screen(void) {
|
||||
uint8_t i, j;
|
||||
for( i = 0; i < ROW_MAX; i++ )
|
||||
for( j = 0; j < LINE_MAX; j++ )
|
||||
screen[i][j] = 0;
|
||||
}
|
||||
|
||||
// append a line to the screen, scroll up
|
||||
void add_line_to_screen(void) {
|
||||
uint8_t i, j;
|
||||
for( j = 0; j < LINE_MAX; j++ )
|
||||
for( i = 0; i < rows-1; i++ )
|
||||
screen[i][j] = screen[i+1][j];
|
||||
|
||||
for( j = 0; j < LINE_MAX; j++ )
|
||||
screen[rows-1][j] = line_buf[j];
|
||||
}
|
||||
|
||||
// U8GLIB draw procedure: output the screen
|
||||
void draw(void) {
|
||||
uint8_t i, y;
|
||||
// graphic commands to redraw the complete screen are placed here
|
||||
y = 0; // reference is the top left -1 position of the string
|
||||
y--; // correct the -1 position of the drawStr
|
||||
for( i = 0; i < rows; i++ )
|
||||
{
|
||||
u8g.drawStr( 0, y, (char *)(screen[i]));
|
||||
y += u8g.getFontLineSpacing();
|
||||
}
|
||||
}
|
||||
|
||||
void exec_line(void) {
|
||||
// echo line to the serial monitor
|
||||
Serial.println((const char *)line_buf);
|
||||
|
||||
// add the line to the screen
|
||||
add_line_to_screen();
|
||||
|
||||
// U8GLIB picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
}
|
||||
|
||||
// clear current input buffer
|
||||
void reset_line(void) {
|
||||
line_pos = 0;
|
||||
line_buf[line_pos] = '\0';
|
||||
}
|
||||
|
||||
// add a single character to the input buffer
|
||||
void char_to_line(uint8_t c) {
|
||||
line_buf[line_pos] = c;
|
||||
line_pos++;
|
||||
line_buf[line_pos] = '\0';
|
||||
}
|
||||
|
||||
// check serial in and handle the character
|
||||
void read_line(void) {
|
||||
if ( Serial.available() )
|
||||
{
|
||||
uint8_t c;
|
||||
c = Serial.read();
|
||||
if ( line_pos >= cols-1 ) {
|
||||
exec_line();
|
||||
reset_line();
|
||||
char_to_line(c);
|
||||
}
|
||||
else if ( c == '\n' ) {
|
||||
// ignore '\n'
|
||||
}
|
||||
else if ( c == '\r' ) {
|
||||
exec_line();
|
||||
reset_line();
|
||||
}
|
||||
else {
|
||||
char_to_line(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Arduino master setup
|
||||
void setup(void) {
|
||||
// set font for the console window
|
||||
u8g.setFont(u8g_font_5x7);
|
||||
//u8g.setFont(u8g_font_9x15);
|
||||
|
||||
// set upper left position for the string draw procedure
|
||||
u8g.setFontPosTop();
|
||||
|
||||
// calculate the number of rows for the display
|
||||
rows = u8g.getHeight() / u8g.getFontLineSpacing();
|
||||
if ( rows > ROW_MAX )
|
||||
rows = ROW_MAX;
|
||||
|
||||
// estimate the number of columns for the display
|
||||
cols = u8g.getWidth() / u8g.getStrWidth("m");
|
||||
if ( cols > LINE_MAX-1 )
|
||||
cols = LINE_MAX-1;
|
||||
|
||||
clear_screen(); // clear screen
|
||||
delay(1000); // do some delay
|
||||
Serial.begin(9600); // init serial
|
||||
exec_line(); // place the input buffer into the screen
|
||||
reset_line(); // clear input buffer
|
||||
}
|
||||
|
||||
// Arduino main loop
|
||||
void loop(void) {
|
||||
read_line();
|
||||
}
|
||||
|
||||
181
.piolibdeps/U8glib_ID7/examples/F/F.ino
Normal file
181
.piolibdeps/U8glib_ID7/examples/F/F.ino
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
|
||||
F.pde
|
||||
|
||||
Example code for the F() macro.
|
||||
|
||||
>>> This example requires Arduino 1.0 and above.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
|
||||
// assign default font
|
||||
u8g.setFont(u8g_font_unifont);
|
||||
|
||||
// pointer to strings in flash memory can be stored in a special type
|
||||
const __FlashStringHelper *flash_ptr;
|
||||
|
||||
// the result of the F() macro can be assigned to this pointer
|
||||
flash_ptr = F("Hello World!");
|
||||
|
||||
// this pointer can be used as argument to the draw procedures
|
||||
u8g.drawStr( 0+1, 20+1, flash_ptr);
|
||||
u8g.drawStr( 0, 20, flash_ptr);
|
||||
|
||||
// of course, the F() macro can be used directly
|
||||
u8g.drawStr( 0, 40, F("PROGMEM"));
|
||||
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(500);
|
||||
}
|
||||
|
||||
404
.piolibdeps/U8glib_ID7/examples/FPS/FPS.ino
Normal file
404
.piolibdeps/U8glib_ID7/examples/FPS/FPS.ino
Normal file
@@ -0,0 +1,404 @@
|
||||
/*
|
||||
|
||||
FPS.pde
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
ST7920_192X32, SPI: FPS: Box=7.6 @=9.8 iFPS: Box=11.4 @=14.7
|
||||
ST7920_192X32, 8Bit: FPS: Box=6.2 @=7.5 iFPS: Box=9.3 @=11.2
|
||||
DOGM128 SW SPI: FPS: Box=5.1 @=5.9 Pix=2.6 iFPS: Box=10.2 @=11.8 Pix=5.2
|
||||
DOGM128 HW SPI: FPS: Box=5.5 @=6.3 iFPS: Box=11.0 @=12.6
|
||||
DOGXL160 SW SPI: FPS: Box=1.7 @=1.9 iFPS: Box=6.9 @=7.7
|
||||
DOGXL160 HW SPI: FPS: Box=1.8 @=2.1
|
||||
|
||||
NHD27OLED_BW, SW SPI: FPS: Box=3.0 @=3.7
|
||||
NHD27OLED_BW, HW SPI: FPS: Box=3.5 @=4.5
|
||||
NHD27OLED_2X_BW, SW SPI: FPS: Box=3.8 @=4.9
|
||||
NHD27OLED_2X_BW, HW SPI: FPS: Box=4.6 @=6.4
|
||||
|
||||
30 Sep 2012
|
||||
NHD27OLED_BW, SW SPI: FPS: Clip=9.2 Box=3.9 @=4.4 NEW_CODE
|
||||
NHD27OLED_BW, SW SPI: FPS: Clip=9.2 Box=3.6 @=4.5
|
||||
NHD27OLED_BW, HW SPI: FPS: Clip=16.3 Box=4.7 @=5.6
|
||||
NHD27OLED_2X_BW, SW SPI: FPS: Clip=9.7 Box=4.5 @=5.8
|
||||
NHD27OLED_2X_BW, SW SPI: FPS: Clip=18.0 Box=5.8 @=7.9
|
||||
|
||||
1 Oct 2012
|
||||
ST7920_192X32, 8Bit: FPS: Box=7.2 @=10.0
|
||||
DOGM128 SW SPI: FPS: Box=5.2 @=6.6 Pix=2.6
|
||||
DOGM128 HW SPI: FPS: Clip=33.2 Box=5.5 @=7.1
|
||||
DOGXL160 SW SPI: FPS: Box=1.7 @=2.0
|
||||
DOGXL160 HW SPI: FPS: Box=1.8 @=2.2
|
||||
|
||||
DOGXL160 GR SW SPI: FPS: Box=1.1 @=1.3
|
||||
|
||||
1 Mar 2013
|
||||
ST7920_192X32_1X, SPI: FPS: Clip=10.3 Box=5.5 @=7.2 Pix=3.9
|
||||
ST7920_192X32_4X, SPI: FPS: Clip=10.9 Box=6.7 @=8.8 Pix=7.4
|
||||
ST7920_192X32_1X, 8Bit: FPS: Clip=14.2 Box=6.1 @=8.4 Pix=4.2
|
||||
ST7920_192X32_4X, 8Bit: FPS: Clip=14.2 Box=7.8 @=10.7 Pix=8.7
|
||||
ST7920_192X32_1X, HW SPI: FPS: Clip=14.2 Box=6.3 @=8.7 Pix=4.3
|
||||
ST7920_192X32_4X, HW SPI: FPS: Clip=15.3 Box=8.0 @=11.2 Pix=9.0
|
||||
|
||||
2 Jun 2013
|
||||
U8GLIB_DOGM128 SW SPI: FPS: Clip=23.9 Box=4.5 @=6.6 Pix=2.1
|
||||
U8GLIB_DOGM128_2X SW SPI: FPS: Clip=28.5 Box=6.6 @=9.7 Pix=3.9
|
||||
U8GLIB_DOGM128_2X HW SPI: FPS: Clip=40.8 Box=7.1 @=10.8 Pix=4.1
|
||||
|
||||
3 Jun 2013
|
||||
U8GLIB_ST7920_192X32_1X -Os SW SPI FPS: Clip=11.0 Box=5.4 @=7.1 Pix=3.9 Size=11828
|
||||
U8GLIB_ST7920_192X32_1X -O3 SW SPI FPS: Clip=10.9 Box=5.6 @=7.5 Pix=4.0 Size=13800
|
||||
U8GLIB_ST7920_192X32_1X -Os SW SPI FPS: Clip=16.8 Box=6.7 @=9.6 Pix=4.5 Size=11858 (new seq data output)
|
||||
U8GLIB_ST7920_192X32_1X -Os HW SPI FPS: Clip=25.7 Box=7.5 @=11.3 Pix=4.8 (new seq data output)
|
||||
|
||||
6 Jun 2013
|
||||
U8GLIB_DOGS102 u8g(13, 11, 10, 9); STD SW SPI FPS: Clip=9.5 Box=7.6 @=8.2 Pix=6.2 Size=15652
|
||||
U8GLIB_DOGS102 u8g(13, 11, 10, 9); SW SPI FPS: Clip=19.1 Box=12.8 @=14.0 Pix=9.2 Size=15532
|
||||
|
||||
|
||||
12 Jun 2013
|
||||
SSD1351_128X128_332 SW SPI Clip=1.3 Box=0.7 @=0.9 Pix=0.4
|
||||
SSD1351_128X128_332 HW SPI Clip=3.6 Box=1.1 @=1.5 Pix=0.5
|
||||
|
||||
24 Jun 2013
|
||||
Uno SSD1351_128X128_332 SW SPI Clip=1.4 Box=0.8 @=0.9 Pix=0.4
|
||||
|
||||
Uno SSD1351_128X128_332 HW SPI Clip=4.4 Box=1.2 @=1.6 Pix=0.5
|
||||
Uno SSD1351_128X128_HICOLOR HW SPI Clip=3.7 Box=0.8 @=1.0 Pix=0.3
|
||||
|
||||
Mega2560 SSD1351_128X128_332 HW SPI Clip=4.4 Box=1.2 @=1.6 Pix=0.5
|
||||
Mega2560 SSD1351_128X128_4X_332 HW SPI Clip=4.6 Box=2.3 @=2.8 Pix=1.5
|
||||
Mega2560 SSD1351_128X128_HICOLOR HW SPI Clip=3.6 Box=0.8 @=1.0 Pix=0.3
|
||||
Mega2560 SSD1351_128X128_4X_HICOLOR HW SPI Clip=4.2 Box=1.7 @=2.1 Pix=1.0
|
||||
|
||||
Due SSD1351_128X128_332 HW SPI Clip=24.6 Box=6.3 @=7.8 Pix=2.8
|
||||
Due SSD1351_128X128_4X_332 HW SPI Clip=28.1 Box=13.0 @=15.1 Pix=8.5
|
||||
Due SSD1351_128X128_HICOLOR HW SPI Clip=20.8 Box=3.4 @=4.5 Pix=1.4
|
||||
Due SSD1351_128X128_4X_HICOLOR HW SPI Clip=26.3 Box=8.9 @=11.1 Pix=4.8
|
||||
|
||||
Due SSD1351_128X128_4X_HICOLOR SW SPI Clip=0.4 Box=0.4 @=0.4 Pix=0.4
|
||||
|
||||
Due DOGS102 u8g(13, 11, 10, 9); SW SPI FPS: Clip=19.1 Box=13.1 @=14.3 Pix=9.4
|
||||
Due DOGS102 u8g(10, 9); HW SPI FPS: Clip=128.9 Box=30.7 @=40.6 Pix=15.4
|
||||
|
||||
Due NHD27OLED_BW u8g(10, 9) HW SPI FPS: Clip=53.0 Box=19.6 @=23.8 Pix=10.6
|
||||
Due NHD27OLED_2X_BW u8g(10, 9) HW SPI FPS: Clip=57.0 Box=25.3 @=31.7 Pix=18.1
|
||||
Due NHD27OLED_GR u8g(10, 9) HW SPI FPS: Clip=34.1 Box=11.7 @=13.7 Pix=5.6
|
||||
Due NHD27OLED_2X_GR u8g(10, 9) HW SPI FPS: Clip=38.1 Box=15.5 @=20.0 Pix=8.8
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
#define SECONDS 10
|
||||
uint8_t flip_color = 0;
|
||||
uint8_t draw_color = 1;
|
||||
|
||||
void draw_set_screen(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
if ( flip_color == 0 )
|
||||
u8g.setHiColorByRGB(0,0,0);
|
||||
else
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
else {
|
||||
u8g.setColorIndex(flip_color);
|
||||
}
|
||||
u8g.drawBox( 0, 0, u8g.getWidth(), u8g.getHeight() );
|
||||
}
|
||||
|
||||
void draw_clip_test(void) {
|
||||
u8g_uint_t i, j, k;
|
||||
char buf[3] = "AB";
|
||||
k = 0;
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
else {
|
||||
u8g.setColorIndex(draw_color);
|
||||
}
|
||||
u8g.setFont(u8g_font_6x10);
|
||||
|
||||
for( i = 0; i < 6; i++ ) {
|
||||
for( j = 1; j < 8; j++ ) {
|
||||
u8g.drawHLine(i-3, k, j);
|
||||
u8g.drawHLine(i-3+10, k, j);
|
||||
|
||||
u8g.drawVLine(k+20, i-3, j);
|
||||
u8g.drawVLine(k+20, i-3+10, j);
|
||||
|
||||
k++;
|
||||
}
|
||||
}
|
||||
u8g.drawStr(0-3, 50, buf);
|
||||
u8g.drawStr180(0+3, 50, buf);
|
||||
|
||||
u8g.drawStr(u8g.getWidth()-3, 40, buf);
|
||||
u8g.drawStr180(u8g.getWidth()+3, 40, buf);
|
||||
|
||||
u8g.drawStr90(u8g.getWidth()-10, 0-3, buf);
|
||||
u8g.drawStr270(u8g.getWidth()-10, 3, buf);
|
||||
|
||||
u8g.drawStr90(u8g.getWidth()-20, u8g.getHeight()-3, buf);
|
||||
u8g.drawStr270(u8g.getWidth()-20, u8g.getHeight()+3, buf);
|
||||
|
||||
}
|
||||
|
||||
void draw_char(void) {
|
||||
char buf[2] = "@";
|
||||
u8g_uint_t i, j;
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
else {
|
||||
u8g.setColorIndex(draw_color);
|
||||
}
|
||||
u8g.setFont(u8g_font_6x10);
|
||||
j = 8;
|
||||
for(;;) {
|
||||
i = 0;
|
||||
for(;;) {
|
||||
u8g.drawStr( i, j, buf);
|
||||
i += 8;
|
||||
if ( i > u8g.getWidth() )
|
||||
break;
|
||||
}
|
||||
j += 8;
|
||||
if ( j > u8g.getHeight() )
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void draw_pixel(void) {
|
||||
u8g_uint_t x, y, w2, h2;
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
else {
|
||||
u8g.setColorIndex(draw_color);
|
||||
}
|
||||
w2 = u8g.getWidth();
|
||||
h2 = u8g.getHeight();
|
||||
w2 /= 2;
|
||||
h2 /= 2;
|
||||
for( y = 0; y < h2; y++ ) {
|
||||
for( x = 0; x < w2; x++ ) {
|
||||
if ( (x + y) & 1 ) {
|
||||
u8g.drawPixel(x,y);
|
||||
u8g.drawPixel(x,y+h2);
|
||||
u8g.drawPixel(x+w2,y);
|
||||
u8g.drawPixel(x+w2,y+h2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returns unadjusted FPS
|
||||
uint16_t picture_loop_with_fps(void (*draw_fn)(void)) {
|
||||
uint16_t FPS10 = 0;
|
||||
uint32_t time;
|
||||
|
||||
time = millis() + SECONDS*1000;
|
||||
|
||||
// picture loop
|
||||
do {
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw_fn();
|
||||
} while( u8g.nextPage() );
|
||||
FPS10++;
|
||||
flip_color = flip_color ^ 1;
|
||||
} while( millis() < time );
|
||||
return FPS10;
|
||||
}
|
||||
|
||||
const char *convert_FPS(uint16_t fps) {
|
||||
static char buf[6];
|
||||
strcpy(buf, u8g_u8toa( (uint8_t)(fps/10), 3));
|
||||
buf[3] = '.';
|
||||
buf[4] = (fps % 10) + '0';
|
||||
buf[5] = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
void show_result(const char *s, uint16_t fps) {
|
||||
// assign default color value
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
else {
|
||||
u8g.setColorIndex(draw_color);
|
||||
}
|
||||
u8g.setFont(u8g_font_8x13B);
|
||||
u8g.firstPage();
|
||||
do {
|
||||
u8g.drawStr(0,12, s);
|
||||
u8g.drawStr(0,24, convert_FPS(fps));
|
||||
} while( u8g.nextPage() );
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
|
||||
// assign default color value
|
||||
if ( u8g.getMode() == U8G_MODE_R3G3B2 )
|
||||
draw_color = 255; // white
|
||||
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
|
||||
draw_color = 3; // max intensity
|
||||
else if ( u8g.getMode() == U8G_MODE_BW )
|
||||
draw_color = 1; // pixel on
|
||||
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
uint16_t fps;
|
||||
fps = picture_loop_with_fps(draw_clip_test);
|
||||
show_result("draw clip test", fps);
|
||||
delay(5000);
|
||||
fps = picture_loop_with_fps(draw_set_screen);
|
||||
show_result("clear screen", fps);
|
||||
delay(5000);
|
||||
fps = picture_loop_with_fps(draw_char);
|
||||
show_result("draw @", fps);
|
||||
delay(5000);
|
||||
fps = picture_loop_with_fps(draw_pixel);
|
||||
show_result("draw pixel", fps);
|
||||
delay(5000);
|
||||
}
|
||||
|
||||
307
.piolibdeps/U8glib_ID7/examples/GraphicsTest/GraphicsTest.ino
Normal file
307
.piolibdeps/U8glib_ID7/examples/GraphicsTest/GraphicsTest.ino
Normal file
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
|
||||
GraphicsTest.pde
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
void u8g_prepare(void) {
|
||||
u8g.setFont(u8g_font_6x10);
|
||||
u8g.setFontRefHeightExtendedText();
|
||||
u8g.setDefaultForegroundColor();
|
||||
u8g.setFontPosTop();
|
||||
}
|
||||
|
||||
void u8g_box_frame(uint8_t a) {
|
||||
u8g.drawStr( 0, 0, "drawBox");
|
||||
u8g.drawBox(5,10,20,10);
|
||||
u8g.drawBox(10+a,15,30,7);
|
||||
u8g.drawStr( 0, 30, "drawFrame");
|
||||
u8g.drawFrame(5,10+30,20,10);
|
||||
u8g.drawFrame(10+a,15+30,30,7);
|
||||
}
|
||||
|
||||
void u8g_disc_circle(uint8_t a) {
|
||||
u8g.drawStr( 0, 0, "drawDisc");
|
||||
u8g.drawDisc(10,18,9);
|
||||
u8g.drawDisc(24+a,16,7);
|
||||
u8g.drawStr( 0, 30, "drawCircle");
|
||||
u8g.drawCircle(10,18+30,9);
|
||||
u8g.drawCircle(24+a,16+30,7);
|
||||
}
|
||||
|
||||
void u8g_r_frame(uint8_t a) {
|
||||
u8g.drawStr( 0, 0, "drawRFrame/Box");
|
||||
u8g.drawRFrame(5, 10,40,30, a+1);
|
||||
u8g.drawRBox(50, 10,25,40, a+1);
|
||||
}
|
||||
|
||||
void u8g_string(uint8_t a) {
|
||||
u8g.drawStr(30+a,31, " 0");
|
||||
u8g.drawStr90(30,31+a, " 90");
|
||||
u8g.drawStr180(30-a,31, " 180");
|
||||
u8g.drawStr270(30,31-a, " 270");
|
||||
}
|
||||
|
||||
void u8g_line(uint8_t a) {
|
||||
u8g.drawStr( 0, 0, "drawLine");
|
||||
u8g.drawLine(7+a, 10, 40, 55);
|
||||
u8g.drawLine(7+a*2, 10, 60, 55);
|
||||
u8g.drawLine(7+a*3, 10, 80, 55);
|
||||
u8g.drawLine(7+a*4, 10, 100, 55);
|
||||
}
|
||||
|
||||
void u8g_triangle(uint8_t a) {
|
||||
uint16_t offset = a;
|
||||
u8g.drawStr( 0, 0, "drawTriangle");
|
||||
u8g.drawTriangle(14,7, 45,30, 10,40);
|
||||
u8g.drawTriangle(14+offset,7-offset, 45+offset,30-offset, 57+offset,10-offset);
|
||||
u8g.drawTriangle(57+offset*2,10, 45+offset*2,30, 86+offset*2,53);
|
||||
u8g.drawTriangle(10+offset,40+offset, 45+offset,30+offset, 86+offset,53+offset);
|
||||
}
|
||||
|
||||
void u8g_ascii_1() {
|
||||
char s[2] = " ";
|
||||
uint8_t x, y;
|
||||
u8g.drawStr( 0, 0, "ASCII page 1");
|
||||
for( y = 0; y < 6; y++ ) {
|
||||
for( x = 0; x < 16; x++ ) {
|
||||
s[0] = y*16 + x + 32;
|
||||
u8g.drawStr(x*7, y*10+10, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_ascii_2() {
|
||||
char s[2] = " ";
|
||||
uint8_t x, y;
|
||||
u8g.drawStr( 0, 0, "ASCII page 2");
|
||||
for( y = 0; y < 6; y++ ) {
|
||||
for( x = 0; x < 16; x++ ) {
|
||||
s[0] = y*16 + x + 160;
|
||||
u8g.drawStr(x*7, y*10+10, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_extra_page(uint8_t a)
|
||||
{
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR || u8g.getMode() == U8G_MODE_R3G3B2) {
|
||||
/* draw background (area is 128x128) */
|
||||
u8g_uint_t r, g, b;
|
||||
b = a << 5;
|
||||
for( g = 0; g < 64; g++ )
|
||||
{
|
||||
for( r = 0; r < 64; r++ )
|
||||
{
|
||||
u8g.setRGB(r<<2, g<<2, b );
|
||||
u8g.drawPixel(g, r);
|
||||
}
|
||||
}
|
||||
u8g.setRGB(255,255,255);
|
||||
u8g.drawStr( 66, 0, "Color Page");
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
|
||||
{
|
||||
u8g.drawStr( 66, 0, "Gray Level");
|
||||
u8g.setColorIndex(1);
|
||||
u8g.drawBox(0, 4, 64, 32);
|
||||
u8g.drawBox(70, 20, 4, 12);
|
||||
u8g.setColorIndex(2);
|
||||
u8g.drawBox(0+1*a, 4+1*a, 64-2*a, 32-2*a);
|
||||
u8g.drawBox(74, 20, 4, 12);
|
||||
u8g.setColorIndex(3);
|
||||
u8g.drawBox(0+2*a, 4+2*a, 64-4*a, 32-4*a);
|
||||
u8g.drawBox(78, 20, 4, 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8g.drawStr( 0, 12, "setScale2x2");
|
||||
u8g.setScale2x2();
|
||||
u8g.drawStr( 0, 6+a, "setScale2x2");
|
||||
u8g.undoScale();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t draw_state = 0;
|
||||
|
||||
void draw(void) {
|
||||
u8g_prepare();
|
||||
switch(draw_state >> 3) {
|
||||
case 0: u8g_box_frame(draw_state&7); break;
|
||||
case 1: u8g_disc_circle(draw_state&7); break;
|
||||
case 2: u8g_r_frame(draw_state&7); break;
|
||||
case 3: u8g_string(draw_state&7); break;
|
||||
case 4: u8g_line(draw_state&7); break;
|
||||
case 5: u8g_triangle(draw_state&7); break;
|
||||
case 6: u8g_ascii_1(); break;
|
||||
case 7: u8g_ascii_2(); break;
|
||||
case 8: u8g_extra_page(draw_state&7); break;
|
||||
}
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
|
||||
// flip screen, if required
|
||||
//u8g.setRot180();
|
||||
|
||||
#if defined(ARDUINO)
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// increase the state
|
||||
draw_state++;
|
||||
if ( draw_state >= 9*8 )
|
||||
draw_state = 0;
|
||||
|
||||
// rebuild the picture after some delay
|
||||
//delay(150);
|
||||
|
||||
}
|
||||
|
||||
|
||||
185
.piolibdeps/U8glib_ID7/examples/HelloWorld/HelloWorld.ino
Normal file
185
.piolibdeps/U8glib_ID7/examples/HelloWorld/HelloWorld.ino
Normal file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
|
||||
HelloWorld.pde
|
||||
|
||||
"Hello World!" example code.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
u8g.setFont(u8g_font_unifont);
|
||||
//u8g.setFont(u8g_font_osb21);
|
||||
u8g.drawStr( 0, 22, "Hello World!");
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
|
||||
// set SPI backup if required
|
||||
//u8g.setHardwareBackup(u8g_backup_avr_spi);
|
||||
|
||||
// assign default color value
|
||||
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
|
||||
u8g.setColorIndex(255); // white
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
|
||||
u8g.setColorIndex(3); // max intensity
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_BW ) {
|
||||
u8g.setColorIndex(1); // pixel on
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
|
||||
pinMode(8, OUTPUT);
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
//delay(50);
|
||||
}
|
||||
|
||||
272
.piolibdeps/U8glib_ID7/examples/Menu/Menu.ino
Normal file
272
.piolibdeps/U8glib_ID7/examples/Menu/Menu.ino
Normal file
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
|
||||
Menu.pde
|
||||
|
||||
Simple Menu Selection
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
|
||||
#define KEY_NONE 0
|
||||
#define KEY_PREV 1
|
||||
#define KEY_NEXT 2
|
||||
#define KEY_SELECT 3
|
||||
#define KEY_BACK 4
|
||||
|
||||
// DOGS102 shield configuration values
|
||||
//uint8_t uiKeyPrev = 2;
|
||||
//uint8_t uiKeyNext = 4;
|
||||
//uint8_t uiKeySelect = 5;
|
||||
//uint8_t uiKeyBack = 3;
|
||||
|
||||
// DOGM128-Shield configuration values
|
||||
// DOGXL60-Shield configuration values
|
||||
uint8_t uiKeyPrev = 7;
|
||||
uint8_t uiKeyNext = 3;
|
||||
uint8_t uiKeySelect = 2;
|
||||
uint8_t uiKeyBack = 8;
|
||||
|
||||
uint8_t uiKeyCodeFirst = KEY_NONE;
|
||||
uint8_t uiKeyCodeSecond = KEY_NONE;
|
||||
uint8_t uiKeyCode = KEY_NONE;
|
||||
|
||||
|
||||
void uiSetup(void) {
|
||||
// configure input keys
|
||||
|
||||
pinMode(uiKeyPrev, INPUT_PULLUP); // set pin to input with pullup
|
||||
pinMode(uiKeyNext, INPUT_PULLUP); // set pin to input with pullup
|
||||
pinMode(uiKeySelect, INPUT_PULLUP); // set pin to input with pullup
|
||||
pinMode(uiKeyBack, INPUT_PULLUP); // set pin to input with pullup
|
||||
}
|
||||
|
||||
void uiStep(void) {
|
||||
uiKeyCodeSecond = uiKeyCodeFirst;
|
||||
if ( digitalRead(uiKeyPrev) == LOW )
|
||||
uiKeyCodeFirst = KEY_PREV;
|
||||
else if ( digitalRead(uiKeyNext) == LOW )
|
||||
uiKeyCodeFirst = KEY_NEXT;
|
||||
else if ( digitalRead(uiKeySelect) == LOW )
|
||||
uiKeyCodeFirst = KEY_SELECT;
|
||||
else if ( digitalRead(uiKeyBack) == LOW )
|
||||
uiKeyCodeFirst = KEY_BACK;
|
||||
else
|
||||
uiKeyCodeFirst = KEY_NONE;
|
||||
|
||||
if ( uiKeyCodeSecond == uiKeyCodeFirst )
|
||||
uiKeyCode = uiKeyCodeFirst;
|
||||
else
|
||||
uiKeyCode = KEY_NONE;
|
||||
}
|
||||
|
||||
|
||||
#define MENU_ITEMS 4
|
||||
const char *menu_strings[MENU_ITEMS] = { "First Line", "Second Item", "3333333", "abcdefg" };
|
||||
|
||||
uint8_t menu_current = 0;
|
||||
uint8_t menu_redraw_required = 0;
|
||||
uint8_t last_key_code = KEY_NONE;
|
||||
|
||||
|
||||
void drawMenu(void) {
|
||||
uint8_t i, h;
|
||||
u8g_uint_t w, d;
|
||||
|
||||
u8g.setFont(u8g_font_6x13);
|
||||
u8g.setFontRefHeightText();
|
||||
u8g.setFontPosTop();
|
||||
|
||||
h = u8g.getFontAscent()-u8g.getFontDescent();
|
||||
w = u8g.getWidth();
|
||||
for( i = 0; i < MENU_ITEMS; i++ ) {
|
||||
d = (w-u8g.getStrWidth(menu_strings[i]))/2;
|
||||
u8g.setDefaultForegroundColor();
|
||||
if ( i == menu_current ) {
|
||||
u8g.drawBox(0, i*h+1, w, h);
|
||||
u8g.setDefaultBackgroundColor();
|
||||
}
|
||||
u8g.drawStr(d, i*h, menu_strings[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void updateMenu(void) {
|
||||
if ( uiKeyCode != KEY_NONE && last_key_code == uiKeyCode ) {
|
||||
return;
|
||||
}
|
||||
last_key_code = uiKeyCode;
|
||||
|
||||
switch ( uiKeyCode ) {
|
||||
case KEY_NEXT:
|
||||
menu_current++;
|
||||
if ( menu_current >= MENU_ITEMS )
|
||||
menu_current = 0;
|
||||
menu_redraw_required = 1;
|
||||
break;
|
||||
case KEY_PREV:
|
||||
if ( menu_current == 0 )
|
||||
menu_current = MENU_ITEMS;
|
||||
menu_current--;
|
||||
menu_redraw_required = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
// rotate screen, if required
|
||||
// u8g.setRot180();
|
||||
|
||||
uiSetup(); // setup key detection and debounce algorithm
|
||||
menu_redraw_required = 1; // force initial redraw
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
uiStep(); // check for key press
|
||||
|
||||
if ( menu_redraw_required != 0 ) {
|
||||
u8g.firstPage();
|
||||
do {
|
||||
drawMenu();
|
||||
} while( u8g.nextPage() );
|
||||
menu_redraw_required = 0;
|
||||
}
|
||||
|
||||
updateMenu(); // update menu bar
|
||||
|
||||
}
|
||||
160
.piolibdeps/U8glib_ID7/examples/PrintTest/PrintTest.ino
Normal file
160
.piolibdeps/U8glib_ID7/examples/PrintTest/PrintTest.ino
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
|
||||
PrintTest.pde
|
||||
|
||||
How to use the base class "Print"
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
u8g.setFont(u8g_font_unifont);
|
||||
u8g.setPrintPos(0, 20);
|
||||
// call procedure from base class, http://arduino.cc/en/Serial/Print
|
||||
u8g.print("Hello World!");
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(500);
|
||||
}
|
||||
|
||||
194
.piolibdeps/U8glib_ID7/examples/Rotation/Rotation.ino
Normal file
194
.piolibdeps/U8glib_ID7/examples/Rotation/Rotation.ino
Normal file
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
|
||||
Rotation.pde
|
||||
|
||||
Example code for RotXXX functions.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
uint8_t offset = 0;
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
u8g.setFont(u8g_font_unifont);
|
||||
u8g.drawStr( 0+0, 20+0, "Hello!");
|
||||
u8g.drawStr( 0+2, 20+16, "Hello!");
|
||||
|
||||
u8g.drawBox(0, 0, 3, 3);
|
||||
u8g.drawBox(u8g.getWidth()-6, 0, 6, 6);
|
||||
u8g.drawBox(u8g.getWidth()-9, u8g.getHeight()-9, 9, 9);
|
||||
u8g.drawBox(0, u8g.getHeight()-12, 12, 12);
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
}
|
||||
|
||||
|
||||
void rotate(void) {
|
||||
static uint8_t dir = 0;
|
||||
static unsigned long next_rotation = 0;
|
||||
|
||||
if ( next_rotation < millis() )
|
||||
{
|
||||
switch(dir) {
|
||||
case 0: u8g.undoRotation(); break;
|
||||
case 1: u8g.setRot90(); break;
|
||||
case 2: u8g.setRot180(); break;
|
||||
case 3: u8g.setRot270(); offset = ( offset + 1 ) & 0x0f; break;
|
||||
}
|
||||
|
||||
dir++;
|
||||
dir &= 3;
|
||||
next_rotation = millis();
|
||||
next_rotation += 1000;
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// screen rotation
|
||||
rotate();
|
||||
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(100);
|
||||
}
|
||||
|
||||
183
.piolibdeps/U8glib_ID7/examples/Scale/Scale.ino
Normal file
183
.piolibdeps/U8glib_ID7/examples/Scale/Scale.ino
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
|
||||
Scale.pde
|
||||
|
||||
Example code for the 2x2 scale function.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
u8g.setFont(u8g_font_unifont);
|
||||
u8g.setFontPosTop();
|
||||
u8g.drawStr(0, 1, "Hello");
|
||||
u8g.drawHLine(0, 1+14, 40);
|
||||
u8g.setScale2x2(); // Scale up all draw procedures
|
||||
u8g.drawStr(0, 12, "Hello"); // actual display position is (0,24)
|
||||
u8g.drawHLine(0, 12+14, 40); // All other procedures are also affected
|
||||
u8g.undoScale(); // IMPORTANT: Switch back to normal mode
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
|
||||
// flip screen, if required
|
||||
u8g.setRot180();
|
||||
|
||||
// set SPI backup if required
|
||||
//u8g.setHardwareBackup(u8g_backup_avr_spi);
|
||||
|
||||
// assign default color value
|
||||
if ( u8g.getMode() == U8G_MODE_R3G3B2 )
|
||||
u8g.setColorIndex(255); // white
|
||||
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
|
||||
u8g.setColorIndex(3); // max intensity
|
||||
else if ( u8g.getMode() == U8G_MODE_BW )
|
||||
u8g.setColorIndex(1); // pixel on
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(500);
|
||||
}
|
||||
|
||||
196
.piolibdeps/U8glib_ID7/examples/TextRotX/TextRotX.ino
Normal file
196
.piolibdeps/U8glib_ID7/examples/TextRotX/TextRotX.ino
Normal file
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
|
||||
TextRotX.pde
|
||||
|
||||
Text rotation example code.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
void draw(void) {
|
||||
u8g_uint_t mx, my;
|
||||
|
||||
mx = u8g.getWidth();
|
||||
mx >>= 1;
|
||||
|
||||
my = u8g.getHeight();
|
||||
my >>= 1;
|
||||
|
||||
u8g.drawStr( mx, my, "Ag");
|
||||
u8g.drawStr90( mx, my, "Ag");
|
||||
u8g.drawStr180( mx, my, "Ag");
|
||||
u8g.drawStr270( mx, my, "Ag");
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
u8g.setFont(u8g_font_9x18);
|
||||
}
|
||||
|
||||
void change_font_pos(void) {
|
||||
static uint8_t dir = 0;
|
||||
static unsigned long next = 0;
|
||||
|
||||
if ( next < millis() )
|
||||
{
|
||||
switch(dir) {
|
||||
case 0: u8g.setFontPosBottom(); break;
|
||||
case 1: u8g.setFontPosBaseline(); break;
|
||||
case 2: u8g.setFontPosCenter(); break;
|
||||
case 3: u8g.setFontPosTop(); break;
|
||||
}
|
||||
|
||||
dir++;
|
||||
dir &= 3;
|
||||
next = millis();
|
||||
next += 1000;
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// change the font position
|
||||
change_font_pos();
|
||||
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(100);
|
||||
}
|
||||
|
||||
354
.piolibdeps/U8glib_ID7/examples/Touch4WSetup/Touch4WSetup.ino
Normal file
354
.piolibdeps/U8glib_ID7/examples/Touch4WSetup/Touch4WSetup.ino
Normal file
@@ -0,0 +1,354 @@
|
||||
/*
|
||||
|
||||
Touch4WSetup.pde
|
||||
|
||||
Use this example to figure out the ranges for of the active area of a 4-wire resistive
|
||||
touch panel.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
//================================================================
|
||||
// Setup 4-Wire Resistive Touch Panel
|
||||
|
||||
uint8_t tp_left = A3;
|
||||
uint8_t tp_right = A5;
|
||||
uint8_t tp_top = A4;
|
||||
uint8_t tp_bottom = A2;
|
||||
|
||||
#define X_START 120
|
||||
#define X_END 140
|
||||
#define Y_START 120
|
||||
#define Y_END 140
|
||||
|
||||
#define PULLUP_THRESHOLD 235
|
||||
|
||||
//================================================================
|
||||
// Touch Panel Code
|
||||
|
||||
/* touch panel dimension */
|
||||
struct tpd_struct
|
||||
{
|
||||
/* raw value */
|
||||
uint8_t raw;
|
||||
|
||||
/* calibration values */
|
||||
uint8_t start;
|
||||
uint8_t end;
|
||||
|
||||
/* user values */
|
||||
uint8_t range; /* result will have range fron 0..range (including the value of range) */
|
||||
|
||||
uint8_t result; /* output value: position [0...range] */
|
||||
uint8_t is_pressed; /* output value: pressed (=1) or not pressed (=0) */
|
||||
uint8_t is_update; /* will be set to 1 if result or is_pressed has been updated */
|
||||
};
|
||||
|
||||
struct tp_struct
|
||||
{
|
||||
struct tpd_struct x;
|
||||
struct tpd_struct y;
|
||||
uint8_t is_pressed; /* combination of x.is_pressed && y.is_pressed */
|
||||
uint8_t is_update;
|
||||
};
|
||||
|
||||
struct tp_struct tp;
|
||||
|
||||
/* map raw value to 0...range (result) */
|
||||
void tpd_map_touch_position(struct tpd_struct *d, uint8_t raw)
|
||||
{
|
||||
uint8_t is_pressed;
|
||||
uint16_t p;
|
||||
uint8_t start, end;
|
||||
|
||||
d->raw = raw;
|
||||
|
||||
start = d->start;
|
||||
end = d->end;
|
||||
|
||||
/* check if position is within active area; store result in "is_pressed" */
|
||||
is_pressed = 1;
|
||||
if ( raw >= PULLUP_THRESHOLD )
|
||||
{
|
||||
d->result = 0;
|
||||
is_pressed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* update start and end */
|
||||
if ( raw < start )
|
||||
{
|
||||
start = raw;
|
||||
d->start = raw;
|
||||
}
|
||||
if ( raw > end )
|
||||
{
|
||||
end = raw;
|
||||
d->end = raw;
|
||||
}
|
||||
}
|
||||
|
||||
/* store "is_pressed" in the global structure, set update flag */
|
||||
if ( d->is_pressed != is_pressed )
|
||||
d->is_update = 1;
|
||||
d->is_pressed = is_pressed;
|
||||
|
||||
/* map "raw" value into target range */
|
||||
if ( is_pressed != 0 )
|
||||
{
|
||||
p = raw;
|
||||
p -= start;
|
||||
p *= d->range;
|
||||
end -= start;
|
||||
p /= end;
|
||||
|
||||
if ( d->result != p )
|
||||
d->is_update = 1;
|
||||
d->result = p;
|
||||
}
|
||||
}
|
||||
|
||||
void tp_Init(uint8_t width, uint8_t height)
|
||||
{
|
||||
tp.x.start = X_START;
|
||||
tp.x.end = X_END;
|
||||
tp.x.range = width-1;
|
||||
|
||||
tp.y.start = Y_START;
|
||||
tp.y.end = Y_END;
|
||||
tp.y.range = height-1;
|
||||
|
||||
tp.is_update = 1;
|
||||
}
|
||||
|
||||
void setTouchRawValues(uint8_t x, uint8_t y)
|
||||
{
|
||||
tpd_map_touch_position(&(tp.x), x);
|
||||
tpd_map_touch_position(&(tp.y), y);
|
||||
|
||||
tp.is_pressed = tp.x.is_pressed && tp.y.is_pressed;
|
||||
if ( tp.x.is_update || tp.y.is_update )
|
||||
tp.is_update = 1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t getTouchPos(uint8_t hiPin, uint8_t lowPin, uint8_t sensePin, uint8_t dcPin)
|
||||
{
|
||||
uint8_t val;
|
||||
pinMode(dcPin, INPUT);
|
||||
pinMode(sensePin, INPUT_PULLUP);
|
||||
pinMode(hiPin, OUTPUT);
|
||||
pinMode(lowPin, OUTPUT);
|
||||
|
||||
digitalWrite(hiPin, HIGH);
|
||||
digitalWrite(lowPin, LOW);
|
||||
delay(10);
|
||||
val = analogRead(sensePin) >> 2;
|
||||
pinMode(hiPin, INPUT);
|
||||
pinMode(lowPin, INPUT);
|
||||
delay(10);
|
||||
return val;
|
||||
}
|
||||
|
||||
void updateTouchPanel(void)
|
||||
{
|
||||
uint8_t tp_raw_x;
|
||||
uint8_t tp_raw_y;
|
||||
|
||||
tp_raw_x = getTouchPos(tp_right, tp_left, tp_bottom, tp_top);
|
||||
tp_raw_y = getTouchPos(tp_top, tp_bottom, tp_left, tp_right);
|
||||
|
||||
setTouchRawValues(tp_raw_x, tp_raw_y);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// graphics output and picture loop
|
||||
|
||||
void center(u8g_uint_t y, const char *str)
|
||||
{
|
||||
u8g_uint_t x;
|
||||
x = u8g.getWidth();
|
||||
x -= u8g.getStrWidth(str);
|
||||
x /= 2;
|
||||
u8g.drawStr(x, y, str);
|
||||
}
|
||||
|
||||
|
||||
void draw(void) {
|
||||
u8g.setFont(u8g_font_6x10);
|
||||
center( 10, "Touch Panel Setup");
|
||||
u8g.setPrintPos(0, 20); u8g.print("x_start=");u8g.print((int)tp.x.start);u8g.print(" x_end=");u8g.print((int)tp.x.end);
|
||||
u8g.setPrintPos(0, 30); u8g.print("y_start=");u8g.print((int)tp.y.start);u8g.print(" y_end=");u8g.print((int)tp.y.end);
|
||||
u8g.setPrintPos(0, 40); u8g.print("x=");u8g.print((int)tp.x.raw);
|
||||
u8g.setPrintPos(0, 50); u8g.print("y=");u8g.print((int)tp.y.raw);
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
u8g.setCursorFont(u8g_font_cursor);
|
||||
u8g.setCursorStyle(32);
|
||||
|
||||
tp_Init(u8g.getWidth(), u8g.getHeight());
|
||||
|
||||
tp.is_update = 1;
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
||||
// update touch panel and handle return values
|
||||
updateTouchPanel();
|
||||
|
||||
if ( tp.is_pressed != 0 )
|
||||
u8g.enableCursor();
|
||||
else
|
||||
u8g.disableCursor();
|
||||
|
||||
u8g.setCursorPos(tp.x.result, u8g.getHeight()-tp.y.result-1);
|
||||
|
||||
// picture loop
|
||||
if ( tp.is_update != 0 )
|
||||
{
|
||||
tp.is_update = 0;
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
341
.piolibdeps/U8glib_ID7/examples/Touch4WTest/Touch4WTest.ino
Normal file
341
.piolibdeps/U8glib_ID7/examples/Touch4WTest/Touch4WTest.ino
Normal file
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
|
||||
Touch4WTest.pde
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
//================================================================
|
||||
// Setup 4-Wire Resistive Touch Panel
|
||||
|
||||
uint8_t tp_left = A3;
|
||||
uint8_t tp_right = A5;
|
||||
uint8_t tp_top = A4;
|
||||
uint8_t tp_bottom = A2;
|
||||
|
||||
/* Run "Touch4WSetup" and enter values here */
|
||||
#define X_START 64
|
||||
#define X_END 200
|
||||
#define Y_START 105
|
||||
#define Y_END 160
|
||||
|
||||
//================================================================
|
||||
// Touch Panel Code
|
||||
|
||||
/* touch panel dimension */
|
||||
struct tpd_struct
|
||||
{
|
||||
/* raw value */
|
||||
uint8_t raw;
|
||||
|
||||
/* calibration values */
|
||||
uint8_t start;
|
||||
uint8_t end;
|
||||
|
||||
/* user values */
|
||||
uint8_t range; /* result will have range fron 0..range (including the value of range) */
|
||||
|
||||
uint8_t result; /* output value: position [0...range] */
|
||||
uint8_t is_pressed; /* output value: pressed (=1) or not pressed (=0) */
|
||||
uint8_t is_update; /* will be set to 1 if result or is_pressed has been updated */
|
||||
};
|
||||
|
||||
struct tp_struct
|
||||
{
|
||||
struct tpd_struct x;
|
||||
struct tpd_struct y;
|
||||
uint8_t is_pressed; /* combination of x.is_pressed && y.is_pressed */
|
||||
uint8_t is_update;
|
||||
};
|
||||
|
||||
struct tp_struct tp;
|
||||
|
||||
/* map raw value to 0...range (result) */
|
||||
void tpd_map_touch_position(struct tpd_struct *d, uint8_t raw)
|
||||
{
|
||||
uint8_t is_pressed;
|
||||
uint16_t p;
|
||||
uint8_t start, end;
|
||||
|
||||
d->raw = raw;
|
||||
|
||||
start = d->start;
|
||||
end = d->end;
|
||||
|
||||
/* check if position is within active area; store result in "is_pressed" */
|
||||
is_pressed = 1;
|
||||
if ( raw < start )
|
||||
{
|
||||
d->result = 0;
|
||||
is_pressed = 0;
|
||||
}
|
||||
if ( raw >= end )
|
||||
{
|
||||
d->result = d->range;
|
||||
is_pressed = 0;
|
||||
}
|
||||
|
||||
/* store "is_pressed" in the global structure, set update flag */
|
||||
if ( d->is_pressed != is_pressed )
|
||||
d->is_update = 1;
|
||||
d->is_pressed = is_pressed;
|
||||
|
||||
/* map "raw" value into target range */
|
||||
if ( is_pressed != 0 )
|
||||
{
|
||||
p = raw;
|
||||
p -= start;
|
||||
p *= d->range;
|
||||
end -= start;
|
||||
p /= end;
|
||||
|
||||
if ( d->result != p )
|
||||
d->is_update = 1;
|
||||
d->result = p;
|
||||
}
|
||||
}
|
||||
|
||||
void tp_Init(uint8_t width, uint8_t height)
|
||||
{
|
||||
tp.x.start = X_START;
|
||||
tp.x.end = X_END;
|
||||
tp.x.range = width-1;
|
||||
|
||||
tp.y.start = Y_START;
|
||||
tp.y.end = Y_END;
|
||||
tp.y.range = height-1;
|
||||
|
||||
tp.is_update = 1;
|
||||
}
|
||||
|
||||
void setTouchRawValues(uint8_t x, uint8_t y)
|
||||
{
|
||||
tpd_map_touch_position(&(tp.x), x);
|
||||
tpd_map_touch_position(&(tp.y), y);
|
||||
|
||||
tp.is_pressed = tp.x.is_pressed && tp.y.is_pressed;
|
||||
if ( tp.x.is_update || tp.y.is_update )
|
||||
tp.is_update = 1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t getTouchPos(uint8_t hiPin, uint8_t lowPin, uint8_t sensePin, uint8_t dcPin)
|
||||
{
|
||||
uint8_t val;
|
||||
pinMode(dcPin, INPUT);
|
||||
pinMode(sensePin, INPUT_PULLUP);
|
||||
pinMode(hiPin, OUTPUT);
|
||||
pinMode(lowPin, OUTPUT);
|
||||
|
||||
digitalWrite(hiPin, HIGH);
|
||||
digitalWrite(lowPin, LOW);
|
||||
delay(10);
|
||||
val = analogRead(sensePin) >> 2;
|
||||
pinMode(hiPin, INPUT);
|
||||
pinMode(lowPin, INPUT);
|
||||
delay(10);
|
||||
return val;
|
||||
}
|
||||
|
||||
void updateTouchPanel(void)
|
||||
{
|
||||
uint8_t tp_raw_x;
|
||||
uint8_t tp_raw_y;
|
||||
|
||||
tp_raw_x = getTouchPos(tp_right, tp_left, tp_bottom, tp_top);
|
||||
tp_raw_y = getTouchPos(tp_top, tp_bottom, tp_left, tp_right);
|
||||
|
||||
setTouchRawValues(tp_raw_x, tp_raw_y);
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// graphics output and picture loop
|
||||
|
||||
void center(u8g_uint_t y, const char *str)
|
||||
{
|
||||
u8g_uint_t x;
|
||||
x = u8g.getWidth();
|
||||
x -= u8g.getStrWidth(str);
|
||||
x /= 2;
|
||||
u8g.drawStr(x, y, str);
|
||||
}
|
||||
|
||||
|
||||
void draw(void) {
|
||||
u8g.setFont(u8g_font_6x10);
|
||||
center( 10, "Touch Panel Test");
|
||||
if ( tp.is_pressed != 0 )
|
||||
{
|
||||
u8g.setPrintPos(0, 20); u8g.print("x=");u8g.print((int)tp.x.result);
|
||||
u8g.setPrintPos(0, 30); u8g.print("y=");u8g.print((int)(u8g.getHeight()-tp.y.result-1));
|
||||
//u8g.setPrintPos(0, 40); u8g.print("x: ");u8g.print((int)tp.x.start);u8g.print("..");u8g.print((int)tp.x.end);
|
||||
//u8g.setPrintPos(0, 50); u8g.print("y: ");u8g.print((int)tp.y.start);u8g.print("..");u8g.print((int)tp.y.end);
|
||||
}
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
u8g.setCursorFont(u8g_font_cursor);
|
||||
u8g.setCursorStyle(32);
|
||||
|
||||
tp_Init(u8g.getWidth(), u8g.getHeight());
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
||||
// update touch panel and handle return values
|
||||
updateTouchPanel();
|
||||
|
||||
if ( tp.is_pressed != 0 )
|
||||
u8g.enableCursor();
|
||||
else
|
||||
u8g.disableCursor();
|
||||
|
||||
u8g.setCursorPos(tp.x.result, u8g.getHeight()-tp.y.result-1);
|
||||
|
||||
// picture loop
|
||||
if ( tp.is_update != 0 ) {
|
||||
tp.is_update = 0;
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
237
.piolibdeps/U8glib_ID7/examples/U8gLogo/U8gLogo.ino
Normal file
237
.piolibdeps/U8glib_ID7/examples/U8gLogo/U8gLogo.ino
Normal file
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
|
||||
U8gLogo.pde
|
||||
|
||||
Put the U8GLIB logo on the display.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
|
||||
//#define MINI_LOGO
|
||||
|
||||
void drawColorBox(void)
|
||||
{
|
||||
u8g_uint_t w,h;
|
||||
u8g_uint_t r, g, b;
|
||||
|
||||
w = u8g.getWidth()/32;
|
||||
h = u8g.getHeight()/8;
|
||||
for( b = 0; b < 4; b++ )
|
||||
for( g = 0; g < 8; g++ )
|
||||
for( r = 0; r < 8; r++ )
|
||||
{
|
||||
u8g.setColorIndex((r<<5) | (g<<2) | b );
|
||||
u8g.drawBox(g*w + b*w*8, r*h, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
void drawLogo(uint8_t d)
|
||||
{
|
||||
#ifdef MINI_LOGO
|
||||
u8g.setFont(u8g_font_gdr17r);
|
||||
u8g.drawStr(0+d, 22+d, "U");
|
||||
u8g.setFont(u8g_font_gdr20n);
|
||||
u8g.drawStr90(17+d,8+d,"8");
|
||||
u8g.setFont(u8g_font_gdr17r);
|
||||
u8g.drawStr(39+d,22+d,"g");
|
||||
|
||||
u8g.drawHLine(2+d, 25+d, 34);
|
||||
u8g.drawVLine(32+d, 22+d, 12);
|
||||
#else
|
||||
u8g.setFont(u8g_font_gdr25r);
|
||||
u8g.drawStr(0+d, 30+d, "U");
|
||||
u8g.setFont(u8g_font_gdr30n);
|
||||
u8g.drawStr90(23+d,10+d,"8");
|
||||
u8g.setFont(u8g_font_gdr25r);
|
||||
u8g.drawStr(53+d,30+d,"g");
|
||||
|
||||
u8g.drawHLine(2+d, 35+d, 47);
|
||||
u8g.drawVLine(45+d, 32+d, 12);
|
||||
#endif
|
||||
}
|
||||
|
||||
void drawURL(void)
|
||||
{
|
||||
#ifndef MINI_LOGO
|
||||
u8g.setFont(u8g_font_4x6);
|
||||
if ( u8g.getHeight() < 59 )
|
||||
{
|
||||
u8g.drawStr(53,9,"code.google.com");
|
||||
u8g.drawStr(77,18,"/p/u8glib");
|
||||
}
|
||||
else
|
||||
{
|
||||
u8g.drawStr(1,54,"code.google.com/p/u8glib");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void draw(void) {
|
||||
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
|
||||
drawColorBox();
|
||||
}
|
||||
u8g.setColorIndex(1);
|
||||
if ( U8G_MODE_GET_BITS_PER_PIXEL(u8g.getMode()) > 1 ) {
|
||||
drawLogo(2);
|
||||
u8g.setColorIndex(2);
|
||||
drawLogo(1);
|
||||
u8g.setColorIndex(3);
|
||||
}
|
||||
drawLogo(0);
|
||||
drawURL();
|
||||
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
// flip screen, if required
|
||||
//u8g.setRot180();
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
u8g.setColorIndex(1);
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(200);
|
||||
}
|
||||
|
||||
178
.piolibdeps/U8glib_ID7/examples/XBM/XBM.ino
Normal file
178
.piolibdeps/U8glib_ID7/examples/XBM/XBM.ino
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
|
||||
XBM.pde
|
||||
|
||||
drawXBM example code.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, https://github.com/olikraus/u8glib/
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: https://github.com/olikraus/u8glib/wiki/device
|
||||
//U8GLIB_NHD27OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD27OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_NHD31OLED_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGS102 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM132 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGM128_2X u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_ST7920_128X64_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_128X64_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_128X64_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_192X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_192X32_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10
|
||||
//U8GLIB_ST7920_192X32_4X u8g(10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = di = 10, HW SPI
|
||||
//U8GLIB_ST7920_202X32_1X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
|
||||
//U8GLIB_ST7920_202X32_1X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_ST7920_202X32_4X u8g(18, 16, 17); // SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
|
||||
//U8GLIB_LM6059 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_LM6063 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_BW u8g(10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_BW u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_DOGXL160_2X_GR u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_PCD8544 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_PCF8812 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, Reset = 8
|
||||
//U8GLIB_KS0108_128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs1=14, cs2=15,di=17,rw=16
|
||||
//U8GLIB_LC7981_160X80 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_LC7981_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=14 ,di=15,rw=17, reset = 16
|
||||
//U8GLIB_ILI9325D_320x240 u8g(18,17,19,U8G_PIN_NONE,16 ); // 8Bit Com: D0..D7: 0,1,2,3,4,5,6,7 en=wr=18, cs=17, rs=19, rd=U8G_PIN_NONE, reset = 16
|
||||
//U8GLIB_SBN1661_122X32 u8g(8,9,10,11,4,5,6,7,14,15, 17, U8G_PIN_NONE, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 cs1=14, cs2=15,di=17,rw=16,reset = 16
|
||||
//U8GLIB_SSD1306_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new white HalTec OLED)
|
||||
//U8GLIB_SSD1306_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_NO_ACK|U8G_I2C_OPT_FAST); // Fast I2C / TWI
|
||||
//U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send AC
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_ADAFRUIT_128X64 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_128X32 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SSD1306_64X48 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1306_64X48 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_SSD1306_64X48 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SH1106_128X64 u8g(4, 5, 6, 7); // SW SPI Com: SCK = 4, MOSI = 5, CS = 6, A0 = 7 (new blue HalTec OLED)
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_DEV_0|U8G_I2C_OPT_FAST); // Dev 0, Fast I2C / TWI
|
||||
//U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK); // Display which does not send ACK
|
||||
//U8GLIB_SSD1309_128X64 u8g(13, 11, 10, 9); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_SSD1327_96X96_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_SSD1327_96X96_2X_GR u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGM240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGM240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(U8G_I2C_OPT_NONE); // I2C
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(13, 11, 10, 9); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(10, 9); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are SCK = 13 and MOSI = 11)
|
||||
//U8GLIB_UC1611_DOGXL240 u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 3, 17, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, cs=3, di/a0=17,rw=16
|
||||
//U8GLIB_NHD_C12864 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_NHD_C12832 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(13, 11, 10, 9, 8); // SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8); // SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8 (SW SPI Nano Board)
|
||||
//U8GLIB_UC1608_240X64 u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(13, 11, 10, 9, 8); // SW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64 u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_UC1608_240X64_2X u8g(10, 9, 8); // HW SPI Com: SCK = 13, MOSI = 11, CS = 10, A0 = 9, RST = 8
|
||||
//U8GLIB_T6963_240X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X128 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_240X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_T6963_128X64 u8g(8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16); // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7, cs=14, a0=15, wr=17, rd=18, reset=16
|
||||
//U8GLIB_HT1632_24X16 u8g(3, 2, 4); // WR = 3, DATA = 2, CS = 4
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(13, 11, 8, 9, 7); // Arduino UNO: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(76, 75, 8, 9, 7); // Arduino DUE: SW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_332 u8g(8, 9, 7); // Arduino: HW SPI Com: SCK = 13, MOSI = 11, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(76, 75, 8, 9, 7); // Arduino DUE, SW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (http://electronics.ilsoft.co.uk/ArduinoShield.aspx)
|
||||
//U8GLIB_SSD1351_128X128GH_332 u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
//U8GLIB_SSD1351_128X128GH_HICOLOR u8g(8, 9, 7); // Arduino, HW SPI Com: SCK = 76, MOSI = 75, CS = 8, A0 = 9, RESET = 7 (Freetronics OLED)
|
||||
|
||||
#define u8g_logo_width 38
|
||||
#define u8g_logo_height 24
|
||||
//static unsigned char u8g_logo_bits[] = {
|
||||
static unsigned char u8g_logo_bits[] U8G_PROGMEM = {
|
||||
0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xe0, 0xe0,
|
||||
0xff, 0xff, 0x3f, 0xe3, 0xe1, 0xff, 0xff, 0x3f, 0xf3, 0xf1, 0xff, 0xff,
|
||||
0x3f, 0xf3, 0xf1, 0xfe, 0xbf, 0x37, 0xf3, 0x11, 0x1c, 0x1f, 0x30, 0xf3,
|
||||
0x01, 0x08, 0x8c, 0x20, 0xf3, 0x01, 0x00, 0xc0, 0x39, 0xf3, 0x81, 0xc7,
|
||||
0xc1, 0x39, 0xf3, 0xc1, 0xc7, 0xc9, 0x38, 0xf3, 0xc1, 0xc3, 0x19, 0x3c,
|
||||
0xe3, 0x89, 0x01, 0x98, 0x3f, 0xc7, 0x18, 0x00, 0x08, 0x3e, 0x0f, 0x3c,
|
||||
0x70, 0x1c, 0x30, 0x3f, 0xff, 0xfc, 0x87, 0x31, 0xff, 0xff, 0xbf, 0xc7,
|
||||
0x23, 0x01, 0x00, 0x00, 0xc6, 0x23, 0x03, 0x00, 0x00, 0x0e, 0x30, 0xff,
|
||||
0xff, 0x3f, 0x1f, 0x3c, 0xff, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0xff, 0x3f,
|
||||
0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff, 0xff, 0xff, 0xff, 0x3f };
|
||||
|
||||
void draw(void) {
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
u8g.drawXBMP( 0, 0, u8g_logo_width, u8g_logo_height, u8g_logo_bits);
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(500);
|
||||
}
|
||||
|
||||
9
.piolibdeps/U8glib_ID7/library.properties
Normal file
9
.piolibdeps/U8glib_ID7/library.properties
Normal file
@@ -0,0 +1,9 @@
|
||||
name=U8glib
|
||||
version=1.19.1
|
||||
author=oliver <olikraus@gmail.com>
|
||||
maintainer=oliver <olikraus@gmail.com>
|
||||
sentence=A library for monochrome TFTs and OLEDs
|
||||
paragraph=Supported display controller: SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SH1106, UC1601, UC1610, UC1611, UC1701, ST7565, ST7920, KS0108, LC7981, PCD8544, PCF8812, SBN1661, TLS8204, T6963.
|
||||
category=Display
|
||||
url=https://github.com/olikraus/u8glib
|
||||
architectures=avr,sam
|
||||
81
.piolibdeps/U8glib_ID7/license.txt
Normal file
81
.piolibdeps/U8glib_ID7/license.txt
Normal file
@@ -0,0 +1,81 @@
|
||||
|
||||
The U8glib code (http://code.google.com/p/u8glib/) is licensed under the terms of
|
||||
the new-bsd license (two-clause bsd license).
|
||||
See also: http://www.opensource.org/licenses/bsd-license.php
|
||||
|
||||
The repository and optionally the releases contain icons, which are
|
||||
derived from the WPZOOM Developer Icon Set:
|
||||
http://www.wpzoom.com/wpzoom/new-freebie-wpzoom-developer-icon-set-154-free-icons/
|
||||
WPZOOM Developer Icon Set by WPZOOM is licensed under a Creative Commons
|
||||
Attribution-ShareAlike 3.0 Unported License.
|
||||
|
||||
Fonts are licensed under different conditions.
|
||||
See http://code.google.com/p/u8glib/wiki/fontgroup for
|
||||
detailed information on the licensing conditions for each font.
|
||||
|
||||
============ X11 Fonts COUR, HELV, NCEN, TIM, SYMB ============
|
||||
|
||||
For fonts derived from the following files, the license below applies.
|
||||
COURB08.BDF COURB10.BDF COURB12.BDF COURB14.BDF COURB18.BDF
|
||||
COURB24.BDF COURR08.BDF COURR10.BDF COURR12.BDF COURR14.BDF
|
||||
COURR18.BDF COURR24.BDF HELVB08.BDF HELVB10.BDF HELVB12.BDF HELVB14.BDF
|
||||
HELVB18.BDF HELVB24.BDF HELVR08.BDF HELVR10.BDF HELVR12.BDF HELVR14.BDF
|
||||
HELVR18.BDF HELVR24.BDF NCENB08.BDF NCENB10.BDF NCENB12.BDF
|
||||
NCENB14.BDF NCENB18.BDF NCENB24.BDF NCENR08.BDF NCENR10.BDF
|
||||
NCENR12.BDF NCENR14.BDF NCENR18.BDF NCENR24.BDF SYMB08.BDF SYMB10.BDF
|
||||
SYMB12.BDF SYMB14.BDF SYMB18.BDF SYMB24.BDF TIMB08.BDF TIMB10.BDF
|
||||
TIMB12.BDF TIMB14.BDF TIMB18.BDF TIMB24.BDF TIMR08.BDF TIMR10.BDF
|
||||
TIMR12.BDF TIMR14.BDF TIMR18.BDF TIMR24.BDF
|
||||
|
||||
Copyright 1984-1989, 1994 Adobe Systems Incorporated.
|
||||
Copyright 1988, 1994 Digital Equipment Corporation.
|
||||
|
||||
Adobe is a trademark of Adobe Systems Incorporated which may be
|
||||
registered in certain jurisdictions.
|
||||
Permission to use these trademarks is hereby granted only in
|
||||
association with the images described in this file.
|
||||
|
||||
Permission to use, copy, modify, distribute and sell this software
|
||||
and its documentation for any purpose and without fee is hereby
|
||||
granted, provided that the above copyright notices appear in all
|
||||
copies and that both those copyright notices and this permission
|
||||
notice appear in supporting documentation, and that the names of
|
||||
Adobe Systems and Digital Equipment Corporation not be used in
|
||||
advertising or publicity pertaining to distribution of the software
|
||||
without specific, written prior permission. Adobe Systems and
|
||||
Digital Equipment Corporation make no representations about the
|
||||
suitability of this software for any purpose. It is provided "as
|
||||
is" without express or implied warranty.
|
||||
|
||||
|
||||
============ BSD License for U8glib Code ============
|
||||
|
||||
Universal 8bit Graphics Library (http://code.google.com/p/u8glib/)
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
80
.piolibdeps/U8glib_ID7/src/U8glib.cpp
Normal file
80
.piolibdeps/U8glib_ID7/src/U8glib.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
|
||||
U8glib.cpp
|
||||
|
||||
C++ Interface
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "U8glib.h"
|
||||
|
||||
|
||||
#if defined(U8G_WITH_PINLIST)
|
||||
uint8_t U8GLIB::initSPI(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset)
|
||||
{
|
||||
prepare();
|
||||
return u8g_InitSPI(&u8g, dev, sck, mosi, cs, a0, reset);
|
||||
}
|
||||
|
||||
uint8_t U8GLIB::initHWSPI(u8g_dev_t *dev, uint8_t cs, uint8_t a0, uint8_t reset)
|
||||
{
|
||||
prepare();
|
||||
return u8g_InitHWSPI(&u8g, dev, cs, a0, reset);
|
||||
}
|
||||
|
||||
uint8_t U8GLIB::initI2C(u8g_dev_t *dev, uint8_t options)
|
||||
{
|
||||
prepare();
|
||||
return u8g_InitI2C(&u8g, dev, options);
|
||||
}
|
||||
|
||||
uint8_t U8GLIB::init8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
|
||||
uint8_t en, uint8_t cs1, uint8_t cs2, uint8_t di, uint8_t rw, uint8_t reset)
|
||||
{
|
||||
prepare();
|
||||
return u8g_Init8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset);
|
||||
}
|
||||
|
||||
uint8_t U8GLIB::init8BitFixedPort(u8g_dev_t *dev, uint8_t en, uint8_t cs, uint8_t di, uint8_t rw, uint8_t reset)
|
||||
{
|
||||
prepare();
|
||||
return u8g_Init8BitFixedPort(&u8g, dev, en, cs, di, rw, reset);
|
||||
}
|
||||
|
||||
uint8_t U8GLIB::initRW8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
|
||||
uint8_t cs, uint8_t a0, uint8_t wr, uint8_t rd, uint8_t reset)
|
||||
{
|
||||
prepare();
|
||||
return u8g_InitRW8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset);
|
||||
}
|
||||
#endif
|
||||
|
||||
1305
.piolibdeps/U8glib_ID7/src/U8glib.h
Normal file
1305
.piolibdeps/U8glib_ID7/src/U8glib.h
Normal file
File diff suppressed because it is too large
Load Diff
2392
.piolibdeps/U8glib_ID7/src/clib/chessengine.c
Normal file
2392
.piolibdeps/U8glib_ID7/src/clib/chessengine.c
Normal file
File diff suppressed because it is too large
Load Diff
2064
.piolibdeps/U8glib_ID7/src/clib/u8g.h
Normal file
2064
.piolibdeps/U8glib_ID7/src/clib/u8g.h
Normal file
File diff suppressed because it is too large
Load Diff
177
.piolibdeps/U8glib_ID7/src/clib/u8g_bitmap.c
Normal file
177
.piolibdeps/U8glib_ID7/src/clib/u8g_bitmap.c
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
|
||||
u8g_bitmap.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
void u8g_DrawHBitmap(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, const uint8_t *bitmap)
|
||||
{
|
||||
while( cnt > 0 )
|
||||
{
|
||||
u8g_Draw8Pixel(u8g, x, y, 0, *bitmap);
|
||||
bitmap++;
|
||||
cnt--;
|
||||
x+=8;
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawBitmap(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, u8g_uint_t h, const uint8_t *bitmap)
|
||||
{
|
||||
if ( u8g_IsBBXIntersection(u8g, x, y, cnt*8, h) == 0 )
|
||||
return;
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g_DrawHBitmap(u8g, x, y, cnt, bitmap);
|
||||
bitmap += cnt;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void u8g_DrawHBitmapP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, const u8g_pgm_uint8_t *bitmap)
|
||||
{
|
||||
while( cnt > 0 )
|
||||
{
|
||||
u8g_Draw8Pixel(u8g, x, y, 0, u8g_pgm_read(bitmap));
|
||||
bitmap++;
|
||||
cnt--;
|
||||
x+=8;
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawBitmapP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, u8g_uint_t h, const u8g_pgm_uint8_t *bitmap)
|
||||
{
|
||||
if ( u8g_IsBBXIntersection(u8g, x, y, cnt*8, h) == 0 )
|
||||
return;
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g_DrawHBitmapP(u8g, x, y, cnt, bitmap);
|
||||
bitmap += cnt;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
/*=========================================================================*/
|
||||
|
||||
static void u8g_DrawHXBM(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, const uint8_t *bitmap)
|
||||
{
|
||||
uint8_t d;
|
||||
x+=7;
|
||||
while( w >= 8 )
|
||||
{
|
||||
u8g_Draw8Pixel(u8g, x, y, 2, *bitmap);
|
||||
bitmap++;
|
||||
w-= 8;
|
||||
x+=8;
|
||||
}
|
||||
if ( w > 0 )
|
||||
{
|
||||
d = *bitmap;
|
||||
x -= 7;
|
||||
do
|
||||
{
|
||||
if ( d & 1 )
|
||||
u8g_DrawPixel(u8g, x, y);
|
||||
x++;
|
||||
w--;
|
||||
d >>= 1;
|
||||
} while ( w > 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawXBM(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h, const uint8_t *bitmap)
|
||||
{
|
||||
u8g_uint_t b;
|
||||
b = w;
|
||||
b += 7;
|
||||
b >>= 3;
|
||||
|
||||
if ( u8g_IsBBXIntersection(u8g, x, y, w, h) == 0 )
|
||||
return;
|
||||
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g_DrawHXBM(u8g, x, y, w, bitmap);
|
||||
bitmap += b;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
|
||||
static void u8g_DrawHXBMP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, const u8g_pgm_uint8_t *bitmap)
|
||||
{
|
||||
uint8_t d;
|
||||
x+=7;
|
||||
while( w >= 8 )
|
||||
{
|
||||
u8g_Draw8Pixel(u8g, x, y, 2, u8g_pgm_read(bitmap));
|
||||
bitmap++;
|
||||
w-= 8;
|
||||
x+=8;
|
||||
}
|
||||
if ( w > 0 )
|
||||
{
|
||||
d = u8g_pgm_read(bitmap);
|
||||
x -= 7;
|
||||
do
|
||||
{
|
||||
if ( d & 1 )
|
||||
u8g_DrawPixel(u8g, x, y);
|
||||
x++;
|
||||
w--;
|
||||
d >>= 1;
|
||||
} while ( w > 0 );
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawXBMP(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h, const u8g_pgm_uint8_t *bitmap)
|
||||
{
|
||||
u8g_uint_t b;
|
||||
b = w;
|
||||
b += 7;
|
||||
b >>= 3;
|
||||
|
||||
if ( u8g_IsBBXIntersection(u8g, x, y, w, h) == 0 )
|
||||
return;
|
||||
while( h > 0 )
|
||||
{
|
||||
u8g_DrawHXBMP(u8g, x, y, w, bitmap);
|
||||
bitmap += b;
|
||||
y++;
|
||||
h--;
|
||||
}
|
||||
}
|
||||
382
.piolibdeps/U8glib_ID7/src/clib/u8g_circle.c
Normal file
382
.piolibdeps/U8glib_ID7/src/clib/u8g_circle.c
Normal file
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
|
||||
u8g_circle.c
|
||||
|
||||
Utility to draw empty and filled circles.
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, bjthom@gmail.com
|
||||
u8g_DrawCircle & u8g_DrawDisc by olikraus@gmail.com
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Addition to the U8G Library 02/25/12
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#ifdef OLD_CODE
|
||||
|
||||
void circ_upperRight(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0) {
|
||||
u8g_DrawPixel(u8g, x0 + x, y0 - y);
|
||||
u8g_DrawPixel(u8g, x0 + y, y0 - x);
|
||||
}
|
||||
|
||||
void circ_upperLeft(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0) {
|
||||
u8g_DrawPixel(u8g, x0 - x, y0 - y);
|
||||
u8g_DrawPixel(u8g, x0 - y, y0 - x);
|
||||
}
|
||||
|
||||
void circ_lowerRight(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0) {
|
||||
u8g_DrawPixel(u8g, x0 + x, y0 + y);
|
||||
u8g_DrawPixel(u8g, x0 + y, y0 + x);
|
||||
}
|
||||
|
||||
void circ_lowerLeft(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0) {
|
||||
u8g_DrawPixel(u8g, x0 - x, y0 + y);
|
||||
u8g_DrawPixel(u8g, x0 - y, y0 + x);
|
||||
}
|
||||
|
||||
void circ_all(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0) {
|
||||
circ_upperRight(u8g, x, y, x0, y0);
|
||||
circ_upperLeft(u8g, x, y, x0, y0);
|
||||
circ_lowerRight(u8g, x, y, x0, y0);
|
||||
circ_lowerLeft(u8g, x, y, x0, y0);
|
||||
}
|
||||
|
||||
void u8g_DrawEmpCirc(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t option)
|
||||
{
|
||||
if ( u8g_IsBBXIntersection(u8g, x0-rad-1, y0-rad-1, 2*rad+1, 2*rad+1) == 0)
|
||||
return;
|
||||
|
||||
int f = 1 - rad;
|
||||
int ddF_x = 1;
|
||||
int ddF_y = -2*rad;
|
||||
uint8_t x = 0;
|
||||
uint8_t y = rad;
|
||||
|
||||
void ( *circ_util )(u8g_t *, u8g_uint_t, u8g_uint_t, u8g_uint_t, u8g_uint_t);
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case U8G_CIRC_UPPER_RIGHT:
|
||||
u8g_DrawPixel(u8g, x0, y0 - rad);
|
||||
u8g_DrawPixel(u8g, x0 + rad, y0);
|
||||
circ_util = circ_upperRight;
|
||||
break;
|
||||
case U8G_CIRC_UPPER_LEFT:
|
||||
u8g_DrawPixel(u8g, x0, y0 - rad);
|
||||
u8g_DrawPixel(u8g, x0 - rad, y0);
|
||||
circ_util = circ_upperLeft;
|
||||
break;
|
||||
case U8G_CIRC_LOWER_RIGHT:
|
||||
u8g_DrawPixel(u8g, x0, y0 + rad);
|
||||
u8g_DrawPixel(u8g, x0 + rad, y0);
|
||||
circ_util = circ_lowerRight;
|
||||
break;
|
||||
case U8G_CIRC_LOWER_LEFT:
|
||||
u8g_DrawPixel(u8g, x0, y0 + rad);
|
||||
u8g_DrawPixel(u8g, x0 - rad, y0);
|
||||
circ_util = circ_lowerLeft;
|
||||
break;
|
||||
default:
|
||||
case U8G_CIRC_ALL:
|
||||
u8g_DrawPixel(u8g, x0, y0 + rad);
|
||||
u8g_DrawPixel(u8g, x0, y0 - rad);
|
||||
u8g_DrawPixel(u8g, x0 + rad, y0);
|
||||
u8g_DrawPixel(u8g, x0 - rad, y0);
|
||||
circ_util = circ_all;
|
||||
break;
|
||||
}
|
||||
|
||||
while( x < y )
|
||||
{
|
||||
if(f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
f += ddF_y;
|
||||
}
|
||||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x;
|
||||
|
||||
circ_util(u8g, x, y, x0, y0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void u8g_DrawFillCirc(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t option)
|
||||
{
|
||||
if ( u8g_IsBBXIntersection(u8g, x0-rad-1, y0-rad-1, 2*rad+1, 2*rad+1) == 0)
|
||||
return;
|
||||
|
||||
int f = 1 - rad;
|
||||
int ddF_x = 1;
|
||||
int ddF_y = -2*rad;
|
||||
uint8_t x = 0;
|
||||
uint8_t y = rad;
|
||||
|
||||
// Draw vertical diameter at the horiz. center
|
||||
// u8g_DrawVLine(u8g, x0, y0 - rad, 2*rad+1);
|
||||
|
||||
if (option == U8G_CIRC_UPPER_LEFT || option == U8G_CIRC_UPPER_RIGHT) {
|
||||
u8g_DrawVLine(u8g, x0, y0 - rad, rad+1);
|
||||
}
|
||||
else if (option == U8G_CIRC_LOWER_LEFT || option == U8G_CIRC_LOWER_RIGHT) {
|
||||
u8g_DrawVLine(u8g, x0, y0, rad+1);
|
||||
}
|
||||
else {
|
||||
u8g_DrawVLine(u8g, x0, y0 - rad, 2*rad+1);
|
||||
}
|
||||
|
||||
while( x < y )
|
||||
{
|
||||
if(f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
f += ddF_y;
|
||||
}
|
||||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x;
|
||||
|
||||
//Draw vertical lines from one point to another
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case U8G_CIRC_UPPER_RIGHT:
|
||||
u8g_DrawVLine(u8g, x0+x, y0-y, y+1);
|
||||
u8g_DrawVLine(u8g, x0+y, y0-x, x+1);
|
||||
break;
|
||||
case U8G_CIRC_UPPER_LEFT:
|
||||
u8g_DrawVLine(u8g, x0-x, y0-y, y+1);
|
||||
u8g_DrawVLine(u8g, x0-y, y0-x, x+1);
|
||||
break;
|
||||
case U8G_CIRC_LOWER_RIGHT:
|
||||
u8g_DrawVLine(u8g, x0+x, y0, y+1);
|
||||
u8g_DrawVLine(u8g, x0+y, y0, x+1);
|
||||
break;
|
||||
case U8G_CIRC_LOWER_LEFT:
|
||||
u8g_DrawVLine(u8g, x0-x, y0, y+1);
|
||||
u8g_DrawVLine(u8g, x0-y, y0, x+1);
|
||||
break;
|
||||
case U8G_CIRC_ALL:
|
||||
u8g_DrawVLine(u8g, x0+x, y0-y, 2*y+1);
|
||||
u8g_DrawVLine(u8g, x0-x, y0-y, 2*y+1);
|
||||
u8g_DrawVLine(u8g, x0+y, y0-x, 2*x+1);
|
||||
u8g_DrawVLine(u8g, x0-y, y0-x, 2*x+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*=========================================================================*/
|
||||
|
||||
static void u8g_draw_circle_section(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0, uint8_t option) U8G_NOINLINE;
|
||||
|
||||
static void u8g_draw_circle_section(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0, uint8_t option)
|
||||
{
|
||||
/* upper right */
|
||||
if ( option & U8G_DRAW_UPPER_RIGHT )
|
||||
{
|
||||
u8g_DrawPixel(u8g, x0 + x, y0 - y);
|
||||
u8g_DrawPixel(u8g, x0 + y, y0 - x);
|
||||
}
|
||||
|
||||
/* upper left */
|
||||
if ( option & U8G_DRAW_UPPER_LEFT )
|
||||
{
|
||||
u8g_DrawPixel(u8g, x0 - x, y0 - y);
|
||||
u8g_DrawPixel(u8g, x0 - y, y0 - x);
|
||||
}
|
||||
|
||||
/* lower right */
|
||||
if ( option & U8G_DRAW_LOWER_RIGHT )
|
||||
{
|
||||
u8g_DrawPixel(u8g, x0 + x, y0 + y);
|
||||
u8g_DrawPixel(u8g, x0 + y, y0 + x);
|
||||
}
|
||||
|
||||
/* lower left */
|
||||
if ( option & U8G_DRAW_LOWER_LEFT )
|
||||
{
|
||||
u8g_DrawPixel(u8g, x0 - x, y0 + y);
|
||||
u8g_DrawPixel(u8g, x0 - y, y0 + x);
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_draw_circle(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t option)
|
||||
{
|
||||
u8g_int_t f;
|
||||
u8g_int_t ddF_x;
|
||||
u8g_int_t ddF_y;
|
||||
u8g_uint_t x;
|
||||
u8g_uint_t y;
|
||||
|
||||
f = 1;
|
||||
f -= rad;
|
||||
ddF_x = 1;
|
||||
ddF_y = 0;
|
||||
ddF_y -= rad;
|
||||
ddF_y *= 2;
|
||||
x = 0;
|
||||
y = rad;
|
||||
|
||||
u8g_draw_circle_section(u8g, x, y, x0, y0, option);
|
||||
|
||||
while ( x < y )
|
||||
{
|
||||
if (f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
f += ddF_y;
|
||||
}
|
||||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x;
|
||||
|
||||
u8g_draw_circle_section(u8g, x, y, x0, y0, option);
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawCircle(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t option)
|
||||
{
|
||||
/* check for bounding box */
|
||||
{
|
||||
u8g_uint_t radp, radp2;
|
||||
|
||||
radp = rad;
|
||||
radp++;
|
||||
radp2 = radp;
|
||||
radp2 *= 2;
|
||||
|
||||
if ( u8g_IsBBXIntersection(u8g, x0-radp, y0-radp, radp2, radp2) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/* draw circle */
|
||||
u8g_draw_circle(u8g, x0, y0, rad, option);
|
||||
}
|
||||
|
||||
static void u8g_draw_disc_section(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0, uint8_t option) U8G_NOINLINE;
|
||||
|
||||
static void u8g_draw_disc_section(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t x0, u8g_uint_t y0, uint8_t option)
|
||||
{
|
||||
/* upper right */
|
||||
if ( option & U8G_DRAW_UPPER_RIGHT )
|
||||
{
|
||||
u8g_DrawVLine(u8g, x0+x, y0-y, y+1);
|
||||
u8g_DrawVLine(u8g, x0+y, y0-x, x+1);
|
||||
}
|
||||
|
||||
/* upper left */
|
||||
if ( option & U8G_DRAW_UPPER_LEFT )
|
||||
{
|
||||
u8g_DrawVLine(u8g, x0-x, y0-y, y+1);
|
||||
u8g_DrawVLine(u8g, x0-y, y0-x, x+1);
|
||||
}
|
||||
|
||||
/* lower right */
|
||||
if ( option & U8G_DRAW_LOWER_RIGHT )
|
||||
{
|
||||
u8g_DrawVLine(u8g, x0+x, y0, y+1);
|
||||
u8g_DrawVLine(u8g, x0+y, y0, x+1);
|
||||
}
|
||||
|
||||
/* lower left */
|
||||
if ( option & U8G_DRAW_LOWER_LEFT )
|
||||
{
|
||||
u8g_DrawVLine(u8g, x0-x, y0, y+1);
|
||||
u8g_DrawVLine(u8g, x0-y, y0, x+1);
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_draw_disc(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t option)
|
||||
{
|
||||
u8g_int_t f;
|
||||
u8g_int_t ddF_x;
|
||||
u8g_int_t ddF_y;
|
||||
u8g_uint_t x;
|
||||
u8g_uint_t y;
|
||||
|
||||
f = 1;
|
||||
f -= rad;
|
||||
ddF_x = 1;
|
||||
ddF_y = 0;
|
||||
ddF_y -= rad;
|
||||
ddF_y *= 2;
|
||||
x = 0;
|
||||
y = rad;
|
||||
|
||||
u8g_draw_disc_section(u8g, x, y, x0, y0, option);
|
||||
|
||||
while ( x < y )
|
||||
{
|
||||
if (f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddF_y += 2;
|
||||
f += ddF_y;
|
||||
}
|
||||
x++;
|
||||
ddF_x += 2;
|
||||
f += ddF_x;
|
||||
|
||||
u8g_draw_disc_section(u8g, x, y, x0, y0, option);
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawDisc(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t option)
|
||||
{
|
||||
/* check for bounding box */
|
||||
{
|
||||
u8g_uint_t radp, radp2;
|
||||
|
||||
radp = rad;
|
||||
radp++;
|
||||
radp2 = radp;
|
||||
radp2 *= 2;
|
||||
|
||||
if ( u8g_IsBBXIntersection(u8g, x0-radp, y0-radp, radp2, radp2) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/* draw disc */
|
||||
u8g_draw_disc(u8g, x0, y0, rad, option);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
156
.piolibdeps/U8glib_ID7/src/clib/u8g_clip.c
Normal file
156
.piolibdeps/U8glib_ID7/src/clib/u8g_clip.c
Normal file
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
|
||||
u8g_clip.c
|
||||
|
||||
procedures for clipping
|
||||
taken over from procs in u8g_pb.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Notes
|
||||
|
||||
This is one of the most critical parts of u8glib. It must be fast, but still reliable.
|
||||
Based on the intersection program (see tools folder), there is minimized version of
|
||||
the condition for the intersaction test:
|
||||
minimized version
|
||||
---1----0 1 b1 <= a2 && b1 > b2
|
||||
-----1--0 1 b2 >= a1 && b1 > b2
|
||||
---1-1--- 1 b1 <= a2 && b2 >= a1
|
||||
It includes the assumption, that a1 <= a2 is always true (correct, because
|
||||
a1, a2 are the page dimensions.
|
||||
|
||||
The direct implementation of the above result is done in:
|
||||
uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
|
||||
However, this is slower than a decision tree version:
|
||||
static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
|
||||
Also suprising is, that the macro implementation is slower than the inlined version.
|
||||
|
||||
The decision tree is based on the expansion of the truth table.
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define U8G_ALWAYS_INLINE __inline__ __attribute__((always_inline))
|
||||
#else
|
||||
#define U8G_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
/*
|
||||
intersection assumptions:
|
||||
a1 <= a2 is always true
|
||||
|
||||
minimized version
|
||||
---1----0 1 b1 <= a2 && b1 > b2
|
||||
-----1--0 1 b2 >= a1 && b1 > b2
|
||||
---1-1--- 1 b1 <= a2 && b2 >= a1
|
||||
*/
|
||||
|
||||
#ifdef OLD_CODE_WHICH_IS_TOO_SLOW
|
||||
static uint8_t u8g_is_intersection_boolean(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
|
||||
{
|
||||
uint8_t c1, c2, c3, tmp;
|
||||
c1 = v0 <= a1;
|
||||
c2 = v1 >= a0;
|
||||
c3 = v0 > v1;
|
||||
|
||||
tmp = c1;
|
||||
c1 &= c2;
|
||||
c2 &= c3;
|
||||
c3 &= tmp;
|
||||
c1 |= c2;
|
||||
c1 |= c3;
|
||||
return c1 & 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1) ((uint8_t)( (v0) <= (a1) ) ? ( ( (v1) >= (a0) ) ? ( 1 ) : ( (v0) > (v1) ) ) : ( ( (v1) >= (a0) ) ? ( (v0) > (v1) ) : ( 0 ) ))
|
||||
|
||||
//static uint8_t u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1) U8G_ALWAYS_INLINE;
|
||||
static uint8_t U8G_ALWAYS_INLINE u8g_is_intersection_decision_tree(u8g_uint_t a0, u8g_uint_t a1, u8g_uint_t v0, u8g_uint_t v1)
|
||||
{
|
||||
/* surprisingly the macro leads to larger code */
|
||||
/* return U8G_IS_INTERSECTION_MACRO(a0,a1,v0,v1); */
|
||||
if ( v0 <= a1 )
|
||||
{
|
||||
if ( v1 >= a0 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v0 > v1 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( v1 >= a0 )
|
||||
{
|
||||
if ( v0 > v1 )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_IsBBXIntersection(u8g_t *u8g, u8g_uint_t x, u8g_uint_t y, u8g_uint_t w, u8g_uint_t h)
|
||||
{
|
||||
register u8g_uint_t tmp;
|
||||
tmp = y;
|
||||
tmp += h;
|
||||
tmp--;
|
||||
if ( u8g_is_intersection_decision_tree(u8g->current_page.y0, u8g->current_page.y1, y, tmp) == 0 )
|
||||
return 0;
|
||||
|
||||
tmp = x;
|
||||
tmp += w;
|
||||
tmp--;
|
||||
return u8g_is_intersection_decision_tree(u8g->current_page.x0, u8g->current_page.x1, x, tmp);
|
||||
}
|
||||
|
||||
|
||||
173
.piolibdeps/U8glib_ID7/src/clib/u8g_com_api.c
Normal file
173
.piolibdeps/U8glib_ID7/src/clib/u8g_com_api.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
|
||||
u8g_com_api.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
uint8_t u8g_InitCom(u8g_t *u8g, u8g_dev_t *dev, uint8_t clk_cycle_time)
|
||||
{
|
||||
return dev->com_fn(u8g, U8G_COM_MSG_INIT, clk_cycle_time, NULL);
|
||||
}
|
||||
|
||||
void u8g_StopCom(u8g_t *u8g, u8g_dev_t *dev)
|
||||
{
|
||||
dev->com_fn(u8g, U8G_COM_MSG_STOP, 0, NULL);
|
||||
}
|
||||
|
||||
/* cs contains the chip number, which should be enabled */
|
||||
void u8g_SetChipSelect(u8g_t *u8g, u8g_dev_t *dev, uint8_t cs)
|
||||
{
|
||||
dev->com_fn(u8g, U8G_COM_MSG_CHIP_SELECT, cs, NULL);
|
||||
}
|
||||
|
||||
void u8g_SetResetLow(u8g_t *u8g, u8g_dev_t *dev)
|
||||
{
|
||||
dev->com_fn(u8g, U8G_COM_MSG_RESET, 0, NULL);
|
||||
}
|
||||
|
||||
void u8g_SetResetHigh(u8g_t *u8g, u8g_dev_t *dev)
|
||||
{
|
||||
dev->com_fn(u8g, U8G_COM_MSG_RESET, 1, NULL);
|
||||
}
|
||||
|
||||
|
||||
void u8g_SetAddress(u8g_t *u8g, u8g_dev_t *dev, uint8_t address)
|
||||
{
|
||||
dev->com_fn(u8g, U8G_COM_MSG_ADDRESS, address, NULL);
|
||||
}
|
||||
|
||||
uint8_t u8g_WriteByte(u8g_t *u8g, u8g_dev_t *dev, uint8_t val)
|
||||
{
|
||||
return dev->com_fn(u8g, U8G_COM_MSG_WRITE_BYTE, val, NULL);
|
||||
}
|
||||
|
||||
uint8_t u8g_WriteSequence(u8g_t *u8g, u8g_dev_t *dev, uint8_t cnt, uint8_t *seq)
|
||||
{
|
||||
return dev->com_fn(u8g, U8G_COM_MSG_WRITE_SEQ, cnt, seq);
|
||||
}
|
||||
|
||||
uint8_t u8g_WriteSequenceP(u8g_t *u8g, u8g_dev_t *dev, uint8_t cnt, const uint8_t *seq)
|
||||
{
|
||||
return dev->com_fn(u8g, U8G_COM_MSG_WRITE_SEQ_P, cnt, (void *)seq);
|
||||
}
|
||||
|
||||
/*
|
||||
sequence := { direct_value | escape_sequence }
|
||||
direct_value := 0..254
|
||||
escape_sequence := value_255 | sequence_end | delay | adr | cs | not_used
|
||||
value_255 := 255 255
|
||||
sequence_end = 255 254
|
||||
delay := 255 0..127
|
||||
adr := 255 0x0e0 .. 0x0ef
|
||||
cs := 255 0x0d0 .. 0x0df
|
||||
not_used := 255 101..254
|
||||
|
||||
#define U8G_ESC_DLY(x) 255, ((x) & 0x7f)
|
||||
#define U8G_ESC_CS(x) 255, (0xd0 | ((x)&0x0f))
|
||||
#define U8G_ESC_ADR(x) 255, (0xe0 | ((x)&0x0f))
|
||||
#define U8G_ESC_VCC(x) 255, (0xbe | ((x)&0x01))
|
||||
#define U8G_ESC_END 255, 254
|
||||
#define U8G_ESC_255 255, 255
|
||||
#define U8G_ESC_RST(x) 255, (0xc0 | ((x)&0x0f))
|
||||
|
||||
*/
|
||||
uint8_t u8g_WriteEscSeqP(u8g_t *u8g, u8g_dev_t *dev, const uint8_t *esc_seq)
|
||||
{
|
||||
uint8_t is_escape = 0;
|
||||
uint8_t value;
|
||||
for(;;)
|
||||
{
|
||||
value = u8g_pgm_read(esc_seq);
|
||||
if ( is_escape == 0 )
|
||||
{
|
||||
if ( value != 255 )
|
||||
{
|
||||
if ( u8g_WriteByte(u8g, dev, value) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_escape = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( value == 255 )
|
||||
{
|
||||
if ( u8g_WriteByte(u8g, dev, value) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else if ( value == 254 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if ( value >= 0x0f0 )
|
||||
{
|
||||
/* not yet used, do nothing */
|
||||
}
|
||||
else if ( value >= 0xe0 )
|
||||
{
|
||||
u8g_SetAddress(u8g, dev, value & 0x0f);
|
||||
}
|
||||
else if ( value >= 0xd0 )
|
||||
{
|
||||
u8g_SetChipSelect(u8g, dev, value & 0x0f);
|
||||
}
|
||||
else if ( value >= 0xc0 )
|
||||
{
|
||||
u8g_SetResetLow(u8g, dev);
|
||||
value &= 0x0f;
|
||||
value <<= 4;
|
||||
value+=2;
|
||||
u8g_Delay(value);
|
||||
u8g_SetResetHigh(u8g, dev);
|
||||
u8g_Delay(value);
|
||||
}
|
||||
else if ( value >= 0xbe )
|
||||
{
|
||||
/* not yet implemented */
|
||||
/* u8g_SetVCC(u8g, dev, value & 0x01); */
|
||||
}
|
||||
else if ( value <= 127 )
|
||||
{
|
||||
u8g_Delay(value);
|
||||
}
|
||||
is_escape = 0;
|
||||
}
|
||||
esc_seq++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
94
.piolibdeps/U8glib_ID7/src/clib/u8g_com_api_16gr.c
Normal file
94
.piolibdeps/U8glib_ID7/src/clib/u8g_com_api_16gr.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
|
||||
u8g_com_api_16gr.c
|
||||
|
||||
Extension of the com api for devices with 16 graylevels (4 bit per pixel).
|
||||
This should fit to the 8h and 16h architectures (pb8v1, pb8v2, pb16v1, pb16v2),
|
||||
mainly intended for SSD OLEDs
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
/* interpret b as a monochrome bit pattern, write value 15 for high bit and value 0 for a low bit */
|
||||
/* topbit (msb) is sent last */
|
||||
/* example: b = 0x083 will send 0xff, 0x00, 0x00, 0xf0 */
|
||||
uint8_t u8g_WriteByteBWTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t b)
|
||||
{
|
||||
static uint8_t buf[4];
|
||||
static uint8_t map[4] = { 0, 0x00f, 0x0f0, 0x0ff };
|
||||
buf [3] = map[b & 3];
|
||||
b>>=2;
|
||||
buf [2] = map[b & 3];
|
||||
b>>=2;
|
||||
buf [1] = map[b & 3];
|
||||
b>>=2;
|
||||
buf [0] = map[b & 3];
|
||||
return dev->com_fn(u8g, U8G_COM_MSG_WRITE_SEQ, 4, buf);
|
||||
}
|
||||
|
||||
uint8_t u8g_WriteSequenceBWTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t cnt, uint8_t *ptr)
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( u8g_WriteByteBWTo16GrDevice(u8g, dev, *ptr++) == 0 )
|
||||
return 0;
|
||||
cnt--;
|
||||
} while( cnt != 0 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* interpret b as a 4L bit pattern, write values 0x000, 0x004, 0x008, 0x00c */
|
||||
uint8_t u8g_WriteByte4LTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t b)
|
||||
{
|
||||
//static uint8_t map[16] = { 0x000, 0x004, 0x008, 0x00c, 0x040, 0x044, 0x048, 0x04c, 0x080, 0x084, 0x088, 0x08c, 0x0c0, 0x0c4, 0x0c8, 0x0cc};
|
||||
//static uint8_t map[16] = { 0x000, 0x004, 0x00a, 0x00f, 0x040, 0x044, 0x04a, 0x04f, 0x0a0, 0x0a4, 0x0aa, 0x0af, 0x0f0, 0x0f4, 0x0fa, 0x0ff};
|
||||
static uint8_t map[16] = { 0x000, 0x040, 0x0a0, 0x0f0, 0x004, 0x044, 0x0a4, 0x0f4, 0x00a, 0x04a, 0x0aa, 0x0fa, 0x00f, 0x04f, 0x0af, 0x0ff};
|
||||
uint8_t bb;
|
||||
bb = b;
|
||||
bb &= 15;
|
||||
b>>=4;
|
||||
dev->com_fn(u8g, U8G_COM_MSG_WRITE_BYTE, map[bb], NULL);
|
||||
return dev->com_fn(u8g, U8G_COM_MSG_WRITE_BYTE, map[b], NULL);
|
||||
}
|
||||
|
||||
uint8_t u8g_WriteSequence4LTo16GrDevice(u8g_t *u8g, u8g_dev_t *dev, uint8_t cnt, uint8_t *ptr)
|
||||
{
|
||||
do
|
||||
{
|
||||
if ( u8g_WriteByte4LTo16GrDevice(u8g, dev, *ptr++) == 0 )
|
||||
return 0;
|
||||
cnt--;
|
||||
} while( cnt != 0 );
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
|
||||
u8g_arduino_ATtiny85_std_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
// Uses code from tinySPI Written by Nick Gammon
|
||||
// March 2013
|
||||
|
||||
// ATMEL ATTINY45 / ARDUINO pin mappings
|
||||
//
|
||||
// +-\/-+
|
||||
// RESET Ain0 (D 5) PB5 1| |8 Vcc
|
||||
// CLK1 Ain3 (D 3) PB3 2| |7 PB2 (D 2) Ain1 SCK / USCK / SCL
|
||||
// CLK0 Ain2 (D 4) PB4 3| |6 PB1 (D 1) pwm1 MISO / DO
|
||||
// GND 4| |5 PB0 (D 0) pwm0 MOSI / DI / SDA
|
||||
// +----+
|
||||
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
#if defined(ARDUINO) && defined(__AVR_ATtiny85__)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
const byte DI = 0; // D0, pin 5 Data In
|
||||
const byte DO = 1; // D1, pin 6 Data Out (this is *not* MOSI)
|
||||
const byte USCK = 2; // D2, pin 7 Universal Serial Interface clock
|
||||
|
||||
uint8_t u8g_arduino_ATtiny85_spi_out(uint8_t val)
|
||||
{
|
||||
USIDR = val; // byte to output
|
||||
USISR = _BV (USIOIF); // clear Counter Overflow Interrupt Flag, set count to zero
|
||||
do
|
||||
{
|
||||
USICR = _BV (USIWM0) // 3-wire mode
|
||||
| _BV (USICS1) | _BV (USICLK) // Software clock strobe
|
||||
| _BV (USITC); // Toggle Clock Port Pin
|
||||
}
|
||||
while ((USISR & _BV (USIOIF)) == 0); // until Counter Overflow Interrupt Flag set
|
||||
|
||||
return USIDR; // return read data
|
||||
}
|
||||
|
||||
uint8_t u8g_com_arduino_ATtiny85_std_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH); // ensure SS stays high until needed
|
||||
pinMode (USCK, OUTPUT);
|
||||
pinMode (DO, OUTPUT);
|
||||
pinMode (u8g->pin_list[U8G_PI_CS], OUTPUT);
|
||||
pinMode (u8g->pin_list[U8G_PI_A0], OUTPUT);
|
||||
USICR = _BV (USIWM0); // 3-wire mode
|
||||
u8g_MicroDelay();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_MicroDelay();
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_arduino_ATtiny85_spi_out(arg_val);
|
||||
u8g_MicroDelay();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_arduino_ATtiny85_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_arduino_ATtiny85_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
u8g_MicroDelay();
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_ATtiny85_std_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
75
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_common.c
Normal file
75
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_common.c
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_common.c
|
||||
|
||||
shared procedures for the arduino communication procedures
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
void u8g_com_arduino_digital_write(u8g_t *u8g, uint8_t pin_index, uint8_t value)
|
||||
{
|
||||
uint8_t pin;
|
||||
pin = u8g->pin_list[pin_index];
|
||||
if ( pin != U8G_PIN_NONE )
|
||||
digitalWrite(pin, value);
|
||||
}
|
||||
|
||||
/* this procedure does not set the RW pin */
|
||||
void u8g_com_arduino_assign_pin_output_high(u8g_t *u8g)
|
||||
{
|
||||
uint8_t i;
|
||||
/* skip the RW pin, which is the last pin in the list */
|
||||
for( i = 0; i < U8G_PIN_LIST_LEN-1; i++ )
|
||||
{
|
||||
if ( u8g->pin_list[i] != U8G_PIN_NONE )
|
||||
{
|
||||
pinMode(u8g->pin_list[i], OUTPUT);
|
||||
digitalWrite(u8g->pin_list[i], HIGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
254
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_fast_parallel.c
Normal file
254
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_fast_parallel.c
Normal file
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
|
||||
u8g_arduino_fast_parallel.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PIN_D0 8
|
||||
PIN_D1 9
|
||||
PIN_D2 10
|
||||
PIN_D3 11
|
||||
PIN_D4 4
|
||||
PIN_D5 5
|
||||
PIN_D6 6
|
||||
PIN_D7 7
|
||||
|
||||
PIN_CS1 14
|
||||
PIN_CS2 15
|
||||
PIN_RW 16
|
||||
PIN_DI 17
|
||||
PIN_EN 18
|
||||
|
||||
u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
|
||||
u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
//#include <WProgram.h>
|
||||
#include <wiring_private.h>
|
||||
#include <pins_arduino.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define PIN_D0 8
|
||||
#define PIN_D1 9
|
||||
#define PIN_D2 10
|
||||
#define PIN_D3 11
|
||||
#define PIN_D4 4
|
||||
#define PIN_D5 5
|
||||
#define PIN_D6 6
|
||||
#define PIN_D7 7
|
||||
|
||||
#define PIN_CS1 14
|
||||
#define PIN_CS2 15
|
||||
#define PIN_RW 16
|
||||
#define PIN_DI 17
|
||||
#define PIN_EN 18
|
||||
|
||||
//#define PIN_RESET
|
||||
|
||||
|
||||
#if defined(__PIC32MX)
|
||||
/* CHIPKIT PIC32 */
|
||||
static volatile uint32_t *u8g_data_port[8];
|
||||
static uint32_t u8g_data_mask[8];
|
||||
#else
|
||||
static volatile uint8_t *u8g_data_port[8];
|
||||
static uint8_t u8g_data_mask[8];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void u8g_com_arduino_fast_parallel_init(u8g_t *u8g)
|
||||
{
|
||||
u8g_data_port[0] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D0]));
|
||||
u8g_data_mask[0] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D0]);
|
||||
u8g_data_port[1] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D1]));
|
||||
u8g_data_mask[1] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D1]);
|
||||
u8g_data_port[2] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D2]));
|
||||
u8g_data_mask[2] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D2]);
|
||||
u8g_data_port[3] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D3]));
|
||||
u8g_data_mask[3] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D3]);
|
||||
|
||||
u8g_data_port[4] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D4]));
|
||||
u8g_data_mask[4] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D4]);
|
||||
u8g_data_port[5] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D5]));
|
||||
u8g_data_mask[5] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D5]);
|
||||
u8g_data_port[6] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D6]));
|
||||
u8g_data_mask[6] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D6]);
|
||||
u8g_data_port[7] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D7]));
|
||||
u8g_data_mask[7] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);
|
||||
}
|
||||
|
||||
/* atomic protection must be done by calling function */
|
||||
static void u8g_com_arduino_fast_write_data_pin(uint8_t pin, uint8_t val)
|
||||
{
|
||||
if ( val != 0 )
|
||||
*u8g_data_port[pin] |= u8g_data_mask[pin];
|
||||
else
|
||||
*u8g_data_port[pin] &= ~u8g_data_mask[pin];
|
||||
}
|
||||
|
||||
|
||||
void u8g_com_arduino_fast_parallel_write(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
U8G_ATOMIC_START();
|
||||
u8g_com_arduino_fast_write_data_pin( 0, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_fast_write_data_pin( 1, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_fast_write_data_pin( 2, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_fast_write_data_pin( 3, val&1 );
|
||||
val >>= 1;
|
||||
|
||||
u8g_com_arduino_fast_write_data_pin( 4, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_fast_write_data_pin( 5, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_fast_write_data_pin( 6, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_fast_write_data_pin( 7, val&1 );
|
||||
val >>= 1;
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
/* EN cycle time must be 1 micro second */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
|
||||
u8g_MicroDelay(); /* delay by 1000ns, reference: ST7920: 140ns, SBN1661: 100ns */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, LOW);
|
||||
u8g_10MicroDelay(); /* ST7920 commands: 72us */
|
||||
u8g_10MicroDelay(); /* ST7920 commands: 72us */
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_fast_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_fast_parallel_init(u8g);
|
||||
/* setup the RW pin as output and force it to low */
|
||||
if ( u8g->pin_list[U8G_PI_RW] != U8G_PIN_NONE )
|
||||
{
|
||||
pinMode(u8g->pin_list[U8G_PI_RW], OUTPUT);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RW, LOW);
|
||||
}
|
||||
/* set all pins (except RW pin) */
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
}
|
||||
else if ( arg_val == 1 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
}
|
||||
else if ( arg_val == 2 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_fast_parallel_write(u8g, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_fast_parallel_write(u8g, *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_fast_parallel_write(u8g, u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_DI, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_fast_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
438
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_hw_spi.c
Normal file
438
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_hw_spi.c
Normal file
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SPI Clock Cycle Type
|
||||
|
||||
SSD1351 50ns 20 MHz
|
||||
SSD1322 300ns 3.3 MHz
|
||||
SSD1327 300ns
|
||||
SSD1306 300ns
|
||||
ST7565 400ns 2.5 MHz
|
||||
ST7920 400ns
|
||||
|
||||
Arduino DUE
|
||||
|
||||
PA25 MISO
|
||||
PA26 MOSI 75
|
||||
PA27 SCLK 76
|
||||
|
||||
|
||||
typedef struct {
|
||||
WoReg SPI_CR; (Spi Offset: 0x00) Control Register
|
||||
RwReg SPI_MR; (Spi Offset: 0x04) Mode Register
|
||||
RoReg SPI_RDR; (Spi Offset: 0x08) Receive Data Register
|
||||
WoReg SPI_TDR; (Spi Offset: 0x0C) Transmit Data Register
|
||||
RoReg SPI_SR; (Spi Offset: 0x10) Status Register
|
||||
WoReg SPI_IER; (Spi Offset: 0x14) Interrupt Enable Register
|
||||
WoReg SPI_IDR; (Spi Offset: 0x18) Interrupt Disable Register
|
||||
RoReg SPI_IMR; (Spi Offset: 0x1C) Interrupt Mask Register
|
||||
RoReg Reserved1[4];
|
||||
RwReg SPI_CSR[4]; (Spi Offset: 0x30) Chip Select Register
|
||||
RoReg Reserved2[41];
|
||||
RwReg SPI_WPMR; (Spi Offset: 0xE4) Write Protection Control Register
|
||||
RoReg SPI_WPSR; (Spi Offset: 0xE8) Write Protection Status Register
|
||||
} Spi;
|
||||
|
||||
Power Management Controller (PMC)
|
||||
arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/include/instance/instance_pmc.h
|
||||
- enable PIO
|
||||
|
||||
REG_PMC_PCER0 = 1UL << ID_PIOA
|
||||
- enable SPI
|
||||
REG_PMC_PCER0 = 1UL << ID_SPI0
|
||||
|
||||
|
||||
- enable PIOA and SPI0
|
||||
REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
|
||||
|
||||
Parallel Input/Output Controller (PIO)
|
||||
arduino-1.5.2/hardware/arduino/sam/system/CMSIS/Device/ATMEL/sam3xa/include/instance/instance_pioa.h
|
||||
- enable special function of the pin: disable PIO on A26 and A27:
|
||||
REG_PIOA_PDR = 0x0c000000
|
||||
PIOA->PIO_PDR = 0x0c000000
|
||||
|
||||
SPI
|
||||
SPI0->SPI_CR = SPI_CR_SPIDIS
|
||||
SPI0->SPI_CR = SPI_CR_SWRST ;
|
||||
SPI0->SPI_CR = SPI_CR_SWRST ;
|
||||
SPI0->SPI_CR = SPI_CR_SPIEN
|
||||
|
||||
Bit 0: Master Mode = 1 (active)
|
||||
Bit 1: Peripheral Select = 0 (fixed)
|
||||
Bit 2: Chip Select Decode Mode = 1 (4 to 16)
|
||||
Bit 4: Mode Fault Detection = 1 (disabled)
|
||||
Bit 5: Wait Data Read = 0 (disabled)
|
||||
Bit 7: Loop Back Mode = 0 (disabled)
|
||||
Bit 16-19: Peripheral Chip Select = 0 (chip select 0)
|
||||
SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PCSDEC | SPI_MR_MODFDIS
|
||||
|
||||
Bit 0: Clock Polarity = 0
|
||||
Bit 1: Clock Phase = 0
|
||||
Bit 4-7: Bits = 0 (8 Bit)
|
||||
Bit 8-15: SCBR = 1
|
||||
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(x) Serial Baud Rate
|
||||
SCBR / 84000000 > 50 / 1000000000
|
||||
SCBR / 84 > 5 / 100
|
||||
SCBR > 50 *84 / 1000 --> SCBR=5
|
||||
SCBR > 300*84 / 1000 --> SCBR=26
|
||||
SCBR > 400*84 / 1000 --> SCBR=34
|
||||
|
||||
Arduino Due test code:
|
||||
REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
|
||||
REG_PIOA_PDR = 0x0c000000;
|
||||
SPI0->SPI_CR = SPI_CR_SPIDIS;
|
||||
SPI0->SPI_CR = SPI_CR_SWRST;
|
||||
SPI0->SPI_CR = SPI_CR_SWRST;
|
||||
SPI0->SPI_CR = SPI_CR_SPIEN;
|
||||
SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PCSDEC | SPI_MR_MODFDIS;
|
||||
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(30);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
while( (SPI0->SPI_SR & SPI_SR_TDRE) == 0 )
|
||||
;
|
||||
SPI0->SPI_TDR = 0x050;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if defined(__AVR__)
|
||||
#define U8G_ARDUINO_ATMEGA_HW_SPI
|
||||
/* remove the definition for attiny */
|
||||
#if __AVR_ARCH__ == 2
|
||||
#undef U8G_ARDUINO_ATMEGA_HW_SPI
|
||||
#endif
|
||||
#if __AVR_ARCH__ == 25
|
||||
#undef U8G_ARDUINO_ATMEGA_HW_SPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(U8G_ARDUINO_ATMEGA_HW_SPI)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
|
||||
/* fixed pins */
|
||||
#if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__) // Sanguino.cc board
|
||||
#define PIN_SCK 7
|
||||
#define PIN_MISO 6
|
||||
#define PIN_MOSI 5
|
||||
#define PIN_CS 4
|
||||
#else // Arduino Board
|
||||
#define PIN_SCK 13
|
||||
#define PIN_MISO 12
|
||||
#define PIN_MOSI 11
|
||||
#define PIN_CS 10
|
||||
#endif // (__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
|
||||
|
||||
#else
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
/* use Arduino pin definitions */
|
||||
#define PIN_SCK SCK
|
||||
#define PIN_MISO MISO
|
||||
#define PIN_MOSI MOSI
|
||||
#define PIN_CS SS
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//static uint8_t u8g_spi_out(uint8_t data) U8G_NOINLINE;
|
||||
static uint8_t u8g_spi_out(uint8_t data)
|
||||
{
|
||||
/* unsigned char x = 100; */
|
||||
/* send data */
|
||||
SPDR = data;
|
||||
/* wait for transmission */
|
||||
while (!(SPSR & (1<<SPIF)))
|
||||
;
|
||||
/* clear the SPIF flag by reading SPDR */
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
pinMode(PIN_SCK, OUTPUT);
|
||||
digitalWrite(PIN_SCK, LOW);
|
||||
pinMode(PIN_MOSI, OUTPUT);
|
||||
digitalWrite(PIN_MOSI, LOW);
|
||||
/* pinMode(PIN_MISO, INPUT); */
|
||||
|
||||
pinMode(PIN_CS, OUTPUT); /* system chip select for the atmega board */
|
||||
digitalWrite(PIN_CS, HIGH);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
SPR1 SPR0
|
||||
0 0 fclk/4
|
||||
0 1 fclk/16
|
||||
1 0 fclk/64
|
||||
1 1 fclk/128
|
||||
*/
|
||||
SPCR = 0;
|
||||
SPCR = (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);
|
||||
#ifdef U8G_HW_SPI_2X
|
||||
SPSR = (1 << SPI2X); /* double speed, issue 89 */
|
||||
#else
|
||||
if ( arg_val <= U8G_SPI_CLK_CYCLE_50NS )
|
||||
{
|
||||
SPSR = (1 << SPI2X); /* double speed, issue 89 */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_spi_out(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* #elif defined(__18CXX) || defined(__PIC32MX) */
|
||||
|
||||
#elif defined(__SAM3X8E__) // Arduino Due, maybe we should better check for __SAM3X8E__
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
/* use Arduino pin definitions */
|
||||
#define PIN_SCK SCK
|
||||
#define PIN_MISO MISO
|
||||
#define PIN_MOSI MOSI
|
||||
#define PIN_CS SS
|
||||
|
||||
|
||||
static uint8_t u8g_spi_out(uint8_t data)
|
||||
{
|
||||
/* wait until tx register is empty */
|
||||
while( (SPI0->SPI_SR & SPI_SR_TDRE) == 0 )
|
||||
;
|
||||
/* send data */
|
||||
SPI0->SPI_TDR = (uint32_t)data;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
|
||||
/* Arduino Due specific code */
|
||||
|
||||
/* enable PIOA and SPI0 */
|
||||
REG_PMC_PCER0 = (1UL << ID_PIOA) | (1UL << ID_SPI0);
|
||||
|
||||
/* disable PIO on A26 and A27 */
|
||||
REG_PIOA_PDR = 0x0c000000;
|
||||
|
||||
/* reset SPI0 (from sam lib) */
|
||||
SPI0->SPI_CR = SPI_CR_SPIDIS;
|
||||
SPI0->SPI_CR = SPI_CR_SWRST;
|
||||
SPI0->SPI_CR = SPI_CR_SWRST;
|
||||
SPI0->SPI_CR = SPI_CR_SPIEN;
|
||||
u8g_MicroDelay();
|
||||
|
||||
/* master mode, no fault detection, chip select 0 */
|
||||
SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PCSDEC | SPI_MR_MODFDIS;
|
||||
|
||||
/* Polarity, Phase, 8 Bit data transfer, baud rate */
|
||||
/* x * 1000 / 84 --> clock cycle in ns
|
||||
5 * 1000 / 84 = 58 ns
|
||||
SCBR > 50 *84 / 1000 --> SCBR=5
|
||||
SCBR > 300*84 / 1000 --> SCBR=26
|
||||
SCBR > 400*84 / 1000 --> SCBR=34
|
||||
*/
|
||||
|
||||
if ( arg_val <= U8G_SPI_CLK_CYCLE_50NS )
|
||||
{
|
||||
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(5) | 1;
|
||||
}
|
||||
else if ( arg_val <= U8G_SPI_CLK_CYCLE_300NS )
|
||||
{
|
||||
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(26) | 1;
|
||||
}
|
||||
else if ( arg_val <= U8G_SPI_CLK_CYCLE_400NS )
|
||||
{
|
||||
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(34) | 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SPI0->SPI_CSR[0] = SPI_CSR_SCBR(84) | 1;
|
||||
}
|
||||
|
||||
u8g_MicroDelay();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
u8g_MicroDelay();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_MicroDelay(); /* this delay is required to avoid that the display is switched off too early --> DOGS102 with DUE */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_spi_out(arg_val);
|
||||
u8g_MicroDelay();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#else /* U8G_ARDUINO_ATMEGA_HW_SPI */
|
||||
|
||||
#endif /* U8G_ARDUINO_ATMEGA_HW_SPI */
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
159
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_hw_usart_spi.c
Normal file
159
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_hw_usart_spi.c
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_hw_usart_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SPI Clock Cycle Type
|
||||
|
||||
SSD1351 50ns 20 MHz
|
||||
SSD1322 300ns 3.3 MHz
|
||||
SSD1327 300ns
|
||||
SSD1306 300ns
|
||||
ST7565 400ns 2.5 MHz
|
||||
ST7920 400ns
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if defined(__AVR_ATmega32U4__ )
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static uint8_t u8g_usart_spi_out(uint8_t data)
|
||||
{
|
||||
/* send data */
|
||||
UDR1 = data;
|
||||
/* wait for empty transmit buffer */
|
||||
while(!(UCSR1A & (1 << UDRE1)));
|
||||
|
||||
return UDR1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_hw_usart_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
/* SCK is already an output as we overwrite TXLED */
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
|
||||
// Init interface at 2MHz
|
||||
UBRR1 = 0x00;
|
||||
UCSR1C = (1 << UMSEL11) | (1 << UMSEL10);
|
||||
UCSR1B = (1 << TXEN1);
|
||||
UBRR1 = 3;
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_usart_spi_out(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_usart_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_usart_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* #elif defined(__18CXX) || defined(__PIC32MX) */
|
||||
/* #elif defined(__arm__) // Arduino Due, maybe we should better check for __SAM3X8E__ */
|
||||
|
||||
#else /* __AVR_ATmega32U4__ */
|
||||
|
||||
#endif /* __AVR_ATmega32U4__ */
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_hw_usart_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
234
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_no_en_parallel.c
Normal file
234
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_no_en_parallel.c
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
|
||||
u8g_arduino_no_en_parallel.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PIN_D0 8
|
||||
PIN_D1 9
|
||||
PIN_D2 10
|
||||
PIN_D3 11
|
||||
PIN_D4 4
|
||||
PIN_D5 5
|
||||
PIN_D6 6
|
||||
PIN_D7 7
|
||||
|
||||
PIN_CS1 14
|
||||
PIN_CS2 15
|
||||
PIN_RW 16
|
||||
PIN_DI 17
|
||||
PIN_EN 18
|
||||
|
||||
u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
|
||||
u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
//#include <WProgram.h>
|
||||
#include <wiring_private.h>
|
||||
#include <pins_arduino.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
//#define PIN_RESET
|
||||
|
||||
#if defined(__PIC32MX)
|
||||
/* CHIPKIT PIC32 */
|
||||
static volatile uint32_t *u8g_data_port[8];
|
||||
static uint32_t u8g_data_mask[8];
|
||||
#else
|
||||
static volatile uint8_t *u8g_data_port[8];
|
||||
static uint8_t u8g_data_mask[8];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void u8g_com_arduino_no_en_parallel_init(u8g_t *u8g)
|
||||
{
|
||||
u8g_data_port[0] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D0]));
|
||||
u8g_data_mask[0] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D0]);
|
||||
u8g_data_port[1] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D1]));
|
||||
u8g_data_mask[1] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D1]);
|
||||
u8g_data_port[2] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D2]));
|
||||
u8g_data_mask[2] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D2]);
|
||||
u8g_data_port[3] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D3]));
|
||||
u8g_data_mask[3] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D3]);
|
||||
|
||||
u8g_data_port[4] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D4]));
|
||||
u8g_data_mask[4] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D4]);
|
||||
u8g_data_port[5] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D5]));
|
||||
u8g_data_mask[5] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D5]);
|
||||
u8g_data_port[6] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D6]));
|
||||
u8g_data_mask[6] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D6]);
|
||||
u8g_data_port[7] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D7]));
|
||||
u8g_data_mask[7] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);
|
||||
}
|
||||
|
||||
/* No atomic protcetion. This is done by caller */
|
||||
static void u8g_com_arduino_no_en_write_data_pin(uint8_t pin, uint8_t val)
|
||||
{
|
||||
if ( val != 0 )
|
||||
{
|
||||
*u8g_data_port[pin] |= u8g_data_mask[pin];
|
||||
}
|
||||
else
|
||||
{
|
||||
*u8g_data_port[pin] &= ~u8g_data_mask[pin];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void u8g_com_arduino_no_en_parallel_write(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
U8G_ATOMIC_START();
|
||||
u8g_com_arduino_no_en_write_data_pin( 0, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_no_en_write_data_pin( 1, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_no_en_write_data_pin( 2, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_no_en_write_data_pin( 3, val&1 );
|
||||
val >>= 1;
|
||||
|
||||
u8g_com_arduino_no_en_write_data_pin( 4, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_no_en_write_data_pin( 5, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_no_en_write_data_pin( 6, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_no_en_write_data_pin( 7, val&1 );
|
||||
val >>= 1;
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
/* EN cycle time must be 1 micro second, digitalWrite is slow enough to do this */
|
||||
if ( u8g->pin_list[U8G_PI_CS_STATE] == 1 )
|
||||
{
|
||||
u8g_MicroDelay();
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_MicroDelay();
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
else if ( u8g->pin_list[U8G_PI_CS_STATE] == 2 )
|
||||
{
|
||||
u8g_MicroDelay();
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
u8g_MicroDelay();
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_no_en_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_no_en_parallel_init(u8g);
|
||||
/* setup the RW pin as output and force it to low */
|
||||
if ( u8g->pin_list[U8G_PI_RW] != U8G_PIN_NONE )
|
||||
{
|
||||
pinMode(u8g->pin_list[U8G_PI_RW], OUTPUT);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RW, LOW);
|
||||
}
|
||||
/* set all pins (except RW pin) */
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
/*
|
||||
0: nothing selected
|
||||
1: CS1 will be used as enable line
|
||||
2: CS2 will be used as enable line
|
||||
this will be used in the u8g_com_arduino_no_en_parallel_write() procedure
|
||||
*/
|
||||
u8g->pin_list[U8G_PI_CS_STATE] = arg_val;
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_no_en_parallel_write(u8g, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_no_en_parallel_write(u8g, *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_no_en_parallel_write(u8g, u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_DI, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_no_en_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
184
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_parallel.c
Normal file
184
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_parallel.c
Normal file
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_parallel.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
PIN_D0 8
|
||||
PIN_D1 9
|
||||
PIN_D2 10
|
||||
PIN_D3 11
|
||||
PIN_D4 4
|
||||
PIN_D5 5
|
||||
PIN_D6 6
|
||||
PIN_D7 7
|
||||
|
||||
PIN_CS1 14
|
||||
PIN_CS2 15
|
||||
PIN_RW 16
|
||||
PIN_DI 17
|
||||
PIN_EN 18
|
||||
|
||||
u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
|
||||
u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void u8g_com_arduino_parallel_write(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D0, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D1, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D2, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D3, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D4, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D5, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D6, val&1);
|
||||
val >>= 1;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_D7, val&1);
|
||||
|
||||
/* EN cycle time must be 1 micro second, digitalWrite is slow enough to do this */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
|
||||
u8g_MicroDelay(); /* delay by 1000ns, reference: ST7920: 140ns, SBN1661: 100ns */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, LOW);
|
||||
u8g_10MicroDelay(); /* ST7920 commands: 72us */
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
/* setup the RW pin as output and force it to low */
|
||||
if ( u8g->pin_list[U8G_PI_RW] != U8G_PIN_NONE )
|
||||
{
|
||||
pinMode(u8g->pin_list[U8G_PI_RW], OUTPUT);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RW, LOW);
|
||||
}
|
||||
/* set all pins (except RW pin) */
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
}
|
||||
else if ( arg_val == 1 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
}
|
||||
else if ( arg_val == 2 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_parallel_write(u8g, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_parallel_write(u8g, *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_parallel_write(u8g, u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_DI, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
177
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_port_d_wr.c
Normal file
177
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_port_d_wr.c
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
|
||||
u8g_arduino_port_d_wr.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Assumes PORTD for 8 bit data transfer.
|
||||
EN is assumed to be a low active write signal (WR)
|
||||
|
||||
ILI9325D_320x240 from iteadstudio.com
|
||||
RS=19, WR=18, CS=17, RST=16
|
||||
|
||||
|
||||
u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
|
||||
u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
|
||||
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
#if defined(ARDUINO) && defined(PORTD)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void u8g_com_arduino_port_d_8bit_wr(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
PORTD = val;
|
||||
|
||||
/* WR cycle time must be 1 micro second, digitalWrite is slow enough to do this */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_port_d_wr_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
|
||||
#ifdef UCSR0B
|
||||
UCSR0B = 0; // disable USART 0
|
||||
#endif
|
||||
U8G_ATOMIC_START();
|
||||
DDRD = 0x0ff;
|
||||
PORTD = 0x0ff;
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
/* setup the RW pin as output and force it to low */
|
||||
if ( u8g->pin_list[U8G_PI_RW] != U8G_PIN_NONE )
|
||||
{
|
||||
pinMode(u8g->pin_list[U8G_PI_RW], OUTPUT);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RW, HIGH);
|
||||
}
|
||||
/* set all pins (except RW pin) */
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_EN, HIGH);
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
}
|
||||
else if ( arg_val == 1 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, HIGH);
|
||||
}
|
||||
else if ( arg_val == 2 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS1, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS2, LOW);
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_port_d_8bit_wr(u8g, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_port_d_8bit_wr(u8g, *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_port_d_8bit_wr(u8g, u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_DI, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_port_d_wr_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO && PORTD */
|
||||
|
||||
212
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_ssd_i2c.c
Normal file
212
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_ssd_i2c.c
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_ssd_i2c.c
|
||||
|
||||
com interface for arduino (AND atmega) and the SSDxxxx chip (SOLOMON) variant
|
||||
I2C protocol
|
||||
|
||||
ToDo: Rename this to u8g_com_avr_ssd_i2c.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Special pin usage:
|
||||
U8G_PI_I2C_OPTION additional options
|
||||
U8G_PI_A0_STATE used to store the last value of the command/data register selection
|
||||
U8G_PI_SET_A0 1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
|
||||
U8G_PI_SCL clock line (NOT USED)
|
||||
U8G_PI_SDA data line (NOT USED)
|
||||
|
||||
U8G_PI_RESET reset line (currently disabled, see below)
|
||||
|
||||
Protocol:
|
||||
SLA, Cmd/Data Selection, Arguments
|
||||
The command/data register is selected by a special instruction byte, which is sent after SLA
|
||||
|
||||
The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(U8G_WITH_PINLIST)
|
||||
|
||||
|
||||
#define I2C_SLA (0x3c*2)
|
||||
//#define I2C_CMD_MODE 0x080
|
||||
#define I2C_CMD_MODE 0x000
|
||||
#define I2C_DATA_MODE 0x040
|
||||
|
||||
uint8_t u8g_com_arduino_ssd_start_sequence(u8g_t *u8g)
|
||||
{
|
||||
/* are we requested to set the a0 state? */
|
||||
if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
|
||||
return 1;
|
||||
|
||||
/* setup bus, might be a repeated start */
|
||||
if ( u8g_i2c_start(I2C_SLA) == 0 )
|
||||
return 0;
|
||||
if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_arduino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: unknown mode */
|
||||
|
||||
u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
/* Currently disabled, but it could be enable. Previous restrictions have been removed */
|
||||
/* u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0;
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again, also forces start condition */
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable chip, send stop condition */
|
||||
u8g_i2c_stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable, do nothing: any byte writing will trigger the i2c start */
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_arduino_ssd_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
if ( u8g_i2c_send_byte(arg_val) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_arduino_ssd_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(*ptr++) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_arduino_ssd_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 )
|
||||
return 0;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again */
|
||||
|
||||
#ifdef OLD_CODE
|
||||
if ( i2c_state != 0 )
|
||||
{
|
||||
u8g_i2c_stop();
|
||||
i2c_state = 0;
|
||||
}
|
||||
|
||||
if ( u8g_com_arduino_ssd_start_sequence(arg_val) == 0 )
|
||||
return 0;
|
||||
|
||||
/* setup bus, might be a repeated start */
|
||||
/*
|
||||
if ( u8g_i2c_start(I2C_SLA) == 0 )
|
||||
return 0;
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
i2c_state = 1;
|
||||
|
||||
if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i2c_state = 2;
|
||||
if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* defined(U8G_WITH_PINLIST) */
|
||||
|
||||
uint8_t u8g_com_arduino_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* defined(U8G_WITH_PINLIST) */
|
||||
|
||||
330
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_st7920_custom.c
Normal file
330
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_st7920_custom.c
Normal file
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_st7920_custom.c
|
||||
|
||||
Additional COM device, initially introduced for 3D Printer community
|
||||
Implements a fast SW SPI com subsystem
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special SPI interface for ST7920 controller
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#include "wiring_private.h"
|
||||
#endif
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
static uint8_t u8g_bitData, u8g_bitNotData;
|
||||
static uint8_t u8g_bitClock, u8g_bitNotClock;
|
||||
static volatile uint8_t *u8g_outData;
|
||||
static volatile uint8_t *u8g_outClock;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
u8g_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
u8g_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
u8g_bitData = digitalPinToBitMask(dataPin);
|
||||
u8g_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
u8g_bitNotClock = u8g_bitClock;
|
||||
u8g_bitNotClock ^= 0x0ff;
|
||||
|
||||
u8g_bitNotData = u8g_bitData;
|
||||
u8g_bitNotData ^= 0x0ff;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
uint8_t bitData = u8g_bitData;
|
||||
uint8_t bitNotData = u8g_bitNotData;
|
||||
uint8_t bitClock = u8g_bitClock;
|
||||
uint8_t bitNotClock = u8g_bitNotClock;
|
||||
volatile uint8_t *outData = u8g_outData;
|
||||
volatile uint8_t *outClock = u8g_outClock;
|
||||
|
||||
|
||||
U8G_ATOMIC_START();
|
||||
bitData |= *outData;
|
||||
bitNotData &= *outData;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
*outData = bitData;
|
||||
else
|
||||
*outData = bitNotData;
|
||||
|
||||
/*
|
||||
*outClock |= bitClock;
|
||||
val <<= 1;
|
||||
cnt--;
|
||||
*outClock &= bitNotClock;
|
||||
*/
|
||||
|
||||
val <<= 1;
|
||||
*outClock &= bitNotClock;
|
||||
cnt--;
|
||||
// removed micro delays, because AVRs are too slow and the delay is not required
|
||||
//u8g_MicroDelay();
|
||||
*outClock |= bitClock;
|
||||
//u8g_MicroDelay();
|
||||
} while( cnt != 0 );
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
#elif defined(__18CXX) || defined(__PIC32MX)
|
||||
|
||||
uint16_t dog_bitData, dog_bitNotData;
|
||||
uint16_t dog_bitClock, dog_bitNotClock;
|
||||
volatile uint32_t *dog_outData;
|
||||
volatile uint32_t *dog_outClock;
|
||||
volatile uint32_t dog_pic32_spi_tmp;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
dog_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
dog_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
dog_bitData = digitalPinToBitMask(dataPin);
|
||||
dog_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
dog_bitNotClock = dog_bitClock;
|
||||
dog_bitNotClock ^= 0x0ffff;
|
||||
|
||||
dog_bitNotData = dog_bitData;
|
||||
dog_bitNotData ^= 0x0ffff;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
U8G_ATOMIC_START();
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
*dog_outData |= dog_bitData;
|
||||
else
|
||||
*dog_outData &= dog_bitNotData;
|
||||
val <<= 1;
|
||||
//u8g_MicroDelay();
|
||||
//*dog_outClock |= dog_bitClock;
|
||||
*dog_outClock &= dog_bitNotClock;
|
||||
cnt--;
|
||||
u8g_MicroDelay();
|
||||
//*dog_outClock &= dog_bitNotClock;
|
||||
*dog_outClock |= dog_bitClock;
|
||||
u8g_MicroDelay();
|
||||
|
||||
} while( cnt != 0 );
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* default interface, Arduino DUE (__arm__) */
|
||||
|
||||
uint8_t u8g_data_custom_pin;
|
||||
uint8_t u8g_clock_custom_pin;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
u8g_data_custom_pin = dataPin;
|
||||
u8g_clock_custom_pin = clockPin;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
digitalWrite(u8g_data_custom_pin, HIGH);
|
||||
else
|
||||
digitalWrite(u8g_data_custom_pin, LOW);
|
||||
val <<= 1;
|
||||
//u8g_MicroDelay();
|
||||
digitalWrite(u8g_clock_custom_pin, LOW);
|
||||
cnt--;
|
||||
u8g_MicroDelay();
|
||||
digitalWrite(u8g_clock_custom_pin, HIGH);
|
||||
u8g_MicroDelay();
|
||||
} while( cnt != 0 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void u8g_com_arduino_st7920_write_byte_seq(uint8_t rs, uint8_t *ptr, uint8_t len)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0fa);
|
||||
}
|
||||
|
||||
while( len > 0 )
|
||||
{
|
||||
u8g_com_arduino_do_shift_out_msb_first(*ptr & 0x0f0);
|
||||
u8g_com_arduino_do_shift_out_msb_first(*ptr << 4);
|
||||
ptr++;
|
||||
len--;
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_st7920_write_byte(uint8_t rs, uint8_t val)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0fa);
|
||||
}
|
||||
|
||||
u8g_com_arduino_do_shift_out_msb_first(val & 0x0f0);
|
||||
u8g_com_arduino_do_shift_out_msb_first(val << 4);
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_custom_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
// u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, LOW);
|
||||
u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, note: the st7920 has an active high chip select */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_st7920_write_byte( u8g->pin_list[U8G_PI_A0_STATE], arg_val);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
//u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
u8g_com_arduino_st7920_write_byte_seq(u8g->pin_list[U8G_PI_A0_STATE], (uint8_t *)arg_ptr, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_st7920_write_byte(u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr) );
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_custom_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
293
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_st7920_hw_spi.c
Normal file
293
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_st7920_hw_spi.c
Normal file
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_st7920_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special HW SPI interface for ST7920 controller
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#include "wiring_private.h"
|
||||
#endif
|
||||
|
||||
#if defined(__AVR__)
|
||||
#define U8G_ARDUINO_ATMEGA_HW_SPI
|
||||
|
||||
/* remove the definition for attiny */
|
||||
#if __AVR_ARCH__ == 2
|
||||
#undef U8G_ARDUINO_ATMEGA_HW_SPI
|
||||
#endif
|
||||
#if __AVR_ARCH__ == 25
|
||||
#undef U8G_ARDUINO_ATMEGA_HW_SPI
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(U8G_ARDUINO_ATMEGA_HW_SPI)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
#if ARDUINO < 100
|
||||
|
||||
/* fixed pins */
|
||||
#if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__) // Sanguino.cc board
|
||||
#define PIN_SCK 7
|
||||
#define PIN_MISO 6
|
||||
#define PIN_MOSI 5
|
||||
#define PIN_CS 4
|
||||
#else // Arduino Board
|
||||
#define PIN_SCK 13
|
||||
#define PIN_MISO 12
|
||||
#define PIN_MOSI 11
|
||||
#define PIN_CS 10
|
||||
#endif // (__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
|
||||
|
||||
#else
|
||||
|
||||
/* use Arduino pin definitions */
|
||||
#define PIN_SCK SCK
|
||||
#define PIN_MISO MISO
|
||||
#define PIN_MOSI MOSI
|
||||
#define PIN_CS SS
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static uint8_t u8g_arduino_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
|
||||
static uint8_t u8g_arduino_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
/* send data */
|
||||
SPDR = val;
|
||||
/* wait for transmission */
|
||||
while (!(SPSR & (1<<SPIF)))
|
||||
;
|
||||
/* clear the SPIF flag by reading SPDR */
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
|
||||
static void u8g_com_arduino_st7920_write_byte_hw_spi_seq(u8g_t *u8g, uint8_t rs, uint8_t *ptr, uint8_t len)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, 0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, 0x0fa);
|
||||
}
|
||||
|
||||
while( len > 0 )
|
||||
{
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, *ptr & 0x0f0);
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, *ptr << 4);
|
||||
ptr++;
|
||||
len--;
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_arduino_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, 0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, 0x0fa);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* do nothing, keep same state */
|
||||
}
|
||||
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, val & 0x0f0);
|
||||
u8g_arduino_st7920_hw_spi_shift_out(u8g, val << 4);
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
|
||||
|
||||
/* code from u8g_com-arduino_hw_spi.c */
|
||||
pinMode(PIN_SCK, OUTPUT);
|
||||
digitalWrite(PIN_SCK, LOW);
|
||||
pinMode(PIN_MOSI, OUTPUT);
|
||||
digitalWrite(PIN_MOSI, LOW);
|
||||
/* pinMode(PIN_MISO, INPUT); */
|
||||
|
||||
pinMode(PIN_CS, OUTPUT); /* system chip select for the atmega board */
|
||||
digitalWrite(PIN_CS, HIGH);
|
||||
|
||||
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
|
||||
#ifdef OBSOLETE
|
||||
DDRB |= _BV(3); /* D0, MOSI */
|
||||
DDRB |= _BV(5); /* SCK */
|
||||
DDRB |= _BV(2); /* slave select */
|
||||
|
||||
PORTB &= ~_BV(3); /* D0, MOSI = 0 */
|
||||
PORTB &= ~_BV(5); /* SCK = 0 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
SPR1 SPR0
|
||||
0 0 fclk/4
|
||||
0 1 fclk/16
|
||||
1 0 fclk/64
|
||||
1 1 fclk/128
|
||||
*/
|
||||
SPCR = 0;
|
||||
|
||||
/* 20 Dez 2012: set CPOL and CPHA to 1 !!! */
|
||||
SPCR = (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);
|
||||
#ifdef U8G_HW_SPI_2X
|
||||
SPSR = (1 << SPI2X); /* double speed, issue 89 */
|
||||
#endif
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, note: the st7920 has an active high chip select */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], arg_val);
|
||||
// u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
//u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
u8g_com_arduino_st7920_write_byte_hw_spi_seq(u8g, u8g->pin_list[U8G_PI_A0_STATE], (uint8_t *)arg_ptr, arg_val);
|
||||
/*
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr) );
|
||||
// u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
330
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_st7920_spi.c
Normal file
330
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_st7920_spi.c
Normal file
@@ -0,0 +1,330 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_st7920_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special SPI interface for ST7920 controller
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#include "wiring_private.h"
|
||||
#endif
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
static uint8_t u8g_bitData, u8g_bitNotData;
|
||||
static uint8_t u8g_bitClock, u8g_bitNotClock;
|
||||
static volatile uint8_t *u8g_outData;
|
||||
static volatile uint8_t *u8g_outClock;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
u8g_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
u8g_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
u8g_bitData = digitalPinToBitMask(dataPin);
|
||||
u8g_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
u8g_bitNotClock = u8g_bitClock;
|
||||
u8g_bitNotClock ^= 0x0ff;
|
||||
|
||||
u8g_bitNotData = u8g_bitData;
|
||||
u8g_bitNotData ^= 0x0ff;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
uint8_t bitData = u8g_bitData;
|
||||
uint8_t bitNotData = u8g_bitNotData;
|
||||
uint8_t bitClock = u8g_bitClock;
|
||||
uint8_t bitNotClock = u8g_bitNotClock;
|
||||
volatile uint8_t *outData = u8g_outData;
|
||||
volatile uint8_t *outClock = u8g_outClock;
|
||||
|
||||
|
||||
U8G_ATOMIC_START();
|
||||
bitData |= *outData;
|
||||
bitNotData &= *outData;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
*outData = bitData;
|
||||
else
|
||||
*outData = bitNotData;
|
||||
|
||||
/*
|
||||
*outClock |= bitClock;
|
||||
val <<= 1;
|
||||
cnt--;
|
||||
*outClock &= bitNotClock;
|
||||
*/
|
||||
|
||||
val <<= 1;
|
||||
*outClock &= bitNotClock;
|
||||
cnt--;
|
||||
// removed micro delays, because AVRs are too slow and the delay is not required
|
||||
//u8g_MicroDelay();
|
||||
*outClock |= bitClock;
|
||||
//u8g_MicroDelay();
|
||||
} while( cnt != 0 );
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
#elif defined(__18CXX) || defined(__PIC32MX)
|
||||
|
||||
uint16_t dog_bitData, dog_bitNotData;
|
||||
uint16_t dog_bitClock, dog_bitNotClock;
|
||||
volatile uint32_t *dog_outData;
|
||||
volatile uint32_t *dog_outClock;
|
||||
volatile uint32_t dog_pic32_spi_tmp;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
dog_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
dog_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
dog_bitData = digitalPinToBitMask(dataPin);
|
||||
dog_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
dog_bitNotClock = dog_bitClock;
|
||||
dog_bitNotClock ^= 0x0ffff;
|
||||
|
||||
dog_bitNotData = dog_bitData;
|
||||
dog_bitNotData ^= 0x0ffff;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
U8G_ATOMIC_START();
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
*dog_outData |= dog_bitData;
|
||||
else
|
||||
*dog_outData &= dog_bitNotData;
|
||||
val <<= 1;
|
||||
//u8g_MicroDelay();
|
||||
//*dog_outClock |= dog_bitClock;
|
||||
*dog_outClock &= dog_bitNotClock;
|
||||
cnt--;
|
||||
u8g_MicroDelay();
|
||||
//*dog_outClock &= dog_bitNotClock;
|
||||
*dog_outClock |= dog_bitClock;
|
||||
u8g_MicroDelay();
|
||||
|
||||
} while( cnt != 0 );
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* default interface, Arduino DUE (__arm__) */
|
||||
|
||||
uint8_t u8g_data_pin;
|
||||
uint8_t u8g_clock_pin;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
u8g_data_pin = dataPin;
|
||||
u8g_clock_pin = clockPin;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
digitalWrite(u8g_data_pin, HIGH);
|
||||
else
|
||||
digitalWrite(u8g_data_pin, LOW);
|
||||
val <<= 1;
|
||||
//u8g_MicroDelay();
|
||||
digitalWrite(u8g_clock_pin, LOW);
|
||||
cnt--;
|
||||
u8g_MicroDelay();
|
||||
digitalWrite(u8g_clock_pin, HIGH);
|
||||
u8g_MicroDelay();
|
||||
} while( cnt != 0 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void u8g_com_arduino_st7920_write_byte_seq(uint8_t rs, uint8_t *ptr, uint8_t len)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0fa);
|
||||
}
|
||||
|
||||
while( len > 0 )
|
||||
{
|
||||
u8g_com_arduino_do_shift_out_msb_first(*ptr & 0x0f0);
|
||||
u8g_com_arduino_do_shift_out_msb_first(*ptr << 4);
|
||||
ptr++;
|
||||
len--;
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_st7920_write_byte(uint8_t rs, uint8_t val)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_com_arduino_do_shift_out_msb_first(0x0fa);
|
||||
}
|
||||
|
||||
u8g_com_arduino_do_shift_out_msb_first(val & 0x0f0);
|
||||
u8g_com_arduino_do_shift_out_msb_first(val << 4);
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
// u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, LOW);
|
||||
u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, note: the st7920 has an active high chip select */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, HIGH);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
/* 28 Dec 2013 reassign pins, fixes issue with more than one display */
|
||||
/* issue 227 */
|
||||
u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_st7920_write_byte( u8g->pin_list[U8G_PI_A0_STATE], arg_val);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
//u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
u8g_com_arduino_st7920_write_byte_seq(u8g->pin_list[U8G_PI_A0_STATE], (uint8_t *)arg_ptr, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_st7920_write_byte(u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr) );
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_st7920_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
143
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_std_sw_spi.c
Normal file
143
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_std_sw_spi.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
|
||||
u8g_arduino_std_sw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
void u8g_arduino_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val)
|
||||
{
|
||||
uint8_t i = 8;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
digitalWrite(dataPin, HIGH);
|
||||
else
|
||||
digitalWrite(dataPin, LOW);
|
||||
val <<= 1;
|
||||
u8g_MicroDelay(); /* 23 Sep 2012 */
|
||||
//delay(1);
|
||||
digitalWrite(clockPin, HIGH);
|
||||
u8g_MicroDelay(); /* 23 Sep 2012 */
|
||||
//delay(1);
|
||||
digitalWrite(clockPin, LOW);
|
||||
u8g_MicroDelay(); /* 23 Sep 2012 */
|
||||
//delay(1);
|
||||
i--;
|
||||
} while( i != 0 );
|
||||
}
|
||||
|
||||
uint8_t u8g_com_arduino_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, LOW);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
301
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_sw_spi.c
Normal file
301
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_sw_spi.c
Normal file
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
|
||||
u8g_arduino_sw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#include "wiring_private.h"
|
||||
#endif
|
||||
|
||||
/*=========================================================*/
|
||||
/* Arduino, AVR */
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
uint8_t u8g_bitData, u8g_bitNotData;
|
||||
uint8_t u8g_bitClock, u8g_bitNotClock;
|
||||
volatile uint8_t *u8g_outData;
|
||||
volatile uint8_t *u8g_outClock;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
u8g_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
u8g_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
u8g_bitData = digitalPinToBitMask(dataPin);
|
||||
u8g_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
u8g_bitNotClock = u8g_bitClock;
|
||||
u8g_bitNotClock ^= 0x0ff;
|
||||
|
||||
u8g_bitNotData = u8g_bitData;
|
||||
u8g_bitNotData ^= 0x0ff;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
uint8_t bitData = u8g_bitData;
|
||||
uint8_t bitNotData = u8g_bitNotData;
|
||||
uint8_t bitClock = u8g_bitClock;
|
||||
uint8_t bitNotClock = u8g_bitNotClock;
|
||||
volatile uint8_t *outData = u8g_outData;
|
||||
volatile uint8_t *outClock = u8g_outClock;
|
||||
U8G_ATOMIC_START();
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
*outData |= bitData;
|
||||
else
|
||||
*outData &= bitNotData;
|
||||
|
||||
*outClock |= bitClock;
|
||||
val <<= 1;
|
||||
cnt--;
|
||||
*outClock &= bitNotClock;
|
||||
} while( cnt != 0 );
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
/*=========================================================*/
|
||||
/* Arduino, Chipkit */
|
||||
#elif defined(__18CXX) || defined(__PIC32MX)
|
||||
|
||||
uint16_t dog_bitData, dog_bitNotData;
|
||||
uint16_t dog_bitClock, dog_bitNotClock;
|
||||
volatile uint32_t *dog_outData;
|
||||
volatile uint32_t *dog_outClock;
|
||||
volatile uint32_t dog_pic32_spi_tmp;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
dog_outData = portOutputRegister(digitalPinToPort(dataPin));
|
||||
dog_outClock = portOutputRegister(digitalPinToPort(clockPin));
|
||||
dog_bitData = digitalPinToBitMask(dataPin);
|
||||
dog_bitClock = digitalPinToBitMask(clockPin);
|
||||
|
||||
dog_bitNotClock = dog_bitClock;
|
||||
dog_bitNotClock ^= 0x0ffff;
|
||||
|
||||
dog_bitNotData = dog_bitData;
|
||||
dog_bitNotData ^= 0x0ffff;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t cnt = 8;
|
||||
U8G_ATOMIC_START();
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
*dog_outData |= dog_bitData;
|
||||
else
|
||||
*dog_outData &= dog_bitNotData;
|
||||
val <<= 1;
|
||||
/*
|
||||
There must be some delay here. However
|
||||
fetching the adress dog_outClock is enough delay, so
|
||||
do not place dog_outClock in a local variable. This will
|
||||
break the procedure
|
||||
*/
|
||||
*dog_outClock |= dog_bitClock;
|
||||
cnt--;
|
||||
*dog_outClock &= dog_bitNotClock;
|
||||
/*
|
||||
little additional delay after clk pulse, done by 3x32bit reads
|
||||
from I/O. Optimized for PIC32 with 80 MHz.
|
||||
*/
|
||||
dog_pic32_spi_tmp = *dog_outClock;
|
||||
dog_pic32_spi_tmp = *dog_outClock;
|
||||
dog_pic32_spi_tmp = *dog_outClock;
|
||||
} while( cnt != 0 );
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
/*=========================================================*/
|
||||
/* Arduino Due */
|
||||
#elif defined(__SAM3X8E__)
|
||||
|
||||
/* Due */
|
||||
|
||||
void u8g_digital_write_sam_high(uint8_t pin)
|
||||
{
|
||||
PIO_Set( g_APinDescription[pin].pPort, g_APinDescription[pin].ulPin) ;
|
||||
}
|
||||
|
||||
void u8g_digital_write_sam_low(uint8_t pin)
|
||||
{
|
||||
PIO_Clear( g_APinDescription[pin].pPort, g_APinDescription[pin].ulPin) ;
|
||||
}
|
||||
|
||||
static uint8_t u8g_sam_data_pin;
|
||||
static uint8_t u8g_sam_clock_pin;
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
u8g_sam_data_pin = dataPin;
|
||||
u8g_sam_clock_pin = clockPin;
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
uint8_t i = 8;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
u8g_digital_write_sam_high(u8g_sam_data_pin);
|
||||
else
|
||||
u8g_digital_write_sam_low(u8g_sam_data_pin);
|
||||
val <<= 1;
|
||||
//u8g_MicroDelay();
|
||||
u8g_digital_write_sam_high(u8g_sam_clock_pin);
|
||||
u8g_MicroDelay();
|
||||
u8g_digital_write_sam_low(u8g_sam_clock_pin);
|
||||
u8g_MicroDelay();
|
||||
i--;
|
||||
} while( i != 0 );
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
/* empty interface */
|
||||
|
||||
static void u8g_com_arduino_init_shift_out(uint8_t dataPin, uint8_t clockPin)
|
||||
{
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_do_shift_out_msb_first(uint8_t val)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_MOSI, LOW);
|
||||
u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_SCK, LOW);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
/* issue 227 */
|
||||
u8g_com_arduino_init_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK]);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_arduino_do_shift_out_msb_first( arg_val );
|
||||
//u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_do_shift_out_msb_first(*ptr++);
|
||||
// u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_arduino_do_shift_out_msb_first( u8g_pgm_read(ptr) );
|
||||
//u8g_arduino_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* ARDUINO */
|
||||
|
||||
uint8_t u8g_com_arduino_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
403
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_t6963.c
Normal file
403
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_t6963.c
Normal file
@@ -0,0 +1,403 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_t6963.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
PIN_D0 8
|
||||
PIN_D1 9
|
||||
PIN_D2 10
|
||||
PIN_D3 11
|
||||
PIN_D4 4
|
||||
PIN_D5 5
|
||||
PIN_D6 6
|
||||
PIN_D7 7
|
||||
|
||||
PIN_CS 14
|
||||
PIN_A0 15
|
||||
PIN_RESET 16
|
||||
PIN_WR 17
|
||||
PIN_RD 18
|
||||
|
||||
u8g_InitRW8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset)
|
||||
u8g_InitRW8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 14, 15, 17, 18, 16)
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
//#include <WProgram.h>
|
||||
#include <wiring_private.h>
|
||||
#include <pins_arduino.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__PIC32MX)
|
||||
/* CHIPKIT PIC32 */
|
||||
static volatile uint32_t *u8g_output_data_port[8];
|
||||
static volatile uint32_t *u8g_input_data_port[8];
|
||||
static volatile uint32_t *u8g_mode_port[8];
|
||||
static uint32_t u8g_data_mask[8];
|
||||
#else
|
||||
static volatile uint8_t *u8g_output_data_port[8];
|
||||
static volatile uint8_t *u8g_input_data_port[8];
|
||||
static volatile uint8_t *u8g_mode_port[8];
|
||||
static uint8_t u8g_data_mask[8];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void u8g_com_arduino_t6963_init(u8g_t *u8g)
|
||||
{
|
||||
u8g_output_data_port[0] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D0]));
|
||||
u8g_input_data_port[0] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D0]));
|
||||
u8g_mode_port[0] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D0]));
|
||||
u8g_data_mask[0] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D0]);
|
||||
|
||||
u8g_output_data_port[1] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D1]));
|
||||
u8g_input_data_port[1] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D1]));
|
||||
u8g_mode_port[1] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D1]));
|
||||
u8g_data_mask[1] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D1]);
|
||||
|
||||
u8g_output_data_port[2] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D2]));
|
||||
u8g_input_data_port[2] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D2]));
|
||||
u8g_mode_port[2] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D2]));
|
||||
u8g_data_mask[2] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D2]);
|
||||
|
||||
u8g_output_data_port[3] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D3]));
|
||||
u8g_input_data_port[3] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D3]));
|
||||
u8g_mode_port[3] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D3]));
|
||||
u8g_data_mask[3] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D3]);
|
||||
|
||||
u8g_output_data_port[4] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D4]));
|
||||
u8g_input_data_port[4] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D4]));
|
||||
u8g_mode_port[4] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D4]));
|
||||
u8g_data_mask[4] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D4]);
|
||||
|
||||
u8g_output_data_port[5] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D5]));
|
||||
u8g_input_data_port[5] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D5]));
|
||||
u8g_mode_port[5] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D5]));
|
||||
u8g_data_mask[5] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D5]);
|
||||
|
||||
u8g_output_data_port[6] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D6]));
|
||||
u8g_input_data_port[6] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D6]));
|
||||
u8g_mode_port[6] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D6]));
|
||||
u8g_data_mask[6] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D6]);
|
||||
|
||||
u8g_output_data_port[7] = portOutputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D7]));
|
||||
u8g_input_data_port[7] = portInputRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D7]));
|
||||
u8g_mode_port[7] = portModeRegister(digitalPinToPort(u8g->pin_list[U8G_PI_D7]));
|
||||
u8g_data_mask[7] = digitalPinToBitMask(u8g->pin_list[U8G_PI_D7]);
|
||||
}
|
||||
|
||||
|
||||
static void u8g_com_arduino_t6963_write_data_pin(uint8_t pin, uint8_t val)
|
||||
{
|
||||
/* no ATOMIC protection required here, this is done by calling procedure */
|
||||
if ( val != 0 )
|
||||
*u8g_output_data_port[pin] |= u8g_data_mask[pin];
|
||||
else
|
||||
*u8g_output_data_port[pin] &= ~u8g_data_mask[pin];
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_t6963_set_port_output(void)
|
||||
{
|
||||
uint8_t i;
|
||||
U8G_ATOMIC_START();
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
#if defined(__PIC32MX)
|
||||
/* CHIPKIT PIC32 */
|
||||
*u8g_mode_port[i] |= u8g_data_mask[i];
|
||||
#elif defined(__AVR__)
|
||||
*u8g_mode_port[i] |= u8g_data_mask[i];
|
||||
#else
|
||||
/* TODO: use generic Arduino API */
|
||||
*u8g_mode_port[i] |= u8g_data_mask[i];
|
||||
#endif
|
||||
|
||||
}
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
static void u8g_com_arduino_t6963_set_port_input(void)
|
||||
{
|
||||
uint8_t i;
|
||||
U8G_ATOMIC_START();
|
||||
for( i = 0; i < 8; i++ )
|
||||
{
|
||||
#if defined(__PIC32MX)
|
||||
/* CHIPKIT PIC32 */
|
||||
*u8g_mode_port[i] &= ~u8g_data_mask[i];
|
||||
#elif defined(__AVR__)
|
||||
/* avr */
|
||||
*u8g_mode_port[i] &= ~u8g_data_mask[i];
|
||||
*u8g_output_data_port[i] &= ~u8g_data_mask[i]; // no pullup
|
||||
#else
|
||||
/* TODO: use generic Arduino API */
|
||||
*u8g_mode_port[i] &= ~u8g_data_mask[i];
|
||||
*u8g_output_data_port[i] &= ~u8g_data_mask[i]; // no pullup
|
||||
#endif
|
||||
}
|
||||
U8G_ATOMIC_END();
|
||||
}
|
||||
|
||||
|
||||
static void u8g_com_arduino_t6963_write(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
U8G_ATOMIC_START();
|
||||
|
||||
u8g_com_arduino_t6963_write_data_pin( 0, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_t6963_write_data_pin( 1, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_t6963_write_data_pin( 2, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_t6963_write_data_pin( 3, val&1 );
|
||||
val >>= 1;
|
||||
|
||||
u8g_com_arduino_t6963_write_data_pin( 4, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_t6963_write_data_pin( 5, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_t6963_write_data_pin( 6, val&1 );
|
||||
val >>= 1;
|
||||
u8g_com_arduino_t6963_write_data_pin( 7, val&1 );
|
||||
val >>= 1;
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_WR, 0);
|
||||
u8g_MicroDelay(); /* 80ns, reference: t6963 datasheet */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_WR, 1);
|
||||
u8g_MicroDelay(); /* 10ns, reference: t6963 datasheet */
|
||||
}
|
||||
|
||||
static uint8_t u8g_com_arduino_t6963_read(u8g_t *u8g)
|
||||
{
|
||||
uint8_t val = 0;
|
||||
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RD, 0);
|
||||
u8g_MicroDelay(); /* 150ns, reference: t6963 datasheet */
|
||||
|
||||
U8G_ATOMIC_START();
|
||||
/* only read bits 0, 1 and 3 */
|
||||
if ( (*u8g_input_data_port[3] & u8g_data_mask[3]) != 0 )
|
||||
val++;
|
||||
val <<= 1;
|
||||
val <<= 1;
|
||||
if ( (*u8g_input_data_port[1] & u8g_data_mask[1]) != 0 )
|
||||
val++;
|
||||
val <<= 1;
|
||||
if ( (*u8g_input_data_port[0] & u8g_data_mask[0]) != 0 )
|
||||
val++;
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RD, 1);
|
||||
u8g_MicroDelay(); /* 10ns, reference: t6963 datasheet */
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#define U8G_STATUS_TIMEOUT 50
|
||||
|
||||
static uint8_t u8g_com_arduino_t6963_until_01_ok(u8g_t *u8g)
|
||||
{
|
||||
long x;
|
||||
|
||||
u8g_com_arduino_t6963_set_port_input();
|
||||
x = millis();
|
||||
x += U8G_STATUS_TIMEOUT;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if ( (u8g_com_arduino_t6963_read(u8g) & 3) == 3 )
|
||||
break;
|
||||
if ( x < millis() )
|
||||
return 0;
|
||||
}
|
||||
u8g_com_arduino_t6963_set_port_output();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t u8g_com_arduino_t6963_until_3_ok(u8g_t *u8g)
|
||||
{
|
||||
long x;
|
||||
|
||||
u8g_com_arduino_t6963_set_port_input();
|
||||
x = millis();
|
||||
x += U8G_STATUS_TIMEOUT;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if ( (u8g_com_arduino_t6963_read(u8g) & 8) == 8 )
|
||||
break;
|
||||
if ( x < millis() )
|
||||
return 0;
|
||||
}
|
||||
u8g_com_arduino_t6963_set_port_output();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t u8g_com_arduino_t6963_write_cmd(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, 1);
|
||||
if ( u8g_com_arduino_t6963_until_01_ok(u8g) == 0 )
|
||||
return 0;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, 1);
|
||||
u8g_com_arduino_t6963_write(u8g, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t u8g_com_arduino_t6963_write_data(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, 1);
|
||||
if ( u8g_com_arduino_t6963_until_01_ok(u8g) == 0 )
|
||||
return 0;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, 0);
|
||||
u8g_com_arduino_t6963_write(u8g, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t u8g_com_arduino_t6963_write_auto_data(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, 1);
|
||||
if ( u8g_com_arduino_t6963_until_3_ok(u8g) == 0 )
|
||||
return 0;
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_A0, 0);
|
||||
u8g_com_arduino_t6963_write(u8g, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_t6963_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0;
|
||||
u8g_com_arduino_t6963_init(u8g);
|
||||
/* setup the RW (equal to WR) pin as output and force it to high */
|
||||
if ( u8g->pin_list[U8G_PI_WR] != U8G_PIN_NONE )
|
||||
{
|
||||
pinMode(u8g->pin_list[U8G_PI_WR], OUTPUT);
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_WR, HIGH);
|
||||
}
|
||||
/* set all pins (except WR pin) */
|
||||
u8g_com_arduino_assign_pin_output_high(u8g);
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, active low chip select */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_CS, LOW);
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
|
||||
{
|
||||
u8g_com_arduino_t6963_write_data(u8g, arg_val);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8g_com_arduino_t6963_write_cmd(u8g, arg_val);
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
u8g_com_arduino_t6963_write_cmd(u8g, 0x0b0); /* auto write */
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_com_arduino_t6963_write_auto_data(u8g, *ptr++) == 0 )
|
||||
break;
|
||||
arg_val--;
|
||||
}
|
||||
u8g_com_arduino_t6963_write_cmd(u8g, 0x0b2); /* auto reset */
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
u8g_com_arduino_t6963_write_cmd(u8g, 0x0b0); /* auto write */
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_com_arduino_t6963_write_auto_data(u8g, u8g_pgm_read(ptr)) == 0 )
|
||||
break;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
u8g_com_arduino_t6963_write_cmd(u8g, 0x0b2); /* auto reset */
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 1) or data mode (arg_val = 0) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_DI, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_RESET:
|
||||
if ( u8g->pin_list[U8G_PI_RESET] != U8G_PIN_NONE )
|
||||
u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_arduino_t6963_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
206
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_uc_i2c.c
Normal file
206
.piolibdeps/U8glib_ID7/src/clib/u8g_com_arduino_uc_i2c.c
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
|
||||
u8g_com_arduino_uc_i2c.c
|
||||
|
||||
com interface for arduino (AND atmega) and the SSDxxxx chip (SOLOMON) variant
|
||||
I2C protocol
|
||||
|
||||
ToDo: Rename this to u8g_com_avr_ssd_i2c.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Special pin usage:
|
||||
U8G_PI_I2C_OPTION additional options
|
||||
U8G_PI_A0_STATE used to store the last value of the command/data register selection
|
||||
U8G_PI_SET_A0 1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
|
||||
U8G_PI_SCL clock line (NOT USED)
|
||||
U8G_PI_SDA data line (NOT USED)
|
||||
|
||||
U8G_PI_RESET reset line (currently disabled, see below)
|
||||
|
||||
Protocol:
|
||||
SLA, Cmd/Data Selection, Arguments
|
||||
The command/data register is selected by a special instruction byte, which is sent after SLA
|
||||
|
||||
The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(U8G_WITH_PINLIST)
|
||||
|
||||
#define DOGM240_SLA_CMD (0x38*2)
|
||||
#define DOGM240_SLA_DATA (0x39*2)
|
||||
|
||||
uint8_t u8g_com_arduino_uc_start_sequence(u8g_t *u8g)
|
||||
{
|
||||
/* are we requested to set the a0 state? */
|
||||
if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
|
||||
return 1;
|
||||
|
||||
if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
|
||||
{
|
||||
if ( u8g_i2c_start(DOGM240_SLA_CMD) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( u8g_i2c_start(DOGM240_SLA_DATA) == 0 )
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_arduino_uc_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SCL, HIGH);
|
||||
//u8g_com_arduino_digital_write(u8g, U8G_PI_SDA, HIGH);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: unknown mode */
|
||||
|
||||
u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
/* Currently disabled, but it could be enable. Previous restrictions have been removed */
|
||||
/* u8g_com_arduino_digital_write(u8g, U8G_PI_RESET, arg_val); */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0;
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again, also forces start condition */
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable chip, send stop condition */
|
||||
u8g_i2c_stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable, do nothing: any byte writing will trigger the i2c start */
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_arduino_uc_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
if ( u8g_i2c_send_byte(arg_val) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_arduino_uc_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(*ptr++) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_arduino_uc_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 )
|
||||
return 0;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again */
|
||||
|
||||
#ifdef OLD_CODE
|
||||
if ( i2c_state != 0 )
|
||||
{
|
||||
u8g_i2c_stop();
|
||||
i2c_state = 0;
|
||||
}
|
||||
|
||||
if ( u8g_com_arduino_uc_start_sequence(arg_val) == 0 )
|
||||
return 0;
|
||||
|
||||
/* setup bus, might be a repeated start */
|
||||
/*
|
||||
if ( u8g_i2c_start(I2C_SLA) == 0 )
|
||||
return 0;
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
i2c_state = 1;
|
||||
|
||||
if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i2c_state = 2;
|
||||
if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* defined(U8G_WITH_PINLIST) */
|
||||
|
||||
uint8_t u8g_com_arduino_uc_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* defined(U8G_WITH_PINLIST) */
|
||||
|
||||
188
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_hw_spi.c
Normal file
188
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_hw_spi.c
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
|
||||
u8g_com_atmega_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Assumes, that
|
||||
MOSI is at PORTB, Pin 3
|
||||
and
|
||||
SCK is at PORTB, Pin 5
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START()
|
||||
U8G_ATOMIC_END()
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR_XMEGA__)
|
||||
#elif defined(__AVR__)
|
||||
#define U8G_ATMEGA_HW_SPI
|
||||
|
||||
/* remove the definition for attiny */
|
||||
#if __AVR_ARCH__ == 2
|
||||
#undef U8G_ATMEGA_HW_SPI
|
||||
#endif
|
||||
#if __AVR_ARCH__ == 25
|
||||
#undef U8G_ATMEGA_HW_SPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(U8G_ATMEGA_HW_SPI)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
static uint8_t u8g_atmega_spi_out(uint8_t data)
|
||||
{
|
||||
/* unsigned char x = 100; */
|
||||
/* send data */
|
||||
SPDR = data;
|
||||
/* wait for transmission */
|
||||
while (!(SPSR & (1<<SPIF)))
|
||||
;
|
||||
/* clear the SPIF flag by reading SPDR */
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
|
||||
U8G_ATOMIC_START();
|
||||
|
||||
DDRB |= _BV(3); /* D0, MOSI */
|
||||
DDRB |= _BV(5); /* SCK */
|
||||
DDRB |= _BV(2); /* slave select */
|
||||
|
||||
PORTB &= ~_BV(3); /* D0, MOSI = 0 */
|
||||
PORTB &= ~_BV(5); /* SCK = 0 */
|
||||
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
|
||||
/*
|
||||
SPR1 SPR0
|
||||
0 0 fclk/4 x
|
||||
0 1 fclk/16
|
||||
1 0 fclk/64
|
||||
1 1 fclk/128
|
||||
*/
|
||||
SPCR = 0;
|
||||
SPCR = (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(0<<CPOL)|(0<<CPHA);
|
||||
#ifdef U8G_HW_SPI_2X
|
||||
SPSR = (1 << SPI2X); /* double speed, issue 89 */
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
PORTB &= ~_BV(5); /* SCK = 0 */
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0); /* CS = 0 (low active) */
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_atmega_spi_out(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_atmega_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_atmega_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_atmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
183
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_parallel.c
Normal file
183
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_parallel.c
Normal file
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
|
||||
u8g_com_atmega_parallel.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
PIN_D0 8
|
||||
PIN_D1 9
|
||||
PIN_D2 10
|
||||
PIN_D3 11
|
||||
PIN_D4 4
|
||||
PIN_D5 5
|
||||
PIN_D6 6
|
||||
PIN_D7 7
|
||||
|
||||
PIN_CS1 14
|
||||
PIN_CS2 15
|
||||
PIN_RW 16
|
||||
PIN_DI 17
|
||||
PIN_EN 18
|
||||
|
||||
u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
|
||||
u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
static void u8g_com_atmega_parallel_write(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_atmega_parallel_write(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_D0, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D1, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D2, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D3, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D4, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D5, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D6, val&1);
|
||||
val >>= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_D7, val&1);
|
||||
|
||||
/* EN cycle time must be 1 micro second */
|
||||
u8g_SetPILevel(u8g, U8G_PI_EN, 1);
|
||||
u8g_MicroDelay(); /* delay by 1000ns, reference: ST7920: 140ns, SBN1661: 100ns */
|
||||
u8g_SetPILevel(u8g, U8G_PI_EN, 0);
|
||||
u8g_10MicroDelay(); /* ST7920 commands: 72us */
|
||||
u8g_10MicroDelay(); /* ST7920 commands: 72us */
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
/* setup the RW pin as output and force it to low */
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RW);
|
||||
u8g_SetPILevel(u8g, U8G_PI_RW, 0);
|
||||
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D0);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D1);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D2);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D3);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D4);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D5);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D6);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_D7);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_EN);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS1);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS2);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_DI);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS1, 1);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS2, 1);
|
||||
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS1, 1);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS2, 1);
|
||||
}
|
||||
else if ( arg_val == 1 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS1, 0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS2, 1);
|
||||
}
|
||||
else if ( arg_val == 2 )
|
||||
{
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS1, 1);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS2, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS1, 0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS2, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_atmega_parallel_write(u8g, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atmega_parallel_write(u8g, *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atmega_parallel_write(u8g, u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_DI, arg_val);
|
||||
break;
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_atmega_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
217
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_st7920_hw_spi.c
Normal file
217
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_st7920_hw_spi.c
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
|
||||
u8g_com_atmega_st7920_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special SPI interface for ST7920 controller with HW SPI Support
|
||||
|
||||
Assumes, that
|
||||
MOSI is at PORTB, Pin 3
|
||||
and
|
||||
SCK is at PORTB, Pin 5
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START()
|
||||
U8G_ATOMIC_END()
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR_XMEGA__)
|
||||
#elif defined(__AVR__)
|
||||
#define U8G_ATMEGA_HW_SPI
|
||||
|
||||
/* remove the definition for attiny */
|
||||
#if __AVR_ARCH__ == 2
|
||||
#undef U8G_ATMEGA_HW_SPI
|
||||
#endif
|
||||
#if __AVR_ARCH__ == 25
|
||||
#undef U8G_ATMEGA_HW_SPI
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(U8G_ATMEGA_HW_SPI)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
static uint8_t u8g_atmega_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
|
||||
static uint8_t u8g_atmega_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
/* send data */
|
||||
SPDR = val;
|
||||
/* wait for transmission */
|
||||
while (!(SPSR & (1<<SPIF)))
|
||||
;
|
||||
/* clear the SPIF flag by reading SPDR */
|
||||
return SPDR;
|
||||
}
|
||||
|
||||
|
||||
static void u8g_com_atmega_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_atmega_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_atmega_st7920_hw_spi_shift_out(u8g, 0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_atmega_st7920_hw_spi_shift_out(u8g, 0x0fa);
|
||||
}
|
||||
|
||||
u8g_atmega_st7920_hw_spi_shift_out(u8g, val & 0x0f0);
|
||||
u8g_atmega_st7920_hw_spi_shift_out(u8g, val << 4);
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
//u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
|
||||
U8G_ATOMIC_START();
|
||||
|
||||
DDRB |= _BV(3); /* D0, MOSI */
|
||||
DDRB |= _BV(5); /* SCK */
|
||||
DDRB |= _BV(2); /* slave select */
|
||||
|
||||
PORTB &= ~_BV(3); /* D0, MOSI = 0 */
|
||||
PORTB &= ~_BV(5); /* SCK = 0 */
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
|
||||
/*
|
||||
SPR1 SPR0
|
||||
0 0 fclk/4
|
||||
0 1 fclk/16
|
||||
1 0 fclk/64
|
||||
1 1 fclk/128
|
||||
*/
|
||||
SPCR = 0;
|
||||
|
||||
/* maybe set CPOL and CPHA to 1 */
|
||||
/* 20 Dez 2012: did set CPOL and CPHA to 1 in Arduino variant! */
|
||||
/* 24 Jan 2014: implemented, see also issue 221 */
|
||||
SPCR = (1<<SPE) | (1<<MSTR)|(0<<SPR1)|(0<<SPR0)|(1<<CPOL)|(1<<CPHA);
|
||||
#ifdef U8G_HW_SPI_2X
|
||||
SPSR = (1 << SPI2X); /* double speed, issue 89 */
|
||||
#endif
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, note: the st7920 has an active high chip select */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* u8g_SetPILevel(u8g, U8G_PI_SCK, 0 ); */
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1); /* CS = 1 (high active) */
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_atmega_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], arg_val);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atmega_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atmega_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr));
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
170
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_st7920_spi.c
Normal file
170
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_st7920_spi.c
Normal file
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
|
||||
u8g_com_atmega_st7920_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special SPI interface for ST7920 controller
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
static void u8g_atmega_st7920_sw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_atmega_st7920_sw_spi_shift_out(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
uint8_t i = 8;
|
||||
do
|
||||
{
|
||||
u8g_SetPILevel(u8g, U8G_PI_MOSI, val & 128 );
|
||||
val <<= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 1 );
|
||||
u8g_MicroDelay(); /* 15 Aug 2012: added for high speed uC */
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0 );
|
||||
u8g_MicroDelay(); /* 15 Aug 2012: added for high speed uC */
|
||||
i--;
|
||||
} while( i != 0 );
|
||||
}
|
||||
|
||||
static void u8g_com_atmega_st7920_write_byte(u8g_t *u8g, uint8_t rs, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_atmega_st7920_write_byte(u8g_t *u8g, uint8_t rs, uint8_t val)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_atmega_st7920_sw_spi_shift_out(u8g, 0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_atmega_st7920_sw_spi_shift_out(u8g, 0x0fa);
|
||||
}
|
||||
|
||||
u8g_atmega_st7920_sw_spi_shift_out(u8g, val & 0x0f0);
|
||||
u8g_atmega_st7920_sw_spi_shift_out(u8g, val << 4);
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_st7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_SetPIOutput(u8g, U8G_PI_SCK);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_MOSI);
|
||||
/* u8g_SetPIOutput(u8g, U8G_PI_A0); */
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0 );
|
||||
u8g_SetPILevel(u8g, U8G_PI_MOSI, 0 );
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0 );
|
||||
/* u8g_SetPILevel(u8g, U8G_PI_A0, 0); */
|
||||
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, note: the st7920 has an active high chip select */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* u8g_SetPILevel(u8g, U8G_PI_SCK, 0 ); */
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1); /* CS = 1 (high active) */
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_atmega_st7920_write_byte(u8g, u8g->pin_list[U8G_PI_A0_STATE], arg_val);
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atmega_st7920_write_byte(u8g, u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atmega_st7920_write_byte(u8g, u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr));
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_st7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
141
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_sw_spi.c
Normal file
141
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atmega_sw_spi.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
|
||||
u8g_com_atmega_sw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
static void u8g_atmega_sw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_atmega_sw_spi_shift_out(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
uint8_t i = 8;
|
||||
do
|
||||
{
|
||||
u8g_SetPILevel(u8g, U8G_PI_MOSI, val & 128 );
|
||||
val <<= 1;
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 1 );
|
||||
u8g_MicroDelay(); /* 15 Aug 2012: added for high speed uC */
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0 );
|
||||
u8g_MicroDelay(); /* 15 Aug 2012: added for high speed uC */
|
||||
i--;
|
||||
} while( i != 0 );
|
||||
}
|
||||
|
||||
uint8_t u8g_com_atmega_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_SetPIOutput(u8g, U8G_PI_SCK);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_MOSI);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0 );
|
||||
u8g_SetPILevel(u8g, U8G_PI_MOSI, 0 );
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1 );
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, 0);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0 );
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0); /* CS = 0 (low active) */
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_atmega_sw_spi_shift_out(u8g, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_atmega_sw_spi_shift_out(u8g, *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_atmega_sw_spi_shift_out(u8g, u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_atmega_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
174
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atxmega_hw_spi.c
Normal file
174
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atxmega_hw_spi.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
|
||||
u8g_com_atxmega_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
Copyright (c) 2015, florianmenne@t-online.de
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special SPI interface for ST7920 controller with HW SPI Support
|
||||
|
||||
Assumes, that
|
||||
MOSI is at PORTB, Pin 3
|
||||
and
|
||||
SCK is at PORTB, Pin 5
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START()
|
||||
U8G_ATOMIC_END()
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR_XMEGA__)
|
||||
#define U8G_ATXMEGA_HW_SPI
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(U8G_ATXMEGA_HW_SPI)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
static uint8_t u8g_atxmega_spi_out(uint8_t data)
|
||||
{
|
||||
/* send data */
|
||||
SPIC.DATA = data;
|
||||
|
||||
/* wait for transmission */
|
||||
while(!(SPIC.STATUS & SPI_IF_bm));
|
||||
|
||||
/* clear the SPIF flag by reading SPDR */
|
||||
return SPIC.DATA;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_atxmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
|
||||
//U8G_ATOMIC_START();
|
||||
|
||||
PORTC.DIR |= PIN4_bm | PIN5_bm | PIN7_bm;
|
||||
PORTC.DIR &= ~PIN6_bm;
|
||||
|
||||
//U8G_ATOMIC_END();
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
|
||||
SPIC.CTRL = 0;
|
||||
SPIC.CTRL = SPI_PRESCALER_DIV4_gc | // SPI prescaler.
|
||||
//SPI_CLK2X_bm | //SPI Clock double.
|
||||
SPI_ENABLE_bm | //Enable SPI module.
|
||||
//SPI_DORD_bm | //Data order.
|
||||
SPI_MASTER_bm | //SPI master.
|
||||
SPI_MODE_0_gc; // SPI mode.
|
||||
|
||||
#ifdef U8G_HW_SPI_2X
|
||||
SPIC.CTRL |= SPI_CLK2X_bm; /* double speed, issue 89 */
|
||||
#endif
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//PORTB &= ~_BV(5); /* SCK = 0 */
|
||||
PORTC.OUT &= ~PIN7_bm;
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0); /* CS = 0 (low active) */
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_atxmega_spi_out(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_atxmega_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_atxmega_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_atxmega_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
202
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atxmega_st7920_hw_spi.c
Normal file
202
.piolibdeps/U8glib_ID7/src/clib/u8g_com_atxmega_st7920_hw_spi.c
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
|
||||
u8g_com_atxmega_st7920_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
Copyright (c) 2015, florianmenne@t-online.de
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
A special SPI interface for ST7920 controller with HW SPI Support
|
||||
|
||||
Assumes, that
|
||||
MOSI is at PORTB, Pin 3
|
||||
and
|
||||
SCK is at PORTB, Pin 5
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START()
|
||||
U8G_ATOMIC_END()
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR_XMEGA__)
|
||||
#define U8G_ATXMEGA_HW_SPI
|
||||
#endif
|
||||
|
||||
#if defined(U8G_ATXMEGA_HW_SPI)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
static uint8_t u8g_atxmega_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val) U8G_NOINLINE;
|
||||
static uint8_t u8g_atxmega_st7920_hw_spi_shift_out(u8g_t *u8g, uint8_t val)
|
||||
{
|
||||
/* send data */
|
||||
SPIC.DATA = val;
|
||||
|
||||
/* wait for transmission */
|
||||
while(!(SPIC.STATUS & SPI_IF_bm));
|
||||
|
||||
/* clear the SPIF flag by reading SPDR */
|
||||
return SPIC.DATA;
|
||||
}
|
||||
|
||||
|
||||
static void u8g_com_atxmega_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val) U8G_NOINLINE;
|
||||
static void u8g_com_atxmega_st7920_write_byte_hw_spi(u8g_t *u8g, uint8_t rs, uint8_t val)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
if ( rs == 0 )
|
||||
{
|
||||
/* command */
|
||||
u8g_atxmega_st7920_hw_spi_shift_out(u8g, 0x0f8);
|
||||
}
|
||||
else if ( rs == 1 )
|
||||
{
|
||||
/* data */
|
||||
u8g_atxmega_st7920_hw_spi_shift_out(u8g, 0x0fa);
|
||||
}
|
||||
|
||||
u8g_atxmega_st7920_hw_spi_shift_out(u8g, val & 0x0f0);
|
||||
u8g_atxmega_st7920_hw_spi_shift_out(u8g, val << 4);
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
u8g_10MicroDelay();
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_com_atxmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
//u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
|
||||
//U8G_ATOMIC_START();
|
||||
|
||||
PORTC.DIR |= PIN4_bm | PIN5_bm | PIN7_bm;
|
||||
PORTC.DIR &= ~PIN6_bm;
|
||||
|
||||
//U8G_ATOMIC_END();
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
|
||||
SPIC.CTRL = 0;
|
||||
SPIC.CTRL = SPI_PRESCALER_DIV4_gc | // SPI prescaler.
|
||||
//SPI_CLK2X_bm | //SPI Clock double.
|
||||
SPI_ENABLE_bm | //Enable SPI module.
|
||||
//SPI_DORD_bm | //Data order.
|
||||
SPI_MASTER_bm | //SPI master.
|
||||
SPI_MODE_0_gc; // SPI mode.
|
||||
|
||||
#ifdef U8G_HW_SPI_2X
|
||||
SPIC.CTRL |= SPI_CLK2X_bm; /* double speed, issue 89 */
|
||||
#endif
|
||||
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0; /* inital RS state: command mode */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable, note: the st7920 has an active high chip select */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* u8g_SetPILevel(u8g, U8G_PI_SCK, 0 ); */
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1); /* CS = 1 (high active) */
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_com_atxmega_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], arg_val);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atxmega_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], *ptr++);
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_com_atxmega_st7920_write_byte_hw_spi(u8g, u8g->pin_list[U8G_PI_A0_STATE], u8g_pgm_read(ptr));
|
||||
//u8g->pin_list[U8G_PI_A0_STATE] = 2;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_atxmega_st7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
643
.piolibdeps/U8glib_ID7/src/clib/u8g_com_i2c.c
Normal file
643
.piolibdeps/U8glib_ID7/src/clib/u8g_com_i2c.c
Normal file
@@ -0,0 +1,643 @@
|
||||
/*
|
||||
|
||||
u8g_com_i2c.c
|
||||
|
||||
generic i2c interface
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
//#define U8G_I2C_WITH_NO_ACK
|
||||
|
||||
static uint8_t u8g_i2c_err_code;
|
||||
static uint8_t u8g_i2c_opt; /* U8G_I2C_OPT_NO_ACK, SAM: U8G_I2C_OPT_DEV_1 */
|
||||
/*
|
||||
position values
|
||||
1: start condition
|
||||
2: sla transfer
|
||||
*/
|
||||
static uint8_t u8g_i2c_err_pos;
|
||||
|
||||
|
||||
void u8g_i2c_clear_error(void)
|
||||
{
|
||||
u8g_i2c_err_code = U8G_I2C_ERR_NONE;
|
||||
u8g_i2c_err_pos = 0;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_get_error(void)
|
||||
{
|
||||
return u8g_i2c_err_code;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_get_err_pos(void)
|
||||
{
|
||||
return u8g_i2c_err_pos;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__AVR_XMEGA__)
|
||||
#elif defined(__AVR__)
|
||||
|
||||
static void u8g_i2c_set_error(uint8_t code, uint8_t pos)
|
||||
{
|
||||
if ( u8g_i2c_err_code > 0 )
|
||||
return;
|
||||
u8g_i2c_err_code |= code;
|
||||
u8g_i2c_err_pos = pos;
|
||||
}
|
||||
|
||||
#define U8G_ATMEGA_HW_TWI
|
||||
|
||||
/* remove the definition for attiny */
|
||||
#if __AVR_ARCH__ == 2
|
||||
#undef U8G_ATMEGA_HW_TWI
|
||||
#endif
|
||||
#if __AVR_ARCH__ == 25
|
||||
#undef U8G_ATMEGA_HW_TWI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(U8G_ATMEGA_HW_TWI)
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <util/twi.h>
|
||||
|
||||
|
||||
|
||||
void u8g_i2c_init(uint8_t options)
|
||||
{
|
||||
/*
|
||||
TWBR: bit rate register
|
||||
TWSR: status register (contains preselector bits)
|
||||
|
||||
prescalar
|
||||
0 1
|
||||
1 4
|
||||
2 16
|
||||
3 64
|
||||
|
||||
f = F_CPU/(16+2*TWBR*prescalar)
|
||||
|
||||
F_CPU = 16MHz
|
||||
TWBR = 152;
|
||||
TWSR = 0;
|
||||
--> 50KHz
|
||||
|
||||
TWBR = 72;
|
||||
TWSR = 0;
|
||||
--> 100KHz
|
||||
|
||||
TWBR = 12;
|
||||
TWSR = 0;
|
||||
--> 400KHz
|
||||
|
||||
F_CPU/(2*100000)-8 --> calculate TWBR value for 100KHz
|
||||
*/
|
||||
u8g_i2c_opt = options;
|
||||
TWSR = 0;
|
||||
if ( options & U8G_I2C_OPT_FAST )
|
||||
{
|
||||
TWBR = F_CPU/(2*400000)-8;
|
||||
}
|
||||
else
|
||||
{
|
||||
TWBR = F_CPU/(2*100000)-8;
|
||||
}
|
||||
u8g_i2c_clear_error();
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos)
|
||||
{
|
||||
volatile uint16_t cnt = 2000; /* timout value should be > 280 for 50KHz Bus and 16 Mhz CPU, however the start condition might need longer */
|
||||
while( !(TWCR & mask) )
|
||||
{
|
||||
if ( cnt == 0 )
|
||||
{
|
||||
if ( u8g_i2c_opt & U8G_I2C_OPT_NO_ACK )
|
||||
{
|
||||
return 1; /* all ok */
|
||||
}
|
||||
else
|
||||
{
|
||||
u8g_i2c_set_error(U8G_I2C_ERR_TIMEOUT, pos);
|
||||
return 0; /* error */
|
||||
}
|
||||
}
|
||||
cnt--;
|
||||
}
|
||||
return 1; /* all ok */
|
||||
}
|
||||
|
||||
/* sla includes all 8 bits (with r/w bit), assums master transmit */
|
||||
uint8_t u8g_i2c_start(uint8_t sla)
|
||||
{
|
||||
register uint8_t status;
|
||||
|
||||
/* send start */
|
||||
TWCR = _BV(TWINT) | _BV(TWSTA) | _BV(TWEN);
|
||||
|
||||
/* wait */
|
||||
if ( u8g_i2c_wait(_BV(TWINT), 1) == 0 )
|
||||
return 0;
|
||||
|
||||
status = TW_STATUS;
|
||||
|
||||
/* check status after start */
|
||||
if ( status != TW_START && status != TW_REP_START )
|
||||
{
|
||||
u8g_i2c_set_error(U8G_I2C_ERR_BUS, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* set slave address */
|
||||
TWDR = sla;
|
||||
|
||||
/* enable sla transfer */
|
||||
TWCR = _BV(TWINT) | _BV(TWEN);
|
||||
|
||||
/* wait */
|
||||
if ( u8g_i2c_wait(_BV(TWINT), 2) == 0 )
|
||||
return 0;
|
||||
|
||||
if ( u8g_i2c_opt & U8G_I2C_OPT_NO_ACK )
|
||||
{
|
||||
/* do not check for ACK */
|
||||
}
|
||||
else
|
||||
{
|
||||
status = TW_STATUS;
|
||||
/* check status after sla */
|
||||
if ( status != TW_MT_SLA_ACK )
|
||||
{
|
||||
u8g_i2c_set_error(U8G_I2C_ERR_BUS, 2);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data)
|
||||
{
|
||||
register uint8_t status;
|
||||
TWDR = data;
|
||||
TWCR = _BV(TWINT) | _BV(TWEN);
|
||||
if ( u8g_i2c_wait(_BV(TWINT), 3) == 0 )
|
||||
return 0;
|
||||
|
||||
if ( u8g_i2c_opt & U8G_I2C_OPT_NO_ACK )
|
||||
{
|
||||
/* do not check for ACK */
|
||||
}
|
||||
else
|
||||
{
|
||||
status = TW_STATUS;
|
||||
if ( status != TW_MT_DATA_ACK )
|
||||
{
|
||||
u8g_i2c_set_error(U8G_I2C_ERR_BUS, 3);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void u8g_i2c_stop(void)
|
||||
{
|
||||
/* write stop */
|
||||
TWCR = _BV(TWINT) | _BV(TWEN) | _BV(TWSTO);
|
||||
|
||||
/* no error is checked for the stop condition */
|
||||
u8g_i2c_wait(_BV(TWSTO), 4);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void twi_send(uint8_t adr, uint8_t data1, uint8_t data2)
|
||||
{
|
||||
u8g_i2c_start(adr<<1);
|
||||
u8g_i2c_send_byte(data1);
|
||||
u8g_i2c_send_byte(data2);
|
||||
u8g_i2c_stop();
|
||||
}
|
||||
*/
|
||||
|
||||
#elif defined(ARDUINO) && defined(__SAM3X8E__)
|
||||
/* Arduino Due */
|
||||
#include "Arduino.h"
|
||||
#include "sam.h"
|
||||
|
||||
/*
|
||||
|
||||
Controller
|
||||
|
||||
TWI0 TWCK0 PA18 A DUE PCB: SCL1
|
||||
TWI0 TWD0 PA17 A DUE PCB: SDA1
|
||||
TWI1 TWCK1 PB13 A DUE PCB: SCL 21
|
||||
TWI1 TWD1 PB12 A DUE PCB: SDA 20
|
||||
|
||||
Arduino definitions
|
||||
|
||||
#define PIN_WIRE_SDA (20u)
|
||||
#define PIN_WIRE_SCL (21u)
|
||||
#define WIRE_INTERFACE TWI1
|
||||
#define WIRE_INTERFACE_ID ID_TWI1
|
||||
#define WIRE_ISR_HANDLER TWI1_Handler
|
||||
|
||||
#define PIN_WIRE1_SDA (70u)
|
||||
#define PIN_WIRE1_SCL (71u)
|
||||
#define WIRE1_INTERFACE TWI0
|
||||
#define WIRE1_INTERFACE_ID ID_TWI0
|
||||
#define WIRE1_ISR_HANDLER TWI0_Handler
|
||||
|
||||
|
||||
*/
|
||||
|
||||
static void i2c_400KHz_delay(void)
|
||||
{
|
||||
/* should be at least 4 */
|
||||
/* should be 5 for 100KHz transfer speed */
|
||||
|
||||
|
||||
/*
|
||||
Arduino Due
|
||||
0x NOP: 470KHz
|
||||
4x NOP: 450KHz
|
||||
8x NOP: 430KHz
|
||||
16x NOP: 400KHz
|
||||
*/
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
}
|
||||
|
||||
static void i2c_100KHz_delay(void)
|
||||
{
|
||||
/*
|
||||
1x u8g_MicroDelay() ca. 130KHz
|
||||
2x u8g_MicroDelay() ca. 80KHz
|
||||
*/
|
||||
u8g_MicroDelay();
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
|
||||
|
||||
uint32_t i2c_started = 0;
|
||||
uint32_t i2c_scl_pin = 0;
|
||||
uint32_t i2c_sda_pin = 0;
|
||||
void (*i2c_delay)(void) = i2c_100KHz_delay;
|
||||
|
||||
const PinDescription *i2c_scl_pin_desc;
|
||||
const PinDescription *i2c_sda_pin_desc;
|
||||
|
||||
|
||||
/* maybe this can be optimized */
|
||||
static void i2c_init(void)
|
||||
{
|
||||
i2c_sda_pin_desc = &(g_APinDescription[i2c_sda_pin]);
|
||||
i2c_scl_pin_desc = &(g_APinDescription[i2c_scl_pin]);
|
||||
pinMode(i2c_sda_pin, OUTPUT);
|
||||
digitalWrite(i2c_sda_pin, HIGH);
|
||||
pinMode(i2c_scl_pin, OUTPUT);
|
||||
digitalWrite(i2c_scl_pin, HIGH);
|
||||
PIO_Configure( i2c_sda_pin_desc->pPort, PIO_OUTPUT_0, i2c_sda_pin_desc->ulPin, PIO_OPENDRAIN );
|
||||
PIO_Configure( i2c_scl_pin_desc->pPort, PIO_OUTPUT_0, i2c_scl_pin_desc->ulPin, PIO_OPENDRAIN );
|
||||
PIO_Clear( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin) ;
|
||||
PIO_Clear( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin) ;
|
||||
PIO_Configure( i2c_sda_pin_desc->pPort, PIO_INPUT, i2c_sda_pin_desc->ulPin, PIO_DEFAULT ) ;
|
||||
PIO_Configure( i2c_scl_pin_desc->pPort, PIO_INPUT, i2c_scl_pin_desc->ulPin, PIO_DEFAULT ) ;
|
||||
i2c_delay();
|
||||
}
|
||||
|
||||
/* actually, the scl line is not observed, so this procedure does not return a value */
|
||||
static void i2c_read_scl_and_delay(void)
|
||||
{
|
||||
uint32_t dwMask = i2c_scl_pin_desc->ulPin;
|
||||
//PIO_Configure( i2c_scl_pin_desc->pPort, PIO_INPUT, i2c_scl_pin_desc->ulPin, PIO_DEFAULT ) ;
|
||||
//PIO_SetInput( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin, PIO_DEFAULT ) ;
|
||||
|
||||
/* set as input */
|
||||
i2c_scl_pin_desc->pPort->PIO_ODR = dwMask ;
|
||||
i2c_scl_pin_desc->pPort->PIO_PER = dwMask ;
|
||||
|
||||
i2c_delay();
|
||||
}
|
||||
|
||||
static void i2c_clear_scl(void)
|
||||
{
|
||||
uint32_t dwMask = i2c_scl_pin_desc->ulPin;
|
||||
|
||||
/* set open collector and drive low */
|
||||
//PIO_Configure( i2c_scl_pin_desc->pPort, PIO_OUTPUT_0, i2c_scl_pin_desc->ulPin, PIO_OPENDRAIN );
|
||||
//PIO_SetOutput( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin, 0, 1, 0);
|
||||
|
||||
/* open drain, zero default output */
|
||||
i2c_scl_pin_desc->pPort->PIO_MDER = dwMask;
|
||||
i2c_scl_pin_desc->pPort->PIO_CODR = dwMask;
|
||||
i2c_scl_pin_desc->pPort->PIO_OER = dwMask;
|
||||
i2c_scl_pin_desc->pPort->PIO_PER = dwMask;
|
||||
|
||||
//PIO_Clear( i2c_scl_pin_desc->pPort, i2c_scl_pin_desc->ulPin) ;
|
||||
}
|
||||
|
||||
static uint8_t i2c_read_sda(void)
|
||||
{
|
||||
uint32_t dwMask = i2c_sda_pin_desc->ulPin;
|
||||
//PIO_Configure( i2c_sda_pin_desc->pPort, PIO_INPUT, i2c_sda_pin_desc->ulPin, PIO_DEFAULT ) ;
|
||||
//PIO_SetInput( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin, PIO_DEFAULT ) ;
|
||||
|
||||
/* set as input */
|
||||
i2c_sda_pin_desc->pPort->PIO_ODR = dwMask ;
|
||||
i2c_sda_pin_desc->pPort->PIO_PER = dwMask ;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void i2c_clear_sda(void)
|
||||
{
|
||||
uint32_t dwMask = i2c_sda_pin_desc->ulPin;
|
||||
|
||||
/* set open collector and drive low */
|
||||
//PIO_Configure( i2c_sda_pin_desc->pPort, PIO_OUTPUT_0, i2c_sda_pin_desc->ulPin, PIO_OPENDRAIN );
|
||||
//PIO_SetOutput( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin, 0, 1, 0);
|
||||
|
||||
/* open drain, zero default output */
|
||||
i2c_sda_pin_desc->pPort->PIO_MDER = dwMask ;
|
||||
i2c_sda_pin_desc->pPort->PIO_CODR = dwMask ;
|
||||
i2c_sda_pin_desc->pPort->PIO_OER = dwMask ;
|
||||
i2c_sda_pin_desc->pPort->PIO_PER = dwMask ;
|
||||
|
||||
//PIO_Clear( i2c_sda_pin_desc->pPort, i2c_sda_pin_desc->ulPin) ;
|
||||
}
|
||||
|
||||
static void i2c_start(void)
|
||||
{
|
||||
if ( i2c_started != 0 )
|
||||
{
|
||||
/* if already started: do restart */
|
||||
i2c_read_sda(); /* SDA = 1 */
|
||||
i2c_delay();
|
||||
i2c_read_scl_and_delay();
|
||||
}
|
||||
i2c_read_sda();
|
||||
/*
|
||||
if (i2c_read_sda() == 0)
|
||||
{
|
||||
// do something because arbitration is lost
|
||||
}
|
||||
*/
|
||||
/* send the start condition, both lines go from 1 to 0 */
|
||||
i2c_clear_sda();
|
||||
i2c_delay();
|
||||
i2c_clear_scl();
|
||||
i2c_started = 1;
|
||||
}
|
||||
|
||||
|
||||
static void i2c_stop(void)
|
||||
{
|
||||
/* set SDA to 0 */
|
||||
i2c_clear_sda();
|
||||
i2c_delay();
|
||||
|
||||
/* now release all lines */
|
||||
i2c_read_scl_and_delay();
|
||||
|
||||
/* set SDA to 1 */
|
||||
i2c_read_sda();
|
||||
i2c_delay();
|
||||
i2c_started = 0;
|
||||
}
|
||||
|
||||
static void i2c_write_bit(uint8_t val)
|
||||
{
|
||||
if (val)
|
||||
i2c_read_sda();
|
||||
else
|
||||
i2c_clear_sda();
|
||||
|
||||
i2c_delay();
|
||||
i2c_read_scl_and_delay();
|
||||
i2c_clear_scl();
|
||||
}
|
||||
|
||||
static uint8_t i2c_read_bit(void)
|
||||
{
|
||||
uint8_t val;
|
||||
/* do not drive SDA */
|
||||
i2c_read_sda();
|
||||
i2c_delay();
|
||||
i2c_read_scl_and_delay();
|
||||
val = i2c_read_sda();
|
||||
i2c_delay();
|
||||
i2c_clear_scl();
|
||||
return val;
|
||||
}
|
||||
|
||||
static uint8_t i2c_write_byte(uint8_t b)
|
||||
{
|
||||
i2c_write_bit(b & 128);
|
||||
i2c_write_bit(b & 64);
|
||||
i2c_write_bit(b & 32);
|
||||
i2c_write_bit(b & 16);
|
||||
i2c_write_bit(b & 8);
|
||||
i2c_write_bit(b & 4);
|
||||
i2c_write_bit(b & 2);
|
||||
i2c_write_bit(b & 1);
|
||||
|
||||
/* read ack from client */
|
||||
/* 0: ack was given by client */
|
||||
/* 1: nothing happend during ack cycle */
|
||||
return i2c_read_bit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void u8g_i2c_init(uint8_t options)
|
||||
{
|
||||
u8g_i2c_opt = options;
|
||||
u8g_i2c_clear_error();
|
||||
|
||||
if ( u8g_i2c_opt & U8G_I2C_OPT_FAST )
|
||||
{
|
||||
i2c_delay = i2c_400KHz_delay;
|
||||
}
|
||||
else
|
||||
{
|
||||
i2c_delay = i2c_100KHz_delay;
|
||||
}
|
||||
|
||||
|
||||
if ( u8g_i2c_opt & U8G_I2C_OPT_DEV_1 )
|
||||
{
|
||||
i2c_scl_pin = PIN_WIRE1_SCL;
|
||||
i2c_sda_pin = PIN_WIRE1_SDA;
|
||||
|
||||
//REG_PIOA_PDR = PIO_PB12A_TWD1 | PIO_PB13A_TWCK1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
i2c_scl_pin = PIN_WIRE_SCL;
|
||||
i2c_sda_pin = PIN_WIRE_SDA;
|
||||
|
||||
//REG_PIOA_PDR = PIO_PA17A_TWD0 | PIO_PA18A_TWCK0;
|
||||
}
|
||||
|
||||
i2c_init();
|
||||
|
||||
}
|
||||
|
||||
/* sla includes also the r/w bit */
|
||||
uint8_t u8g_i2c_start(uint8_t sla)
|
||||
{
|
||||
i2c_start();
|
||||
i2c_write_byte(sla);
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data)
|
||||
{
|
||||
return i2c_write_byte(data);
|
||||
}
|
||||
|
||||
void u8g_i2c_stop(void)
|
||||
{
|
||||
i2c_stop();
|
||||
}
|
||||
|
||||
|
||||
#elif defined(U8G_RASPBERRY_PI)
|
||||
|
||||
#include <wiringPi.h>
|
||||
#include <wiringPiI2C.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define I2C_SLA 0x3c
|
||||
|
||||
static int fd=-1;
|
||||
static uint8_t i2cMode = 0;
|
||||
|
||||
void u8g_i2c_init(uint8_t options) {
|
||||
u8g_i2c_clear_error();
|
||||
u8g_i2c_opt = options;
|
||||
|
||||
if (wiringPiSetup() == -1) {
|
||||
printf("wiringPi-Error\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fd = wiringPiI2CSetup(I2C_SLA);
|
||||
if (fd < 0) {
|
||||
printf ("Unable to open I2C device 0: %s\n", strerror (errno)) ;
|
||||
exit (1) ;
|
||||
}
|
||||
//u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
//u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
}
|
||||
uint8_t u8g_i2c_start(uint8_t sla) {
|
||||
u8g_i2c_send_mode(0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void u8g_i2c_stop(void) {
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_send_mode(uint8_t mode) {
|
||||
i2cMode = mode;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data) {
|
||||
wiringPiI2CWriteReg8(fd, i2cMode, data);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* empty interface */
|
||||
|
||||
void u8g_i2c_init(uint8_t options)
|
||||
{
|
||||
u8g_i2c_clear_error();
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_i2c_start(uint8_t sla)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
uint8_t u8g_i2c_send_byte(uint8_t data)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void u8g_i2c_stop(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
452
.piolibdeps/U8glib_ID7/src/clib/u8g_com_io.c
Normal file
452
.piolibdeps/U8glib_ID7/src/clib/u8g_com_io.c
Normal file
@@ -0,0 +1,452 @@
|
||||
/*
|
||||
|
||||
u8g_com_io.c
|
||||
|
||||
abstraction layer for low level i/o
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START();
|
||||
U8G_ATOMIC_END();
|
||||
|
||||
uint8_t u8g_Pin(uint8_t port, uint8_t bitpos) Convert to internal number: AVR: port*8+bitpos, ARM: port*16+bitpos
|
||||
void u8g_SetPinOutput(uint8_t internal_pin_number)
|
||||
void u8g_SetPinInput(uint8_t internal_pin_number)
|
||||
void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level)
|
||||
uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__AVR__)
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
typedef volatile uint8_t * IO_PTR;
|
||||
|
||||
/* create internal pin number */
|
||||
uint8_t u8g_Pin(uint8_t port, uint8_t bitpos)
|
||||
{
|
||||
port <<= 3;
|
||||
port += bitpos;
|
||||
return port;
|
||||
}
|
||||
|
||||
#if defined(__AVR_XMEGA__)
|
||||
|
||||
const IO_PTR u8g_avr_ddr_P[] PROGMEM = {
|
||||
#ifdef PORTA
|
||||
&PORTA.DIR,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
&PORTB.DIR,
|
||||
#ifdef PORTC
|
||||
&PORTC.DIR,
|
||||
#ifdef PORTD
|
||||
&PORTD.DIR,
|
||||
#ifdef PORTE
|
||||
&PORTE.DIR,
|
||||
#ifdef PORTF
|
||||
&PORTF.DIR,
|
||||
#ifdef PORTR
|
||||
&PORTR.DIR,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
const IO_PTR u8g_avr_port_P[] PROGMEM = {
|
||||
#ifdef PORTA
|
||||
&PORTA.OUT,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
&PORTB.OUT,
|
||||
#ifdef PORTC
|
||||
&PORTC.OUT,
|
||||
#ifdef PORTD
|
||||
&PORTD.OUT,
|
||||
#ifdef PORTE
|
||||
&PORTE.OUT,
|
||||
#ifdef PORTF
|
||||
&PORTF.OUT,
|
||||
#ifdef PORTR
|
||||
&PORTR.OUT,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
const IO_PTR u8g_avr_pin_P[] PROGMEM = {
|
||||
#ifdef PORTA
|
||||
&PORTA.IN,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
&PORTB.IN,
|
||||
#ifdef PORTC
|
||||
&PORTC.IN,
|
||||
#ifdef PORTD
|
||||
&PORTD.IN,
|
||||
#ifdef PORTE
|
||||
&PORTE.IN,
|
||||
#ifdef PORTF
|
||||
&PORTF.IN,
|
||||
#ifdef PORTR
|
||||
&PORTR.IN,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
const IO_PTR u8g_avr_ddr_P[] PROGMEM = {
|
||||
#ifdef DDRA
|
||||
&DDRA,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
&DDRB,
|
||||
#ifdef DDRC
|
||||
&DDRC,
|
||||
#ifdef DDRD
|
||||
&DDRD,
|
||||
#ifdef DDRE
|
||||
&DDRE,
|
||||
#ifdef DDRF
|
||||
&DDRF,
|
||||
#ifdef DDRG
|
||||
&DDRG,
|
||||
#ifdef DDRH
|
||||
&DDRH,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
const IO_PTR u8g_avr_port_P[] PROGMEM = {
|
||||
#ifdef PORTA
|
||||
&PORTA,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
&PORTB,
|
||||
#ifdef PORTC
|
||||
&PORTC,
|
||||
#ifdef PORTD
|
||||
&PORTD,
|
||||
#ifdef PORTE
|
||||
&PORTE,
|
||||
#ifdef PORTF
|
||||
&PORTF,
|
||||
#ifdef PORTG
|
||||
&PORTG,
|
||||
#ifdef PORTH
|
||||
&PORTH,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
const IO_PTR u8g_avr_pin_P[] PROGMEM = {
|
||||
#ifdef PINA
|
||||
&PINA,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
&PINB,
|
||||
#ifdef PINC
|
||||
&PINC,
|
||||
#ifdef PIND
|
||||
&PIND,
|
||||
#ifdef PINE
|
||||
&PINE,
|
||||
#ifdef PINF
|
||||
&PINF,
|
||||
#ifdef PING
|
||||
&PING,
|
||||
#ifdef PINH
|
||||
&PINH,
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
static volatile uint8_t *u8g_get_avr_io_ptr(const IO_PTR *base, uint8_t offset)
|
||||
{
|
||||
volatile uint8_t * tmp;
|
||||
base += offset;
|
||||
memcpy_P(&tmp, base, sizeof(volatile uint8_t * PROGMEM));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* set direction to output of the specified pin (internal pin number) */
|
||||
void u8g_SetPinOutput(uint8_t internal_pin_number)
|
||||
{
|
||||
*u8g_get_avr_io_ptr(u8g_avr_ddr_P, internal_pin_number>>3) |= _BV(internal_pin_number&7);
|
||||
}
|
||||
|
||||
void u8g_SetPinInput(uint8_t internal_pin_number)
|
||||
{
|
||||
*u8g_get_avr_io_ptr(u8g_avr_ddr_P, internal_pin_number>>3) &= ~_BV(internal_pin_number&7);
|
||||
}
|
||||
|
||||
void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level)
|
||||
{
|
||||
volatile uint8_t * tmp = u8g_get_avr_io_ptr(u8g_avr_port_P, internal_pin_number>>3);
|
||||
|
||||
if ( level == 0 )
|
||||
{
|
||||
U8G_ATOMIC_AND(tmp, ~_BV(internal_pin_number&7));
|
||||
// *tmp &= ~_BV(internal_pin_number&7);
|
||||
}
|
||||
else
|
||||
{
|
||||
U8G_ATOMIC_OR(tmp, _BV(internal_pin_number&7));
|
||||
//*tmp |= _BV(internal_pin_number&7);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
|
||||
{
|
||||
volatile uint8_t * tmp = u8g_get_avr_io_ptr(u8g_avr_pin_P, internal_pin_number>>3);
|
||||
if ( ((*tmp) & _BV(internal_pin_number&7)) != 0 )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined (__MSP430__)
|
||||
#include <msp430.h>
|
||||
|
||||
typedef volatile uint8_t * IO_PTR;
|
||||
|
||||
// MSP430 F5XXX / F6XXX series.
|
||||
const IO_PTR u8g_msp_ddr_P[] PROGMEM = {
|
||||
&P1DIR
|
||||
,&P2DIR
|
||||
,&P3DIR
|
||||
,&P4DIR
|
||||
,&P5DIR
|
||||
,&P6DIR
|
||||
,&P7DIR
|
||||
,&P8DIR
|
||||
#if defined (__MSP430_HAS_PORT9_R__)
|
||||
,&P9DIR
|
||||
#if defined (__MSP430_HAS_PORT10_R__)
|
||||
,&P10DIR
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
const IO_PTR u8g_msp_port_P[] PROGMEM = {
|
||||
&P1OUT
|
||||
,&P2OUT
|
||||
,&P3OUT
|
||||
,&P4OUT
|
||||
,&P5OUT
|
||||
,&P6OUT
|
||||
,&P7OUT
|
||||
,&P8OUT
|
||||
#if defined (__MSP430_HAS_PORT9_R__)
|
||||
,&P9OUT
|
||||
#if defined (__MSP430_HAS_PORT10_R__)
|
||||
,&P10OUT
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
const IO_PTR u8g_msp_pin_P[] PROGMEM = {
|
||||
&P1IN
|
||||
,&P2IN
|
||||
,&P3IN
|
||||
,&P4IN
|
||||
,&P5IN
|
||||
,&P6IN
|
||||
,&P7IN
|
||||
,&P8IN
|
||||
#if defined (__MSP430_HAS_PORT9_R__)
|
||||
,&P9IN
|
||||
#if defined (__MSP430_HAS_PORT10_R__)
|
||||
,&P10IN
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
uint8_t u8g_Pin(uint8_t port, uint8_t bitpos)
|
||||
{
|
||||
port <<= 3;
|
||||
port += bitpos;
|
||||
return port;
|
||||
}
|
||||
|
||||
void u8g_SetPinOutput(uint8_t internal_pin_number)
|
||||
{
|
||||
uint8_t port = (internal_pin_number >> 3)-1;
|
||||
uint8_t output = 1 << (internal_pin_number & 0x07);
|
||||
*u8g_msp_ddr_P[port] |= output;
|
||||
}
|
||||
|
||||
void u8g_SetPinInput(uint8_t internal_pin_number)
|
||||
{
|
||||
uint8_t port = (internal_pin_number >> 3)-1;
|
||||
*u8g_msp_ddr_P[port] &= ~(1 << (internal_pin_number & 0x07));
|
||||
}
|
||||
|
||||
void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level)
|
||||
{
|
||||
uint8_t port = (internal_pin_number >> 3)-1;
|
||||
if (level == 0)
|
||||
{
|
||||
*u8g_msp_port_P[port] &= ~(1 << (internal_pin_number & 0x07));
|
||||
}
|
||||
else
|
||||
{
|
||||
*u8g_msp_port_P[port]|= (1 << (internal_pin_number & 0x07));
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
|
||||
{
|
||||
uint8_t port = (internal_pin_number >> 3)-1;
|
||||
uint8_t tmp = *u8g_msp_pin_P[port];
|
||||
if (tmp & (1 << (internal_pin_number & 0x07)))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#elif defined(U8G_RASPBERRY_PI)
|
||||
|
||||
#include <wiringPi.h>
|
||||
//#include "/usr/local/include/wiringPi.h"
|
||||
|
||||
void u8g_SetPinOutput(uint8_t internal_pin_number) {
|
||||
pinMode(internal_pin_number, OUTPUT);
|
||||
}
|
||||
|
||||
void u8g_SetPinInput(uint8_t internal_pin_number) {
|
||||
pinMode(internal_pin_number, INPUT);
|
||||
}
|
||||
|
||||
void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level) {
|
||||
digitalWrite(internal_pin_number, level);
|
||||
}
|
||||
|
||||
uint8_t u8g_GetPinLevel(uint8_t internal_pin_number) {
|
||||
return digitalRead(internal_pin_number);
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* convert "port" and "bitpos" to internal pin number */
|
||||
uint8_t u8g_Pin(uint8_t port, uint8_t bitpos)
|
||||
{
|
||||
port <<= 3;
|
||||
port += bitpos;
|
||||
return port;
|
||||
}
|
||||
|
||||
void u8g_SetPinOutput(uint8_t internal_pin_number)
|
||||
{
|
||||
}
|
||||
|
||||
void u8g_SetPinInput(uint8_t internal_pin_number)
|
||||
{
|
||||
}
|
||||
|
||||
void u8g_SetPinLevel(uint8_t internal_pin_number, uint8_t level)
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t u8g_GetPinLevel(uint8_t internal_pin_number)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(U8G_WITH_PINLIST)
|
||||
|
||||
void u8g_SetPIOutput(u8g_t *u8g, uint8_t pi)
|
||||
{
|
||||
uint8_t pin;
|
||||
pin = u8g->pin_list[pi];
|
||||
if ( pin != U8G_PIN_NONE )
|
||||
u8g_SetPinOutput(pin);
|
||||
}
|
||||
|
||||
void u8g_SetPILevel(u8g_t *u8g, uint8_t pi, uint8_t level)
|
||||
{
|
||||
uint8_t pin;
|
||||
pin = u8g->pin_list[pi];
|
||||
if ( pin != U8G_PIN_NONE )
|
||||
u8g_SetPinLevel(pin, level);
|
||||
}
|
||||
|
||||
#else /* defined(U8G_WITH_PINLIST) */
|
||||
void u8g_SetPIOutput(u8g_t *u8g, uint8_t pi)
|
||||
{
|
||||
}
|
||||
|
||||
void u8g_SetPILevel(u8g_t *u8g, uint8_t pi, uint8_t level)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* defined(U8G_WITH_PINLIST) */
|
||||
168
.piolibdeps/U8glib_ID7/src/clib/u8g_com_linux_ssd_i2c.c
Normal file
168
.piolibdeps/U8glib_ID7/src/clib/u8g_com_linux_ssd_i2c.c
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
|
||||
u8g_com_linux_ssd_i2c.c
|
||||
|
||||
com interface for linux i2c-dev and the SSDxxxx chip (SOLOMON) variant
|
||||
I2C protocol
|
||||
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
Copyright (c) 2015, daniel@redfelineninja.org.uk
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(U8G_LINUX)
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <linux/i2c-dev.h>
|
||||
|
||||
|
||||
#define I2C_SLA 0x3c
|
||||
#define I2C_CMD_MODE 0x80
|
||||
#define I2C_DATA_MODE 0x40
|
||||
#define MAX_PACKET 64
|
||||
|
||||
#ifndef U8G_WITH_PINLIST
|
||||
#error U8G_WITH_PINLIST is mandatory for this driver
|
||||
#endif
|
||||
|
||||
static void set_cmd_mode(u8g_t *u8g, bool cmd_mode)
|
||||
{
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = cmd_mode;
|
||||
}
|
||||
|
||||
static bool get_cmd_mode(u8g_t *u8g)
|
||||
{
|
||||
return u8g->pin_list[U8G_PI_A0_STATE];
|
||||
}
|
||||
|
||||
static uint8_t send_data_burst(u8g_t *u8g, int fd, uint8_t *buf, size_t buflen)
|
||||
{
|
||||
uint8_t i2cbuf[2*MAX_PACKET];
|
||||
uint8_t i2clen;
|
||||
int res;
|
||||
|
||||
/* ignore bursts when there is no file open */
|
||||
if (fd < 0)
|
||||
return 0;
|
||||
|
||||
if (get_cmd_mode(u8g)) {
|
||||
i2clen = 0;
|
||||
while (buflen > 0) {
|
||||
i2cbuf[i2clen++] = I2C_CMD_MODE;
|
||||
i2cbuf[i2clen++] = *buf++;
|
||||
buflen--;
|
||||
}
|
||||
} else {
|
||||
i2cbuf[0] = I2C_DATA_MODE;
|
||||
memcpy(i2cbuf+1, buf, buflen);
|
||||
i2clen = buflen + 1;
|
||||
}
|
||||
|
||||
res = write(fd, i2cbuf, i2clen);
|
||||
if (res < 0)
|
||||
fprintf(stderr, "I2C write failed (%s)\n", strerror(errno));
|
||||
else if (res != i2clen)
|
||||
fprintf(stderr, "Incomplete I2C write (%d of %d packet)\n", res, i2clen);
|
||||
|
||||
return res == i2clen;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_linux_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
static int fd = -1;
|
||||
char dev[24];
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
sprintf(dev, "/dev/i2c-%d", u8g->pin_list[U8G_PI_I2C_OPTION]);
|
||||
fd = open(dev, O_RDWR);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "cannot open %s (%s)\n", dev, strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(fd, I2C_SLAVE, I2C_SLA) < 0) {
|
||||
fprintf(stderr, "cannot set slave address (%s)\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
/* ignored - i2c-dev will automatically stop between writes */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
/* ignored - no obvious means to reset an SSD via I2C */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
set_cmd_mode(u8g, true);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
send_data_burst(u8g, fd, &arg_val, 1);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
case U8G_COM_MSG_WRITE_SEQ_P: /* no progmem in Linux */
|
||||
while (arg_val > MAX_PACKET) {
|
||||
send_data_burst(u8g, fd, arg_ptr, MAX_PACKET);
|
||||
arg_ptr += MAX_PACKET;
|
||||
arg_val -= MAX_PACKET;
|
||||
}
|
||||
send_data_burst(u8g, fd, arg_ptr, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS:
|
||||
/* choose cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
set_cmd_mode(u8g, !arg_val);
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* U8G_LINUX */
|
||||
221
.piolibdeps/U8glib_ID7/src/clib/u8g_com_msp430_hw_spi.c
Normal file
221
.piolibdeps/U8glib_ID7/src/clib/u8g_com_msp430_hw_spi.c
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
|
||||
u8g_com_msp430_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(__MSP430__)
|
||||
#define U8G_MSP430_HW_SPI
|
||||
#endif
|
||||
|
||||
#if defined(U8G_MSP430_HW_SPI)
|
||||
|
||||
#include <msp430.h>
|
||||
|
||||
#ifndef F_CPU
|
||||
#error "Please specifiy actual master clock using F_CPU in HZ"
|
||||
#endif
|
||||
#ifndef F_SPI
|
||||
#define F_SPI 1000000UL
|
||||
#endif
|
||||
|
||||
#define U8G_USE_USCIA0 1
|
||||
#define U8G_USE_USCIB0 2
|
||||
#define U8G_USE_USCIA1 3
|
||||
#define U8G_USE_USCIB1 4
|
||||
#define U8G_USE_USCIA2 5
|
||||
#define U8G_USE_USCIB2 6
|
||||
#define U8G_USE_USCIA3 7
|
||||
#define U8G_USE_USCIB3 8
|
||||
|
||||
#ifndef U8G_USE_USCI
|
||||
#define U8G_USE_USCI U8G_USE_USCIB0
|
||||
#endif
|
||||
|
||||
#if U8G_USE_USCI == 1
|
||||
#define UCIFG UCA0IFG
|
||||
#define UCTXBUF UCA0TXBUF
|
||||
#define UCSTAT UCA0STAT
|
||||
#define UCCTL0 UCA0CTL0
|
||||
#define UCCTL1 UCA0CTL1
|
||||
#define UCBR0 UCA0BR0
|
||||
#define UCBR1 UCA0BR1
|
||||
#elif U8G_USE_USCI == 2
|
||||
#define UCIFG UCB0IFG
|
||||
#define UCTXBUF UCB0TXBUF
|
||||
#define UCSTAT UCB0STAT
|
||||
#define UCCTL0 UCB0CTL0
|
||||
#define UCCTL1 UCB0CTL1
|
||||
#define UCBR0 UCB0BR0
|
||||
#define UCBR1 UCB0BR1
|
||||
#elif U8G_USE_USCI == 3
|
||||
#define UCIFG UCA1IFG
|
||||
#define UCTXBUF UCA1TXBUF
|
||||
#define UCSTAT UCA1STAT
|
||||
#define UCCTL0 UCA1CTL0
|
||||
#define UCCTL1 UCA1CTL1
|
||||
#define UCBR0 UCA1BR0
|
||||
#define UCBR1 UCA1BR1
|
||||
#elif U8G_USE_USCI == 4
|
||||
#define UCIFG UCB1IFG
|
||||
#define UCTXBUF UCB1TXBUF
|
||||
#define UCSTAT UCB1STAT
|
||||
#define UCCTL0 UCB1CTL0
|
||||
#define UCCTL1 UCB1CTL1
|
||||
#define UCBR0 UCB1BR0
|
||||
#define UCBR1 UCB1BR1
|
||||
#elif U8G_USE_USCI == 5
|
||||
#define UCIFG UCA2IFG
|
||||
#define UCTXBUF UCA2TXBUF
|
||||
#define UCSTAT UCA2STAT
|
||||
#define UCCTL0 UCA2CTL0
|
||||
#define UCCTL1 UCA2CTL1
|
||||
#define UCBR0 UCA2BR0
|
||||
#define UCBR1 UCA2BR1
|
||||
#elif U8G_USE_USCI == 6
|
||||
#define UCIFG UCB2IFG
|
||||
#define UCTXBUF UCB2TXBUF
|
||||
#define UCSTAT UCB2STAT
|
||||
#define UCCTL0 UCB2CTL0
|
||||
#define UCCTL1 UCB2CTL1
|
||||
#define UCBR0 UCB2BR0
|
||||
#define UCBR1 UCB2BR1
|
||||
#elif U8G_USE_USCI == 7
|
||||
#define UCIFG UCA3IFG
|
||||
#define UCTXBUF UCA3TXBUF
|
||||
#define UCSTAT UCA3STAT
|
||||
#define UCCTL0 UCA3CTL0
|
||||
#define UCCTL1 UCA3CTL1
|
||||
#define UCBR0 UCA3BR0
|
||||
#define UCBR1 UCA3BR1
|
||||
#elif U8G_USE_USCI == 8
|
||||
#define UCIFG UCB3IFG
|
||||
#define UCTXBUF UCB3TXBUF
|
||||
#define UCSTAT UCB3STAT
|
||||
#define UCCTL0 UCB3CTL0
|
||||
#define UCCTL1 UCB3CTL1
|
||||
#define UCBR0 UCB3BR0
|
||||
#define UCBR1 UCB3BR1
|
||||
#endif
|
||||
|
||||
inline void u8g_msp430_spi_out(uint8_t data)
|
||||
{
|
||||
while (!(UCIFG&UCTXIFG));
|
||||
UCTXBUF = data;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_msp430_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
/*
|
||||
* on MSP430 you need to set PSEL alternative function which
|
||||
* may not be required on other MCU's - should be handled
|
||||
* by a low level u8g_SetPinAlternate(pin_number)...
|
||||
*/
|
||||
UCCTL1 |= UCSWRST; // **Put state machine in reset**
|
||||
UCCTL0 |= UCMST|UCSYNC|UCCKPL|UCMSB; // 3-pin, 8-bit SPI master Clock polarity high, MSB
|
||||
UCCTL1 |= UCSSEL_2; // SMCLK
|
||||
UCBR0 = (unsigned char)(F_CPU/F_SPI); //
|
||||
UCBR1 = 0; //
|
||||
UCCTL1 &= ~UCSWRST; // **Initialize USCI state machine**
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, 1);
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, 1);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, (arg_val ? 0 : 1));
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_msp430_spi_out(arg_val);
|
||||
while ((UCSTAT&UCBUSY));
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_msp430_spi_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
while ((UCSTAT&UCBUSY));
|
||||
}
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_msp430_spi_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
while ((UCSTAT&UCBUSY));
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_msp430_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
63
.piolibdeps/U8glib_ID7/src/clib/u8g_com_null.c
Normal file
63
.piolibdeps/U8glib_ID7/src/clib/u8g_com_null.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
|
||||
u8g_com_null.c
|
||||
|
||||
communication null device
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
uint8_t u8g_com_null_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
break;
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
/* arg_val contains the chip number, which should be enabled */
|
||||
break;
|
||||
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
break;
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
107
.piolibdeps/U8glib_ID7/src/clib/u8g_com_psoc5_ssd_hw_parallel.c
Normal file
107
.piolibdeps/U8glib_ID7/src/clib/u8g_com_psoc5_ssd_hw_parallel.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
|
||||
u8g_com_psoc5_ssd_hw_parallel.c
|
||||
|
||||
com interface for Cypress PSoC5 and the SSDxxxx chip variant
|
||||
I2C protocol
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2015, olikraus@gmail.com, schmidt.ronny@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(U8G_CYPRESS_PSOC5)
|
||||
|
||||
#include <project.h>
|
||||
|
||||
static uint8 dc = 0; // need to store whether next write is data or command
|
||||
|
||||
uint8_t u8g_com_psoc5_ssd_hw_parallel_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
// stop the device
|
||||
GraphicLCDIntf_Stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
// init hardware interfaces, timers, gpios, ...
|
||||
GraphicLCDIntf_Init();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS:
|
||||
// switch from cmd (arg_val = 0) to data mode (arg_val = 1) or vice versa
|
||||
dc = arg_val;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
/* done by the hardware */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
// toggle the reset pin of the display by value in arg_val
|
||||
nRES_Write(0);
|
||||
u8g_10MicroDelay();
|
||||
nRES_Write(1);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
// write byte to the device
|
||||
GraphicLCDIntf_Write8(dc, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
// write a sequence of bytes to the device
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while (arg_val-- > 0)
|
||||
{
|
||||
GraphicLCDIntf_Write8(dc, *ptr++);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_psoc5_ssd_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
124
.piolibdeps/U8glib_ID7/src/clib/u8g_com_raspberrypi_hw_spi.c
Normal file
124
.piolibdeps/U8glib_ID7/src/clib/u8g_com_raspberrypi_hw_spi.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
|
||||
u8g_com_raspberrypi_hw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Assumes, that
|
||||
MOSI is at PORTB, Pin 3
|
||||
and
|
||||
SCK is at PORTB, Pin 5
|
||||
|
||||
Update for ATOMIC operation done (01 Jun 2013)
|
||||
U8G_ATOMIC_OR(ptr, val)
|
||||
U8G_ATOMIC_AND(ptr, val)
|
||||
U8G_ATOMIC_START()
|
||||
U8G_ATOMIC_END()
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
|
||||
#if defined(U8G_RASPBERRY_PI)
|
||||
|
||||
#include <wiringPiSPI.h>
|
||||
#include <wiringPi.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_INIT:
|
||||
// check wiringPi setup
|
||||
if (wiringPiSetup() == -1)
|
||||
{
|
||||
printf("wiringPi-Error\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (wiringPiSPISetup (0, 100000) < 0)
|
||||
{
|
||||
printf ("Unable to open SPI device 0: %s\n", strerror (errno)) ;
|
||||
exit (1) ;
|
||||
}
|
||||
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
/* Done by the SPI hardware */
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
wiringPiSPIDataRW (0, &arg_val, 1) ;
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
wiringPiSPIDataRW (0, arg_ptr, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
wiringPiSPIDataRW (0, arg_ptr, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
uint8_t u8g_com_raspberrypi_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
176
.piolibdeps/U8glib_ID7/src/clib/u8g_com_raspberrypi_ssd_i2c.c
Normal file
176
.piolibdeps/U8glib_ID7/src/clib/u8g_com_raspberrypi_ssd_i2c.c
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
Special pin usage:
|
||||
U8G_PI_I2C_OPTION additional options
|
||||
U8G_PI_A0_STATE used to store the last value of the command/data register selection
|
||||
U8G_PI_SET_A0 1: Signal request to update I2C device with new A0_STATE, 0: Do nothing, A0_STATE matches I2C device
|
||||
U8G_PI_SCL clock line (NOT USED)
|
||||
U8G_PI_SDA data line (NOT USED)
|
||||
|
||||
U8G_PI_RESET reset line (currently disabled, see below)
|
||||
|
||||
Protocol:
|
||||
SLA, Cmd/Data Selection, Arguments
|
||||
The command/data register is selected by a special instruction byte, which is sent after SLA
|
||||
|
||||
The continue bit is always 0 so that a (re)start is equired for the change from cmd to/data mode
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(U8G_RASPBERRY_PI)
|
||||
|
||||
#include <wiringPi.h>
|
||||
#include <wiringPiI2C.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define I2C_SLA 0x3c
|
||||
#define I2C_CMD_MODE 0x000
|
||||
#define I2C_DATA_MODE 0x040
|
||||
|
||||
#if defined(U8G_WITH_PINLIST)
|
||||
|
||||
uint8_t u8g_com_raspberrypi_ssd_start_sequence(u8g_t *u8g)
|
||||
{
|
||||
/* are we requested to set the a0 state? */
|
||||
if ( u8g->pin_list[U8G_PI_SET_A0] == 0 )
|
||||
return 1;
|
||||
|
||||
/* setup bus, might be a repeated start */
|
||||
if ( u8g_i2c_start(I2C_SLA) == 0 )
|
||||
return 0;
|
||||
if ( u8g->pin_list[U8G_PI_A0_STATE] == 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_mode(I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( u8g_i2c_send_mode(I2C_DATA_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_i2c_init(u8g->pin_list[U8G_PI_I2C_OPTION]);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = 0;
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again, also forces start condition */
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable chip, send stop condition */
|
||||
u8g_i2c_stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable, do nothing: any byte writing will trigger the i2c start */
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_raspberrypi_ssd_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
if ( u8g_i2c_send_byte(arg_val) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_raspberrypi_ssd_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
{
|
||||
register uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(*ptr++) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
//u8g->pin_list[U8G_PI_SET_A0] = 1;
|
||||
if ( u8g_com_raspberrypi_ssd_start_sequence(u8g) == 0 )
|
||||
return u8g_i2c_stop(), 0;
|
||||
{
|
||||
register uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
if ( u8g_i2c_send_byte(u8g_pgm_read(ptr)) == 0 )
|
||||
return 0;
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
// u8g_i2c_stop();
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g->pin_list[U8G_PI_A0_STATE] = arg_val;
|
||||
u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again */
|
||||
|
||||
#ifdef OLD_CODE
|
||||
if ( i2c_state != 0 )
|
||||
{
|
||||
u8g_i2c_stop();
|
||||
i2c_state = 0;
|
||||
}
|
||||
|
||||
if ( u8g_com_raspberrypi_ssd_start_sequence(arg_val) == 0 )
|
||||
return 0;
|
||||
|
||||
/* setup bus, might be a repeated start */
|
||||
/*
|
||||
if ( u8g_i2c_start(I2C_SLA) == 0 )
|
||||
return 0;
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
i2c_state = 1;
|
||||
|
||||
if ( u8g_i2c_send_byte(I2C_CMD_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i2c_state = 2;
|
||||
if ( u8g_i2c_send_byte(I2C_DATA_MODE) == 0 )
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* defined(U8G_WITH_PINLIST) */
|
||||
|
||||
uint8_t u8g_com_raspberrypi_ssd_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* defined(U8G_WITH_PINLIST) */
|
||||
#endif
|
||||
140
.piolibdeps/U8glib_ID7/src/clib/u8g_com_std_sw_spi.c
Normal file
140
.piolibdeps/U8glib_ID7/src/clib/u8g_com_std_sw_spi.c
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
|
||||
u8g_com_std_sw_spi.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2015, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#if defined(U8G_WITH_PINLIST)
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val)
|
||||
{
|
||||
uint8_t i = 8;
|
||||
do
|
||||
{
|
||||
if ( val & 128 )
|
||||
u8g_SetPinLevel(dataPin, 1);
|
||||
else
|
||||
u8g_SetPinLevel(dataPin, 0);
|
||||
val <<= 1;
|
||||
u8g_MicroDelay(); /* 23 Sep 2012 */
|
||||
//delay(1);
|
||||
u8g_SetPinLevel(clockPin, 1);
|
||||
u8g_MicroDelay(); /* 23 Sep 2012 */
|
||||
//delay(1);
|
||||
u8g_SetPinLevel(clockPin, 0);
|
||||
u8g_MicroDelay(); /* 23 Sep 2012 */
|
||||
//delay(1);
|
||||
i--;
|
||||
} while( i != 0 );
|
||||
}
|
||||
|
||||
uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_COM_MSG_INIT:
|
||||
u8g_SetPIOutput(u8g, U8G_PI_SCK);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_MOSI);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_RESET);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_CS);
|
||||
u8g_SetPIOutput(u8g, U8G_PI_A0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_MOSI, 0);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
u8g_SetPILevel(u8g, U8G_PI_RESET, arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
if ( arg_val == 0 )
|
||||
{
|
||||
/* disable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* enable */
|
||||
u8g_SetPILevel(u8g, U8G_PI_SCK, 0);
|
||||
u8g_SetPILevel(u8g, U8G_PI_CS, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], *ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P:
|
||||
{
|
||||
register uint8_t *ptr = arg_ptr;
|
||||
while( arg_val > 0 )
|
||||
{
|
||||
u8g_sw_spi_shift_out(u8g->pin_list[U8G_PI_MOSI], u8g->pin_list[U8G_PI_SCK], u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
u8g_SetPILevel(u8g, U8G_PI_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
|
||||
uint8_t u8g_com_std_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
99
.piolibdeps/U8glib_ID7/src/clib/u8g_cursor.c
Normal file
99
.piolibdeps/U8glib_ID7/src/clib/u8g_cursor.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
|
||||
u8g_cursor.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
void u8g_SetCursorFont(u8g_t *u8g, const u8g_pgm_uint8_t *cursor_font)
|
||||
{
|
||||
u8g->cursor_font = cursor_font;
|
||||
}
|
||||
|
||||
void u8g_SetCursorStyle(u8g_t *u8g, uint8_t encoding)
|
||||
{
|
||||
u8g->cursor_encoding = encoding;
|
||||
}
|
||||
|
||||
void u8g_SetCursorColor(u8g_t *u8g, uint8_t fg, uint8_t bg)
|
||||
{
|
||||
u8g->cursor_bg_color = bg;
|
||||
u8g->cursor_fg_color = fg;
|
||||
}
|
||||
|
||||
void u8g_SetCursorPos(u8g_t *u8g, u8g_uint_t cursor_x, u8g_uint_t cursor_y)
|
||||
{
|
||||
u8g->cursor_x = cursor_x;
|
||||
u8g->cursor_y = cursor_y;
|
||||
}
|
||||
|
||||
void u8g_EnableCursor(u8g_t *u8g)
|
||||
{
|
||||
u8g->cursor_fn = u8g_DrawCursor;
|
||||
}
|
||||
|
||||
void u8g_DisableCursor(u8g_t *u8g)
|
||||
{
|
||||
u8g->cursor_fn = (u8g_draw_cursor_fn)0;
|
||||
}
|
||||
|
||||
void u8g_DrawCursor(u8g_t *u8g)
|
||||
{
|
||||
const u8g_pgm_uint8_t *font;
|
||||
uint8_t color;
|
||||
uint8_t encoding = u8g->cursor_encoding;
|
||||
|
||||
/* get current values */
|
||||
color = u8g_GetColorIndex(u8g);
|
||||
font = u8g->font;
|
||||
|
||||
/* draw cursor */
|
||||
u8g->font = u8g->cursor_font;
|
||||
encoding++;
|
||||
u8g_SetColorIndex(u8g, u8g->cursor_bg_color);
|
||||
/* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */
|
||||
/* required, because y adjustment should not happen to the cursor fonts */
|
||||
u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding);
|
||||
encoding--;
|
||||
u8g_SetColorIndex(u8g, u8g->cursor_fg_color);
|
||||
/* 27. Jan 2013: replaced call to u8g_DrawGlyph with call to u8g_draw_glyph */
|
||||
/* required, because y adjustment should not happen to the cursor fonts */
|
||||
/* u8g_DrawGlyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding); */
|
||||
u8g_draw_glyph(u8g, u8g->cursor_x, u8g->cursor_y, encoding);
|
||||
|
||||
/* restore previous values */
|
||||
u8g->font = font;
|
||||
u8g_SetColorIndex(u8g, color);
|
||||
}
|
||||
|
||||
323
.piolibdeps/U8glib_ID7/src/clib/u8g_delay.c
Normal file
323
.piolibdeps/U8glib_ID7/src/clib/u8g_delay.c
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
|
||||
u8g_delay.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
void u8g_Delay(uint16_t val) Delay by "val" milliseconds
|
||||
void u8g_MicroDelay(void) Delay be one microsecond
|
||||
void u8g_10MicroDelay(void) Delay by 10 microseconds
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
/*==== Part 1: Derive suitable delay procedure ====*/
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
# if ARDUINO < 100
|
||||
# include <WProgram.h>
|
||||
# else
|
||||
# include <Arduino.h>
|
||||
# endif
|
||||
|
||||
/* issue 353 */
|
||||
#if defined(ARDUINO_ARCH_SAMD)
|
||||
# include <delay.h>
|
||||
#endif
|
||||
|
||||
# if defined(__AVR__)
|
||||
# define USE_AVR_DELAY
|
||||
# elif defined(__PIC32MX)
|
||||
# define USE_PIC32_DELAY
|
||||
# elif defined(__arm__) /* Arduino Due & Teensy */
|
||||
# define USE_ARDUINO_DELAY
|
||||
# else
|
||||
# define USE_ARDUINO_DELAY
|
||||
# endif
|
||||
#elif defined(_GNU_SOURCE)
|
||||
# define USE_LINUX_DELAY
|
||||
#elif defined(__MSP430__)
|
||||
# define USE_MSP430_DELAY
|
||||
#elif defined(U8G_RASPBERRY_PI)
|
||||
# define USE_RASPBERRYPI_DELAY
|
||||
#elif defined(__AVR__)
|
||||
# define USE_AVR_DELAY
|
||||
#elif defined(__18CXX)
|
||||
# define USE_PIC18_DELAY
|
||||
#elif defined(U8G_CYPRESS_PSOC5)
|
||||
#define USE_PSOC5_DELAY
|
||||
#elif defined(__arm__)
|
||||
/* do not define anything, all procedures are expected to be defined outside u8glib */
|
||||
|
||||
/*
|
||||
void u8g_Delay(uint16_t val);
|
||||
void u8g_MicroDelay(void);
|
||||
void u8g_10MicroDelay(void);
|
||||
*/
|
||||
|
||||
#else
|
||||
# define USE_DUMMY_DELAY
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*==== Part 2: Definition of the delay procedures ====*/
|
||||
|
||||
/*== Raspberry Pi Delay ==*/
|
||||
#if defined (USE_RASPBERRYPI_DELAY)
|
||||
#include <wiringPi.h>
|
||||
//#include "/usr/local/include/wiringPi.h"
|
||||
void u8g_Delay(uint16_t val) {
|
||||
//delay(val);
|
||||
//usleep((uint32_t)val*(uint32_t)1000);
|
||||
delayMicroseconds((uint32_t)val*(uint32_t)1000);
|
||||
}
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
usleep(1);
|
||||
}
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
usleep(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_LINUX_DELAY)
|
||||
void u8g_Delay(uint16_t val) {
|
||||
//delay(val);
|
||||
usleep((uint32_t)val*(uint32_t)1000);
|
||||
}
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
usleep(1);
|
||||
}
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
usleep(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*== AVR Delay ==*/
|
||||
|
||||
#if defined(USE_AVR_DELAY)
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
|
||||
/*
|
||||
Delay by the provided number of milliseconds.
|
||||
Thus, a 16 bit value will allow a delay of 0..65 seconds
|
||||
Makes use of the _delay_loop_2
|
||||
|
||||
_delay_loop_2 will do a delay of n * 4 prozessor cycles.
|
||||
with f = F_CPU cycles per second,
|
||||
n = f / (1000 * 4 )
|
||||
with f = 16000000 the result is 4000
|
||||
with f = 1000000 the result is 250
|
||||
|
||||
the millisec loop, gcc requires the following overhead:
|
||||
- movev 1
|
||||
- subwi 2x2
|
||||
- bne i 2
|
||||
==> 7 cycles
|
||||
==> must be devided by 4, rounded up 7/4 = 2
|
||||
*/
|
||||
void u8g_Delay(uint16_t val)
|
||||
{
|
||||
/* old version did a call to the arduino lib: delay(val); */
|
||||
while( val != 0 )
|
||||
{
|
||||
_delay_loop_2( (F_CPU / 4000 ) -2);
|
||||
val--;
|
||||
}
|
||||
}
|
||||
|
||||
/* delay by one micro second */
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
#if (F_CPU / 4000000 ) > 0
|
||||
_delay_loop_2( (F_CPU / 4000000 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
/* delay by 10 micro seconds */
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
#if (F_CPU / 400000 ) > 0
|
||||
_delay_loop_2( (F_CPU / 400000 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*== Delay for PIC18 (not tested) ==*/
|
||||
|
||||
#if defined(USE_PIC18_DELAY)
|
||||
#include <delays.h>
|
||||
#define GetSystemClock() (64000000ul) // Hz
|
||||
#define GetInstructionClock() (GetSystemClock()/4)
|
||||
|
||||
void u8g_Delay(uint16_t val)
|
||||
{/*
|
||||
unsigned int _iTemp = (val);
|
||||
while(_iTemp--)
|
||||
Delay1KTCYx((GetInstructionClock()+999999)/1000000);
|
||||
*/
|
||||
}
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
/* not implemented */
|
||||
}
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
/* not implemented */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*== Arduino Delay ==*/
|
||||
#if defined(USE_ARDUINO_DELAY)
|
||||
void u8g_Delay(uint16_t val)
|
||||
{
|
||||
#if defined(__arm__)
|
||||
delayMicroseconds((uint32_t)val*(uint32_t)1000);
|
||||
#else
|
||||
delay(val);
|
||||
#endif
|
||||
}
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
delayMicroseconds(1);
|
||||
}
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
delayMicroseconds(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(USE_PIC32_DELAY)
|
||||
/*
|
||||
Assume chipkit here with F_CPU correctly defined
|
||||
The problem was, that u8g_Delay() is called within the constructor.
|
||||
It seems that the chipkit is not fully setup at this time, so a
|
||||
call to delay() will not work. So here is my own implementation.
|
||||
|
||||
*/
|
||||
#define CPU_COUNTS_PER_SECOND (F_CPU/2UL)
|
||||
#define TICKS_PER_MILLISECOND (CPU_COUNTS_PER_SECOND/1000UL)
|
||||
#include "plib.h"
|
||||
void u8g_Delay(uint16_t val)
|
||||
{
|
||||
uint32_t d;
|
||||
uint32_t s;
|
||||
d = val;
|
||||
d *= TICKS_PER_MILLISECOND;
|
||||
s = ReadCoreTimer();
|
||||
while ( (uint32_t)(ReadCoreTimer() - s) < d )
|
||||
;
|
||||
}
|
||||
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
uint32_t d;
|
||||
uint32_t s;
|
||||
d = TICKS_PER_MILLISECOND/1000;
|
||||
s = ReadCoreTimer();
|
||||
while ( (uint32_t)(ReadCoreTimer() - s) < d )
|
||||
;
|
||||
}
|
||||
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
uint32_t d;
|
||||
uint32_t s;
|
||||
d = TICKS_PER_MILLISECOND/100;
|
||||
s = ReadCoreTimer();
|
||||
while ( (uint32_t)(ReadCoreTimer() - s) < d )
|
||||
;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(USE_MSP430_DELAY)
|
||||
#include <msp430.h>
|
||||
|
||||
#ifndef F_CPU
|
||||
#define F_CPU 1000000UL
|
||||
#endif
|
||||
|
||||
|
||||
void u8g_Delay(uint16_t val)
|
||||
{
|
||||
int t;
|
||||
for (t=0; t < val; t++)
|
||||
{
|
||||
__delay_cycles(F_CPU/1000UL);
|
||||
}
|
||||
}
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
__delay_cycles(F_CPU/1000000UL);
|
||||
}
|
||||
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
__delay_cycles(F_CPU/100000UL);
|
||||
}
|
||||
#endif
|
||||
#if defined USE_PSOC5_DELAY
|
||||
#include <project.h>
|
||||
void u8g_Delay(uint16_t val) {CyDelay(val);};
|
||||
void u8g_MicroDelay(void) {CyDelay(1);};
|
||||
void u8g_10MicroDelay(void) {CyDelay(10);};
|
||||
#endif
|
||||
|
||||
|
||||
/*== Any other systems: Dummy Delay ==*/
|
||||
#if defined(USE_DUMMY_DELAY)
|
||||
void u8g_Delay(uint16_t val)
|
||||
{
|
||||
/* do not know how to delay... */
|
||||
}
|
||||
void u8g_MicroDelay(void)
|
||||
{
|
||||
}
|
||||
void u8g_10MicroDelay(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
199
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_a2_micro_printer.c
Normal file
199
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_a2_micro_printer.c
Normal file
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
|
||||
u8g_dev_a2_micro_printer_ds.c
|
||||
|
||||
Use DC2 bitmap command of the A2 Micro panel termal printer
|
||||
double stroke
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2013, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define LINE_DELAY 40
|
||||
|
||||
|
||||
uint8_t u8g_dev_a2_micro_printer_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t y, i, j;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
|
||||
u8g_WriteByte(u8g, dev, 27); /* ESC */
|
||||
u8g_WriteByte(u8g, dev, 55 ); /* parameter command */
|
||||
u8g_WriteByte(u8g, dev, 7); /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
|
||||
u8g_WriteByte(u8g, dev, 160); /* 3-255 Heating time,Unit(10us),Default:80(800us) */
|
||||
u8g_WriteByte(u8g, dev, 20); /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
|
||||
|
||||
u8g_WriteByte(u8g, dev, 18); /* DC2 */
|
||||
u8g_WriteByte(u8g, dev, 42 ); /* * */
|
||||
u8g_WriteByte(u8g, dev, pb->p.page_height );
|
||||
u8g_WriteByte(u8g, dev, pb->width/8 );
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i ++ )
|
||||
{
|
||||
for( j = 0; j < pb->width/8; j++ )
|
||||
{
|
||||
u8g_WriteByte(u8g, dev, *ptr);
|
||||
ptr++;
|
||||
}
|
||||
u8g_Delay(LINE_DELAY);
|
||||
y++;
|
||||
}
|
||||
|
||||
/* set parameters back to their default values */
|
||||
u8g_WriteByte(u8g, dev, 27); /* ESC */
|
||||
u8g_WriteByte(u8g, dev, 55 ); /* parameter command */
|
||||
u8g_WriteByte(u8g, dev, 7); /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
|
||||
u8g_WriteByte(u8g, dev, 80); /* 3-255 Heating time,Unit(10us),Default:80(800us) */
|
||||
u8g_WriteByte(u8g, dev, 2); /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
static uint8_t u8g_dev_expand4(uint8_t val)
|
||||
{
|
||||
uint8_t a,b,c,d;
|
||||
a = val&1;
|
||||
b = (val&2)<<1;
|
||||
c = (val&4)<<2;
|
||||
d = (val&8)<<3;
|
||||
a |=b;
|
||||
a |=c;
|
||||
a |=d;
|
||||
a |= a<<1;
|
||||
return a;
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_a2_micro_printer_double_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_FIRST:
|
||||
{
|
||||
//u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
//u8g_WriteByte(u8g, dev, 18); /* DC2 */
|
||||
//u8g_WriteByte(u8g, dev, 42 ); /* * */
|
||||
//u8g_WriteByte(u8g, dev, pb->p.total_height*2 );
|
||||
//u8g_WriteByte(u8g, dev, pb->width/8*2 );
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t y, i, j;
|
||||
uint8_t *ptr;
|
||||
uint8_t *p2;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
//u8g_WriteByte(u8g, dev, 18); /* DC2 */
|
||||
//u8g_WriteByte(u8g, dev, 35 ); /* # */
|
||||
//u8g_WriteByte(u8g, dev, 0x0ff ); /* max */
|
||||
|
||||
u8g_WriteByte(u8g, dev, 27); /* ESC */
|
||||
u8g_WriteByte(u8g, dev, 55 ); /* parameter command */
|
||||
u8g_WriteByte(u8g, dev, 7); /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
|
||||
u8g_WriteByte(u8g, dev, 160); /* 3-255 Heating time,Unit(10us),Default:80(800us) */
|
||||
u8g_WriteByte(u8g, dev, 20); /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
|
||||
|
||||
u8g_WriteByte(u8g, dev, 18); /* DC2 */
|
||||
u8g_WriteByte(u8g, dev, 42 ); /* * */
|
||||
u8g_WriteByte(u8g, dev, pb->p.page_height*2 );
|
||||
u8g_WriteByte(u8g, dev, pb->width/8*2 );
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i ++ )
|
||||
{
|
||||
p2 = ptr;
|
||||
for( j = 0; j < pb->width/8; j++ )
|
||||
{
|
||||
u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 >> 4));
|
||||
u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 & 15));
|
||||
p2++;
|
||||
}
|
||||
u8g_Delay(LINE_DELAY);
|
||||
p2 = ptr;
|
||||
for( j = 0; j < pb->width/8; j++ )
|
||||
{
|
||||
u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 >> 4));
|
||||
u8g_WriteByte(u8g, dev, u8g_dev_expand4(*p2 & 15));
|
||||
p2++;
|
||||
}
|
||||
u8g_Delay(LINE_DELAY);
|
||||
ptr += pb->width/8;
|
||||
y++;
|
||||
}
|
||||
|
||||
/* set parameters back to their default values */
|
||||
u8g_WriteByte(u8g, dev, 27); /* ESC */
|
||||
u8g_WriteByte(u8g, dev, 55 ); /* parameter command */
|
||||
u8g_WriteByte(u8g, dev, 7); /* Max printing dots,Unit(8dots),Default:7(64 dots) 8*(x+1)*/
|
||||
u8g_WriteByte(u8g, dev, 80); /* 3-255 Heating time,Unit(10us),Default:80(800us) */
|
||||
u8g_WriteByte(u8g, dev, 2); /* 0-255 Heating interval,Unit(10us),Default:2(20us)*/
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
#if defined(U8G_16BIT)
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_384x240, 384, 240, 8, u8g_dev_a2_micro_printer_fn, u8g_com_null_fn);
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_192x360_ds, 192, 360, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_192x720_ds, 192, 720, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
|
||||
#else
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_384x240, 240, 240, 8, u8g_dev_a2_micro_printer_fn, u8g_com_null_fn);
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_192x360_ds, 192, 240, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_192x720_ds, 192, 240, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
|
||||
#endif
|
||||
|
||||
U8G_PB_DEV(u8g_dev_a2_micro_printer_192x120_ds, 192, 120, 8, u8g_dev_a2_micro_printer_double_fn, u8g_com_null_fn);
|
||||
92
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_flipdisc_2x7.c
Normal file
92
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_flipdisc_2x7.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
|
||||
u8g_dev_flipdisc.c
|
||||
|
||||
1-Bit (BW) Driver for flip disc matrix
|
||||
2x 7 pixel height
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 28
|
||||
#define HEIGHT 14
|
||||
#define PAGE_HEIGHT 14
|
||||
|
||||
/*
|
||||
Write data to the flip disc matrix.
|
||||
This procedure must be implemented by the user.
|
||||
Arguments:
|
||||
id: Id for the matrix. Currently always 0.
|
||||
page: A page has a height of 14 pixel. For a matrix with HEIGHT == 14 this will be always 0
|
||||
width: The width of the flip disc matrix. Always equal to WIDTH
|
||||
row1: first data line (7 pixel per byte)
|
||||
row2: first data line (7 pixel per byte)
|
||||
*/
|
||||
void writeFlipDiscMatrix(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2);
|
||||
|
||||
|
||||
|
||||
void (*u8g_write_flip_disc_matrix)(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2);
|
||||
|
||||
void u8g_SetFlipDiscCallback(u8g_t *u8g, void (*cb)(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2))
|
||||
{
|
||||
u8g_write_flip_disc_matrix = cb;
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_flipdisc_2x7_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
/* current page: pb->p.page */
|
||||
/* ptr to the buffer: pb->buf */
|
||||
|
||||
(*u8g_write_flip_disc_matrix)(0, pb->p.page, WIDTH, pb->buf, (uint8_t *)(pb->buf)+WIDTH);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb14v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_flipdisc_2x7_bw_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_flipdisc_2x7_bw_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_flipdisc_2x7_bw_buf};
|
||||
u8g_dev_t u8g_dev_flipdisc_2x7 = { u8g_dev_flipdisc_2x7_bw_fn, &u8g_dev_flipdisc_2x7_bw_pb, u8g_com_null_fn };
|
||||
130
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_gprof.c
Normal file
130
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_gprof.c
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
|
||||
u8g_dev_gprof.c
|
||||
|
||||
Device for performance measurement with gprof.
|
||||
Does not write any data, but uses a buffer.
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
uint8_t u8g_dev_gprof_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg);
|
||||
|
||||
uint8_t u8g_pb_dev_gprof_buf[WIDTH];
|
||||
u8g_pb_t u8g_pb_dev_gprof = { {PAGE_HEIGHT, HEIGHT, 0, 0, 0}, WIDTH, u8g_pb_dev_gprof_buf };
|
||||
|
||||
u8g_dev_t u8g_dev_gprof = { u8g_dev_gprof_fn, &u8g_pb_dev_gprof, NULL };
|
||||
|
||||
uint8_t u8g_dev_gprof_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_FIRST:
|
||||
u8g_pb_Clear(pb);
|
||||
u8g_page_First(&(pb->p));
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
/*
|
||||
{
|
||||
uint8_t i, j;
|
||||
uint8_t page_height;
|
||||
page_height = pb->p.page_y1;
|
||||
page_height -= pb->p.page_y0;
|
||||
page_height++;
|
||||
for( j = 0; j < page_height; j++ )
|
||||
{
|
||||
printf("%02d ", j);
|
||||
for( i = 0; i < WIDTH; i++ )
|
||||
{
|
||||
if ( (u8g_pb_dev_stdout_buf[i] & (1<<j)) != 0 )
|
||||
printf("#");
|
||||
else
|
||||
printf(".");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ( u8g_page_Next(&(pb->p)) == 0 )
|
||||
{
|
||||
//printf("\n");
|
||||
return 0;
|
||||
}
|
||||
u8g_pb_Clear(pb);
|
||||
break;
|
||||
#ifdef U8G_DEV_MSG_IS_BBX_INTERSECTION
|
||||
case U8G_DEV_MSG_IS_BBX_INTERSECTION:
|
||||
{
|
||||
u8g_dev_arg_bbx_t *bbx = (u8g_dev_arg_bbx_t *)arg;
|
||||
u8g_uint_t x2, y2;
|
||||
|
||||
y2 = bbx->y;
|
||||
y2 += bbx->h;
|
||||
y2--;
|
||||
|
||||
if ( u8g_pb_IsYIntersection(pb, bbx->y, y2) == 0 )
|
||||
return 0;
|
||||
|
||||
/* maybe this one can be skiped... probability is very high to have an intersection, so it would be ok to always return 1 */
|
||||
x2 = bbx->x;
|
||||
x2 += bbx->w;
|
||||
x2--;
|
||||
|
||||
if ( u8g_pb_IsXIntersection(pb, bbx->x, x2) == 0 )
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
#endif
|
||||
case U8G_DEV_MSG_GET_PAGE_BOX:
|
||||
u8g_pb_GetPageBox(pb, (u8g_box_t *)arg);
|
||||
break;
|
||||
case U8G_DEV_MSG_SET_COLOR_ENTRY:
|
||||
break;
|
||||
case U8G_DEV_MSG_SET_XY_CB:
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
281
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ht1632.c
Normal file
281
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ht1632.c
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ht1632.c
|
||||
|
||||
1-Bit (BW) Driver for HT1632 controller
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2013, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
U8G_PIN_NONE can be used as argument
|
||||
|
||||
uint8_t u8g_InitSPI(u8g_t *u8g, u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset)
|
||||
{
|
||||
...
|
||||
u8g->pin_list[U8G_PI_SCK] = sck;
|
||||
u8g->pin_list[U8G_PI_MOSI] = mosi;
|
||||
u8g->pin_list[U8G_PI_CS] = cs;
|
||||
u8g->pin_list[U8G_PI_A0] = a0;
|
||||
u8g->pin_list[U8G_PI_RESET] = reset;
|
||||
|
||||
mapping
|
||||
|
||||
#define DATA_PIN --> U8G_PI_MOSI
|
||||
#define WR_PIN --> U8G_PI_SCK
|
||||
#define CS_PIN --> U8G_PI_CS
|
||||
U8G_PI_A0 --> not used
|
||||
U8G_PI_RESET --> not used
|
||||
|
||||
Usage:
|
||||
|
||||
u8g_InitSPI(&u8g, &u8g_dev_ht1632_24x16, WR_PIN, DATA_IN, CS_PIN, U8G_PIN_NONE, U8G_PIN_NONE)
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 24
|
||||
#define HEIGHT 16
|
||||
#define PAGE_HEIGHT 16
|
||||
|
||||
/* http://forum.arduino.cc/index.php?topic=168537.0 */
|
||||
|
||||
#define HT1632_CMD_SYSDIS 0x00 // CMD= 0000-0000-x Turn off oscil
|
||||
#define HT1632_CMD_SYSON 0x01 // CMD= 0000-0001-x Enable system oscil
|
||||
#define HT1632_CMD_LEDOFF 0x02 // CMD= 0000-0010-x LED duty cycle gen off
|
||||
#define HT1632_CMD_LEDON 0x03 // CMD= 0000-0011-x LEDs ON
|
||||
#define HT1632_CMD_BLOFF 0x08 // CMD= 0000-1000-x Blink OFF
|
||||
#define HT1632_CMD_BLON 0x09 // CMD= 0000-1001-x Blink On
|
||||
#define HT1632_CMD_SLVMD 0x10 // CMD= 0001-00xx-x Slave Mode
|
||||
#define HT1632_CMD_MSTMD 0x14 // CMD= 0001-01xx-x Master Mode
|
||||
#define HT1632_CMD_RCCLK 0x18 // CMD= 0001-10xx-x Use on-chip clock
|
||||
#define HT1632_CMD_EXTCLK 0x1C // CMD= 0001-11xx-x Use external clock
|
||||
#define HT1632_CMD_COMS00 0x20 // CMD= 0010-ABxx-x commons options
|
||||
#define HT1632_CMD_COMS01 0x24 // CMD= 0010-ABxx-x commons options
|
||||
#define HT1632_CMD_COMS10 0x28 // CMD= 0010-ABxx-x commons options
|
||||
#define HT1632_CMD_COMS11 0x2C // P-MOS OUTPUT AND 16COMMON OPTION
|
||||
#define HT1632_CMD_PWM 0xA0 // CMD= 101x-PPPP-x PWM duty cycle
|
||||
|
||||
#define HT1632_ID_CMD 4 /* ID = 100 - Commands */
|
||||
#define HT1632_ID_RD 6 /* ID = 110 - Read RAM */
|
||||
#define HT1632_ID_WR 5 /* ID = 101 - Write RAM */
|
||||
|
||||
#define HT1632_ID_LEN 3 // IDs are 3 bits
|
||||
#define HT1632_CMD_LEN 8 // CMDs are 8 bits
|
||||
#define HT1632_DATA_LEN 8 // Data are 4*2 bits
|
||||
#define HT1632_ADDR_LEN 7 // Address are 7 bits
|
||||
|
||||
#if defined(ARDUINO)
|
||||
|
||||
#if ARDUINO < 100
|
||||
#include <WProgram.h>
|
||||
#else
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
//#define WR_PIN 3
|
||||
//#define DATA_PIN 2
|
||||
//#define CS_PIN 4
|
||||
|
||||
void ht1632_write_data_MSB(u8g_t *u8g, uint8_t cnt, uint8_t data, uint8_t extra)
|
||||
{
|
||||
int8_t i;
|
||||
uint8_t data_pin = u8g->pin_list[U8G_PI_MOSI];
|
||||
uint8_t wr_pin = u8g->pin_list[U8G_PI_SCK];
|
||||
|
||||
for(i = cnt - 1; i >= 0; i--)
|
||||
{
|
||||
if ((data >> i) & 1)
|
||||
{
|
||||
digitalWrite(data_pin, HIGH);
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalWrite(data_pin, LOW);
|
||||
}
|
||||
|
||||
digitalWrite(wr_pin, LOW);
|
||||
u8g_MicroDelay();
|
||||
digitalWrite(wr_pin, HIGH);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
|
||||
// Send an extra bit
|
||||
if (extra)
|
||||
{
|
||||
digitalWrite(data_pin, HIGH);
|
||||
digitalWrite(wr_pin, LOW);
|
||||
u8g_MicroDelay();
|
||||
digitalWrite(wr_pin, HIGH);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
}
|
||||
|
||||
void ht1632_write_data(u8g_t *u8g, uint8_t cnt, uint8_t data)
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t data_pin = u8g->pin_list[U8G_PI_MOSI];
|
||||
uint8_t wr_pin = u8g->pin_list[U8G_PI_SCK];
|
||||
for (i = 0; i < cnt; i++)
|
||||
{
|
||||
|
||||
if ((data >> i) & 1) {
|
||||
digitalWrite(data_pin, HIGH);
|
||||
}
|
||||
else {
|
||||
digitalWrite(data_pin, LOW);
|
||||
}
|
||||
|
||||
digitalWrite(wr_pin, LOW);
|
||||
u8g_MicroDelay();
|
||||
digitalWrite(wr_pin, HIGH);
|
||||
u8g_MicroDelay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ht1632_init(u8g_t *u8g)
|
||||
{
|
||||
//uint8_t i;
|
||||
uint8_t data_pin = u8g->pin_list[U8G_PI_MOSI];
|
||||
uint8_t wr_pin = u8g->pin_list[U8G_PI_SCK];
|
||||
uint8_t cs_pin = u8g->pin_list[U8G_PI_CS];
|
||||
pinMode(data_pin, OUTPUT);
|
||||
pinMode(wr_pin, OUTPUT);
|
||||
pinMode(cs_pin, OUTPUT);
|
||||
|
||||
digitalWrite(data_pin, HIGH);
|
||||
digitalWrite(wr_pin, HIGH);
|
||||
digitalWrite(cs_pin, HIGH);
|
||||
|
||||
digitalWrite(cs_pin, LOW);
|
||||
/* init display once after startup */
|
||||
ht1632_write_data_MSB(u8g, 3, HT1632_ID_CMD, false); // IDs are 3 bits
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_SYSDIS, true); // 8 bits
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_SYSON, true); // 8 bits
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_COMS11, true); // 8 bits
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_LEDON, true); // 8 bits
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_BLOFF, true); // 8 bits
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_PWM+15, true); // 8 bits
|
||||
digitalWrite(cs_pin, HIGH);
|
||||
|
||||
/* removed following (debug) code */
|
||||
/*
|
||||
digitalWrite(cs_pin, LOW);
|
||||
ht1632_write_data_MSB(u8g, 3, HT1632_ID_WR, false); // Send "write to display" command
|
||||
ht1632_write_data_MSB(u8g, 7, 0, false);
|
||||
for(i = 0; i<48; ++i)
|
||||
{
|
||||
ht1632_write_data(u8g, 8, 0xFF);
|
||||
}
|
||||
digitalWrite(cs_pin, HIGH);
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
page: 0=data contain lines 0..16, 1=data contain lines 16..32 (a 24x16 display will only have page 0)
|
||||
cnt: width of the display
|
||||
data: pointer to a buffer with 2*cnt bytes.
|
||||
*/
|
||||
void ht1632_transfer_data(u8g_t *u8g, uint8_t page, uint8_t cnt, uint8_t *data)
|
||||
{
|
||||
uint8_t addr;
|
||||
uint8_t cs_pin = u8g->pin_list[U8G_PI_CS];
|
||||
/* send data to the ht1632 */
|
||||
digitalWrite(cs_pin, LOW);
|
||||
ht1632_write_data_MSB(u8g, 3, HT1632_ID_WR, false); // Send "write to display" command
|
||||
ht1632_write_data_MSB(u8g, 7, page*2*cnt, false);
|
||||
|
||||
// Operating in progressive addressing mode
|
||||
for (addr = 0; addr < cnt; addr++)
|
||||
{
|
||||
ht1632_write_data(u8g, 8, data[addr]);
|
||||
ht1632_write_data(u8g, 8, data[addr+cnt]);
|
||||
}
|
||||
digitalWrite(cs_pin, HIGH);
|
||||
}
|
||||
|
||||
/* value is between 0...15 */
|
||||
void ht1632_set_contrast(u8g_t *u8g, uint8_t value)
|
||||
{
|
||||
uint8_t cs_pin = u8g->pin_list[U8G_PI_CS];
|
||||
digitalWrite(cs_pin, LOW);
|
||||
ht1632_write_data_MSB(u8g, 3, HT1632_ID_CMD, false);
|
||||
ht1632_write_data_MSB(u8g, 8, HT1632_CMD_PWM + value, false);
|
||||
digitalWrite(cs_pin, HIGH);
|
||||
}
|
||||
|
||||
#else
|
||||
void ht1632_init(u8g_t *u8g)
|
||||
{
|
||||
}
|
||||
|
||||
void ht1632_transfer_data(u8g_t *u8g, uint8_t page, uint8_t cnt, uint8_t *data)
|
||||
{
|
||||
}
|
||||
|
||||
void ht1632_set_contrast(u8g_t *u8g, uint8_t value)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* ARDUINO */
|
||||
|
||||
|
||||
uint8_t u8g_dev_ht1632_24x16_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
ht1632_init(u8g);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
/* current page: pb->p.page */
|
||||
/* ptr to the buffer: pb->buf */
|
||||
ht1632_transfer_data(u8g, pb->p.page, WIDTH, pb->buf);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
/* values passed to SetContrast() are between 0 and 255, scale down to 0...15 */
|
||||
ht1632_set_contrast(u8g, (*(uint8_t *)arg) >> 4);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_ht1632_24x16_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ht1632_24x16_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ht1632_24x16_buf};
|
||||
u8g_dev_t u8g_dev_ht1632_24x16 = { u8g_dev_ht1632_24x16_fn, &u8g_dev_ht1632_24x16_pb, u8g_com_null_fn };
|
||||
|
||||
326
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ili9325d_320x240.c
Normal file
326
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ili9325d_320x240.c
Normal file
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ili9325d_320x240.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Color format
|
||||
Red: 5 Bit
|
||||
Green: 6 Bit
|
||||
Blue: 5 Bit
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 240
|
||||
|
||||
#if defined(U8G_16BIT)
|
||||
#define HEIGHT 320
|
||||
#else
|
||||
/* if the user tries to compile the 8Bit version of the lib, then restrict the height to something which fits to 8Bit */
|
||||
#define HEIGHT 240
|
||||
#endif
|
||||
#define PAGE_HEIGHT 4
|
||||
|
||||
|
||||
/*
|
||||
reference board for this device:
|
||||
http://iteadstudio.com/store/index.php?main_page=product_info&cPath=57_58&products_id=55
|
||||
documentation:
|
||||
http://iteadstudio.com/Downloadfile/ITDB02_material.rar
|
||||
datasheet
|
||||
http://www.newhavendisplay.com/app_notes/ILI9325D.pdf
|
||||
other libs
|
||||
http://henningkarlsen.com/electronics/library.php
|
||||
init sequence
|
||||
http://code.google.com/p/itdb02/, ITDB02.cpp, iteadstudio.com
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_ili9325d_320x240_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
|
||||
//U8G_ESC_ADR(0), 0x000, 0x0E5, /* only used for none D version: set SRAM internal timing */
|
||||
//U8G_ESC_ADR(1), 0x078, 0x0f0,
|
||||
U8G_ESC_ADR(0), 0x000, 0x001, /* Driver Output Control, bits 8 & 10 */
|
||||
U8G_ESC_ADR(1), 0x001, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x002, /* LCD Driving Wave Control, bit 9: Set line inversion */
|
||||
U8G_ESC_ADR(1), 0x002, 0x000, /* ITDB02 none D verion: 0x007, 0x000 */
|
||||
U8G_ESC_ADR(0), 0x000, 0x003, /* Entry Mode, GRAM write direction and BGR=1 */
|
||||
U8G_ESC_ADR(1), 0x010, 0x030,
|
||||
U8G_ESC_ADR(0), 0x000, 0x004, /* Resize register */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x008, /* Display Control 2: set the back porch and front porch */
|
||||
U8G_ESC_ADR(1), 0x002, 0x007,
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x009, /* Display Control 3 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x00a, /* Display Control 4: FMARK */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x00c, /* RGB Display Interface Control 1 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x00d, /* Frame Maker Position */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x00f, /* RGB Display Interface Control 2 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x010, /* Power Control 1: SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x011, /* Power Control 2: DC1[2:0], DC0[2:0], VC[2:0] */
|
||||
U8G_ESC_ADR(1), 0x000, 0x007,
|
||||
U8G_ESC_ADR(0), 0x000, 0x012, /* Power Control 3: VREG1OUT voltage */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x013, /* Power Control 4: VDV[4:0] for VCOM amplitude */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x007, /* Display Control 1: Operate, but do not display */
|
||||
U8G_ESC_ADR(1), 0x000, 0x001,
|
||||
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */ /* ITDB02 none D verion: 50ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x010, /* Power Control 1: SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
U8G_ESC_ADR(1), 0x016, 0x090, /* ITDB02 none D verion: 0x010, 0x090 */
|
||||
U8G_ESC_ADR(0), 0x000, 0x011, /* Power Control 2: SAP, BT[3:0], AP, DSTB, SLP, STB */
|
||||
U8G_ESC_ADR(1), 0x002, 0x027,
|
||||
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x012, /* Power Control 3: VCI: External, VCI*1.80 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x00d, /* ITDB02 none D verion: 0x000, 0x01f */
|
||||
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x013, /* Power Control 4: VDV[4:0] for VCOM amplitude */
|
||||
U8G_ESC_ADR(1), 0x012, 0x000, /* ITDB02 none D verion: 0x015, 0x000 */
|
||||
U8G_ESC_ADR(0), 0x000, 0x029, /* Power Control 7 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x00a, /* ITDB02 none D verion: 0x000, 0x027 */
|
||||
U8G_ESC_ADR(0), 0x000, 0x02b, /* Frame Rate: 83 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x00d,
|
||||
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x020, /* Horizontal GRAM Address Set */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x021, /* Vertical GRAM Address Set */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
|
||||
/* gamma control */
|
||||
U8G_ESC_ADR(0), 0x000, 0x030,
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x031,
|
||||
U8G_ESC_ADR(1), 0x004, 0x004,
|
||||
U8G_ESC_ADR(0), 0x000, 0x032,
|
||||
U8G_ESC_ADR(1), 0x000, 0x003,
|
||||
U8G_ESC_ADR(0), 0x000, 0x035,
|
||||
U8G_ESC_ADR(1), 0x004, 0x005,
|
||||
U8G_ESC_ADR(0), 0x000, 0x036,
|
||||
U8G_ESC_ADR(1), 0x008, 0x008,
|
||||
U8G_ESC_ADR(0), 0x000, 0x037,
|
||||
U8G_ESC_ADR(1), 0x004, 0x007,
|
||||
U8G_ESC_ADR(0), 0x000, 0x038,
|
||||
U8G_ESC_ADR(1), 0x003, 0x003,
|
||||
U8G_ESC_ADR(0), 0x000, 0x039,
|
||||
U8G_ESC_ADR(1), 0x007, 0x007,
|
||||
U8G_ESC_ADR(0), 0x000, 0x03c,
|
||||
U8G_ESC_ADR(1), 0x005, 0x004,
|
||||
U8G_ESC_ADR(0), 0x000, 0x03d,
|
||||
U8G_ESC_ADR(1), 0x008, 0x008,
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x050, /* Horizontal GRAM Start Address */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x051, /* Horizontal GRAM End Address: 239 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x0EF,
|
||||
U8G_ESC_ADR(0), 0x000, 0x052, /* Vertical GRAM Start Address */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x053, /* Vertical GRAM End Address: 319 */
|
||||
U8G_ESC_ADR(1), 0x001, 0x03F,
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x060, /* Driver Output Control 2 */
|
||||
U8G_ESC_ADR(1), 0x0a7, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x061, /* Base Image Display Control: NDL,VLE, REV */
|
||||
U8G_ESC_ADR(1), 0x000, 0x001,
|
||||
U8G_ESC_ADR(0), 0x000, 0x06a, /* Vertical Scroll Control */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x080, /* Partial Image 1 Display Position */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x081, /* Partial Image 1 RAM Start Address */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x082, /* Partial Image 1 RAM End Address */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x083, /* Partial Image 2 Display Position */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x084, /* Partial Image 2 RAM Start Address */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x085, /* Partial Image 2 RAM End Address */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x090, /* Panel Interface Control 1 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x010,
|
||||
U8G_ESC_ADR(0), 0x000, 0x092, /* Panel Interface Control 2 */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000, /* 0x006, 0x000 */
|
||||
|
||||
U8G_ESC_ADR(0), 0x000, 0x007, /* Display Control 1: Operate, display ON */
|
||||
U8G_ESC_ADR(1), 0x001, 0x033,
|
||||
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
|
||||
/* write test pattern */
|
||||
U8G_ESC_ADR(0), 0x000, 0x020, /* Horizontal GRAM Address Set */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x021, /* Vertical GRAM Address Set */
|
||||
U8G_ESC_ADR(1), 0x000, 0x010,
|
||||
U8G_ESC_ADR(0), 0x000, 0x022, /* Write Data to GRAM */
|
||||
U8G_ESC_ADR(1), 0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
0x000, 0x000,
|
||||
0x0fe, 0x0fe,
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_ili9325d_320x240_page_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_ADR(0), 0x000, 0x020, /* Horizontal GRAM Address Set */
|
||||
U8G_ESC_ADR(1), 0x000, 0x000,
|
||||
U8G_ESC_ADR(0), 0x000, 0x021, /* Vertical GRAM Address Set */
|
||||
U8G_ESC_ADR(1),
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* convert the internal RGB 332 to 65K high byte */
|
||||
static uint8_t u8g_dev_ili9325d_get_65K_high_byte(uint8_t color)
|
||||
{
|
||||
uint8_t h;
|
||||
h = color;
|
||||
h &= 0x0e0;
|
||||
h |= h>>3;
|
||||
h &= 0x0f8;
|
||||
color>>=2;
|
||||
color &= 7;
|
||||
h |= color;
|
||||
return h;
|
||||
}
|
||||
|
||||
/* convert the internal RGB 332 to 65K high byte */
|
||||
static uint8_t u8g_dev_ili9325d_get_65K_low_byte(uint8_t color)
|
||||
{
|
||||
uint8_t l;
|
||||
l = color;
|
||||
l <<= 3;
|
||||
color &= 3;
|
||||
color <<= 1;
|
||||
l |= color;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_dev_ili9325d_320x240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_50NS);
|
||||
//for(;;)
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ili9325d_320x240_init_seq);
|
||||
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
uint16_t y, j;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
for( i = 0; i < pb->p.page_height; i ++ )
|
||||
{
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ili9325d_320x240_page_seq);
|
||||
u8g_WriteByte(u8g, dev, y >> 8 ); /* display ram (cursor) address high byte */
|
||||
u8g_WriteByte(u8g, dev, y & 255 ); /* display ram (cursor) address low byte */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0 );
|
||||
u8g_WriteByte(u8g, dev, 0x022 ); /* start gram data */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
|
||||
for( j = 0; j < pb->width; j++ )
|
||||
{
|
||||
u8g_WriteByte(u8g, dev, u8g_dev_ili9325d_get_65K_high_byte(*ptr) );
|
||||
u8g_WriteByte(u8g, dev, u8g_dev_ili9325d_get_65K_low_byte(*ptr) );
|
||||
|
||||
ptr++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h8_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_ili9325d_320x240_8h8_buf[WIDTH*PAGE_HEIGHT] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_ili9325d_320x240_8h8_pb U8G_NOCOMMON = { {PAGE_HEIGHT, HEIGHT, 0, 0, 0}, WIDTH, u8g_ili9325d_320x240_8h8_buf};
|
||||
u8g_dev_t u8g_dev_ili9325d_320x240_8bit U8G_NOCOMMON = { u8g_dev_ili9325d_320x240_fn, &u8g_ili9325d_320x240_8h8_pb, u8g_com_arduino_port_d_wr_fn };
|
||||
//u8g_dev_t u8g_dev_ili9325d_320x240_8bit = { u8g_dev_ili9325d_320x240_fn, &u8g_ili9325d_320x240_8h8_pb, u8g_com_arduino_parallel_fn };
|
||||
|
||||
//U8G_PB_DEV(u8g_dev_ili9325d_320x240_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ili9325d_320x240_fn, U8G_COM_PARALLEL);
|
||||
|
||||
|
||||
110
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ks0108_128x64.c
Normal file
110
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ks0108_128x64.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ks0108_128x64.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
ADDRESS = 0 (Command Mode)
|
||||
0x03f Display On
|
||||
0x0c0 Start Display at line 0
|
||||
0x040 | y write to y address (y:0..63)
|
||||
0x0b8 | x write to page [0..7]
|
||||
|
||||
|
||||
u8g_Init8Bit(u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset)
|
||||
u8g_Init8Bit(u8g, dev, 8, 9, 10, 11, 4, 5, 6, 7, 18, 14, 15, 17, 16, U8G_PIN_NONE)
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
static const uint8_t u8g_dev_ks0108_128x64_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip 1 */
|
||||
0x03f, /* display on */
|
||||
0x0c0, /* start at line 0 */
|
||||
U8G_ESC_DLY(20), /* delay 20 ms */
|
||||
U8G_ESC_CS(2), /* enable chip 2 */
|
||||
0x03f, /* display on */
|
||||
0x0c0, /* start at line 0 */
|
||||
U8G_ESC_DLY(20), /* delay 20 ms */
|
||||
U8G_ESC_CS(0), /* disable all chips */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
uint8_t u8g_dev_ks0108_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ks0108_128x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* command mode */
|
||||
u8g_SetChipSelect(u8g, dev, 2);
|
||||
u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (KS0108b) */
|
||||
u8g_WriteByte(u8g, dev, 0x040 ); /* set address 0 */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, 64, pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* command mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (KS0108b) */
|
||||
u8g_WriteByte(u8g, dev, 0x040 ); /* set address 0 */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, 64, 64+(uint8_t *)pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ks0108_128x64, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ks0108_128x64_fn, U8G_COM_PARALLEL);
|
||||
U8G_PB_DEV(u8g_dev_ks0108_128x64_fast, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ks0108_128x64_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
|
||||
147
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_160x80.c
Normal file
147
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_160x80.c
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
|
||||
u8g_dev_lc7981_160x80.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 160
|
||||
#define HEIGHT 80
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
/*
|
||||
code ideas:
|
||||
https://github.com/vsergeev/embedded-drivers/tree/master/avr-lc7981
|
||||
data sheets:
|
||||
http://www.lcd-module.de/eng/pdf/zubehoer/lc7981.pdf
|
||||
http://www.lcd-module.de/pdf/grafik/w160-6.pdf
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_lc7981_160x80_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x000, /* mode register */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x032, /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1)*/
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x001, /* character/bits per pixel pitch */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x007, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x002, /* number of chars/byte width of the screen */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
WIDTH/8-1, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x003, /* time division */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x050, /* Oct 2015: Changed from 7f to 50 (1/80 duty cycle) */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x008, /* display start low */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x009, /* display start high */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_lc7981_160x80_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_160x80_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t y, i;
|
||||
uint16_t disp_ram_adr;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
disp_ram_adr = WIDTH/8;
|
||||
disp_ram_adr *= y;
|
||||
for( i = 0; i < 8; i ++ )
|
||||
{
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00a ); /* display ram (cursor) address low byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr & 0x0ff );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00b ); /* display ram (cursor) address hight byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr >> 8 );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00c ); /* write data */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
|
||||
ptr += WIDTH/8;
|
||||
disp_ram_adr += WIDTH/8;
|
||||
}
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h1f_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_lc7981_160x80_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_lc7981_160x80_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
|
||||
145
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_240x128.c
Normal file
145
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_240x128.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
|
||||
u8g_dev_lc7981_240x128.c
|
||||
|
||||
Hitachi Display SP14N002
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 240
|
||||
#define HEIGHT 128
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
/*
|
||||
http://www.mark-products.com/graphics.htm#240x128%20Pixel%20Format
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_lc7981_240x128_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x000, /* mode register */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x032, /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1)*/
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x001, /* character/bits per pixel pitch */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x007, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x002, /* number of chars/byte width of the screen */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
WIDTH/8-1, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x003, /* time division */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x07f, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x008, /* display start low */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x009, /* display start high */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_lc7981_240x128_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_240x128_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t y, i;
|
||||
uint16_t disp_ram_adr;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
disp_ram_adr = WIDTH/8;
|
||||
disp_ram_adr *= y;
|
||||
for( i = 0; i < 8; i ++ )
|
||||
{
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00a ); /* display ram (cursor) address low byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr & 0x0ff );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00b ); /* display ram (cursor) address hight byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr >> 8 );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00c ); /* write data */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
|
||||
ptr += WIDTH/8;
|
||||
disp_ram_adr += WIDTH/8;
|
||||
}
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h1f_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_lc7981_240x128_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_lc7981_240x128_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
|
||||
145
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_240x64.c
Normal file
145
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_240x64.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
|
||||
u8g_dev_lc7981_240x64.c
|
||||
|
||||
Tested with Nan Ya LM_J6_003_
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 240
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
/*
|
||||
http://www.mark-products.com/graphics.htm#240x64%20Pixel%20Format
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_lc7981_240x64_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x000, /* mode register */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x032, /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1)*/
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x001, /* character/bits per pixel pitch */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x007, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x002, /* number of chars/byte width of the screen */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
WIDTH/8-1, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x003, /* time division */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x07f, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x008, /* display start low */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x009, /* display start high */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_lc7981_240x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_240x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t y, i;
|
||||
uint16_t disp_ram_adr;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
disp_ram_adr = WIDTH/8;
|
||||
disp_ram_adr *= y;
|
||||
for( i = 0; i < 8; i ++ )
|
||||
{
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00a ); /* display ram (cursor) address low byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr & 0x0ff );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00b ); /* display ram (cursor) address hight byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr >> 8 );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00c ); /* write data */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
|
||||
ptr += WIDTH/8;
|
||||
disp_ram_adr += WIDTH/8;
|
||||
}
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h1f_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_lc7981_240x64_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_lc7981_240x64_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
|
||||
151
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_320x64.c
Normal file
151
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_lc7981_320x64.c
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
|
||||
u8g_dev_lc7981_320x64.c
|
||||
|
||||
Note: Requires 16 bit mode (Must be enabled in u8g.h)
|
||||
|
||||
Tested with Varitronix MGLS32064-03.pdf
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#ifdef U8G_16BIT
|
||||
#define WIDTH 320
|
||||
#else
|
||||
#define WIDTH 240
|
||||
#endif
|
||||
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
/*
|
||||
http://www.gaw.ru/pdf/lcd/lcm/Varitronix/graf/MGLS32064-03.pdf
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_lc7981_320x64_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x000, /* mode register */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x032, /* display on (bit 5), master mode on (bit 4), graphics mode on (bit 1)*/
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x001, /* character/bits per pixel pitch */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x007, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x002, /* number of chars/byte width of the screen */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
WIDTH/8-1, /* 8 bits per pixel */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x003, /* time division */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x07f, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x008, /* display start low */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_ADR(1), /* instruction mode */
|
||||
0x009, /* display start high */
|
||||
U8G_ESC_ADR(0), /* data mode */
|
||||
0x000, /* */
|
||||
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_lc7981_320x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_lc7981_320x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t y, i;
|
||||
uint16_t disp_ram_adr;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
y = pb->p.page_y0;
|
||||
ptr = pb->buf;
|
||||
disp_ram_adr = WIDTH/8;
|
||||
disp_ram_adr *= y;
|
||||
for( i = 0; i < 8; i ++ )
|
||||
{
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00a ); /* display ram (cursor) address low byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr & 0x0ff );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00b ); /* display ram (cursor) address hight byte */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, disp_ram_adr >> 8 );
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* cmd mode */
|
||||
u8g_WriteByte(u8g, dev, 0x00c ); /* write data */
|
||||
u8g_SetAddress(u8g, dev, 0); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, WIDTH/8, ptr);
|
||||
ptr += WIDTH/8;
|
||||
disp_ram_adr += WIDTH/8;
|
||||
}
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8h1f_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_lc7981_320x64_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_lc7981_320x64_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
232
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ld7032_60x32.c
Normal file
232
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ld7032_60x32.c
Normal file
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ld7032_60x32.c
|
||||
|
||||
60x32 OLED display
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
/* define width as 64, so that it is a multiple of 8 */
|
||||
#define WIDTH 64
|
||||
#define HEIGHT 32
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
static const uint8_t u8g_dev_ld7032_60x32_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_DLY(1), /* delay 1 ms */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x002, /* Dot Matrix Display ON/OFF */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x001, /* ON */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x014, /* Dot Matrix Display Stand-by ON/OFF */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* ON */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x01a, /* Dot Matrix Frame Rate */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x004, /* special value for this OLED from manual */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x01d, /* Graphics Memory Writing Direction */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* reset default (right down, horizontal) */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x009, /* Display Direction */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* reset default (x,y: min --> max) */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x030, /* Display Size X */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* Column Start Output */
|
||||
0x03b, /* Column End Output */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x032, /* Display Size Y */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* Row Start Output */
|
||||
0x01f, /* Row End Output */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x010, /* Peak Pulse Width Set */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* 0 SCLK */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x016, /* Peak Pulse Delay Set */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* 0 SCLK */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x012, /* Dot Matrix Current Level Set */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x050, /* 0x050 * 1 uA = 80 uA */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x018, /* Pre-Charge Pulse Width */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x003, /* 3 SCLK */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x044, /* Pre-Charge Mode */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x002, /* Every Time */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x048, /* Row overlap timing */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x003, /* Pre-Charge + Peak Delay + Peak boot Timing */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x03f, /* VCC_R_SEL */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x011, /* ??? */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x03d, /* VSS selection */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* 2.8V */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x002, /* Dot Matrix Display ON/OFF */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x001, /* ON */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x008, /* write data */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* use box commands to set start adr */
|
||||
static const uint8_t u8g_dev_ld7032_60x32_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x034, /* box x start */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* 0 */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x035, /* box x end */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x007, /* */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x037, /* box y end */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x01f, /* */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x036, /* box y start */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ld7032_60x32_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
/* ... */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ld7032_60x32_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
/* ... */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ld7032_60x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_data_start);
|
||||
u8g_WriteByte(u8g, dev, pb->p.page_y0); /* y start */
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x008);
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 2);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ld7032_60x32_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ld7032_60x32_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ld7032_60x32_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ld7032_60x32_parallel, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_PARALLEL);
|
||||
U8G_PB_DEV(u8g_dev_ld7032_60x32_hw_usart_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ld7032_60x32_fn, U8G_COM_HW_USART_SPI);
|
||||
|
||||
67
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_null.c
Normal file
67
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_null.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
|
||||
u8g_dev_null.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
uint8_t u8g_dev_null(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_SET_8PIXEL: /* most often used command */
|
||||
break;
|
||||
case U8G_DEV_MSG_SET_PIXEL:
|
||||
break;
|
||||
case U8G_DEV_MSG_INIT:
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_FIRST:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
break;
|
||||
#ifdef U8G_DEV_MSG_IS_BBX_INTERSECTION
|
||||
case U8G_DEV_MSG_IS_BBX_INTERSECTION:
|
||||
return 1;
|
||||
#endif
|
||||
case U8G_DEV_MSG_GET_PAGE_BOX:
|
||||
break;
|
||||
case U8G_DEV_MSG_SET_COLOR_ENTRY:
|
||||
break;
|
||||
case U8G_DEV_MSG_SET_XY_CB:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
141
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_pcd8544_84x48.c
Normal file
141
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_pcd8544_84x48.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
|
||||
u8g_dev_pcd8544_84x48.c
|
||||
|
||||
Display: Nokia 84x48
|
||||
|
||||
Status: Tested with PCF8812 Display
|
||||
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 84
|
||||
#define HEIGHT 48
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_pcd8544_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x021, /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */
|
||||
0x006, /* temp. control: b10 = 2 */
|
||||
0x013, /* bias system 1:48 */
|
||||
0x0c0, /* medium Vop */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00c, /* display on, normal operation */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00d, /* display on, invert */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00c, /* display on, normal */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_pcd8544_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00c, /* display on, normal */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_pcd8544_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x008, /* display blank */
|
||||
0x024, /* power down (PD=1), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
uint8_t u8g_dev_pcd8544_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcd8544_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_SetAddress(u8g, dev, 0); /* command mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_WriteByte(u8g, dev, 0x020 ); /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
u8g_WriteByte(u8g, dev, 0x080 ); /* set X address */
|
||||
u8g_WriteByte(u8g, dev, 0x040 | pb->p.page); /* set Y address */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
/* the contrast adjustment does not work, needs to be analysed */
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_WriteByte(u8g, dev, 0x021); /* command mode, extended function set */
|
||||
u8g_WriteByte(u8g, dev, 0x080 | ( (*(uint8_t *)arg) >> 1 ) );
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcd8544_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcd8544_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
U8G_PB_DEV(u8g_dev_pcd8544_84x48_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcd8544_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_pcd8544_84x48_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcd8544_fn, U8G_COM_HW_SPI);
|
||||
|
||||
138
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_pcf8812_96x65.c
Normal file
138
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_pcf8812_96x65.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
|
||||
u8g_dev_pcf8812_96x65.c
|
||||
|
||||
Display: Nokia 96x65
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
om6206 comaptible to pcf8812 ?
|
||||
|
||||
Status: Tested
|
||||
|
||||
|
||||
Display Controller Seen in
|
||||
LPH7366 (9 pins, 84x48) PCD8544 Nokia 5110 / 5120 / 5130 / 5160 / 6110 / 6150
|
||||
LPH7677 (8 pins, 84x48) PCD8544 Nokia 3210
|
||||
LPH7779 (8 pins, 84x48) PCD8544 Nokia 3310 / 3315 / 3330 / 3110, also 3410?
|
||||
??? PCD8544 Nokia 5110 / 6110
|
||||
LPH7690 ? (96x65) PCF8455/OM6202 Nokia 3410
|
||||
LPH7690 ? (96x65?) SED1565/S1D15605 Nokia 7110 / 3510?
|
||||
LPH7690 ??? Nokia 6210
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 96
|
||||
#define HEIGHT 65
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_pcf8812_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x021, /* activate chip (PD=0), horizontal increment (V=0), enter extended command set (H=1) */
|
||||
0x006, /* temp. control: b10 = 2 */
|
||||
0x013, /* bias system 1:48 */
|
||||
0x080 | 0x040, /* medium Vop */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00c, /* display on, normal operation */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00d, /* display on, invert */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x020, /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
0x00c, /* display on, normal */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_pcf8812_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_pcf8812_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_SetAddress(u8g, dev, 0); /* command mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_WriteByte(u8g, dev, 0x020 ); /* activate chip (PD=0), horizontal increment (V=0), enter normal command set (H=0) */
|
||||
u8g_WriteByte(u8g, dev, 0x080 ); /* set X address */
|
||||
u8g_WriteByte(u8g, dev, 0x040 | pb->p.page); /* set Y address */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
|
||||
/* mirrored output, not tested*/
|
||||
/*
|
||||
{
|
||||
uint8_t i = pb->width;
|
||||
while( i > 0 )
|
||||
{
|
||||
i--;
|
||||
u8g_WriteByte(u8g, dev, ((unsigned char *)pb->buf)[i] );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
/* the contrast adjustment does not work, needs to be analysed */
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_WriteByte(u8g, dev, 0x021); /* command mode, extended function set */
|
||||
u8g_WriteByte(u8g, dev, 0x080 | ( (*(uint8_t *)arg) >> 1 ) );
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
/* u8g_com_arduino_sw_spi_fn does not work, too fast??? */
|
||||
U8G_PB_DEV(u8g_dev_pcf8812_96x65_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcf8812_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_pcf8812_96x65_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_pcf8812_fn, U8G_COM_HW_SPI);
|
||||
107
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_sbn1661_122x32.c
Normal file
107
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_sbn1661_122x32.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
|
||||
u8g_dev_sbn1661_122x32.c
|
||||
|
||||
WG12232 display with 2xSBN1661 / SED1520 controller (122x32 display)
|
||||
At the moment only available in the Arduino Environment
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 122
|
||||
#define HEIGHT 32
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_sbn1661_122x32_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip 1 */
|
||||
0x0af, /* display on */
|
||||
0x0c0, /* display start at line 0 */
|
||||
0x0a0, /* a0: ADC forward, a1: ADC reverse */
|
||||
0x0a9, /* a8: 1/16, a9: 1/32 duty */
|
||||
U8G_ESC_CS(2), /* enable chip 2 */
|
||||
0x0af, /* display on */
|
||||
0x0c0, /* display start at line 0 */
|
||||
0x0a0, /* a0: ADC forward, a1: ADC reverse */
|
||||
0x0a9, /* a8: 1/16, a9: 1/32 duty */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
|
||||
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_sbn1661_122x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sbn1661_122x32_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* command mode */
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (SBN1661/SED1520) */
|
||||
u8g_WriteByte(u8g, dev, 0x000 ); /* set X address */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, WIDTH/2, pb->buf);
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* command mode */
|
||||
u8g_SetChipSelect(u8g, dev, 2);
|
||||
u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (SBN1661/SED1520) */
|
||||
u8g_WriteByte(u8g, dev, 0x000 ); /* set X address */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, WIDTH/2, WIDTH/2+(uint8_t *)pb->buf);
|
||||
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
/* u8g_com_arduino_sw_spi_fn does not work, too fast??? */
|
||||
U8G_PB_DEV(u8g_dev_sbn1661_122x32 , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sbn1661_122x32_fn, u8g_com_arduino_no_en_parallel_fn);
|
||||
303
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1306_128x32.c
Normal file
303
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1306_128x32.c
Normal file
@@ -0,0 +1,303 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1306_128x32.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
23 Feb 2013: Fixed, Issue 147
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 32
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
/* init sequence adafruit 128x32 OLED (NOT TESTED) */
|
||||
static const uint8_t u8g_dev_ssd1306_128x32_adafruit1_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x010, /* [1] charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
0x020, 0x000, /* */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x09f, /* [1] set contrast control */
|
||||
0x0d9, 0x022, /* [1] pre-charge period 0x022/f1*/
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
/* init sequence adafruit 128x32 OLED (NOT TESTED) */
|
||||
static const uint8_t u8g_dev_ssd1306_128x32_adafruit2_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x014, /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
0x020, 0x000, /* */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x0cf, /* [2] set contrast control */
|
||||
0x0d9, 0x0f1, /* [2] pre-charge period 0x022/f1*/
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
/* init sequence adafruit 128x32 OLED (TESTED - WORKING 23.02.13), like adafruit3, but with page addressing mode */
|
||||
static const uint8_t u8g_dev_ssd1306_128x32_adafruit3_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x01f, /* Feb 23, 2013: 128x32 OLED: 0x01f, 128x32 OLED 0x03f */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x014, /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
0x020, 0x002, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), Feb 23, 2013: 128x32 OLED: 0x002, 128x32 OLED 0x012 */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x002, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x0cf, /* [2] set contrast control */
|
||||
0x0d9, 0x0f1, /* [2] pre-charge period 0x022/f1*/
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
/* init sequence Univision datasheet (NOT TESTED) */
|
||||
static const uint8_t u8g_dev_ssd1306_128x32_univision_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* multiplex ratio */
|
||||
0x0d3, 0x000, /* display offset */
|
||||
0x040, /* start line */
|
||||
0x08d, 0x010, /* charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x09f, /* set contrast control */
|
||||
0x0d9, 0x022, /* pre-charge period */
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
0x022, 0x000, /* page addressing mode WRONG: 3 byte cmd! */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
/* select one init sequence here */
|
||||
//define u8g_dev_ssd1306_128x32_init_seq u8g_dev_ssd1306_128x32_univision_init_seq
|
||||
//define u8g_dev_ssd1306_128x32_init_seq u8g_dev_ssd1306_128x32_adafruit1_init_seq
|
||||
//define u8g_dev_ssd1306_128x32_init_seq u8g_dev_ssd1306_128x32_adafruit2_init_seq
|
||||
#define u8g_dev_ssd1306_128x32_init_seq u8g_dev_ssd1306_128x32_adafruit3_init_seq
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_128x32_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010, /* set upper 4 bit of the col adr. to 0 */
|
||||
0x000, /* set lower 4 bit of the col adr. to 4 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x32_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x32_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x32_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x32_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x32_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x32_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x32_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x32_fn, U8G_COM_SSD_I2C);
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x32_2x_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1306_128x32_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1306_128x32_2x_buf};
|
||||
u8g_dev_t u8g_dev_ssd1306_128x32_2x_sw_spi = { u8g_dev_ssd1306_128x32_2x_fn, &u8g_dev_ssd1306_128x32_2x_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1306_128x32_2x_hw_spi = { u8g_dev_ssd1306_128x32_2x_fn, &u8g_dev_ssd1306_128x32_2x_pb, U8G_COM_HW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1306_128x32_2x_i2c = { u8g_dev_ssd1306_128x32_2x_fn, &u8g_dev_ssd1306_128x32_2x_pb, U8G_COM_SSD_I2C };
|
||||
457
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1306_128x64.c
Normal file
457
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1306_128x64.c
Normal file
@@ -0,0 +1,457 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1306_128x64.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
/* init sequence adafruit 128x64 OLED (NOT TESTED) */
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_adafruit1_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x010, /* [1] charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
0x020, 0x000, /* */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x09f, /* [1] set contrast control */
|
||||
0x0d9, 0x022, /* [1] pre-charge period 0x022/f1*/
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* init sequence adafruit 128x64 OLED (NOT TESTED) */
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_adafruit2_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x014, /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
0x020, 0x000, /* */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x0cf, /* [2] set contrast control */
|
||||
0x0d9, 0x0f1, /* [2] pre-charge period 0x022/f1*/
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* init sequence adafruit 128x64 OLED (NOT TESTED), like adafruit3, but with page addressing mode */
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_adafruit3_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x014, /* [2] charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
0x020, 0x002, /* 2012-05-27: page addressing mode */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x0cf, /* [2] set contrast control */
|
||||
0x0d9, 0x0f1, /* [2] pre-charge period 0x022/f1*/
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* init sequence Univision datasheet (NOT TESTED) */
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_univision_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x03f, /* multiplex ratio */
|
||||
0x0d3, 0x000, /* display offset */
|
||||
0x040, /* start line */
|
||||
0x08d, 0x010, /* charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5) */
|
||||
0x081, 0x09f, /* set contrast control */
|
||||
0x0d9, 0x022, /* pre-charge period */
|
||||
0x0db, 0x040, /* vcomh deselect level */
|
||||
0x022, 0x000, /* page addressing mode WRONG: 3 byte cmd! */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* select one init sequence here */
|
||||
//#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_univision_init_seq
|
||||
//#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_adafruit1_init_seq
|
||||
// 26. Apr 2014: in this thead: http://forum.arduino.cc/index.php?topic=234930.msg1696754;topicseen#msg1696754
|
||||
// it is mentiond, that adafruit2_init_seq works better --> this will be used by the ssd1306_adafruit device
|
||||
//#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_adafruit2_init_seq
|
||||
|
||||
#define u8g_dev_ssd1306_128x64_init_seq u8g_dev_ssd1306_128x64_adafruit3_init_seq
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_128x64_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010, /* set upper 4 bit of the col adr to 0 */
|
||||
0x000, /* set lower 4 bit of the col adr to 0 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* the sh1106 is compatible to the ssd1306, but is 132x64. display seems to be centered */
|
||||
static const uint8_t u8g_dev_sh1106_128x64_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010, /* set upper 4 bit of the col adr to 0 */
|
||||
0x002, /* set lower 4 bit of the col adr to 2 (centered display with sh1106) */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_adafruit2_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
{
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_ssd1306_adafruit_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
{
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_sh1106_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
{
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
{
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_sh1106_128x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_128x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_sh1106_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
{
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x81);
|
||||
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_128x64_fn, U8G_COM_SSD_I2C);
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_adafruit_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_adafruit_128x64_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_adafruit_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_adafruit_128x64_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_adafruit_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_adafruit_128x64_fn, U8G_COM_SSD_I2C);
|
||||
|
||||
|
||||
uint8_t u8g_dev_ssd1306_128x64_2x_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1306_128x64_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1306_128x64_2x_buf};
|
||||
u8g_dev_t u8g_dev_ssd1306_128x64_2x_sw_spi = { u8g_dev_ssd1306_128x64_2x_fn, &u8g_dev_ssd1306_128x64_2x_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1306_128x64_2x_hw_spi = { u8g_dev_ssd1306_128x64_2x_fn, &u8g_dev_ssd1306_128x64_2x_pb, U8G_COM_HW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1306_128x64_2x_i2c = { u8g_dev_ssd1306_128x64_2x_fn, &u8g_dev_ssd1306_128x64_2x_pb, U8G_COM_SSD_I2C };
|
||||
|
||||
|
||||
U8G_PB_DEV(u8g_dev_sh1106_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_sh1106_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_sh1106_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sh1106_128x64_fn, U8G_COM_SSD_I2C);
|
||||
|
||||
uint8_t u8g_dev_sh1106_128x64_2x_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_sh1106_128x64_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_sh1106_128x64_2x_buf};
|
||||
u8g_dev_t u8g_dev_sh1106_128x64_2x_sw_spi = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_sh1106_128x64_2x_hw_spi = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_HW_SPI };
|
||||
u8g_dev_t u8g_dev_sh1106_128x64_2x_i2c = { u8g_dev_sh1106_128x64_2x_fn, &u8g_dev_sh1106_128x64_2x_pb, U8G_COM_SSD_I2C };
|
||||
|
||||
201
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1306_64x48.c
Normal file
201
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1306_64x48.c
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1306_64x48.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 64
|
||||
#define HEIGHT 48
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
|
||||
/* init sequence buydisplay.com 0.66" 64x48 OLED */
|
||||
/* http://www.buydisplay.com/download/manual/ER-OLED0.66-1_Series_Datasheet.pdf */
|
||||
static const uint8_t u8g_dev_ssd1306_64x48_init_seq[] PROGMEM = {
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0d5, 0x080, /* clock divide ratio (0x00=1) and oscillator frequency (0x8) */
|
||||
0x0a8, 0x02f, /* Multiplex Ration, Jul 12, 2015: From 0.66" OLED datasheet */
|
||||
|
||||
0x0d3, 0x000, /* */
|
||||
|
||||
0x040, /* start line */
|
||||
|
||||
0x08d, 0x014, /* charge pump setting (p62): 0x014 enable, 0x010 disable */
|
||||
|
||||
//0x020, 0x002, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), Feb 23, 2013: 64x48 OLED: 0x002, 64x48 OLED 0x012 */
|
||||
0x0a1, /* segment remap a0/a1*/
|
||||
0x0c8, /* c0: scan dir normal, c8: reverse */
|
||||
0x0da, 0x012, /* com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5), Jul 12, 2015: From 0.66" OLED datasheet */
|
||||
0x081, 0x0cf, /* set contrast control */
|
||||
0x0d9, 0x022, /* pre-charge period 0x022/f1, from 0.66" OLED datasheet */
|
||||
0x0db, 0x000, /* vcomh deselect level, from 0.66" OLED datasheet */
|
||||
|
||||
0x02e, /* 2012-05-27: Deactivate scroll */
|
||||
0x0a4, /* output ram to display */
|
||||
0x0a6, /* none inverted normal display mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_ssd1306_64x48_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010+2, /* set upper 4 bit of the col adr. to 0, 0.66" OLED starts with offset 32 */
|
||||
0x000, /* set lower 4 bit of the col adr. to 4 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1306_64x48_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_64x48_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_64x48_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_ssd1306_64x48_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_64x48_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_64x48_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, pb->buf);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1306_64x48_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page*2+1)); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_64x48_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_64x48_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_64x48_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_64x48_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1306_64x48_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1306_64x48_fn, U8G_COM_SSD_I2C);
|
||||
|
||||
uint8_t u8g_dev_ssd1306_64x48_2x_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1306_64x48_2x_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1306_64x48_2x_buf};
|
||||
u8g_dev_t u8g_dev_ssd1306_64x48_2x_sw_spi = { u8g_dev_ssd1306_64x48_2x_fn, &u8g_dev_ssd1306_64x48_2x_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1306_64x48_2x_hw_spi = { u8g_dev_ssd1306_64x48_2x_fn, &u8g_dev_ssd1306_64x48_2x_pb, U8G_COM_HW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1306_64x48_2x_i2c = { u8g_dev_ssd1306_64x48_2x_fn, &u8g_dev_ssd1306_64x48_2x_pb, U8G_COM_SSD_I2C };
|
||||
142
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1309_128x64.c
Normal file
142
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1309_128x64.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1309_128x64.c
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
|
||||
/* ssd1309 ini sequence*/
|
||||
static const uint8_t u8g_dev_ssd1309_128x64_init_seq[] PROGMEM={
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
0xfd,0x12, /*Command Lock */
|
||||
0xae, /*Set Display Off */
|
||||
0xd5,0xa0, /*set Display Clock Divide Ratio/Oscillator Frequency */
|
||||
0xa8,0x3f, /*Set Multiplex Ratio */
|
||||
0x3d,0x00, /*Set Display Offset*/
|
||||
0x40, /*Set Display Start Line*/
|
||||
0xa1, /*Set Segment Re-Map*/
|
||||
0xc8, /*Set COM Output Scan Direction*/
|
||||
0xda,0x12, /*Set COM Pins Hardware Configuration*/
|
||||
0x81,0xdf, /*Set Current Control */
|
||||
0xd9,0x82, /*Set Pre-Charge Period */
|
||||
0xdb,0x34, /*Set VCOMH Deselect Level */
|
||||
0xa4, /*Set Entire Display On/Off */
|
||||
0xa6, /*Set Normal/Inverse Display*/
|
||||
U8G_ESC_VCC(1), /*Power up VCC & Stabilized */
|
||||
U8G_ESC_DLY(50),
|
||||
0xaf, /*Set Display On */
|
||||
U8G_ESC_DLY(50),
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
/* select one init sequence here */
|
||||
#define u8g_dev_ssd1309_128x64_init_seq u8g_dev_ssd1309_128x64_init_seq
|
||||
|
||||
|
||||
static const uint8_t u8g_dev_ssd1309_128x64_data_start[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x010, /* set upper 4 bit of the col adr to 0 */
|
||||
0x000, /* set lower 4 bit of the col adr to 4 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1309_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1309_128x64_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1309_128x64_data_start);
|
||||
u8g_WriteByte(u8g, dev, 0x0b0 | pb->p.page); /* select current page (SSD1306) */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
|
||||
return 0;
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1309_128x64_hw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1309_128x64_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1309_128x64_sw_spi, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1309_128x64_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1309_128x64_i2c, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1309_128x64_fn, U8G_COM_SSD_I2C);
|
||||
338
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1322_nhd31oled_bw.c
Normal file
338
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1322_nhd31oled_bw.c
Normal file
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1322_nhd31oled_bw.c
|
||||
|
||||
1-Bit (BW) Driver for SSD1322 Controller (OLED Display)
|
||||
Tested with NHD-3.12-25664
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SSD130x Monochrom OLED Controller
|
||||
SSD131x Character OLED Controller
|
||||
SSD132x Graylevel OLED Controller
|
||||
SSD1331 Color OLED Controller
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
/* width must be multiple of 8, largest value is 248 unless u8g 16 bit mode is enabled */
|
||||
#if defined(U8G_16BIT)
|
||||
#define WIDTH 256
|
||||
#else
|
||||
#define WIDTH 248
|
||||
#endif
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
/*
|
||||
http://www.newhavendisplay.com/app_notes/OLED_25664.txt
|
||||
http://www.newhavendisplay.com/forum/viewtopic.php?f=15&t=3758
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_ssd1322_1bit_nhd_312_init_seq[] PROGMEM = {
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0fd, /* lock command */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x012, /* unlock */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0ae, /* display off, sleep mode */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b3,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x091, /* set display clock divide ratio/oscillator frequency (set clock as 80 frames/sec) */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0ca, /* multiplex ratio */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x03f, /* 1/64 Duty (0x0F~0x3F) */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a2,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* display offset, shift mapping ram counter */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a1,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* display start line */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a0, /* Set Re-Map / Dual COM Line Mode */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x014, /* was 0x014 */
|
||||
0x011, /* was 0x011 */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0ab,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x001, /* Enable Internal VDD Regulator */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b4, /* Display Enhancement A */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x0a0,
|
||||
0x005|0x0fd,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0c1, /* contrast */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x09f,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0c7, /* Set Scale Factor of Segment Output Current Control */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x00f,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b9, /* linear gray scale */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b1, /* Phase 1 (Reset) & Phase 2 (Pre-Charge) Period Adjustment */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x0e2,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0d1, /* Display Enhancement B */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x082|0x020,
|
||||
0x020,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0bb, /* precharge voltage */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x01f,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b6, /* precharge period */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x008,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0be, /* vcomh */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x007,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a6, /* normal display */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a9, /* exit partial display */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1322_1bit_nhd_312_prepare_page_seq[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x015, /* column address... */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x01c, /* start at column 0 */
|
||||
0x05b, /* end column */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x075, /* row address... */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static void u8g_dev_ssd1322_1bit_prepare_row(u8g_t *u8g, u8g_dev_t *dev, uint8_t delta_row)
|
||||
{
|
||||
uint8_t row = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
row *= ((u8g_pb_t *)(dev->dev_mem))->p.page_height;
|
||||
row += delta_row;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_1bit_nhd_312_prepare_page_seq);
|
||||
|
||||
u8g_WriteByte(u8g, dev, row); /* start at the selected row */
|
||||
u8g_WriteByte(u8g, dev, row+1); /* end within the selected row */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode mode */
|
||||
u8g_WriteByte(u8g, dev, 0x05c); /* write to ram */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
uint8_t u8g_dev_ssd1322_nhd31oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_1bit_nhd_312_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
uint8_t *p = pb->buf;
|
||||
u8g_uint_t cnt;
|
||||
cnt = pb->width;
|
||||
cnt >>= 3;
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i++ )
|
||||
{
|
||||
u8g_dev_ssd1322_1bit_prepare_row(u8g, dev, i); /* this will also enable chip select */
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
#endif
|
||||
u8g_WriteSequenceBWTo16GrDevice(u8g, dev, cnt, p);
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
#endif
|
||||
u8g_MicroDelay(); // for DUE?
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
p+=cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_MicroDelay(); // for DUE?
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_1bit_nhd_312_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
uint8_t *p = pb->buf;
|
||||
u8g_uint_t cnt;
|
||||
cnt = pb->width;
|
||||
cnt >>= 3;
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i++ )
|
||||
{
|
||||
u8g_dev_ssd1322_1bit_prepare_row(u8g, dev, i); /* this will also enable chip select */
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
#endif
|
||||
u8g_WriteSequenceBWTo16GrDevice(u8g, dev, cnt, p);
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
u8g_WriteByte(u8g, dev, 0x0ff);
|
||||
#endif
|
||||
u8g_MicroDelay(); // for DUE?
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
p+=cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x0c1); /* 21 May 2013, fixed contrast command */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_bw_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_bw_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_bw_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_bw_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_bw_parallel , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1322_nhd31oled_bw_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
#define DWIDTH (WIDTH*2)
|
||||
uint8_t u8g_dev_ssd1322_nhd31oled_2x_bw_buf[DWIDTH] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1322_nhd31oled_2x_bw_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1322_nhd31oled_2x_bw_buf};
|
||||
u8g_dev_t u8g_dev_ssd1322_nhd31oled_2x_bw_sw_spi = { u8g_dev_ssd1322_nhd31oled_2x_bw_fn, &u8g_dev_ssd1322_nhd31oled_2x_bw_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1322_nhd31oled_2x_bw_hw_spi = { u8g_dev_ssd1322_nhd31oled_2x_bw_fn, &u8g_dev_ssd1322_nhd31oled_2x_bw_pb, U8G_COM_HW_SPI };
|
||||
|
||||
338
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1322_nhd31oled_gr.c
Normal file
338
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1322_nhd31oled_gr.c
Normal file
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1322_nhd31oled_gr.c
|
||||
|
||||
2-Bit (4L) Driver for SSD1322 Controller (OLED Display)
|
||||
Tested with NHD-3.12-25664
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SSD130x Monochrom OLED Controller
|
||||
SSD131x Character OLED Controller
|
||||
SSD132x Graylevel OLED Controller
|
||||
SSD1331 Color OLED Controller
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
/* width must be multiple of 8, largest value is 248 unless u8g 16 bit mode is enabled */
|
||||
#if defined(U8G_16BIT)
|
||||
#define WIDTH 256
|
||||
#else
|
||||
#define WIDTH 248
|
||||
#endif
|
||||
#define HEIGHT 64
|
||||
//#define PAGE_HEIGHT 8
|
||||
|
||||
/*
|
||||
http://www.newhavendisplay.com/app_notes/OLED_25664.txt
|
||||
http://www.newhavendisplay.com/forum/viewtopic.php?f=15&t=3758
|
||||
*/
|
||||
|
||||
static const uint8_t u8g_dev_ssd1322_2bit_nhd_312_init_seq[] PROGMEM = {
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0fd, /* lock command */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x012, /* unlock */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0ae, /* display off, sleep mode */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b3,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x091, /* set display clock divide ratio/oscillator frequency (set clock as 80 frames/sec) */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0ca, /* multiplex ratio */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x03f, /* 1/64 Duty (0x0F~0x3F) */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a2,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* display offset, shift mapping ram counter */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a1,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x000, /* display start line */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a0, /* Set Re-Map / Dual COM Line Mode */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x014, /* was 0x014 */
|
||||
0x011, /* was 0x011 */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0ab,
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x001, /* Enable Internal VDD Regulator */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b4, /* Display Enhancement A */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x0a0,
|
||||
0x005|0x0fd,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0c1, /* contrast */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x09f,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0c7, /* Set Scale Factor of Segment Output Current Control */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x00f,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b9, /* linear gray scale */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b1, /* Phase 1 (Reset) & Phase 2 (Pre-Charge) Period Adjustment */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x0e2,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0d1, /* Display Enhancement B */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x082|0x020,
|
||||
0x020,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0bb, /* precharge voltage */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x01f,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0b6, /* precharge period */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x008,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0be, /* vcomh */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x007,
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a6, /* normal display */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0a9, /* exit partial display */
|
||||
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x0af, /* display on */
|
||||
|
||||
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1322_2bit_nhd_312_prepare_page_seq[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x015, /* column address... */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
0x01c, /* start at column 0 */
|
||||
0x05b, /* end column */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
0x075, /* row address... */
|
||||
U8G_ESC_ADR(1), /* data mode */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static void u8g_dev_ssd1322_2bit_prepare_row(u8g_t *u8g, u8g_dev_t *dev, uint8_t delta_row)
|
||||
{
|
||||
uint8_t row = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
row *= ((u8g_pb_t *)(dev->dev_mem))->p.page_height;
|
||||
row += delta_row;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_2bit_nhd_312_prepare_page_seq);
|
||||
|
||||
u8g_WriteByte(u8g, dev, row); /* start at the selected row */
|
||||
u8g_WriteByte(u8g, dev, row+1); /* end within the selected row */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode mode */
|
||||
u8g_WriteByte(u8g, dev, 0x05c); /* write to ram */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
uint8_t u8g_dev_ssd1322_nhd31oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_2bit_nhd_312_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
uint8_t *p = pb->buf;
|
||||
u8g_uint_t cnt;
|
||||
cnt = pb->width;
|
||||
cnt >>= 2;
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i++ )
|
||||
{
|
||||
u8g_dev_ssd1322_2bit_prepare_row(u8g, dev, i); /* this will also enable chip select */
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
#endif
|
||||
u8g_WriteSequence4LTo16GrDevice(u8g, dev, cnt, p);
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
#endif
|
||||
u8g_MicroDelay(); // for DUE?
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
p+=cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_MicroDelay(); // for DUE?
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8h2_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1322_2bit_nhd_312_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
uint8_t *p = pb->buf;
|
||||
u8g_uint_t cnt;
|
||||
cnt = pb->width;
|
||||
cnt >>= 2; /* 23 Oct 2013, changed to 2 */
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i++ )
|
||||
{
|
||||
u8g_dev_ssd1322_2bit_prepare_row(u8g, dev, i); /* this will also enable chip select */
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
#endif
|
||||
u8g_WriteSequence4LTo16GrDevice(u8g, dev, cnt, p);
|
||||
#if !defined(U8G_16BIT)
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
u8g_WriteByte(u8g, dev, 0x00);
|
||||
#endif
|
||||
u8g_MicroDelay(); // for DUE?
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
p+=cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16h2_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_sw_spi , WIDTH, HEIGHT, 4, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_hw_spi , WIDTH, HEIGHT, 4, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1322_nhd31oled_gr_parallel , WIDTH, HEIGHT, 4, u8g_dev_ssd1322_nhd31oled_gr_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
|
||||
#define DWIDTH (WIDTH*2)
|
||||
uint8_t u8g_dev_ssd1322_nhd31oled_2x_gr_buf[DWIDTH] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1322_nhd31oled_2x_gr_pb = { {8, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1322_nhd31oled_2x_gr_buf};
|
||||
u8g_dev_t u8g_dev_ssd1322_nhd31oled_2x_gr_sw_spi = { u8g_dev_ssd1322_nhd31oled_2x_gr_fn, &u8g_dev_ssd1322_nhd31oled_2x_gr_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1322_nhd31oled_2x_gr_hw_spi = { u8g_dev_ssd1322_nhd31oled_2x_gr_fn, &u8g_dev_ssd1322_nhd31oled_2x_gr_pb, U8G_COM_HW_SPI };
|
||||
|
||||
263
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1325_nhd27oled_bw.c
Normal file
263
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1325_nhd27oled_bw.c
Normal file
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1325_nhd27oled_bw.c
|
||||
|
||||
1-Bit (BW) Driver for SSD1325 Controller (OLED Display)
|
||||
Tested with NHD-2.7-12864UCY3
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SSD130x Monochrom OLED Controller
|
||||
SSD131x Character OLED Controller
|
||||
SSD132x Graylevel OLED Controller
|
||||
SSD1331 Color OLED Controller
|
||||
|
||||
*/
|
||||
|
||||
#ifdef OBSOLETE_CODE
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
#define PAGE_HEIGHT 8
|
||||
|
||||
/* http://www.newhavendisplay.com/app_notes/OLED_2_7_12864.txt */
|
||||
static const uint8_t u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_init_seq[] PROGMEM = {
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0b3, 0x091, /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */
|
||||
0x0a8, 0x03f, /* multiplex ratio: 0x03f * 1/64 duty */
|
||||
0x0a2, 0x04c, /* display offset, shift mapping ram counter */
|
||||
0x0a1, 0x000, /* display start line */
|
||||
0x0ad, 0x002, /* master configuration: disable embedded DC-DC, enable internal VCOMH */
|
||||
0x0a0, 0x056, /* remap configuration, vertical address increment, enable nibble remap (upper nibble is left) */
|
||||
0x086, /* full current range (0x084, 0x085, 0x086) */
|
||||
0x0b8, /* set gray scale table */
|
||||
0x01, 0x011, 0x022, 0x032, 0x043, 0x054, 0x065, 0x076,
|
||||
0x081, 0x070, /* contrast, brightness, 0..128, Newhaven: 0x040 */
|
||||
0x0b2, 0x051, /* frame frequency (row period) */
|
||||
0x0b1, 0x055, /* phase length */
|
||||
0x0bc, 0x010, /* pre-charge voltage level */
|
||||
0x0b4, 0x002, /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0b0, 0x028, /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0be, 0x01c, /* VCOMH voltage */
|
||||
0x0bf, 0x002|0x00d, /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0a5, /* all pixel on */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x0a4, /* normal display mode */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_prepare_page_seq[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x015, /* column address... */
|
||||
0x000, /* start at column 0 */
|
||||
0x03f, /* end at column 63 (which is y == 127), because there are two pixel in one column */
|
||||
0x075, /* row address... */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
static void u8g_dev_ssd1325_1bit_prepare_page(u8g_t *u8g, u8g_dev_t *dev)
|
||||
{
|
||||
uint8_t page = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_prepare_page_seq);
|
||||
|
||||
page <<= 3;
|
||||
u8g_WriteByte(u8g, dev, page); /* start at the selected page */
|
||||
page += 7;
|
||||
u8g_WriteByte(u8g, dev, page); /* end within the selected page */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
static void u8g_dev_ssd1325_1bit_2x_prepare_page(u8g_t *u8g, u8g_dev_t *dev, uint8_t is_odd)
|
||||
{
|
||||
uint8_t page = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_prepare_page_seq);
|
||||
|
||||
page <<= 1;
|
||||
page += is_odd;
|
||||
|
||||
page <<= 3;
|
||||
u8g_WriteByte(u8g, dev, page); /* start at the selected page */
|
||||
page += 7;
|
||||
u8g_WriteByte(u8g, dev, page); /* end within the selected page */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
/* assumes row autoincrement and activated nibble remap */
|
||||
#ifdef OLD
|
||||
static void _OLD_u8g_dev_ssd1325_1bit_write_16_pixel(u8g_t *u8g, u8g_dev_t *dev, uint8_t left, uint8_t right)
|
||||
{
|
||||
uint8_t d, cnt;
|
||||
cnt = 8;
|
||||
do
|
||||
{
|
||||
d = 0;
|
||||
if ( left & 1 )
|
||||
d |= 0x0f0;
|
||||
if ( right & 1 )
|
||||
d |= 0x00f;
|
||||
u8g_WriteByte(u8g, dev, d);
|
||||
left >>= 1;
|
||||
right >>= 1;
|
||||
cnt--;
|
||||
}while ( cnt > 0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
static void u8g_dev_ssd1325_1bit_write_16_pixel(u8g_t *u8g, u8g_dev_t *dev, uint8_t left, uint8_t right)
|
||||
{
|
||||
uint8_t d, cnt;
|
||||
static uint8_t buf[8];
|
||||
cnt = 8;
|
||||
do
|
||||
{
|
||||
d = 0;
|
||||
if ( left & 128 )
|
||||
d |= 0x0f0;
|
||||
if ( right & 128 )
|
||||
d |= 0x00f;
|
||||
cnt--;
|
||||
buf[cnt] = d;
|
||||
left <<= 1;
|
||||
right <<= 1;
|
||||
}while ( cnt > 0 );
|
||||
u8g_WriteSequence(u8g, dev, 8, buf);
|
||||
}
|
||||
|
||||
static void u8g_dev_ssd1325_1bit_write_buffer(u8g_t *u8g, u8g_dev_t *dev, uint8_t is_odd)
|
||||
{
|
||||
uint8_t cnt, left, right;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
ptr = pb->buf;
|
||||
cnt = pb->width;
|
||||
if ( is_odd )
|
||||
ptr += cnt;
|
||||
cnt >>= 1;
|
||||
do
|
||||
{
|
||||
left = *ptr++;
|
||||
right = *ptr++;
|
||||
u8g_dev_ssd1325_1bit_write_16_pixel(u8g, dev, left, right);
|
||||
cnt--;
|
||||
} while( cnt > 0 );
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_ssd1325_nhd27oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_dev_ssd1325_1bit_prepare_page(u8g, dev);
|
||||
u8g_dev_ssd1325_1bit_write_buffer(u8g, dev, 0);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
uint8_t u8g_dev_ssd1325_nhd27oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_1bit_nhd_27_12864ucy3_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_dev_ssd1325_1bit_2x_prepare_page(u8g, dev, 0);
|
||||
u8g_dev_ssd1325_1bit_write_buffer(u8g, dev, 0);
|
||||
u8g_dev_ssd1325_1bit_2x_prepare_page(u8g, dev, 1);
|
||||
u8g_dev_ssd1325_1bit_write_buffer(u8g, dev, 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
}
|
||||
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
/* disabled, see bw_new.c */
|
||||
/*
|
||||
U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_bw_sw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1325_nhd27oled_bw_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_bw_hw_spi , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1325_nhd27oled_bw_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_bw_parallel , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_ssd1325_nhd27oled_bw_fn, U8G_COM_FAST_PARALLEL);
|
||||
*/
|
||||
|
||||
/*
|
||||
uint8_t u8g_dev_ssd1325_nhd27oled_2x_bw_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1325_nhd27oled_2x_bw_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1325_nhd27oled_2x_bw_buf};
|
||||
u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_sw_spi = { u8g_dev_ssd1325_nhd27oled_2x_bw_fn, &u8g_dev_ssd1325_nhd27oled_2x_bw_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_hw_spi = { u8g_dev_ssd1325_nhd27oled_2x_bw_fn, &u8g_dev_ssd1325_nhd27oled_2x_bw_pb, U8G_COM_HW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_parallel = { u8g_dev_ssd1325_nhd27oled_2x_bw_fn, &u8g_dev_ssd1325_nhd27oled_2x_bw_pb, U8G_COM_FAST_PARALLEL };
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1325_nhd27oled_bw.c
|
||||
|
||||
1-Bit (BW) Driver for SSD1325 Controller (OLED Display)
|
||||
Horizontal architecture, completly rewritten
|
||||
Tested with NHD-2.7-12864UCY3
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2012, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SSD130x Monochrom OLED Controller
|
||||
SSD131x Character OLED Controller
|
||||
SSD132x Graylevel OLED Controller
|
||||
SSD1331 Color OLED Controller
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
/* width must be multiple of 8, largest value is 248 unless u8g 16 bit mode is enabled */
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
|
||||
/* http://www.newhavendisplay.com/app_notes/OLED_2_7_12864.txt */
|
||||
static const uint8_t u8g_dev_ssd1325_nhd_27_12864_init_seq[] PROGMEM = {
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0b3, 0x091, /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */
|
||||
0x0a8, 0x03f, /* multiplex ratio: 0x03f * 1/64 duty */
|
||||
0x0a2, 0x04c, /* display offset, shift mapping ram counter */
|
||||
0x0a1, 0x000, /* display start line */
|
||||
0x0ad, 0x002, /* master configuration: disable embedded DC-DC, enable internal VCOMH */
|
||||
0x0a0, 0x052, /* remap configuration, horizontal address increment (bit 2 = 0), enable nibble remap (upper nibble is left, bit 1 = 1) */
|
||||
0x086, /* full current range (0x084, 0x085, 0x086) */
|
||||
0x0b8, /* set gray scale table */
|
||||
0x01, 0x011, 0x022, 0x032, 0x043, 0x054, 0x065, 0x076,
|
||||
|
||||
0x081, 0x070, /* contrast, brightness, 0..128, Newhaven: 0x040 */
|
||||
0x0b2, 0x051, /* frame frequency (row period) */
|
||||
0x0b1, 0x055, /* phase length */
|
||||
0x0bc, 0x010, /* pre-charge voltage level */
|
||||
0x0b4, 0x002, /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0b0, 0x028, /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0be, 0x01c, /* VCOMH voltage */
|
||||
0x0bf, 0x002|0x00d, /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0a4, /* normal display mode */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1325_prepare_row_seq[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x015, /* column address... */
|
||||
0x000, /* start at column 0 */
|
||||
0x03f, /* end at column 63 (which is y == 127), because there are two pixel in one column */
|
||||
0x075, /* row address... */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static void u8g_dev_ssd1325_prepare_row(u8g_t *u8g, u8g_dev_t *dev, uint8_t delta_row)
|
||||
{
|
||||
uint8_t row = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
row *= ((u8g_pb_t *)(dev->dev_mem))->p.page_height;
|
||||
row += delta_row;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_prepare_row_seq);
|
||||
|
||||
u8g_WriteByte(u8g, dev, row); /* start at the selected row */
|
||||
u8g_WriteByte(u8g, dev, row+1); /* end within the selected row */
|
||||
|
||||
//u8g_SetAddress(u8g, dev, 0); /* instruction mode mode */
|
||||
//u8g_WriteByte(u8g, dev, 0x05c); /* write to ram */
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_on[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd13xx_sleep_off[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(50), /* delay 50 ms */
|
||||
U8G_ESC_CS(0), /* disable chip, bugfix 12 nov 2014 */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
static uint8_t u8g_dev_ssd1325_nhd27oled_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
//case U8G_DEV_MSG_IS_BBX_INTERSECTION:
|
||||
// return u8g_pb_IsIntersection((u8g_pb_t *)(dev->dev_mem), (u8g_dev_arg_bbx_t *)arg);
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_nhd_27_12864_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
uint8_t *p = pb->buf;
|
||||
u8g_uint_t cnt;
|
||||
cnt = pb->width;
|
||||
cnt >>= 3;
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i++ )
|
||||
{
|
||||
u8g_dev_ssd1325_prepare_row(u8g, dev, i); /* this will also enable chip select */
|
||||
u8g_WriteSequenceBWTo16GrDevice(u8g, dev, cnt, p);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
p+=cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
static uint8_t u8g_dev_ssd1325_nhd27oled_2x_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_nhd_27_12864_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
uint8_t i;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
uint8_t *p = pb->buf;
|
||||
u8g_uint_t cnt;
|
||||
cnt = pb->width;
|
||||
cnt >>= 3;
|
||||
|
||||
for( i = 0; i < pb->p.page_height; i++ )
|
||||
{
|
||||
u8g_dev_ssd1325_prepare_row(u8g, dev, i); /* this will also enable chip select */
|
||||
u8g_WriteSequenceBWTo16GrDevice(u8g, dev, cnt, p);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
p+=cnt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
break;
|
||||
case U8G_DEV_MSG_SLEEP_ON:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
|
||||
return 1;
|
||||
case U8G_DEV_MSG_SLEEP_OFF:
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_bw_sw_spi , WIDTH, HEIGHT, 8, u8g_dev_ssd1325_nhd27oled_bw_fn, U8G_COM_SW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_bw_hw_spi , WIDTH, HEIGHT, 8, u8g_dev_ssd1325_nhd27oled_bw_fn, U8G_COM_HW_SPI);
|
||||
U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_bw_parallel , WIDTH, HEIGHT, 8, u8g_dev_ssd1325_nhd27oled_bw_fn, U8G_COM_FAST_PARALLEL);
|
||||
|
||||
uint8_t u8g_dev_ssd1325_nhd27oled_2x_bw_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
u8g_pb_t u8g_dev_ssd1325_nhd27oled_2x_bw_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1325_nhd27oled_2x_bw_buf};
|
||||
u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_sw_spi = { u8g_dev_ssd1325_nhd27oled_2x_bw_fn, &u8g_dev_ssd1325_nhd27oled_2x_bw_pb, U8G_COM_SW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_hw_spi = { u8g_dev_ssd1325_nhd27oled_2x_bw_fn, &u8g_dev_ssd1325_nhd27oled_2x_bw_pb, U8G_COM_HW_SPI };
|
||||
u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_bw_parallel = { u8g_dev_ssd1325_nhd27oled_2x_bw_fn, &u8g_dev_ssd1325_nhd27oled_2x_bw_pb, U8G_COM_FAST_PARALLEL };
|
||||
|
||||
255
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1325_nhd27oled_gr.c
Normal file
255
.piolibdeps/U8glib_ID7/src/clib/u8g_dev_ssd1325_nhd27oled_gr.c
Normal file
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
|
||||
u8g_dev_ssd1325_nhd27oled_gr.c
|
||||
|
||||
2-Bit (gray level) Driver for SSD1325 Controller (OLED Display)
|
||||
Tested with NHD-2.7-12864UCY3
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, olikraus@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SSD130x Monochrom OLED Controller
|
||||
SSD131x Character OLED Controller
|
||||
SSD132x Graylevel OLED Controller
|
||||
SSD1331 Color OLED Controller
|
||||
|
||||
*/
|
||||
|
||||
#ifdef OBSOLETE_CODE
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
#define WIDTH 128
|
||||
#define HEIGHT 64
|
||||
|
||||
/* http://www.newhavendisplay.com/app_notes/OLED_2_7_12864.txt */
|
||||
static const uint8_t u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq[] PROGMEM = {
|
||||
U8G_ESC_DLY(10), /* delay 10 ms */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x0ae, /* display off, sleep mode */
|
||||
0x0b3, 0x091, /* set display clock divide ratio/oscillator frequency (set clock as 135 frames/sec) */
|
||||
0x0a8, 0x03f, /* multiplex ratio: 0x03f * 1/64 duty */
|
||||
0x0a2, 0x04c, /* display offset, shift mapping ram counter */
|
||||
0x0a1, 0x000, /* display start line */
|
||||
0x0ad, 0x002, /* master configuration: disable embedded DC-DC, enable internal VCOMH */
|
||||
0x0a0, 0x056, /* remap configuration, vertical address increment, enable nibble remap (upper nibble is left) */
|
||||
0x086, /* full current range (0x084, 0x085, 0x086) */
|
||||
0x0b8, /* set gray scale table */
|
||||
//0x01, 0x011, 0x022, 0x032, 0x043, 0x054, 0x065, 0x076,
|
||||
0x01, 0x011, 0x022, 0x032, 0x043, 0x054, 0x077, 0x077, // 4L mode uses 0, 2, 4, 7
|
||||
0x081, 0x070, /* contrast, brightness, 0..128, Newhaven: 0x040 */
|
||||
0x0b2, 0x051, /* frame frequency (row period) */
|
||||
0x0b1, 0x055, /* phase length */
|
||||
0x0bc, 0x010, /* pre-charge voltage level */
|
||||
0x0b4, 0x002, /* set pre-charge compensation level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0b0, 0x028, /* enable pre-charge compensation (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0be, 0x01c, /* VCOMH voltage */
|
||||
0x0bf, 0x002|0x00d, /* VSL voltage level (not documented in the SDD1325 datasheet, but used in the NHD init seq.) */
|
||||
0x0a5, /* all pixel on */
|
||||
0x0af, /* display on */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
U8G_ESC_DLY(100), /* delay 100 ms */
|
||||
0x0a4, /* normal display mode */
|
||||
U8G_ESC_CS(0), /* disable chip */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
static const uint8_t u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_prepare_page_seq[] PROGMEM = {
|
||||
U8G_ESC_ADR(0), /* instruction mode */
|
||||
U8G_ESC_CS(1), /* enable chip */
|
||||
0x015, /* column address... */
|
||||
0x000, /* start at column 0 */
|
||||
0x03f, /* end at column 63 (which is y == 127), because there are two pixel in one column */
|
||||
0x075, /* row address... */
|
||||
U8G_ESC_END /* end of sequence */
|
||||
};
|
||||
|
||||
|
||||
static void u8g_dev_ssd1325_2bit_prepare_page(u8g_t *u8g, u8g_dev_t *dev)
|
||||
{
|
||||
uint8_t page = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_prepare_page_seq);
|
||||
|
||||
page <<= 2;
|
||||
u8g_WriteByte(u8g, dev, page); /* start at the selected page */
|
||||
page += 3;
|
||||
u8g_WriteByte(u8g, dev, page); /* end within the selected page */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
static void u8g_dev_ssd1325_2bit_2x_prepare_page(u8g_t *u8g, u8g_dev_t *dev, uint8_t is_odd)
|
||||
{
|
||||
uint8_t page = ((u8g_pb_t *)(dev->dev_mem))->p.page;
|
||||
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_prepare_page_seq);
|
||||
|
||||
page <<= 1;
|
||||
page += is_odd;
|
||||
|
||||
|
||||
page <<= 2;
|
||||
u8g_WriteByte(u8g, dev, page); /* start at the selected page */
|
||||
page += 3;
|
||||
u8g_WriteByte(u8g, dev, page); /* end within the selected page */
|
||||
|
||||
u8g_SetAddress(u8g, dev, 1); /* data mode */
|
||||
}
|
||||
|
||||
/* assumes row autoincrement and activated nibble remap */
|
||||
static void u8g_dev_ssd1325_2bit_write_4_pixel(u8g_t *u8g, u8g_dev_t *dev, uint8_t left, uint8_t right)
|
||||
{
|
||||
uint8_t d, tmp, cnt;
|
||||
cnt = 4;
|
||||
do
|
||||
{
|
||||
d = left;
|
||||
d &= 3;
|
||||
d <<= 4;
|
||||
tmp = right;
|
||||
tmp &= 3;
|
||||
d |= tmp;
|
||||
d <<= 2;
|
||||
u8g_WriteByte(u8g, dev, d);
|
||||
left >>= 2;
|
||||
right >>= 2;
|
||||
cnt--;
|
||||
}while ( cnt > 0 );
|
||||
}
|
||||
|
||||
static void u8g_dev_ssd1325_2bit_write_buffer(u8g_t *u8g, u8g_dev_t *dev)
|
||||
{
|
||||
uint8_t cnt, left, right;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
cnt = pb->width;
|
||||
cnt >>= 1;
|
||||
ptr = pb->buf;
|
||||
do
|
||||
{
|
||||
left = *ptr++;
|
||||
right = *ptr++;
|
||||
u8g_dev_ssd1325_2bit_write_4_pixel(u8g, dev, left, right);
|
||||
cnt--;
|
||||
} while( cnt > 0 );
|
||||
}
|
||||
|
||||
static void u8g_dev_ssd1325_2bit_2x_write_buffer(u8g_t *u8g, u8g_dev_t *dev, uint8_t is_odd)
|
||||
{
|
||||
uint8_t cnt, left, right;
|
||||
uint8_t *ptr;
|
||||
u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
|
||||
|
||||
ptr = pb->buf;
|
||||
cnt = pb->width;
|
||||
if ( is_odd )
|
||||
ptr += cnt;
|
||||
cnt >>= 1;
|
||||
do
|
||||
{
|
||||
left = *ptr++;
|
||||
right = *ptr++;
|
||||
u8g_dev_ssd1325_2bit_write_4_pixel(u8g, dev, left, right);
|
||||
cnt--;
|
||||
} while( cnt > 0 );
|
||||
}
|
||||
|
||||
static uint8_t u8g_dev_ssd1325_nhd27oled_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_dev_ssd1325_2bit_prepare_page(u8g, dev);
|
||||
u8g_dev_ssd1325_2bit_write_buffer(u8g, dev);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb8v2_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
static uint8_t u8g_dev_ssd1325_nhd27oled_2x_gr_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case U8G_DEV_MSG_INIT:
|
||||
u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_300NS);
|
||||
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd1325_2bit_nhd_27_12864ucy3_init_seq);
|
||||
break;
|
||||
case U8G_DEV_MSG_STOP:
|
||||
break;
|
||||
case U8G_DEV_MSG_PAGE_NEXT:
|
||||
{
|
||||
u8g_dev_ssd1325_2bit_2x_prepare_page(u8g, dev, 0);
|
||||
u8g_dev_ssd1325_2bit_2x_write_buffer(u8g, dev, 0);
|
||||
u8g_dev_ssd1325_2bit_2x_prepare_page(u8g, dev, 1);
|
||||
u8g_dev_ssd1325_2bit_2x_write_buffer(u8g, dev, 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
}
|
||||
break;
|
||||
case U8G_DEV_MSG_CONTRAST:
|
||||
u8g_SetChipSelect(u8g, dev, 1);
|
||||
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
|
||||
u8g_WriteByte(u8g, dev, 0x081);
|
||||
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) >> 1);
|
||||
u8g_SetChipSelect(u8g, dev, 0);
|
||||
return 1;
|
||||
}
|
||||
return u8g_dev_pb16v2_base_fn(u8g, dev, msg, arg);
|
||||
}
|
||||
|
||||
//U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_gr_sw_spi , WIDTH, HEIGHT, 4, u8g_dev_ssd1325_nhd27oled_gr_fn, U8G_COM_SW_SPI);
|
||||
//U8G_PB_DEV(u8g_dev_ssd1325_nhd27oled_gr_hw_spi , WIDTH, HEIGHT, 4, u8g_dev_ssd1325_nhd27oled_gr_fn, U8G_COM_HW_SPI);
|
||||
|
||||
//uint8_t u8g_dev_ssd1325_nhd27oled_2x_buf[WIDTH*2] U8G_NOCOMMON ;
|
||||
//u8g_pb_t u8g_dev_ssd1325_nhd27oled_2x_pb = { {8, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_ssd1325_nhd27oled_2x_buf};
|
||||
//u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_gr_sw_spi = { u8g_dev_ssd1325_nhd27oled_2x_gr_fn, &u8g_dev_ssd1325_nhd27oled_2x_pb, U8G_COM_SW_SPI };
|
||||
//u8g_dev_t u8g_dev_ssd1325_nhd27oled_2x_gr_hw_spi = { u8g_dev_ssd1325_nhd27oled_2x_gr_fn, &u8g_dev_ssd1325_nhd27oled_2x_pb, U8G_COM_HW_SPI };
|
||||
|
||||
|
||||
#endif /* OBSOLETE_CODE */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user