Compare commits
2380 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
122bdd187f | ||
|
|
f394c0639e | ||
|
|
9045ea3adf | ||
|
|
f52f388bda | ||
|
|
f077c7abbf | ||
|
|
6f9442afca | ||
|
|
080c85a4c9 | ||
|
|
0da744b7b0 | ||
|
|
4823791eb0 | ||
|
|
af6049c6c2 | ||
|
|
80f221ed11 | ||
|
|
5e5d250832 | ||
|
|
89a845659a | ||
|
|
e12a481e35 | ||
|
|
c80e5aca30 | ||
|
|
dd4d860ad7 | ||
|
|
a6e39c1005 | ||
|
|
42ec1f39e7 | ||
|
|
b6ca86b974 | ||
|
|
515c8d4fe9 | ||
|
|
a6805ddf30 | ||
|
|
d62ba3d87e | ||
|
|
af32a7d5d6 | ||
|
|
02f466e633 | ||
|
|
04fa9d4f47 | ||
|
|
e3f583a3be | ||
|
|
3b3e8a02b5 | ||
|
|
da9d4c4caf | ||
|
|
c5857f96c8 | ||
|
|
f774420488 | ||
|
|
7d55d86081 | ||
|
|
7ea4e095ad | ||
|
|
bcbac698f2 | ||
|
|
49ed4696ea | ||
|
|
7112f2e41a | ||
|
|
041fc639d7 | ||
|
|
1c6a16d5bb | ||
|
|
1b336971ae | ||
|
|
ba4eebad2f | ||
|
|
cbce025248 | ||
|
|
665338bb69 | ||
|
|
97ed8abd3f | ||
|
|
b705ae0cb0 | ||
|
|
1cd1ccbf86 | ||
|
|
ff272c7b69 | ||
|
|
0c8e747f88 | ||
|
|
815943ceed | ||
|
|
6486e8b74a | ||
|
|
757661b299 | ||
|
|
fc75e6f92d | ||
|
|
22299c13c1 | ||
|
|
adb5375a09 | ||
|
|
cadded1e21 | ||
|
|
04e57e2b5e | ||
|
|
40c7e5d4e7 | ||
|
|
f260e00a72 | ||
|
|
b1a3a95ad4 | ||
|
|
04a6924633 | ||
|
|
15fccd43ee | ||
|
|
be08eb6153 | ||
|
|
d1ff7959b7 | ||
|
|
10caee2b7c | ||
|
|
1cc316f1fd | ||
|
|
7bf5d117e7 | ||
|
|
db8ab50c66 | ||
|
|
06332f20be | ||
|
|
ac4e461901 | ||
|
|
92a7d4515a | ||
|
|
1aa531a3db | ||
|
|
68dda08fff | ||
|
|
f8c10d6b0e | ||
|
|
468df96b0f | ||
|
|
338b69c24b | ||
|
|
b39b54031b | ||
|
|
32f75749e4 | ||
|
|
7aafee3003 | ||
|
|
37eaa1406b | ||
|
|
198d5d56fd | ||
|
|
4119cef32f | ||
|
|
da94bcfebb | ||
|
|
41145e6e81 | ||
|
|
3ce0c5063f | ||
|
|
eda95d8bed | ||
|
|
59483221d5 | ||
|
|
5d0570cea0 | ||
|
|
f96bc03081 | ||
|
|
8d9cf72db0 | ||
|
|
6843b78f99 | ||
|
|
98392782ea | ||
|
|
daa52124b0 | ||
|
|
3166aed087 | ||
|
|
a02ae36ae8 | ||
|
|
7f2375ab46 | ||
|
|
cf7c444aff | ||
|
|
eda5190581 | ||
|
|
68085ca855 | ||
|
|
6a3529247f | ||
|
|
c97c2dcaf7 | ||
|
|
09ef955191 | ||
|
|
38b0082bf2 | ||
|
|
4bbea5124d | ||
|
|
637cc03686 | ||
|
|
3f45a1acf9 | ||
|
|
4634feaeab | ||
|
|
9bf87aac6a | ||
|
|
4ae03df5c2 | ||
|
|
963a92ceda | ||
|
|
7ec7bb31c4 | ||
|
|
861391d530 | ||
|
|
8d580ea7e8 | ||
|
|
d9e1f22682 | ||
|
|
e5fd43f343 | ||
|
|
80277cc9c8 | ||
|
|
8fe7420310 | ||
|
|
7d25c107a8 | ||
|
|
d56c6af24e | ||
|
|
cc291aeb3c | ||
|
|
e7e1866589 | ||
|
|
57e82cacc9 | ||
|
|
4338813814 | ||
|
|
8f24475e02 | ||
|
|
fbef2f5b61 | ||
|
|
b8b51d8da8 | ||
|
|
999a76dbdf | ||
|
|
e8fa843c2d | ||
|
|
fc04b587cf | ||
|
|
d7c6fd5c2f | ||
|
|
cb0dbfa3b5 | ||
|
|
a15c5d222a | ||
|
|
609c0d46d9 | ||
|
|
3ba9b06b79 | ||
|
|
5286e73f29 | ||
|
|
2ef49a9d53 | ||
|
|
eb8cf29464 | ||
|
|
91cdea4022 | ||
|
|
6e1bc03d3b | ||
|
|
cc9968f893 | ||
|
|
1c384930f3 | ||
|
|
ff30a18d9c | ||
|
|
de2cca73ac | ||
|
|
a4314c4907 | ||
|
|
8de7a6f9b1 | ||
|
|
21be07a6f6 | ||
|
|
9418b4f2f3 | ||
|
|
4b648793f2 | ||
|
|
73a59a4e45 | ||
|
|
c73f1b2471 | ||
|
|
f4a3efd35e | ||
|
|
3f5fbbd398 | ||
|
|
c16c47954c | ||
|
|
30c3a21d1f | ||
|
|
81d759efb6 | ||
|
|
2179f598bf | ||
|
|
62a9b9902d | ||
|
|
f928894c38 | ||
|
|
236a44c83b | ||
|
|
7326d63ce0 | ||
|
|
f9ded2a7c4 | ||
|
|
a645860431 | ||
|
|
1981e53d68 | ||
|
|
7976e29399 | ||
|
|
81aab828e2 | ||
|
|
0c48eaf3de | ||
|
|
e8b10d2836 | ||
|
|
7bb7ac8353 | ||
|
|
cd2ef25032 | ||
|
|
4d4a842cfb | ||
|
|
89838cdb10 | ||
|
|
70a41a8532 | ||
|
|
793cd0ae3b | ||
|
|
27f244ba2c | ||
|
|
ce639b8b03 | ||
|
|
3fd31976c3 | ||
|
|
b45a0c4c60 | ||
|
|
25d1c94fa8 | ||
|
|
bedd4dab6a | ||
|
|
986b508ff7 | ||
|
|
fd5414c6ea | ||
|
|
b7928a000a | ||
|
|
5cba0b4187 | ||
|
|
302d1bfbc4 | ||
|
|
04b147645d | ||
|
|
37b857e8ec | ||
|
|
29e09c7c3e | ||
|
|
fac85f6fa1 | ||
|
|
642e3699ce | ||
|
|
501f63802a | ||
|
|
c23db208d9 | ||
|
|
1002eb67c8 | ||
|
|
2cbcba1808 | ||
|
|
7dde761aa6 | ||
|
|
eafbc5e0cc | ||
|
|
cf792fd8d8 | ||
|
|
cacf04f8a7 | ||
|
|
50e3482e0a | ||
|
|
679be3294f | ||
|
|
f18d3f451a | ||
|
|
988332c67a | ||
|
|
2690d8568e | ||
|
|
614febaaf3 | ||
|
|
13ef12ad3f | ||
|
|
e2b022cce2 | ||
|
|
5cba0210f2 | ||
|
|
6165fd41a5 | ||
|
|
71718d888a | ||
|
|
83795d3e63 | ||
|
|
143ad74db7 | ||
|
|
b0f5ba0232 | ||
|
|
02b131b552 | ||
|
|
45dc8a51f3 | ||
|
|
6a21180bd4 | ||
|
|
b18816fcbf | ||
|
|
be83036212 | ||
|
|
b82d91eca6 | ||
|
|
45bcc43e48 | ||
|
|
ef68c1910c | ||
|
|
ea9fd1200b | ||
|
|
e4945b30d2 | ||
|
|
ff13070b59 | ||
|
|
209f5f21e0 | ||
|
|
c8f76bb8aa | ||
|
|
adc25db8c4 | ||
|
|
e7cf85b922 | ||
|
|
6e64895c30 | ||
|
|
34b8b9f0f5 | ||
|
|
1e20949afb | ||
|
|
f5972c4d2c | ||
|
|
3a3d358df9 | ||
|
|
eb85342fd9 | ||
|
|
14f3ca1b2e | ||
|
|
91fcdc2b99 | ||
|
|
772460a7b8 | ||
|
|
aa0b0483f4 | ||
|
|
0fb507a75d | ||
|
|
04a0d45c22 | ||
|
|
b4e5e0f11d | ||
|
|
547d35a921 | ||
|
|
79778d46d9 | ||
|
|
a68228bf55 | ||
|
|
9eb4aceee4 | ||
|
|
0631541166 | ||
|
|
222d13d5ed | ||
|
|
186629aee8 | ||
|
|
a42fb35c56 | ||
|
|
67e15aac3d | ||
|
|
17cc2a9663 | ||
|
|
252f4a75cd | ||
|
|
fd1243c184 | ||
|
|
0bc648353f | ||
|
|
f27c2b6b4b | ||
|
|
615bec2329 | ||
|
|
1c889cd303 | ||
|
|
4b02f33e69 | ||
|
|
be24fdacea | ||
|
|
5b0f659355 | ||
|
|
32ae9f9ab7 | ||
|
|
b6e69e71ce | ||
|
|
051325ccd7 | ||
|
|
e736779d7e | ||
|
|
7253a1971d | ||
|
|
d118e3f985 | ||
|
|
100271e6ac | ||
|
|
fd9e94e5a4 | ||
|
|
8dccd5a7ea | ||
|
|
6a4f06d35d | ||
|
|
68eae2b5a8 | ||
|
|
eb5817675d | ||
|
|
8006684c19 | ||
|
|
cb88fdd242 | ||
|
|
dc0f41868e | ||
|
|
ea8409ad5d | ||
|
|
9a3408e58f | ||
|
|
1093c780c8 | ||
|
|
a4fe6a45ae | ||
|
|
c2e5c6c12c | ||
|
|
042a6a0a37 | ||
|
|
08b3147791 | ||
|
|
9f8e6dce20 | ||
|
|
e1beaf61eb | ||
|
|
34cde1b77c | ||
|
|
f00ca3fd89 | ||
|
|
0c9db67273 | ||
|
|
fbfbc5e330 | ||
|
|
d4e7c2d694 | ||
|
|
9df0e0e0cc | ||
|
|
3e2473e695 | ||
|
|
8eaba020fb | ||
|
|
438a87eba8 | ||
|
|
b19b272172 | ||
|
|
7f30f85602 | ||
|
|
b81d3b83cf | ||
|
|
be691b51f1 | ||
|
|
f3f58bd619 | ||
|
|
b03787262a | ||
|
|
83ffc9eb4f | ||
|
|
373e8a1ad4 | ||
|
|
31656e68bc | ||
|
|
8ea55323d8 | ||
|
|
b83e472bd3 | ||
|
|
68457ee903 | ||
|
|
711e5db19a | ||
|
|
400e9329be | ||
|
|
cdcb80f3c5 | ||
|
|
6f473f7fc6 | ||
|
|
efbd705eda | ||
|
|
8e66028d25 | ||
|
|
ab5aa3fc92 | ||
|
|
27d918d836 | ||
|
|
159ff94afd | ||
|
|
1112dcd3c2 | ||
|
|
1270fbfd38 | ||
|
|
b58083b0fa | ||
|
|
1833049b8a | ||
|
|
1b7c443628 | ||
|
|
6f9e9c0e4f | ||
|
|
becbfe1065 | ||
|
|
4882a7eded | ||
|
|
d7272e3f36 | ||
|
|
9ed1275a37 | ||
|
|
62bad1b60f | ||
|
|
59d345a3dd | ||
|
|
b8f0c8a4c7 | ||
|
|
df0d599c79 | ||
|
|
a366697649 | ||
|
|
7c94c83765 | ||
|
|
51aa7d93eb | ||
|
|
2932602643 | ||
|
|
06555febdd | ||
|
|
8d2aa2368d | ||
|
|
0de5fcad0a | ||
|
|
1403b9acc0 | ||
|
|
5cf1c38ea1 | ||
|
|
04ab61bf40 | ||
|
|
39c62fbd6f | ||
|
|
efcb769003 | ||
|
|
992fbb831d | ||
|
|
5ee6fe6385 | ||
|
|
056daf00fc | ||
|
|
71aafb79a0 | ||
|
|
2c9e0415c7 | ||
|
|
a64bcd53e9 | ||
|
|
e6cc232184 | ||
|
|
83c4131ba3 | ||
|
|
5eeea2f611 | ||
|
|
f6950acb8e | ||
|
|
7a670e3911 | ||
|
|
58658c9279 | ||
|
|
0fa3bac8ee | ||
|
|
3b2973da6a | ||
|
|
1635613c25 | ||
|
|
0b429461d5 | ||
|
|
0cebe85e65 | ||
|
|
e7b40bbe98 | ||
|
|
e2da2b4105 | ||
|
|
4f314afaf0 | ||
|
|
60d5658da8 | ||
|
|
ae4acc42ec | ||
|
|
57da1b8497 | ||
|
|
fcceb98191 | ||
|
|
78a347a01a | ||
|
|
6d691aceee | ||
|
|
6bfcb74c25 | ||
|
|
0fbfb22506 | ||
|
|
8d1eeff021 | ||
|
|
e19fe4054d | ||
|
|
5a54204f72 | ||
|
|
bb4efcf603 | ||
|
|
96d0d04b8f | ||
|
|
e293ea57f0 | ||
|
|
c956b52c4a | ||
|
|
956418c674 | ||
|
|
8cea79a81d | ||
|
|
33addc52a1 | ||
|
|
8da2e98985 | ||
|
|
6dfc7124a1 | ||
|
|
be7167ed97 | ||
|
|
9acdc6c234 | ||
|
|
e7099ea597 | ||
|
|
a0f6407d6a | ||
|
|
754b13d8fe | ||
|
|
dbd4c17096 | ||
|
|
644c376e84 | ||
|
|
54a39d8c1a | ||
|
|
17c23bbaf3 | ||
|
|
c0e791dbe9 | ||
|
|
b4af4441c5 | ||
|
|
8f16563bbd | ||
|
|
6fa7e24af3 | ||
|
|
d5b7c595ae | ||
|
|
9bdab4f3a8 | ||
|
|
9b23490f01 | ||
|
|
c6c37abd41 | ||
|
|
c24045475a | ||
|
|
25d636c9e0 | ||
|
|
47401ec97b | ||
|
|
ba6a243197 | ||
|
|
0c7f7ebcfb | ||
|
|
b5fb7075b9 | ||
|
|
7b4bdc0203 | ||
|
|
91b5156b3e | ||
|
|
03f0edb57e | ||
|
|
0ad25c6665 | ||
|
|
56a6d85c41 | ||
|
|
4cdafc0b35 | ||
|
|
e01f5e1ef7 | ||
|
|
5e36b64635 | ||
|
|
5d65a36dee | ||
|
|
0f149ea0c6 | ||
|
|
b825567e0f | ||
|
|
42e381f8e2 | ||
|
|
db27e67580 | ||
|
|
bc50db9cf6 | ||
|
|
b5987de08a | ||
|
|
cffb2d457e | ||
|
|
7ac7ddbf20 | ||
|
|
5bc480fee8 | ||
|
|
fc882c34a3 | ||
|
|
e27dd5c22d | ||
|
|
fabf3ae4a0 | ||
|
|
8c768a76a2 | ||
|
|
5b9010965d | ||
|
|
89fb778684 | ||
|
|
558665cd90 | ||
|
|
9f462f0cf5 | ||
|
|
a356699882 | ||
|
|
8b3d63c423 | ||
|
|
7c72b57313 | ||
|
|
f690b82343 | ||
|
|
868dbbac6a | ||
|
|
8e4fa08a20 | ||
|
|
a4c78ae786 | ||
|
|
a39fadf876 | ||
|
|
34e0a8d848 | ||
|
|
28599c51c7 | ||
|
|
11a065c0ca | ||
|
|
f7f6b5faae | ||
|
|
fe0cbd40fe | ||
|
|
2b30e8ac99 | ||
|
|
7c7a4051fe | ||
|
|
b23d765991 | ||
|
|
fe8816214f | ||
|
|
c3c4d50a99 | ||
|
|
8347a9d6e4 | ||
|
|
703df2cb6c | ||
|
|
4c8330c15c | ||
|
|
93a512cf97 | ||
|
|
962120d1d2 | ||
|
|
109628a77e | ||
|
|
20b4772155 | ||
|
|
194f98ff95 | ||
|
|
6292d9e815 | ||
|
|
91fd66ffba | ||
|
|
7a275773ee | ||
|
|
6b4b6fa315 | ||
|
|
9897a9147c | ||
|
|
a7822e3ff7 | ||
|
|
4939c642b4 | ||
|
|
ad90e851b3 | ||
|
|
29b456ae07 | ||
|
|
23d742bf06 | ||
|
|
e3b1e08777 | ||
|
|
c2f695c84e | ||
|
|
a1eb90d5c0 | ||
|
|
91122277f4 | ||
|
|
9531b154ea | ||
|
|
5707a2c3d5 | ||
|
|
d8860f9ad9 | ||
|
|
4ca8f4a9a7 | ||
|
|
3d23424121 | ||
|
|
e2d69f66b2 | ||
|
|
8d23c4230e | ||
|
|
6a6e863a47 | ||
|
|
e09ff79635 | ||
|
|
e6aed7bb4e | ||
|
|
9d8cc24abf | ||
|
|
f3ab1dba54 | ||
|
|
35afea1c0e | ||
|
|
3c7470dbc3 | ||
|
|
c54076456b | ||
|
|
6af75f4b5d | ||
|
|
edeb58288e | ||
|
|
c30b7693e0 | ||
|
|
46453905d6 | ||
|
|
4a72d2ba9c | ||
|
|
8afd94ed3a | ||
|
|
4c2948a8e6 | ||
|
|
e3acc84b99 | ||
|
|
b227d8c128 | ||
|
|
cd7828a928 | ||
|
|
4e2f5618c1 | ||
|
|
329acc852e | ||
|
|
a8db0aac32 | ||
|
|
5a11d32a85 | ||
|
|
7bb7a52940 | ||
|
|
e66ab97a3c | ||
|
|
244ea2014a | ||
|
|
80f2a20842 | ||
|
|
2684d061ed | ||
|
|
4f46df5dab | ||
|
|
09571b7753 | ||
|
|
866efc14fe | ||
|
|
267f3479d7 | ||
|
|
56702e7bb9 | ||
|
|
4b9d5cd352 | ||
|
|
1e2deff4fd | ||
|
|
68055a5959 | ||
|
|
3cfe1dce1f | ||
|
|
f8ed3a835d | ||
|
|
7deae6b6be | ||
|
|
eb65c57496 | ||
|
|
5418faa1f9 | ||
|
|
f03e063750 | ||
|
|
270c766de2 | ||
|
|
496fc28dc3 | ||
|
|
8d3b74cc6e | ||
|
|
aa1d38613a | ||
|
|
0f5ada8cbd | ||
|
|
7ddf1cda1d | ||
|
|
e309fb4bcb | ||
|
|
f32048b8f5 | ||
|
|
e944f960de | ||
|
|
8ebf0b92be | ||
|
|
94a796c8cc | ||
|
|
b217474eab | ||
|
|
c39dc2908f | ||
|
|
d3532bd2a6 | ||
|
|
2460f82d8b | ||
|
|
58cfcd4239 | ||
|
|
5e834352a9 | ||
|
|
bf6eb93c61 | ||
|
|
51e89a269c | ||
|
|
c35fb88094 | ||
|
|
0d8989fc14 | ||
|
|
b4abb0ae7f | ||
|
|
c0d7ea3e7e | ||
|
|
4b40964064 | ||
|
|
abe9905ef8 | ||
|
|
32683b282b | ||
|
|
37d1879386 | ||
|
|
819fa7216e | ||
|
|
9d151bb61b | ||
|
|
9334479aeb | ||
|
|
1f63293624 | ||
|
|
edaaead7e0 | ||
|
|
ed4a6371ad | ||
|
|
47ae96ce15 | ||
|
|
70be61d416 | ||
|
|
ae9274be05 | ||
|
|
c7c8cfed6f | ||
|
|
4a58e447a1 | ||
|
|
a0ae9e30df | ||
|
|
d03f037a92 | ||
|
|
f9195d114b | ||
|
|
3b2b2313ff | ||
|
|
0af2a80e06 | ||
|
|
525d0dc239 | ||
|
|
67c4d22984 | ||
|
|
dd22cbbfb8 | ||
|
|
9f48798ffd | ||
|
|
22b9fd97b2 | ||
|
|
3c1653207c | ||
|
|
ae00fad75b | ||
|
|
a401d738df | ||
|
|
ed7d45e8f5 | ||
|
|
d17f7ebc8a | ||
|
|
bea6739774 | ||
|
|
81bba7ed88 | ||
|
|
78b7c486fd | ||
|
|
87a97f3724 | ||
|
|
aaccea0260 | ||
|
|
e4c01f1c7e | ||
|
|
ab6f1fdf8b | ||
|
|
096046c09f | ||
|
|
1183c10a2e | ||
|
|
0e064357f4 | ||
|
|
960de3411b | ||
|
|
bcb7d5a149 | ||
|
|
5b24f59401 | ||
|
|
fd0e81b0c7 | ||
|
|
53d9c9ff23 | ||
|
|
e2957df05c | ||
|
|
819c5b9b50 | ||
|
|
5a7356b6fc | ||
|
|
d233976737 | ||
|
|
088e09e052 | ||
|
|
8b876241bd | ||
|
|
b116c096bd | ||
|
|
f7e7862588 | ||
|
|
a1154d4a20 | ||
|
|
0a7f2a8be7 | ||
|
|
932f1c109e | ||
|
|
90f8ddfc1e | ||
|
|
00dbf69b6d | ||
|
|
8ac5e56934 | ||
|
|
eef595aa64 | ||
|
|
a0120a533c | ||
|
|
4e14e152fa | ||
|
|
27d7d2ccab | ||
|
|
469843427d | ||
|
|
c66955aaf9 | ||
|
|
72b9e3a6ac | ||
|
|
278aa15301 | ||
|
|
d85861d296 | ||
|
|
17960fd2b0 | ||
|
|
aac2b9aa9d | ||
|
|
4971fa73f9 | ||
|
|
96ace72ddc | ||
|
|
b80a6a8d31 | ||
|
|
000a6fce46 | ||
|
|
adfcfcba95 | ||
|
|
e83eac312e | ||
|
|
5c5936508d | ||
|
|
39092efe88 | ||
|
|
9f53e2f0c9 | ||
|
|
fa00e1d97f | ||
|
|
c7dd5527b4 | ||
|
|
129f986ccf | ||
|
|
69b0490b77 | ||
|
|
9d1d590f43 | ||
|
|
eacfe132aa | ||
|
|
3b23ccd366 | ||
|
|
54ddc1d417 | ||
|
|
c2760c3cac | ||
|
|
944090c19c | ||
|
|
417706e578 | ||
|
|
f3c1a6b19c | ||
|
|
fba4e6241b | ||
|
|
d15d869267 | ||
|
|
f209b755a5 | ||
|
|
a91263f79e | ||
|
|
0f1df62389 | ||
|
|
2945eb6650 | ||
|
|
b742af2e2a | ||
|
|
e0f4fc2033 | ||
|
|
baa9199973 | ||
|
|
77e80ef367 | ||
|
|
3bde4f4855 | ||
|
|
82a3ed2f9a | ||
|
|
db23b9b184 | ||
|
|
81d42406b7 | ||
|
|
552a327df8 | ||
|
|
ee71845d60 | ||
|
|
a6628f12cc | ||
|
|
8504992e9f | ||
|
|
2cbb85fe88 | ||
|
|
ed6598adf5 | ||
|
|
62302ceb9e | ||
|
|
f7659f02bb | ||
|
|
de25a48dec | ||
|
|
7456710a1f | ||
|
|
391386dd94 | ||
|
|
63715aba4f | ||
|
|
5243d8b523 | ||
|
|
49609f6c14 | ||
|
|
40b6edcad7 | ||
|
|
2ddb2a2be9 | ||
|
|
8a01e5fb7a | ||
|
|
e83575537a | ||
|
|
7268d46508 | ||
|
|
87a872e103 | ||
|
|
2e0da8abdc | ||
|
|
85b7cca4d0 | ||
|
|
447dbd6fa5 | ||
|
|
a0351bdb73 | ||
|
|
6b1b8cb2b3 | ||
|
|
0fd814e4f1 | ||
|
|
8e61314323 | ||
|
|
4b204da3c1 | ||
|
|
536f86e896 | ||
|
|
f068e46661 | ||
|
|
9ebcae496d | ||
|
|
c3c605c658 | ||
|
|
3b769753eb | ||
|
|
4e9d658141 | ||
|
|
bc0fdbe88e | ||
|
|
d78ebbc0e9 | ||
|
|
6b494c1535 | ||
|
|
15190d40df | ||
|
|
0e1cf78f5c | ||
|
|
d421f5250d | ||
|
|
52fcc743ab | ||
|
|
a5033c3652 | ||
|
|
23c8c5348f | ||
|
|
a111fbbd0a | ||
|
|
dae4eb36ad | ||
|
|
2c1414f81f | ||
|
|
316469e76a | ||
|
|
42465ee444 | ||
|
|
9682ed455e | ||
|
|
8c760f1c31 | ||
|
|
cfb416fda9 | ||
|
|
9643e6c744 | ||
|
|
4683645036 | ||
|
|
efd5658e32 | ||
|
|
9b13e60e38 | ||
|
|
907032616e | ||
|
|
e2f2458928 | ||
|
|
d8785ffc6f | ||
|
|
ae9de515b8 | ||
|
|
363d7c505f | ||
|
|
7592bb1f2f | ||
|
|
deea00dde3 | ||
|
|
1fd335b702 | ||
|
|
bf629cf7b1 | ||
|
|
bb44fe17cf | ||
|
|
36746143a1 | ||
|
|
47b78ed1af | ||
|
|
f6ca5a8da8 | ||
|
|
aaad65ff5d | ||
|
|
862c72b030 | ||
|
|
30976f9773 | ||
|
|
d135b15bb8 | ||
|
|
e09abb1b31 | ||
|
|
5ccb1c9e7d | ||
|
|
fb16a83b8a | ||
|
|
97ec224d72 | ||
|
|
4ce9ddbb74 | ||
|
|
a1e8714d5f | ||
|
|
b8b5762e55 | ||
|
|
d5bfbf5a59 | ||
|
|
149c474e55 | ||
|
|
722829b058 | ||
|
|
c461975140 | ||
|
|
1e9cf905c7 | ||
|
|
ec93383ec8 | ||
|
|
c2cef42f8e | ||
|
|
dc40a5f6e0 | ||
|
|
98c9111a7d | ||
|
|
e6baf8afd9 | ||
|
|
3b293fc5d1 | ||
|
|
df21857583 | ||
|
|
2dd1859247 | ||
|
|
a274769f4f | ||
|
|
d3bce05d54 | ||
|
|
b4b10a57fe | ||
|
|
bba14dcbe6 | ||
|
|
06906bc1c8 | ||
|
|
318318b02f | ||
|
|
346c8b339b | ||
|
|
b93cddfcc9 | ||
|
|
6ab7b560af | ||
|
|
29122db2fa | ||
|
|
1418470ae9 | ||
|
|
1d94d098bf | ||
|
|
e602c28ad9 | ||
|
|
90f858aa85 | ||
|
|
e2a4a83586 | ||
|
|
6b1b3adaf0 | ||
|
|
eb81982fcd | ||
|
|
55b23c896a | ||
|
|
b0860adab6 | ||
|
|
45642b7fe8 | ||
|
|
c85a486445 | ||
|
|
962b107341 | ||
|
|
4061279218 | ||
|
|
06ae832276 | ||
|
|
4c3ca0b5b6 | ||
|
|
ff6081be3a | ||
|
|
d8e2f5d333 | ||
|
|
aad121864e | ||
|
|
96a3fba8ac | ||
|
|
1ad2c5bfc0 | ||
|
|
f92907183c | ||
|
|
58941e543e | ||
|
|
cf5d64d940 | ||
|
|
788eb6e647 | ||
|
|
3a5963c0e7 | ||
|
|
e55e65d1e4 | ||
|
|
5239a4e839 | ||
|
|
8d295547be | ||
|
|
3eea5222cf | ||
|
|
6d0e91328d | ||
|
|
c4a2e5ac23 | ||
|
|
2076906aaa | ||
|
|
10733a2bb0 | ||
|
|
0c7bdf569c | ||
|
|
303d47228e | ||
|
|
ad09d6a60f | ||
|
|
8359cdf01d | ||
|
|
6b095af9b1 | ||
|
|
b3a3080b4b | ||
|
|
54375cc7a4 | ||
|
|
bdf778bec2 | ||
|
|
08968c29bb | ||
|
|
fed18bcc20 | ||
|
|
b94a0e1501 | ||
|
|
bc205c76a3 | ||
|
|
2bf482ce65 | ||
|
|
e400fce271 | ||
|
|
5ed0c1a2bd | ||
|
|
95f1feab1a | ||
|
|
163a9ff58e | ||
|
|
c3fe6e61ae | ||
|
|
4db8d2def4 | ||
|
|
38c21ff34d | ||
|
|
b7e9ba7591 | ||
|
|
d1f4471000 | ||
|
|
ac382cbdaf | ||
|
|
b1404a0743 | ||
|
|
17b0ec84ed | ||
|
|
35af5ef23e | ||
|
|
e7e964432b | ||
|
|
d4c6fc5d0a | ||
|
|
0d9d21d15f | ||
|
|
76306f9073 | ||
|
|
ca2dcff9d4 | ||
|
|
881146bc22 | ||
|
|
c33fffd6a7 | ||
|
|
01a7b5cc97 | ||
|
|
cc5d006087 | ||
|
|
2724baae8b | ||
|
|
11e3f3375d | ||
|
|
6f4873329e | ||
|
|
764e61708b | ||
|
|
a8670b66a7 | ||
|
|
93da52d011 | ||
|
|
9c09967803 | ||
|
|
0f3f7d6835 | ||
|
|
9d2a980bcf | ||
|
|
2728dc0606 | ||
|
|
be5236e839 | ||
|
|
06f401e7e5 | ||
|
|
1a882bcc2e | ||
|
|
a672872717 | ||
|
|
9beed830eb | ||
|
|
068d4a1eb2 | ||
|
|
5824f613ff | ||
|
|
c5c9d12630 | ||
|
|
ef4becc413 | ||
|
|
eecabf0b00 | ||
|
|
0564625757 | ||
|
|
f18f689c01 | ||
|
|
af7e3f5076 | ||
|
|
d46d9d998e | ||
|
|
e86f2342c0 | ||
|
|
a8a8f236d2 | ||
|
|
f0523b5816 | ||
|
|
790c697c19 | ||
|
|
76b4678f99 | ||
|
|
03d5709b09 | ||
|
|
d76a01194d | ||
|
|
22c8bc5ef4 | ||
|
|
97a48e36e9 | ||
|
|
2deb5a8ac5 | ||
|
|
b5743d6927 | ||
|
|
5ea139fd79 | ||
|
|
da246f5cb1 | ||
|
|
959da98d8e | ||
|
|
ffc39dc182 | ||
|
|
68f6f149d0 | ||
|
|
f8aabd670e | ||
|
|
94120740d8 | ||
|
|
c9141e604a | ||
|
|
3778362f88 | ||
|
|
b55f8718c3 | ||
|
|
b0d520b109 | ||
|
|
ffe27a6225 | ||
|
|
86083badc2 | ||
|
|
47d7a9cb5e | ||
|
|
350f239d84 | ||
|
|
672b0c1fd3 | ||
|
|
f4584c51c5 | ||
|
|
15a2351675 | ||
|
|
8cba3bd811 | ||
|
|
550dd87b2a | ||
|
|
38cc0b93c6 | ||
|
|
04a1622172 | ||
|
|
81c2ca3e10 | ||
|
|
f919a2fed1 | ||
|
|
65343e8ae8 | ||
|
|
063881b5bd | ||
|
|
94dff5b36a | ||
|
|
70d2f48d4e | ||
|
|
0c0ace2a04 | ||
|
|
00716d0ca0 | ||
|
|
834747deb7 | ||
|
|
bde9c70d42 | ||
|
|
50bd7493cc | ||
|
|
4d11b29959 | ||
|
|
71ff9adb12 | ||
|
|
ff98b8632b | ||
|
|
9b0fa9c309 | ||
|
|
bc0764894a | ||
|
|
b878bc5620 | ||
|
|
3004359191 | ||
|
|
6c86266fb6 | ||
|
|
3eee09cb6c | ||
|
|
945fd2cf82 | ||
|
|
1b707a7cf7 | ||
|
|
1d8f61ca8a | ||
|
|
735bf2d35f | ||
|
|
f39658c822 | ||
|
|
6eb4f90ce7 | ||
|
|
9d1961ebe3 | ||
|
|
d6c1285ab5 | ||
|
|
4422365a53 | ||
|
|
4113762062 | ||
|
|
89d2ee6f13 | ||
|
|
120d4c7a8c | ||
|
|
cb6e82dc60 | ||
|
|
9d13942278 | ||
|
|
6398c5e28d | ||
|
|
f4a93ed997 | ||
|
|
2990c6c45f | ||
|
|
9b8c6ed254 | ||
|
|
06513565e9 | ||
|
|
082ed3beed | ||
|
|
152b681bb5 | ||
|
|
995b84944b | ||
|
|
7bc5fd8193 | ||
|
|
94de1e0d93 | ||
|
|
23ee57c1c1 | ||
|
|
4d4fa3607b | ||
|
|
e353d27430 | ||
|
|
775ea401c8 | ||
|
|
ca8d1756d5 | ||
|
|
b96b28b7cc | ||
|
|
258bcdefe0 | ||
|
|
7750180c93 | ||
|
|
70163dafb9 | ||
|
|
a0f362c735 | ||
|
|
adc8fcb77f | ||
|
|
c6d8dd19d9 | ||
|
|
1116e13f5a | ||
|
|
3a4c3ab76e | ||
|
|
a83bf18ee1 | ||
|
|
cad248fc55 | ||
|
|
97ca1b3f4d | ||
|
|
7ff18f6657 | ||
|
|
0f2c9bacfd | ||
|
|
3feaef6526 | ||
|
|
047e688e93 | ||
|
|
1999ac415c | ||
|
|
41f8cdb3a6 | ||
|
|
c5feb9c6a1 | ||
|
|
21ff773832 | ||
|
|
6c27eaf864 | ||
|
|
80d2c11f9d | ||
|
|
d580a0d186 | ||
|
|
2f3a410cb0 | ||
|
|
b83e3f0905 | ||
|
|
7dfb8becdb | ||
|
|
c966aa26ff | ||
|
|
c54a2ea042 | ||
|
|
072625ccad | ||
|
|
16032f149f | ||
|
|
273a4a253f | ||
|
|
64825a3d1e | ||
|
|
ea3df2b0b3 | ||
|
|
ca79282eaf | ||
|
|
ce218cafdb | ||
|
|
46d59784ad | ||
|
|
98c4f22432 | ||
|
|
513077c317 | ||
|
|
ef62463d20 | ||
|
|
76438195f0 | ||
|
|
7fecc48174 | ||
|
|
d2563804c8 | ||
|
|
e114662cfa | ||
|
|
98e91f5253 | ||
|
|
8b2cd930c3 | ||
|
|
19166a92e4 | ||
|
|
95f5a68006 | ||
|
|
e97fcafd0e | ||
|
|
197a256669 | ||
|
|
2e6f57baa9 | ||
|
|
0f6cd3640b | ||
|
|
0ce355d9e7 | ||
|
|
a366e57385 | ||
|
|
7b3acfbb6f | ||
|
|
78beef2d73 | ||
|
|
1a4a09c26f | ||
|
|
68ce419147 | ||
|
|
8b92249f18 | ||
|
|
80807b2d71 | ||
|
|
56126786a6 | ||
|
|
f65833931d | ||
|
|
56090fc374 | ||
|
|
fcfd99c1ae | ||
|
|
d693e0f378 | ||
|
|
6697a8f375 | ||
|
|
5693a6e3c9 | ||
|
|
747fd5801c | ||
|
|
6e5572228d | ||
|
|
27ad381e25 | ||
|
|
5146694452 | ||
|
|
b2bd9aae7c | ||
|
|
bd20bd5444 | ||
|
|
9e95ceb3fc | ||
|
|
9ba8cf5fe3 | ||
|
|
873f7d6f2a | ||
|
|
f48599f172 | ||
|
|
b5200e184c | ||
|
|
8d814de558 | ||
|
|
367e2eb9f4 | ||
|
|
fd873c00c6 | ||
|
|
1d5677cc3b | ||
|
|
df12e68e7d | ||
|
|
fa951f8a0b | ||
|
|
27a3b1d895 | ||
|
|
fb44b53ae3 | ||
|
|
46d1932380 | ||
|
|
429c6ccad2 | ||
|
|
8a0dc4d54a | ||
|
|
8332a15899 | ||
|
|
526ad82d20 | ||
|
|
2b92b01afc | ||
|
|
2445ae3d3a | ||
|
|
4097207c75 | ||
|
|
45d64040fe | ||
|
|
9b3d4380d3 | ||
|
|
52c0696e44 | ||
|
|
58781cb88c | ||
|
|
b55f32f8a1 | ||
|
|
e70e6e2b48 | ||
|
|
f73f4ce555 | ||
|
|
598c7aea5d | ||
|
|
4cafe9e275 | ||
|
|
b0235adccd | ||
|
|
875d86bf9b | ||
|
|
37219072c1 | ||
|
|
4aa2490099 | ||
|
|
1351e40c72 | ||
|
|
c0b318330b | ||
|
|
12d0983757 | ||
|
|
7cd7b2e4c8 | ||
|
|
031294bdd2 | ||
|
|
b2b595f8f4 | ||
|
|
2ddace1a84 | ||
|
|
caf15371e2 | ||
|
|
29f4ebf32a | ||
|
|
39d6de1558 | ||
|
|
711f7b0180 | ||
|
|
b413cf34e9 | ||
|
|
d92b52b19b | ||
|
|
b9b9a2085a | ||
|
|
0de83187ea | ||
|
|
6e8f8706b0 | ||
|
|
d54fe3a40c | ||
|
|
86ed55e75c | ||
|
|
28c87ec81b | ||
|
|
79106638a8 | ||
|
|
6110494a56 | ||
|
|
54deb9eea3 | ||
|
|
deedb00c18 | ||
|
|
9a6423ea17 | ||
|
|
be77cfd895 | ||
|
|
8b59e620bb | ||
|
|
44decda00b | ||
|
|
cb4ea75fab | ||
|
|
0e70511381 | ||
|
|
0cb87795a3 | ||
|
|
182e0d99c9 | ||
|
|
b425851441 | ||
|
|
d1148a0198 | ||
|
|
7f3252eea9 | ||
|
|
0511ccda23 | ||
|
|
181ccc884c | ||
|
|
073e4af7e2 | ||
|
|
b7fcb11580 | ||
|
|
8f8174dc93 | ||
|
|
91fa1dea82 | ||
|
|
69655205f5 | ||
|
|
b492391fa7 | ||
|
|
26c53634e1 | ||
|
|
72bf6acb5b | ||
|
|
79633a74ab | ||
|
|
ba9741139e | ||
|
|
22e0d2afcb | ||
|
|
816aa19861 | ||
|
|
df4d50579a | ||
|
|
8f8bf3a897 | ||
|
|
777f2d3820 | ||
|
|
ecb46de349 | ||
|
|
150a35eff8 | ||
|
|
7dbb595424 | ||
|
|
ab246ab032 | ||
|
|
59529b755d | ||
|
|
df4c104637 | ||
|
|
1f039cde61 | ||
|
|
1285784a49 | ||
|
|
65487b75e2 | ||
|
|
35493e1af9 | ||
|
|
26015b02d8 | ||
|
|
aedd580911 | ||
|
|
555128d9e6 | ||
|
|
2c892fca6a | ||
|
|
4b156a612a | ||
|
|
2db384a21d | ||
|
|
ca8cec8e8a | ||
|
|
425cd46c12 | ||
|
|
b12bcd0f92 | ||
|
|
d4c74b8f8c | ||
|
|
d065d37822 | ||
|
|
e47e888a08 | ||
|
|
013a09dbe6 | ||
|
|
4dcc0fd55a | ||
|
|
514d8ac460 | ||
|
|
ce3caf447b | ||
|
|
a235dca79c | ||
|
|
2610b8d047 | ||
|
|
b4b19a6cbd | ||
|
|
7548a56f64 | ||
|
|
02acf0641a | ||
|
|
a9a4f0ed3b | ||
|
|
a120bf3fe4 | ||
|
|
3688256f86 | ||
|
|
ae53b3cdc3 | ||
|
|
c1fbef1722 | ||
|
|
31516e2a3b | ||
|
|
185f8a0a66 | ||
|
|
0970102950 | ||
|
|
0f687b5dda | ||
|
|
28aef684b4 | ||
|
|
c1dd9bda7f | ||
|
|
71a0b1a5bb | ||
|
|
8c28e36e75 | ||
|
|
c36226c4dc | ||
|
|
2bc1d70a31 | ||
|
|
ff178d8cf7 | ||
|
|
ed988e39a8 | ||
|
|
e449659338 | ||
|
|
ff67ee73fc | ||
|
|
5b248757c7 | ||
|
|
c5dfb35597 | ||
|
|
6423fe7601 | ||
|
|
8f8824e1d3 | ||
|
|
6af40e9dc0 | ||
|
|
d1c1f766d5 | ||
|
|
98ca46006c | ||
|
|
6cba6bcd82 | ||
|
|
1d9699be0f | ||
|
|
76b12edecf | ||
|
|
6b1b71837c | ||
|
|
fb379384ee | ||
|
|
0fca084ea6 | ||
|
|
01bedd17c9 | ||
|
|
d43cc2dd5f | ||
|
|
1f530beaf1 | ||
|
|
0ec444720f | ||
|
|
a22a228bcc | ||
|
|
ac9ca64c50 | ||
|
|
a932e7490f | ||
|
|
9c5d14ea68 | ||
|
|
b3436c875a | ||
|
|
5c29fda167 | ||
|
|
0438f0d835 | ||
|
|
a640cad139 | ||
|
|
c92b59952a | ||
|
|
b275946a52 | ||
|
|
97dfa0365d | ||
|
|
7295640f44 | ||
|
|
0d8c00d3f6 | ||
|
|
777ca11760 | ||
|
|
182f2cda35 | ||
|
|
3a6fd912cd | ||
|
|
3c9e94e035 | ||
|
|
56ff46eb8b | ||
|
|
ce142afdda | ||
|
|
c5a1b227a4 | ||
|
|
35e79d56a5 | ||
|
|
3a74bb5039 | ||
|
|
2606d1d892 | ||
|
|
0fed46360c | ||
|
|
79a44a9de3 | ||
|
|
588ed70d4a | ||
|
|
7fb8d9fe05 | ||
|
|
0165560333 | ||
|
|
075386e7fe | ||
|
|
2558c10c6c | ||
|
|
31932912dd | ||
|
|
c2e11daf66 | ||
|
|
c3560e0288 | ||
|
|
a0a5ff61c4 | ||
|
|
0094481e55 | ||
|
|
64268f3312 | ||
|
|
996d0a9185 | ||
|
|
8534bc376c | ||
|
|
3b97a7d446 | ||
|
|
461aaf2126 | ||
|
|
be9e4ceddc | ||
|
|
c26d816839 | ||
|
|
f2c94b3298 | ||
|
|
c5e0e29d23 | ||
|
|
b59e92ab99 | ||
|
|
61ae43f35e | ||
|
|
da0d91a79b | ||
|
|
3a27a78f9e | ||
|
|
064f2b37d0 | ||
|
|
92575cecca | ||
|
|
671aaf2dc9 | ||
|
|
d931220a65 | ||
|
|
47847765e2 | ||
|
|
a4ca87ba99 | ||
|
|
5e3bb4bdf3 | ||
|
|
67a4471324 | ||
|
|
b99e63a7bf | ||
|
|
2d1e730216 | ||
|
|
581685a231 | ||
|
|
483384aaa4 | ||
|
|
cc6b7cf3ce | ||
|
|
e4595fa24a | ||
|
|
b09a957fce | ||
|
|
d0b65ff642 | ||
|
|
58d128b7a9 | ||
|
|
63b98b8280 | ||
|
|
d69da22f7c | ||
|
|
53be0f3399 | ||
|
|
574e2d856e | ||
|
|
f49a73d69f | ||
|
|
cde5eee2a5 | ||
|
|
e1b69db6d1 | ||
|
|
d0b1f70118 | ||
|
|
f8389b1076 | ||
|
|
60f46276bf | ||
|
|
a40c274310 | ||
|
|
1de9b568db | ||
|
|
0af5e3a04f | ||
|
|
637babb99b | ||
|
|
71f183a3a2 | ||
|
|
cb9ac490d4 | ||
|
|
3851ac6226 | ||
|
|
b447a4ffab | ||
|
|
d57b23b1e3 | ||
|
|
7336e6df07 | ||
|
|
5dd87d2e74 | ||
|
|
639ffc341e | ||
|
|
3f02da646c | ||
|
|
e0e68c5cbc | ||
|
|
ffaf1b4f22 | ||
|
|
dee6840c50 | ||
|
|
642f6a92bc | ||
|
|
6b51305c4b | ||
|
|
17ad80c1e1 | ||
|
|
09d60e0128 | ||
|
|
c05b347617 | ||
|
|
5a9e45cc4a | ||
|
|
0908c41156 | ||
|
|
257a907456 | ||
|
|
e4b1e8651b | ||
|
|
cfa60bdb97 | ||
|
|
ccddc280be | ||
|
|
666f9cd7b4 | ||
|
|
e7aae314de | ||
|
|
74e4b42f7e | ||
|
|
8857b9e921 | ||
|
|
a37c7ff16d | ||
|
|
ac2b23f574 | ||
|
|
b089eb42eb | ||
|
|
055b11814a | ||
|
|
388dd0cfa5 | ||
|
|
f8b4ee079b | ||
|
|
c6bb98abad | ||
|
|
79a5b14eb7 | ||
|
|
ccbe2c4ea3 | ||
|
|
71adb1ee59 | ||
|
|
f1a03c5447 | ||
|
|
5fe382949b | ||
|
|
8f164f4c83 | ||
|
|
a327d876fe | ||
|
|
652d59cd80 | ||
|
|
fe912f44dc | ||
|
|
93eb63238f | ||
|
|
a3b13eb5ac | ||
|
|
3105ebc562 | ||
|
|
01654bdec1 | ||
|
|
907e8e98e5 | ||
|
|
8b16ebe705 | ||
|
|
67c0e8323e | ||
|
|
740152ee70 | ||
|
|
5914d9d7de | ||
|
|
b328c6e6b6 | ||
|
|
fb4cefc91d | ||
|
|
4c3736ed43 | ||
|
|
9189cc66ab | ||
|
|
56fc3a4835 | ||
|
|
7a1aef1450 | ||
|
|
6096164d79 | ||
|
|
a488445cbe | ||
|
|
b1950a7f25 | ||
|
|
df50523605 | ||
|
|
dcde09fdff | ||
|
|
2ca099d1e7 | ||
|
|
837ceb9abb | ||
|
|
a95544f92a | ||
|
|
a00ebf03d4 | ||
|
|
7f22464353 | ||
|
|
1269c445ab | ||
|
|
4abd23ae9e | ||
|
|
585eee6549 | ||
|
|
c5961892e3 | ||
|
|
6248c93f37 | ||
|
|
540dbb35e2 | ||
|
|
14d4419e16 | ||
|
|
ea897654a4 | ||
|
|
7dc64efe67 | ||
|
|
6a514f3dc9 | ||
|
|
a76fb42ca6 | ||
|
|
bcc04192fc | ||
|
|
98f3130a5c | ||
|
|
4788b59300 | ||
|
|
bb917ecda8 | ||
|
|
caa7734402 | ||
|
|
c82da64d10 | ||
|
|
3162971cd6 | ||
|
|
27cb90da8b | ||
|
|
07fc2b5b70 | ||
|
|
756bb5e268 | ||
|
|
7431ef7e2d | ||
|
|
43773ff735 | ||
|
|
eb6e3886f4 | ||
|
|
cf9b58452c | ||
|
|
419f3ebc03 | ||
|
|
ff429cdd8a | ||
|
|
1d291be2ba | ||
|
|
e03da4805b | ||
|
|
5b2c67f4c3 | ||
|
|
f7c4e7e19f | ||
|
|
a9ed39b12d | ||
|
|
002340f32c | ||
|
|
3db4e0fb5d | ||
|
|
c379f17117 | ||
|
|
7d2c2f1790 | ||
|
|
967db181d0 | ||
|
|
e502144eda | ||
|
|
d05efa008d | ||
|
|
d20f42c883 | ||
|
|
5c2bb05af3 | ||
|
|
d70a4a3847 | ||
|
|
56aea5f8e5 | ||
|
|
6a860b99dc | ||
|
|
ac843fbf3b | ||
|
|
6d084c017f | ||
|
|
ed7a2f9fac | ||
|
|
d27c82a450 | ||
|
|
9a093b2e8f | ||
|
|
6ae714894e | ||
|
|
d521693641 | ||
|
|
b6f2bff461 | ||
|
|
d867c18535 | ||
|
|
46474cf2f2 | ||
|
|
cf66cb8808 | ||
|
|
1a5293c2ce | ||
|
|
5360158545 | ||
|
|
bf04a92cc0 | ||
|
|
9865318f1c | ||
|
|
f5dad8ade2 | ||
|
|
53eb662908 | ||
|
|
d24ea7c03f | ||
|
|
61de6ecd54 | ||
|
|
2f0081bbb5 | ||
|
|
0e6514e7bd | ||
|
|
ea10601406 | ||
|
|
cb02bc6db4 | ||
|
|
f3597cf55a | ||
|
|
b02a55e60f | ||
|
|
6c5f07c5cb | ||
|
|
340d165a9c | ||
|
|
418d22d7b3 | ||
|
|
6361404b91 | ||
|
|
6d4b3f0d6a | ||
|
|
4cb7dfc546 | ||
|
|
b0f198c153 | ||
|
|
3d01492228 | ||
|
|
bf5dbb90c4 | ||
|
|
60f8e0386f | ||
|
|
f9dbd73652 | ||
|
|
c83faa9c5e | ||
|
|
cabd713610 | ||
|
|
f39e5988a3 | ||
|
|
20a047b8c5 | ||
|
|
a5e9263987 | ||
|
|
506a42338b | ||
|
|
2f189be2e4 | ||
|
|
1836aa2615 | ||
|
|
61f8394361 | ||
|
|
a98183b463 | ||
|
|
41ded7e996 | ||
|
|
4119738e69 | ||
|
|
6f06d33be5 | ||
|
|
2d099a2c70 | ||
|
|
0f9b29e6c5 | ||
|
|
0935084141 | ||
|
|
c065da52ec | ||
|
|
a3e129e091 | ||
|
|
e8a711994a | ||
|
|
ab11f90da0 | ||
|
|
8680b515b0 | ||
|
|
a6ba40ae48 | ||
|
|
fc3c76fc16 | ||
|
|
c185912c19 | ||
|
|
1e5c18bb14 | ||
|
|
e0d4368cb5 | ||
|
|
4c7af484f8 | ||
|
|
c747becec1 | ||
|
|
369a497300 | ||
|
|
84e4edaea7 | ||
|
|
9ba55baa5b | ||
|
|
528e32a1d4 | ||
|
|
b98ebd517e | ||
|
|
713953d8c1 | ||
|
|
8f893eb8df | ||
|
|
dde7e11f8e | ||
|
|
abd7fc36b6 | ||
|
|
610c8c5471 | ||
|
|
1ad5fb1178 | ||
|
|
e4934164e4 | ||
|
|
a469d796e1 | ||
|
|
c0ca26cd50 | ||
|
|
5c1f08a35f | ||
|
|
db7b0ea0cf | ||
|
|
92119d0f7d | ||
|
|
007a4bd421 | ||
|
|
424d5495e4 | ||
|
|
6b919e14c1 | ||
|
|
21cd2e4fae | ||
|
|
0e8182bbf2 | ||
|
|
e8700bd1e2 | ||
|
|
45565b680d | ||
|
|
581b2aae04 | ||
|
|
48b1c3822f | ||
|
|
8f620de0ff | ||
|
|
ccdaea51ba | ||
|
|
f4599143eb | ||
|
|
a33e20b27d | ||
|
|
34c7d45879 | ||
|
|
c756b4cf07 | ||
|
|
23cd54755f | ||
|
|
e96df67630 | ||
|
|
93fdc2951b | ||
|
|
79b56b083f | ||
|
|
0afe6696f0 | ||
|
|
9e603920c2 | ||
|
|
59994bd519 | ||
|
|
916f59e35f | ||
|
|
66b3b53e76 | ||
|
|
56633da44f | ||
|
|
ae2ebc6951 | ||
|
|
6bdebede27 | ||
|
|
6b91b7b411 | ||
|
|
26dc80bf2d | ||
|
|
b84db7ff5b | ||
|
|
2966ae2022 | ||
|
|
67d5e7973e | ||
|
|
fb74995fe3 | ||
|
|
bb41edc2ef | ||
|
|
f53e951462 | ||
|
|
a57862e29f | ||
|
|
ca40921bf1 | ||
|
|
745d9fe1a4 | ||
|
|
488666832b | ||
|
|
443468df8d | ||
|
|
9593f09b99 | ||
|
|
7bf31cc8a1 | ||
|
|
72c7de3570 | ||
|
|
97a258b0b0 | ||
|
|
831016b09f | ||
|
|
a508d835db | ||
|
|
fdb4ddbdea | ||
|
|
d273c90d53 | ||
|
|
1c7391717e | ||
|
|
8231fb166d | ||
|
|
0b57a2ab8b | ||
|
|
18bb6be80e | ||
|
|
3f2e863206 | ||
|
|
85f8a26ba4 | ||
|
|
19b11dfdd7 | ||
|
|
c89b8368ee | ||
|
|
d08782386b | ||
|
|
be593b600b | ||
|
|
97a69d9b1c | ||
|
|
5f6962dd90 | ||
|
|
ae89ccd2c7 | ||
|
|
9a5a7a3f68 | ||
|
|
6ff1620fcb | ||
|
|
8a4ed3c241 | ||
|
|
cda4bd4ad9 | ||
|
|
db4d8e835c | ||
|
|
935592cf6a | ||
|
|
2a45922afe | ||
|
|
28792e5731 | ||
|
|
bb6174524f | ||
|
|
571652c49b | ||
|
|
45ece5afb1 | ||
|
|
17707e7479 | ||
|
|
21ab44cfa7 | ||
|
|
50145266cd | ||
|
|
a117b6bff6 | ||
|
|
3348b3bf0c | ||
|
|
82794fa5f7 | ||
|
|
ba2c7cb467 | ||
|
|
ec1d9c0b8f | ||
|
|
3175c70c79 | ||
|
|
faac2af4af | ||
|
|
3be00cce6f | ||
|
|
e08f8eed05 | ||
|
|
2e7a4bd7db | ||
|
|
5e82ed4f30 | ||
|
|
b8973051c3 | ||
|
|
992b07ca57 | ||
|
|
cba5692673 | ||
|
|
8500c80b33 | ||
|
|
92b54aa27e | ||
|
|
5519882eea | ||
|
|
6864280803 | ||
|
|
8c136a5ab5 | ||
|
|
2faed961ce | ||
|
|
baa6787393 | ||
|
|
346c07cc1a | ||
|
|
9ac7dc675e | ||
|
|
50a732360a | ||
|
|
e63076504d | ||
|
|
41d258697a | ||
|
|
06f767d608 | ||
|
|
b47fa8c064 | ||
|
|
e96db1cd6c | ||
|
|
d73b169de3 | ||
|
|
85b67e5223 | ||
|
|
ce44bee28b | ||
|
|
0213f7f016 | ||
|
|
803425e12c | ||
|
|
1e9999711c | ||
|
|
d738b7acdd | ||
|
|
e8ae51bfe3 | ||
|
|
7b2550a604 | ||
|
|
507efa771b | ||
|
|
2b959a7752 | ||
|
|
0f1bd6e4a7 | ||
|
|
81bab8739d | ||
|
|
a9802c95b3 | ||
|
|
62834a1c43 | ||
|
|
666fad3494 | ||
|
|
08a7aa16c5 | ||
|
|
80285251cc | ||
|
|
fe4549cd83 | ||
|
|
82d2f11129 | ||
|
|
05134f0807 | ||
|
|
c75a5e8c55 | ||
|
|
a98ac4033b | ||
|
|
6125124d6c | ||
|
|
324c14943b | ||
|
|
ca5821aa57 | ||
|
|
04fda6b3e9 | ||
|
|
ca1477d830 | ||
|
|
15028e9b08 | ||
|
|
18245c6cd2 | ||
|
|
234a9d0b12 | ||
|
|
a22efc5f11 | ||
|
|
62a3da9618 | ||
|
|
cc7a081cae | ||
|
|
afff968e88 | ||
|
|
2b0c25a091 | ||
|
|
22bea37393 | ||
|
|
93dc0d0518 | ||
|
|
4f399bf1fb | ||
|
|
edb67ea165 | ||
|
|
c481c3b180 | ||
|
|
059052889f | ||
|
|
8b81f20c61 | ||
|
|
fd823449ad | ||
|
|
92eb8109ab | ||
|
|
44b88b41a2 | ||
|
|
2979b40a7a | ||
|
|
9f3ff14008 | ||
|
|
f47fc879fe | ||
|
|
29a713ea5e | ||
|
|
b14be7235e | ||
|
|
ba871e46bf | ||
|
|
ffe0df4b36 | ||
|
|
bc2f249cc6 | ||
|
|
abfcbd793f | ||
|
|
72510b75d2 | ||
|
|
55739a4efe | ||
|
|
1aec2f437c | ||
|
|
df02b992b0 | ||
|
|
fe29bdd72b | ||
|
|
578f93bc26 | ||
|
|
7d472367e2 | ||
|
|
d841028805 | ||
|
|
ce485175eb | ||
|
|
782464ea4d | ||
|
|
460f73056b | ||
|
|
19d418cd6a | ||
|
|
b2496533c6 | ||
|
|
267d6bef15 | ||
|
|
3fd7790a15 | ||
|
|
b76a352d41 | ||
|
|
4385ac4f9d | ||
|
|
410f64782a | ||
|
|
0b32431551 | ||
|
|
53169d96e8 | ||
|
|
06eb7f5b3c | ||
|
|
04328d7537 | ||
|
|
d2e73545ba | ||
|
|
81aec66d21 | ||
|
|
78090275a9 | ||
|
|
1ff6df8f9e | ||
|
|
ebe5b87c2c | ||
|
|
20f909567a | ||
|
|
eab5fad539 | ||
|
|
abadeac08d | ||
|
|
9e8427f253 | ||
|
|
32331faee4 | ||
|
|
46601b1c65 | ||
|
|
f5f4c2b366 | ||
|
|
7667023817 | ||
|
|
5eff15c409 | ||
|
|
ad05a726c1 | ||
|
|
5261d35737 | ||
|
|
fbf9b21e0c | ||
|
|
96b5da7198 | ||
|
|
02b4f5f9cd | ||
|
|
f680e509c4 | ||
|
|
d43d47da14 | ||
|
|
ac81b4084f | ||
|
|
92a7260fd0 | ||
|
|
4a78db29eb | ||
|
|
55025558dc | ||
|
|
a4ad9117dd | ||
|
|
2dfd0e5ce7 | ||
|
|
4c3cbc0961 | ||
|
|
01cc97a3c3 | ||
|
|
94330705c7 | ||
|
|
dd0067afa6 | ||
|
|
80ae160c26 | ||
|
|
8848b7e9ef | ||
|
|
4beffbca69 | ||
|
|
045ea42cc8 | ||
|
|
c2ba5d0c09 | ||
|
|
0ce3576685 | ||
|
|
c686069ccd | ||
|
|
b00a531df8 | ||
|
|
9d589cbb2a | ||
|
|
512a0056a9 | ||
|
|
8db4fd7177 | ||
|
|
c6df5f4d85 | ||
|
|
8dd94ccf58 | ||
|
|
4afe50b920 | ||
|
|
0d81abe1c9 | ||
|
|
01740fd9c6 | ||
|
|
e2576b1ac5 | ||
|
|
8b004d26c1 | ||
|
|
fc53e43de6 | ||
|
|
03fa9fae9f | ||
|
|
b1a7f74ee4 | ||
|
|
2606da9e81 | ||
|
|
1fac388664 | ||
|
|
703f3b38c4 | ||
|
|
37cde8a191 | ||
|
|
b26a3ea02c | ||
|
|
36474be8eb | ||
|
|
e6f6c6e3a1 | ||
|
|
6bdee87be3 | ||
|
|
34a41648ab | ||
|
|
4fbb80567e | ||
|
|
f65f61fa72 | ||
|
|
7717e1ce33 | ||
|
|
146501215f | ||
|
|
e0a42d3f9a | ||
|
|
15345cc249 | ||
|
|
0f034dd97e | ||
|
|
6c96f32069 | ||
|
|
379348487e | ||
|
|
8bd6e37b21 | ||
|
|
88ed5268d2 | ||
|
|
582cd780cd | ||
|
|
9b3462f73f | ||
|
|
691e753cc3 | ||
|
|
88e81a4804 | ||
|
|
15eb5d35a2 | ||
|
|
19df90622b | ||
|
|
9b639b4135 | ||
|
|
2c9bd15625 | ||
|
|
a96bfee76a | ||
|
|
63abeaff38 | ||
|
|
3703694e30 | ||
|
|
3d0a060a7a | ||
|
|
c516747847 | ||
|
|
b5970492e2 | ||
|
|
af14c684b5 | ||
|
|
13fbf42d95 | ||
|
|
64e3d33893 | ||
|
|
a7e89d4cfa | ||
|
|
08856d9615 | ||
|
|
8c5bb38748 | ||
|
|
0d869703ca | ||
|
|
2176a22d42 | ||
|
|
e72cb3e45d | ||
|
|
cb6942d4a7 | ||
|
|
6bfccaf99e | ||
|
|
e3f04c876a | ||
|
|
5644ad6809 | ||
|
|
63d5d28085 | ||
|
|
526a755a66 | ||
|
|
a1c240b0a4 | ||
|
|
5112cf8422 | ||
|
|
4619d80524 | ||
|
|
199151a4ed | ||
|
|
2424713a8f | ||
|
|
b6d381f863 | ||
|
|
e85061d20d | ||
|
|
33c7c6e11d | ||
|
|
8ade04b78e | ||
|
|
670006b919 | ||
|
|
a61f679568 | ||
|
|
c87faa69ed | ||
|
|
47c1ea72af | ||
|
|
f1d3d1524d | ||
|
|
0858fba192 | ||
|
|
fa889cd6e1 | ||
|
|
7279e4f82f | ||
|
|
90ba61b9b8 | ||
|
|
15d29efad5 | ||
|
|
a547dc2148 | ||
|
|
9c1f6e7ac7 | ||
|
|
e650d4044e | ||
|
|
eff6a2bd2e | ||
|
|
e917477fec | ||
|
|
ae01a6b5f2 | ||
|
|
a534ac197a | ||
|
|
80e0ee10ca | ||
|
|
4ce79920e5 | ||
|
|
76127b8a55 | ||
|
|
be3f2dc1d9 | ||
|
|
8d396584bf | ||
|
|
8664c6d465 | ||
|
|
10711ccc6a | ||
|
|
28c91deb5c | ||
|
|
240b5cfe04 | ||
|
|
4521f6655b | ||
|
|
5ddb8d94e2 | ||
|
|
f8c4d43886 | ||
|
|
72a9fed4fb | ||
|
|
b94dd33641 | ||
|
|
e90985a4e8 | ||
|
|
5099b86ad4 | ||
|
|
5d81c779cc | ||
|
|
450b89e63c | ||
|
|
d1658eebfc | ||
|
|
00adb2a6c1 | ||
|
|
0d43898a22 | ||
|
|
8067a985ce | ||
|
|
f5f99c4883 | ||
|
|
05333f61b7 | ||
|
|
1883e1bb60 | ||
|
|
be79235ef2 | ||
|
|
89fe77468d | ||
|
|
2b1ddc0413 | ||
|
|
cb676cdf39 | ||
|
|
8a29dd4839 | ||
|
|
7e69f72db6 | ||
|
|
00b162a993 | ||
|
|
e38dd5f030 | ||
|
|
08e4651ece | ||
|
|
752c804677 | ||
|
|
14f0250853 | ||
|
|
e6cb8ee188 | ||
|
|
e93eb3e8d3 | ||
|
|
b8ae3feb9e | ||
|
|
3570447ded | ||
|
|
8a739b6fba | ||
|
|
cbe4496123 | ||
|
|
7629c4f05c | ||
|
|
3405f85a6a | ||
|
|
e983a5ab92 | ||
|
|
f34b9c83d1 | ||
|
|
a686c9878f | ||
|
|
8005d22c81 | ||
|
|
0e51e53813 | ||
|
|
d0d12962e0 | ||
|
|
3f34d9d44e | ||
|
|
f0dcea7e14 | ||
|
|
28b1c37dea | ||
|
|
a8c1bdabd2 | ||
|
|
2f374f1465 | ||
|
|
5efc798642 | ||
|
|
b83e52e50f | ||
|
|
7bc77dc134 | ||
|
|
3aadaa7677 | ||
|
|
b80ed51fcc | ||
|
|
4b50205f11 | ||
|
|
bb4cb1b15a | ||
|
|
63f41f56f8 | ||
|
|
4eabd80025 | ||
|
|
d3259d0dba | ||
|
|
25c4f17e5d | ||
|
|
b73ba26b23 | ||
|
|
901c3c5392 | ||
|
|
c37f7d15c9 | ||
|
|
44a205d9d9 | ||
|
|
4d878b9bac | ||
|
|
12ec557a75 | ||
|
|
1d25d510bc | ||
|
|
a89d690b77 | ||
|
|
cb57fc727d | ||
|
|
3d6deb9bdf | ||
|
|
730497aaa1 | ||
|
|
3240d89f7d | ||
|
|
2f3c77b751 | ||
|
|
ace3c62a1c | ||
|
|
bfb8a53156 | ||
|
|
1feb71895b | ||
|
|
9518b1c873 | ||
|
|
d9b3232e94 | ||
|
|
09838dc948 | ||
|
|
96f8d20f2f | ||
|
|
76da32b567 | ||
|
|
2e7ba44633 | ||
|
|
352aa3f4c5 | ||
|
|
196db5720e | ||
|
|
e3ca9137b5 | ||
|
|
0620267ebb | ||
|
|
3898ace246 | ||
|
|
08694339eb | ||
|
|
e4d77a6313 | ||
|
|
b373826428 | ||
|
|
5bafb1fe1f | ||
|
|
c0b6075f77 | ||
|
|
c7067edddf | ||
|
|
9157cbd8f3 | ||
|
|
888cf161bd | ||
|
|
af63b54562 | ||
|
|
817751d4b9 | ||
|
|
c4b0087f7a | ||
|
|
b60761bcff | ||
|
|
749e5b9b84 | ||
|
|
97ae3c5c6a | ||
|
|
33fe89f539 | ||
|
|
ae76b1e8a8 | ||
|
|
5bf42066fa | ||
|
|
8a4b62d081 | ||
|
|
255ca68123 | ||
|
|
60ceca1bc1 | ||
|
|
6fc2ccd568 | ||
|
|
0f26f3abf2 | ||
|
|
6d575b1bc7 | ||
|
|
901cf203fe | ||
|
|
2d5134b0ed | ||
|
|
d813090d90 | ||
|
|
c321c97f35 | ||
|
|
53abc5e2f1 | ||
|
|
956fb2d278 | ||
|
|
978dadf806 | ||
|
|
0eae9c24bc | ||
|
|
624f23f550 | ||
|
|
424c747fb3 | ||
|
|
0d593ab7c1 | ||
|
|
3e8c5678f5 | ||
|
|
ed7874b4e0 | ||
|
|
b9dfa5cad4 | ||
|
|
901b03d020 | ||
|
|
4fba7b084f | ||
|
|
cfc6a3a87a | ||
|
|
e6862700af | ||
|
|
39d255608d | ||
|
|
7c24b97958 | ||
|
|
a5342c942e | ||
|
|
0f3b7d5575 | ||
|
|
c5aa56bc4d | ||
|
|
9dccd3a94f | ||
|
|
d085725c86 | ||
|
|
8b6766b37b | ||
|
|
ca4b36deda | ||
|
|
9eed8c8cf0 | ||
|
|
7136268273 | ||
|
|
16e173e167 | ||
|
|
254970c92a | ||
|
|
d3660d22ae | ||
|
|
25dc79f124 | ||
|
|
34e51f576f | ||
|
|
b14270b029 | ||
|
|
fe2bd237d5 | ||
|
|
bbeb1117d4 | ||
|
|
344a12bd10 | ||
|
|
1149c24b86 | ||
|
|
62bd734612 | ||
|
|
fd9beb1672 | ||
|
|
3024f6c706 | ||
|
|
ba27f90e36 | ||
|
|
63b62d8d4e | ||
|
|
99fb1bc3e8 | ||
|
|
92ebb7f4c8 | ||
|
|
fad14ae7eb | ||
|
|
273d00353f | ||
|
|
cdc38aa783 | ||
|
|
94fd8c7555 | ||
|
|
6d9e9a6bef | ||
|
|
4db2179f5c | ||
|
|
0e074d4050 | ||
|
|
f90a947e65 | ||
|
|
2ef6b3d57a | ||
|
|
f3f04e9fd6 | ||
|
|
08b722b635 | ||
|
|
32744d41a9 | ||
|
|
0a7d85c20e | ||
|
|
48e3a97a18 | ||
|
|
d052a3c6aa | ||
|
|
d8eeddfb93 | ||
|
|
81a6e59a82 | ||
|
|
b423b90c77 | ||
|
|
075507fb9a | ||
|
|
dfb38874f8 | ||
|
|
32eef03b58 | ||
|
|
7f8ea7105f | ||
|
|
7684721977 | ||
|
|
874d3d3fc5 | ||
|
|
7540a81106 | ||
|
|
e363428c54 | ||
|
|
bcb57f13ea | ||
|
|
e3d92b9168 | ||
|
|
c13d81ce15 | ||
|
|
a375d648c7 | ||
|
|
4a7aca2736 | ||
|
|
715104e477 | ||
|
|
e428e8da75 | ||
|
|
20e59dc61e | ||
|
|
f171656f8e | ||
|
|
f379edca78 | ||
|
|
c7cdb176c8 | ||
|
|
187d336665 | ||
|
|
7f060d7caf | ||
|
|
49f471a5fc | ||
|
|
f2710e11d1 | ||
|
|
fb75a9272d | ||
|
|
558c6313f7 | ||
|
|
08bc723a3c | ||
|
|
e487bd642b | ||
|
|
2eeb241b42 | ||
|
|
9377089c43 | ||
|
|
e30bfedce4 | ||
|
|
875812d346 | ||
|
|
3eafea840d | ||
|
|
c7fb1b70f2 | ||
|
|
2e172f38bd | ||
|
|
f994729999 | ||
|
|
b869476e99 | ||
|
|
9b50ec6512 | ||
|
|
838a22de64 | ||
|
|
8d5839151b | ||
|
|
443e7edef4 | ||
|
|
1db02c2891 | ||
|
|
a99470fbb0 | ||
|
|
5727cb3ed4 | ||
|
|
a5bbd402bf | ||
|
|
1a7b0d9a37 | ||
|
|
864dddc878 | ||
|
|
227ab8c665 | ||
|
|
fd1ea9d56f | ||
|
|
8742b6bd56 | ||
|
|
aa9c1f1bed | ||
|
|
9c9726d469 | ||
|
|
c6d2ebe452 | ||
|
|
e6af82ba2f | ||
|
|
c9a3eb0c1a | ||
|
|
2af559cca3 | ||
|
|
7ec391e689 | ||
|
|
df8c51528f | ||
|
|
517f411999 | ||
|
|
4938ae5caf | ||
|
|
e182cdebf9 | ||
|
|
adbb839b16 | ||
|
|
fa4c36df68 | ||
|
|
0cf0c20532 | ||
|
|
38500165ea | ||
|
|
b55995aae8 | ||
|
|
b4e9395661 | ||
|
|
8ccdac9898 | ||
|
|
29097b0ab2 | ||
|
|
21bd4fd6db | ||
|
|
fb56aad898 | ||
|
|
08c543f8fb | ||
|
|
c89413db1e | ||
|
|
1c71e4751a | ||
|
|
a9e15aa503 | ||
|
|
3ba47ea277 | ||
|
|
c1240f23dd | ||
|
|
a57869ba49 | ||
|
|
2e166f5337 | ||
|
|
40ef472a25 | ||
|
|
c3c50528e6 | ||
|
|
1c13cd604b | ||
|
|
3a26804d80 | ||
|
|
422582da71 | ||
|
|
27ac3e985d | ||
|
|
0d6a7a2df0 | ||
|
|
c7a97e18b7 | ||
|
|
6d5c13df74 | ||
|
|
5b9e341222 | ||
|
|
57bc28b42c | ||
|
|
4fcd4b444e | ||
|
|
9c35ed149d | ||
|
|
430c4b6538 | ||
|
|
3aa5f98b64 | ||
|
|
a8939eec28 | ||
|
|
09e09b308e | ||
|
|
e3fd3e8fa4 | ||
|
|
c610471b0c | ||
|
|
2d6fa9ce80 | ||
|
|
b8e79dce89 | ||
|
|
65e1fc71be | ||
|
|
c9465c33cf | ||
|
|
623119619c | ||
|
|
859c8d3fef | ||
|
|
7891eacf21 | ||
|
|
b12cd1f841 | ||
|
|
1600506545 | ||
|
|
5d0c93ae10 | ||
|
|
335b7680c9 | ||
|
|
15b73386b5 | ||
|
|
08c236059e | ||
|
|
ab419795b3 | ||
|
|
f238c7428d | ||
|
|
da275c72ab | ||
|
|
159196d1e9 | ||
|
|
266ff227cf | ||
|
|
dfd4e74a5c | ||
|
|
6cdcd6c6d1 | ||
|
|
c033904693 | ||
|
|
84a87a5b1c | ||
|
|
63a5ff7ab9 | ||
|
|
efb0491d40 | ||
|
|
8309b4f408 | ||
|
|
961998cf91 | ||
|
|
59e92a2db4 | ||
|
|
b71322e793 | ||
|
|
978d114c73 | ||
|
|
7c6236761a | ||
|
|
9875352dd8 | ||
|
|
d28f5b9e82 | ||
|
|
3e6ae25481 | ||
|
|
513ff94b89 | ||
|
|
83cb702e72 | ||
|
|
07a9165ca2 | ||
|
|
afc737ca0c | ||
|
|
ec53c6309a | ||
|
|
68184af57b | ||
|
|
7866fa161f | ||
|
|
8cfdd3e8a4 | ||
|
|
ea9e49b20d | ||
|
|
d0ad8a978c | ||
|
|
e74138b2be | ||
|
|
622a531d9c | ||
|
|
290ab42d22 | ||
|
|
22a7985445 | ||
|
|
b3bda57ca2 | ||
|
|
9d75a56b56 | ||
|
|
0a59fee763 | ||
|
|
d75cd69de4 | ||
|
|
eb5889b3da | ||
|
|
b9ed873827 | ||
|
|
0a19109476 | ||
|
|
a4f939cc27 | ||
|
|
4546c92f5b | ||
|
|
32d4dd073f | ||
|
|
f92b0dc6c7 | ||
|
|
c246026bda | ||
|
|
07e488cfae | ||
|
|
e7ecf14d0c | ||
|
|
8be25389f2 | ||
|
|
52c3cf6d34 | ||
|
|
ba24a09f24 | ||
|
|
f4b0a40abb | ||
|
|
3aac2df057 | ||
|
|
488633bf44 | ||
|
|
8e92729141 | ||
|
|
38a500d05c | ||
|
|
697ee2dc50 | ||
|
|
85e5aa4011 | ||
|
|
4228758f1d | ||
|
|
0116320d2c | ||
|
|
69240d41b0 | ||
|
|
78b9428f4e | ||
|
|
5d159851e5 | ||
|
|
c99f1de9f3 | ||
|
|
1a548c1bc1 | ||
|
|
c093ea36e6 | ||
|
|
90fa1345b0 | ||
|
|
aa67b38a44 | ||
|
|
7850ae2f4f | ||
|
|
2647402095 | ||
|
|
12a3975341 | ||
|
|
4bb72f9480 | ||
|
|
37c43a7ab3 | ||
|
|
9c0adae3cd | ||
|
|
4d341bb758 | ||
|
|
1a3c7d91f1 | ||
|
|
72856166a9 | ||
|
|
b51204cc1c | ||
|
|
56769ba4f8 | ||
|
|
94bebf31ac | ||
|
|
32aaadc301 | ||
|
|
53f6bbdfe0 | ||
|
|
ac7a4358d6 | ||
|
|
09a385d9b0 | ||
|
|
b2627200ea | ||
|
|
ef18bfdd3f | ||
|
|
3490a19103 | ||
|
|
cfbb94a2a8 | ||
|
|
b65c5d8ec6 | ||
|
|
6250cc9a8d | ||
|
|
0de5083aff | ||
|
|
c421ffd520 | ||
|
|
0575dd10de | ||
|
|
f708884808 | ||
|
|
b6ca50a2cc | ||
|
|
cc56f36870 | ||
|
|
8663f4bbaf | ||
|
|
fed931afda | ||
|
|
0cb1029311 | ||
|
|
9381bfe7f9 | ||
|
|
b97a950f53 | ||
|
|
04ce708031 | ||
|
|
0e41882b5c | ||
|
|
2abf1ad940 | ||
|
|
86c0583525 | ||
|
|
33f8580255 | ||
|
|
0c24bb6cfc | ||
|
|
b1dbd765c6 | ||
|
|
65642592ee | ||
|
|
f9cc1df00b | ||
|
|
c20606b8d7 | ||
|
|
3602474c25 | ||
|
|
f5fd94d62a | ||
|
|
6cce924cd0 | ||
|
|
b3973ed224 | ||
|
|
d8b7f29fa2 | ||
|
|
6d81968db5 | ||
|
|
5bb3933b21 | ||
|
|
a507431400 | ||
|
|
d109cd940b | ||
|
|
055c4beaf9 | ||
|
|
9dc5de6166 | ||
|
|
bd387068bb | ||
|
|
4a146d584b | ||
|
|
bca884bf72 | ||
|
|
137ba7b590 | ||
|
|
8e287c2762 | ||
|
|
2dd43a82b1 | ||
|
|
26e55471f8 | ||
|
|
85385be132 | ||
|
|
0e40408ee5 | ||
|
|
8dce5a6644 | ||
|
|
0cec0b73bc | ||
|
|
c009c81e65 | ||
|
|
f4ebc02555 | ||
|
|
0af9a0bf57 | ||
|
|
5f8dd92905 | ||
|
|
3f3ad9b3ad | ||
|
|
07639053fb | ||
|
|
4f4cd7a2c0 | ||
|
|
fb7c636ecf | ||
|
|
787d6fb61a | ||
|
|
5fd5105d44 | ||
|
|
b40dd814b0 | ||
|
|
76bf93efcb | ||
|
|
4d5b0e2037 | ||
|
|
33408a4dfc | ||
|
|
6e6e3cf443 | ||
|
|
b3ca430a20 | ||
|
|
e045034c3f | ||
|
|
27c638803e | ||
|
|
b033783e0f | ||
|
|
073c59c50a | ||
|
|
9a4d4b3a2f | ||
|
|
8aa6487b4b | ||
|
|
666ad7106b | ||
|
|
e5c45fbe8c | ||
|
|
1e22137e27 | ||
|
|
05d2ebd118 | ||
|
|
06cba91c39 | ||
|
|
9352c9547f | ||
|
|
0dfb0162f3 | ||
|
|
7222b27501 | ||
|
|
a6f808c9b1 | ||
|
|
152fa579f5 | ||
|
|
7a32b742f3 | ||
|
|
4e176d2ce8 | ||
|
|
1f8c8ad3ed | ||
|
|
0e8836ce5e | ||
|
|
56d3e6615d | ||
|
|
1258980832 | ||
|
|
766762a4dc | ||
|
|
7df9ca051c | ||
|
|
fe3810f073 | ||
|
|
6137bbd484 | ||
|
|
45805c2b76 | ||
|
|
9bc9051405 | ||
|
|
ff99ca3040 | ||
|
|
6c285930cb | ||
|
|
0d4ce27b79 | ||
|
|
13118cde33 | ||
|
|
093fedfde8 | ||
|
|
34377ee512 | ||
|
|
7378a7fef4 | ||
|
|
5fbef6bed2 | ||
|
|
53eea611b8 | ||
|
|
d7211a5324 | ||
|
|
0a21727c0a | ||
|
|
c90f2e77d8 | ||
|
|
34758088c5 | ||
|
|
2ce4a102ee | ||
|
|
eacd931fad | ||
|
|
ae4b348d77 | ||
|
|
80be6f3f91 | ||
|
|
ebe78cb36f | ||
|
|
82474fef8a | ||
|
|
8045e4d60d | ||
|
|
df4f3e7712 | ||
|
|
b6ecbd8cc4 | ||
|
|
4e573134de | ||
|
|
574a5ab72a | ||
|
|
b697bb260e | ||
|
|
ab1ddcd89d | ||
|
|
d55c62bf9f | ||
|
|
e779641c73 | ||
|
|
baac6e242d | ||
|
|
a425111eb7 | ||
|
|
75cf302da3 | ||
|
|
61fd45a0c2 | ||
|
|
2650be4921 | ||
|
|
a9763d894e | ||
|
|
4949088302 | ||
|
|
fc5204bd42 | ||
|
|
9834818ef7 | ||
|
|
8696963154 | ||
|
|
ee8a7419f4 | ||
|
|
e18403235d | ||
|
|
7baee555f4 | ||
|
|
cebc7daf2a | ||
|
|
ef4c7abb21 | ||
|
|
22e591518a | ||
|
|
a20c35bb38 | ||
|
|
dd301be52d | ||
|
|
aa48056c03 | ||
|
|
0d219b3e14 | ||
|
|
59315330dd | ||
|
|
8c792c7b22 | ||
|
|
a231764523 | ||
|
|
acf4a12fc3 | ||
|
|
74b40b039a | ||
|
|
812fafac80 | ||
|
|
a0a97c9c4c | ||
|
|
aa23e75eb8 | ||
|
|
89282ebaa6 | ||
|
|
b87ec5da73 | ||
|
|
e5a7f34fa4 | ||
|
|
865ca0ef04 | ||
|
|
b51a583f08 | ||
|
|
5347ac2766 | ||
|
|
b684f7e92b | ||
|
|
86f1d1cfc3 | ||
|
|
3021f7f743 | ||
|
|
415d95a298 | ||
|
|
a7b02975b7 | ||
|
|
3ec0f7cfc0 | ||
|
|
6723388f7f | ||
|
|
09eff0c4db | ||
|
|
03c9cb60e8 | ||
|
|
ef5959a705 | ||
|
|
3d4ee6c868 | ||
|
|
986e723eeb | ||
|
|
9552e59306 | ||
|
|
49765fc75d | ||
|
|
f16bdd2ff2 | ||
|
|
1ed3913333 | ||
|
|
06c3b37933 | ||
|
|
23fcd1ecb2 | ||
|
|
fd78902194 | ||
|
|
5c1814383a | ||
|
|
0ebf896070 | ||
|
|
a9d7ab9530 | ||
|
|
a244bcb953 | ||
|
|
3a9a3e5ed8 | ||
|
|
e770489f27 | ||
|
|
54d5b52a2e | ||
|
|
0ce252ba7a | ||
|
|
0218ad45a1 | ||
|
|
9040446780 | ||
|
|
25f79c5010 | ||
|
|
9ce75ab7de | ||
|
|
99e6ce901b | ||
|
|
15a00a5a7c | ||
|
|
23cb899c5a | ||
|
|
d9d4a78e0f | ||
|
|
d1322dafc9 | ||
|
|
3b50a5e2e6 | ||
|
|
2d454da3af | ||
|
|
4f35de991a | ||
|
|
91f7cc2e6d | ||
|
|
22571ca13d | ||
|
|
935ee968a7 | ||
|
|
ccdbeda526 | ||
|
|
e13f159343 | ||
|
|
51c7f2fd5a | ||
|
|
5333590ac2 | ||
|
|
ba3ac40b9d | ||
|
|
993bcd370f | ||
|
|
53f971095d | ||
|
|
5c7e38478b | ||
|
|
67b597ad46 | ||
|
|
88fe6777bf | ||
|
|
1a2f796dc7 | ||
|
|
d4880a9e60 | ||
|
|
ccdb086fc8 | ||
|
|
5151db5c2f | ||
|
|
1746b2582b | ||
|
|
4b51b5a46d | ||
|
|
f2cb4a3655 | ||
|
|
2d398393bd | ||
|
|
9fd4292923 | ||
|
|
d4c8cfe1f2 | ||
|
|
cf50c0eff8 | ||
|
|
abdb974d7f | ||
|
|
db3b4d0c98 | ||
|
|
f84ff4ba7d | ||
|
|
ab074dac17 | ||
|
|
d4a665694a | ||
|
|
b6623a0d49 | ||
|
|
9d9c859ac1 | ||
|
|
5045d17a39 | ||
|
|
848475a5b0 | ||
|
|
3a5a6f42fb | ||
|
|
cd55a93a13 | ||
|
|
23bfe30036 | ||
|
|
538859669d | ||
|
|
46843bd927 | ||
|
|
d9cd8e9e69 | ||
|
|
bf2c923db5 | ||
|
|
0877aa0fe0 | ||
|
|
e0beb98fd3 | ||
|
|
1d4af46496 | ||
|
|
7d32c7f36d | ||
|
|
69dc411ae0 | ||
|
|
d74394369b | ||
|
|
3e2af67ce3 | ||
|
|
37c7e8300f | ||
|
|
326b925557 | ||
|
|
6e8e9bb41e | ||
|
|
5b4daf2669 | ||
|
|
1aade4a8e2 | ||
|
|
8a2e84e3f1 | ||
|
|
905aab3b85 | ||
|
|
b9cf1465a7 | ||
|
|
c7632be5cc | ||
|
|
8f0dba7cbf | ||
|
|
eafa98e6f4 | ||
|
|
d94109e886 | ||
|
|
cd33b5b062 | ||
|
|
9b6c1cfda6 | ||
|
|
ffa09f86f4 | ||
|
|
2bbb68be8a | ||
|
|
590caafa2d | ||
|
|
3bb9b31515 | ||
|
|
47881574ed | ||
|
|
26337a56cc | ||
|
|
eaa462279e | ||
|
|
6712179502 | ||
|
|
6dc9e87b68 | ||
|
|
38669a56cb | ||
|
|
49b759b804 | ||
|
|
6388be0731 | ||
|
|
c98d87935a | ||
|
|
11a42c3215 | ||
|
|
d19ef56199 | ||
|
|
bc91167363 | ||
|
|
fd68d0074b | ||
|
|
cf88d61c20 | ||
|
|
4a1f34c522 | ||
|
|
e351eec169 | ||
|
|
6f137bbe3e | ||
|
|
5db6ffc03e | ||
|
|
abea094f90 | ||
|
|
04eafe3d04 | ||
|
|
a06700a14b | ||
|
|
489b4fd3a5 | ||
|
|
fdf9dbb6fe | ||
|
|
506353892e | ||
|
|
5de8cce7bf | ||
|
|
652895d656 | ||
|
|
39fae9e3a3 |
23
.astylerc
Normal file
23
.astylerc
Normal file
@@ -0,0 +1,23 @@
|
||||
--style=google
|
||||
--keep-one-line-blocks
|
||||
|
||||
--indent=spaces=2
|
||||
--indent-preproc-block
|
||||
--indent-preproc-define
|
||||
--indent-col1-comments
|
||||
|
||||
--remove-brackets
|
||||
--break-after-logical
|
||||
--delete-empty-lines
|
||||
|
||||
--pad-oper
|
||||
--pad-header
|
||||
--unpad-paren
|
||||
--align-pointer=type
|
||||
--align-reference=type
|
||||
|
||||
--attach-classes
|
||||
--attach-inlines
|
||||
--keep-one-line-statements
|
||||
|
||||
--indent-namespaces
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,3 +1,12 @@
|
||||
// Our automatic versioning scheme generates the following file
|
||||
// NEVER put it in the repository
|
||||
_Version.h
|
||||
|
||||
// All of the following OS, IDE and compiler generated file
|
||||
// references should be moved from this file
|
||||
// They are needed, but they belong in your global .gitignore
|
||||
// rather than in a per-project file such as this
|
||||
|
||||
*.o
|
||||
applet/
|
||||
*~
|
||||
@@ -6,3 +15,6 @@ applet/
|
||||
*.bak
|
||||
*.DS_Store
|
||||
*.idea
|
||||
*.s
|
||||
*.i
|
||||
*.ii
|
||||
|
||||
257
.travis.yml
257
.travis.yml
@@ -2,159 +2,168 @@
|
||||
language: c
|
||||
|
||||
before_install:
|
||||
- pwd
|
||||
- wget https://bootstrap.pypa.io/get-pip.py
|
||||
- wget https://bintray.com/artifact/download/olikraus/u8glib/u8glib_arduino_v1.17.zip
|
||||
# Travis runs a detached head. We need to find the current branch
|
||||
- git checkout `git branch --contains HEAD | grep -v '*'`
|
||||
# Also tags for the root(s) of the minor version(s)
|
||||
- git fetch origin --tags
|
||||
- mkdir ~/bin
|
||||
install:
|
||||
- sudo python get-pip.py
|
||||
- sudo pip install ino
|
||||
# add ppa for newer version of Arduino than available in ubuntu 12.04
|
||||
- sudo add-apt-repository ppa:michael-gruz/elektronik -y
|
||||
- sudo apt-get update -q
|
||||
- sudo apt-get install arduino
|
||||
# Install arduino 1.6.4
|
||||
- wget http://downloads-02.arduino.cc/arduino-1.6.4-linux64.tar.xz
|
||||
- tar Jxf arduino-1.6.4-linux64.tar.xz
|
||||
- sudo mv arduino-1.6.4 /usr/local/share/arduino
|
||||
- ln -s /usr/local/share/arduino/arduino ~/bin/arduino
|
||||
# Our custom build commands
|
||||
- mv LinuxAddons/bin/* ~/bin/
|
||||
- ls -la ~/bin
|
||||
# install our platform
|
||||
- cp -r ArduinoAddons/Arduino_1.6.x/hardware/* /usr/local/share/arduino/hardware
|
||||
# copy libraries to arduino dir, as conditional includes do not work in .ino files
|
||||
- cp -r /usr/local/share/arduino/hardware/marlin/avr/libraries/* /usr/local/share/arduino/libraries/
|
||||
- cp -r ArduinoAddons/Arduino_1.6.x/libraries/* /usr/local/share/arduino/libraries/
|
||||
# add LiquidCrystal_I2C & LiquidTWI2 libraries
|
||||
- git clone https://github.com/kiyoshigawa/LiquidCrystal_I2C.git
|
||||
- mv LiquidCrystal_I2C/LiquidCrystal_I2C /usr/local/share/arduino/libraries/LiquidCrystal_I2C
|
||||
- git clone https://github.com/lincomatic/LiquidTWI2.git
|
||||
- mv LiquidTWI2 /usr/local/share/arduino/libraries/LiquidTWI2
|
||||
before_script:
|
||||
# add U8glib, LiquidCrystal_I2C & LiquidTWI2 libraries
|
||||
- sudo unzip u8glib_arduino_v1.17.zip -d /usr/share/arduino/libraries/
|
||||
- cd /usr/share/arduino/libraries/
|
||||
- sudo git clone https://github.com/kiyoshigawa/LiquidCrystal_I2C.git
|
||||
- ls -la
|
||||
- ls -la LiquidCrystal_I2C/
|
||||
- sudo git clone https://github.com/lincomatic/LiquidTWI2.git
|
||||
# remove Robot_Control library to stop compile error!
|
||||
- sudo rm -rf /usr/share/arduino/libraries/Robot_Control
|
||||
# arduino requires an X server even with command line
|
||||
# https://github.com/arduino/Arduino/issues/1981
|
||||
- Xvfb :1 -screen 0 1024x768x16 &> xvfb.log &
|
||||
# change back to home directory for compiling
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
# ino needs files in src directory
|
||||
- ln -s Marlin src
|
||||
# remove Marlin.pde as it confuses ino after it finds Marlin.ino
|
||||
- rm Marlin/Marlin.pde
|
||||
script:
|
||||
# build default config
|
||||
- ino build -m mega2560
|
||||
# backup configuration.h
|
||||
- build_marlin
|
||||
# Backup Configuration.h, Configuration_adv.h, and pins_RAMPS_14.h
|
||||
- cp Marlin/Configuration.h Marlin/Configuration.h.backup
|
||||
- cp Marlin/Configuration_adv.h Marlin/Configuration_adv.h.backup
|
||||
- cp Marlin/pins_RAMPS_14.h Marlin/pins_RAMPS_14.h.backup
|
||||
# add sensor for bed
|
||||
- opt_set TEMP_SENSOR_BED 1
|
||||
- build_marlin
|
||||
# change extruder numbers from 1 to 2
|
||||
# commented out for the moment fails build but compiles fine in Arduino
|
||||
#- sed -i 's/#define EXTRUDERS 1/#define EXTRUDERS 2/g' Marlin/Configuration.h
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
- opt_set MOTHERBOARD BOARD_RAMPS_14_EEB
|
||||
- opt_set EXTRUDERS 2
|
||||
- opt_set TEMP_SENSOR_1 1
|
||||
#- cat Marlin/Configuration.h
|
||||
- build_marlin
|
||||
# change extruder numbers from 2 to 3, needs to be a board with 3 extruders defined in pins.h
|
||||
#- sed -i 's/#define MOTHERBOARD BOARD_ULTIMAKER/#define MOTHERBOARD BOARD_AZTEEG_X3_PRO/g' Marlin/Configuration.h
|
||||
#- sed -i 's/#define EXTRUDERS 2/#define EXTRUDERS 3/g' Marlin/Configuration.h
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
- opt_set MOTHERBOARD BOARD_RUMBA
|
||||
- opt_set EXTRUDERS 3
|
||||
- opt_set TEMP_SENSOR_2 1
|
||||
- build_marlin
|
||||
# enable PIDTEMPBED
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define PIDTEMPBED/#define PIDTEMPBED/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
# enable THERMAL RUNAWAY PROTECTION for extruders & bed
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_PERIOD/g' Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS/#define THERMAL_RUNAWAY_PROTECTION_HYSTERESIS/g' Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/#define THERMAL_RUNAWAY_PROTECTION_BED_PERIOD/g' Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/#define THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable PIDTEMPBED
|
||||
- build_marlin
|
||||
# enable AUTO_BED_LEVELING
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define ENABLE_AUTO_BED_LEVELING/#define ENABLE_AUTO_BED_LEVELING/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable ENABLE_AUTO_BED_LEVELING
|
||||
- build_marlin
|
||||
# enable AUTO_BED_LEVELING with servos
|
||||
- restore_configs
|
||||
- opt_enable ENABLE_AUTO_BED_LEVELING NUM_SERVOS Z_ENDSTOP_SERVO_NR SERVO_ENDSTOP_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE
|
||||
- build_marlin
|
||||
# enable EEPROM_SETTINGS & EEPROM_CHITCHAT
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define EEPROM_SETTINGS/#define EEPROM_SETTINGS/g' Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define EEPROM_CHITCHAT/#define EEPROM_CHITCHAT/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT
|
||||
- build_marlin
|
||||
### LCDS ###
|
||||
# ULTIMAKERCONTROLLER
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable ULTIMAKERCONTROLLER
|
||||
- build_marlin
|
||||
# MAKRPANEL
|
||||
# Needs to use melzi and sanguino hardware
|
||||
#- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
#- sed -i 's/\/\/#define MAKRPANEL/#define MAKRPANEL/g' Marlin/Configuration.h
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
#- restore_configs
|
||||
#- opt_enable MAKRPANEL
|
||||
#- build_marlin
|
||||
# REPRAP_DISCOUNT_SMART_CONTROLLER
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define REPRAP_DISCOUNT_SMART_CONTROLLER/#define REPRAP_DISCOUNT_SMART_CONTROLLER/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
# G3D_PANE
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define G3D_PANEL/#define G3D_PANEL/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT
|
||||
- build_marlin
|
||||
# G3D_PANEL
|
||||
- restore_configs
|
||||
- opt_enable G3D_PANEL SDSUPPORT
|
||||
- build_marlin
|
||||
# REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
# REPRAPWORLD_KEYPAD
|
||||
- restore_configs
|
||||
- opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
|
||||
- build_marlin
|
||||
# REPRAPWORLD_KEYPAD
|
||||
# Cant find configuration details to get it to compile
|
||||
#- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
#- sed -i 's/\/\/#define ULTRA_LCD/#define ULTRA_LCD/g' Marlin/Configuration.h
|
||||
#- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD/#define REPRAPWORLD_KEYPAD/g' Marlin/Configuration.h
|
||||
#- sed -i 's/\/\/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0/g' Marlin/Configuration.h
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
#- restore_configs
|
||||
#- opt_enable ULTRA_LCD REPRAPWORLD_KEYPAD REPRAPWORLD_KEYPAD_MOVE_STEP
|
||||
#- build_marlin
|
||||
# RA_CONTROL_PANEL
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define RA_CONTROL_PANEL/#define RA_CONTROL_PANEL/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable RA_CONTROL_PANEL
|
||||
- build_marlin
|
||||
### I2C PANELS ###
|
||||
# LCD_I2C_SAINSMART_YWROBOT
|
||||
# Failing at the moment needs different library
|
||||
#- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
#- sed -i 's/\/\/#define LCD_I2C_SAINSMART_YWROBOT/#define LCD_I2C_SAINSMART_YWROBOT/g' Marlin/Configuration.h
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
#- restore_configs
|
||||
#- opt_enable LCD_I2C_SAINSMART_YWROBOT
|
||||
#- build_marlin
|
||||
# LCD_I2C_PANELOLU2
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define LCD_I2C_PANELOLU2/#define LCD_I2C_PANELOLU2/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable LCD_I2C_PANELOLU2
|
||||
- build_marlin
|
||||
# LCD_I2C_VIKI
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define LCD_I2C_VIKI/#define LCD_I2C_VIKI/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable LCD_I2C_VIKI
|
||||
- build_marlin
|
||||
# LCM1602
|
||||
- restore_configs
|
||||
- opt_enable LCM1602
|
||||
- build_marlin
|
||||
# Enable FILAMENTCHANGEENABLE
|
||||
- restore_configs
|
||||
- opt_enable FILAMENTCHANGEENABLE
|
||||
- build_marlin
|
||||
# Enable filament sensor
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
# Enable filament sensor with LCD display
|
||||
- cp Marlin/Configuration.h.backup Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define ULTIMAKERCONTROLLER/#define ULTIMAKERCONTROLLER/g' Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define FILAMENT_SENSOR/#define FILAMENT_SENSOR/g' Marlin/Configuration.h
|
||||
- sed -i 's/\/\/#define FILAMENT_LCD_DISPLAY/#define FILAMENT_LCD_DISPLAY/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- restore_configs
|
||||
- opt_enable FILAMENT_SENSOR
|
||||
- build_marlin
|
||||
# Enable filament sensor with LCD display
|
||||
- restore_configs
|
||||
- opt_enable ULTIMAKERCONTROLLER FILAMENT_SENSOR FILAMENT_LCD_DISPLAY
|
||||
- build_marlin
|
||||
# Enable COREXY
|
||||
- restore_configs
|
||||
- opt_enable COREXY
|
||||
- build_marlin
|
||||
# Enable COREXZ
|
||||
- restore_configs
|
||||
- opt_enable COREXZ
|
||||
- build_marlin
|
||||
# Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS
|
||||
- restore_configs
|
||||
- opt_enable_adv Z_DUAL_STEPPER_DRIVERS Z_DUAL_ENDSTOPS
|
||||
- pins_set RAMPS_14 X_MAX_PIN -1
|
||||
- opt_set_adv Z2_MAX_PIN 2
|
||||
- build_marlin
|
||||
- restore_configs
|
||||
######## Example Configurations ##############
|
||||
# Delta Config
|
||||
- cp Marlin/example_configurations/delta/Configuration* Marlin/
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
# Delta Config (generic)
|
||||
- use_example_configs delta/generic
|
||||
- build_marlin
|
||||
# Delta Config (generic) + ABL + ALLEN_KEY
|
||||
- use_example_configs delta/generic
|
||||
- opt_disable DISABLE_MIN_ENDSTOPS
|
||||
- opt_enable AUTO_BED_LEVELING_FEATURE Z_PROBE_ALLEN_KEY
|
||||
- build_marlin
|
||||
# Delta Config (Mini Kossel)
|
||||
- use_example_configs delta/kossel_mini
|
||||
- build_marlin
|
||||
# Makibox Config need to check board type for Teensy++ 2.0
|
||||
#- cp Marlin/example_configurations/makibox/Configuration* Marlin/
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
#- use_example_configs makibox
|
||||
#- build_marlin
|
||||
# SCARA Config
|
||||
- cp Marlin/example_configurations/SCARA/Configuration* Marlin/
|
||||
- rm -rf .build/
|
||||
- ino build -m mega2560
|
||||
- use_example_configs SCARA
|
||||
- build_marlin
|
||||
# tvrrug Config need to check board type for sanguino atmega644p
|
||||
#- cp Marlin/example_configurations/tvrrug/Round2/Configuration* Marlin/
|
||||
#- rm -rf .build/
|
||||
#- ino build -m mega2560
|
||||
#- use_example_configs tvrrug/Round2
|
||||
#- build_marlin
|
||||
######## Board Types #############
|
||||
- sed -i 's/#define MOTHERBOARD BOARD_RAMPS_13_EFB/#define MOTHERBOARD BOARD_DUEMILANOVE_328P/g' Marlin/Configuration.h
|
||||
- rm -rf .build/
|
||||
- ino build -m atmega328
|
||||
@@ -1,35 +0,0 @@
|
||||
##############################################################
|
||||
|
||||
Generation_Series.name=Gen6 & Gen6 Deluxe
|
||||
Generation_Series.upload.protocol=stk500
|
||||
Generation_Series.upload.maximum_size=63488
|
||||
Generation_Series.upload.speed=38400
|
||||
Generation_Series.bootloader.low_fuses=0xFF
|
||||
Generation_Series.bootloader.high_fuses=0xDC
|
||||
Generation_Series.bootloader.extended_fuses=0xFD
|
||||
Generation_Series.bootloader.path=atmega644p
|
||||
Generation_Series.bootloader.file=ATmegaBOOT_644P.hex
|
||||
Generation_Series.bootloader.unlock_bits=0x3F
|
||||
Generation_Series.bootloader.lock_bits=0x0F
|
||||
Generation_Series.build.mcu=atmega644p
|
||||
Generation_Series.build.f_cpu=16000000L
|
||||
Generation_Series.build.core=arduino
|
||||
|
||||
|
||||
##############################################################
|
||||
|
||||
|
||||
Sanguinololu.name=Sanguinololu 1.2 and above
|
||||
Sanguinololu.upload.protocol=stk500
|
||||
Sanguinololu.upload.maximum_size=63488
|
||||
Sanguinololu.upload.speed=38400
|
||||
Sanguinololu.bootloader.low_fuses=0xFF
|
||||
Sanguinololu.bootloader.high_fuses=0xDC
|
||||
Sanguinololu.bootloader.extended_fuses=0xFD
|
||||
Sanguinololu.bootloader.path=atmega644p
|
||||
Sanguinololu.bootloader.file=ATmegaBOOT_644P.hex
|
||||
Sanguinololu.bootloader.unlock_bits=0x3F
|
||||
Sanguinololu.bootloader.lock_bits=0x0F
|
||||
Sanguinololu.build.mcu=atmega644p
|
||||
Sanguinololu.build.f_cpu=16000000L
|
||||
Sanguinololu.build.core=arduino
|
||||
@@ -1,713 +0,0 @@
|
||||
/**********************************************************/
|
||||
/* Serial Bootloader for Atmel megaAVR Controllers */
|
||||
/* */
|
||||
/* tested with ATmega644 and ATmega644P */
|
||||
/* should work with other mega's, see code for details */
|
||||
/* */
|
||||
/* ATmegaBOOT.c */
|
||||
/* */
|
||||
/* 20090131: Added 324P support from Alex Leone */
|
||||
/* Marius Kintel */
|
||||
/* 20080915: applied ADABoot mods for Sanguino 644P */
|
||||
/* Brian Riley */
|
||||
/* 20080711: hacked for Sanguino by Zach Smith */
|
||||
/* and Justin Day */
|
||||
/* 20070626: hacked for Arduino Diecimila (which auto- */
|
||||
/* resets when a USB connection is made to it) */
|
||||
/* by D. Mellis */
|
||||
/* 20060802: hacked for Arduino by D. Cuartielles */
|
||||
/* based on a previous hack by D. Mellis */
|
||||
/* and D. Cuartielles */
|
||||
/* */
|
||||
/* Monitor and debug functions were added to the original */
|
||||
/* code by Dr. Erik Lins, chip45.com. (See below) */
|
||||
/* */
|
||||
/* Thanks to Karl Pitrich for fixing a bootloader pin */
|
||||
/* problem and more informative LED blinking! */
|
||||
/* */
|
||||
/* For the latest version see: */
|
||||
/* http://www.chip45.com/ */
|
||||
/* */
|
||||
/* ------------------------------------------------------ */
|
||||
/* */
|
||||
/* based on stk500boot.c */
|
||||
/* Copyright (c) 2003, Jason P. Kyle */
|
||||
/* All rights reserved. */
|
||||
/* see avr1.org for original file and information */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it */
|
||||
/* and/or modify it under the terms of the GNU General */
|
||||
/* Public License as published by the Free Software */
|
||||
/* Foundation; either version 2 of the License, or */
|
||||
/* (at your option) any later version. */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will */
|
||||
/* be useful, but WITHOUT ANY WARRANTY; without even the */
|
||||
/* implied warranty of MERCHANTABILITY or FITNESS FOR A */
|
||||
/* PARTICULAR PURPOSE. See the GNU General Public */
|
||||
/* License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General */
|
||||
/* Public License along with this program; if not, write */
|
||||
/* to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
/* */
|
||||
/* Licence can be viewed at */
|
||||
/* http://www.fsf.org/licenses/gpl.txt */
|
||||
/* */
|
||||
/* Target = Atmel AVR m128,m64,m32,m16,m8,m162,m163,m169, */
|
||||
/* m8515,m8535. ATmega161 has a very small boot block so */
|
||||
/* isn't supported. */
|
||||
/* */
|
||||
/* Tested with m168 */
|
||||
/**********************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/* some includes */
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/boot.h>
|
||||
|
||||
#ifdef ADABOOT
|
||||
#define NUM_LED_FLASHES 3
|
||||
#define ADABOOT_VER 1
|
||||
#endif
|
||||
|
||||
|
||||
/* 20070707: hacked by David A. Mellis - after this many errors give up and launch application */
|
||||
#define MAX_ERROR_COUNT 5
|
||||
|
||||
/* set the UART baud rate */
|
||||
/* 20080711: hack by Zach Hoeken */
|
||||
#define BAUD_RATE 38400
|
||||
|
||||
/* SW_MAJOR and MINOR needs to be updated from time to time to avoid warning message from AVR Studio */
|
||||
/* never allow AVR Studio to do an update !!!! */
|
||||
#define HW_VER 0x02
|
||||
#define SW_MAJOR 0x01
|
||||
#define SW_MINOR 0x10
|
||||
|
||||
/* onboard LED is used to indicate, that the bootloader was entered (3x flashing) */
|
||||
/* if monitor functions are included, LED goes on after monitor was entered */
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB0
|
||||
|
||||
/* define various device id's */
|
||||
/* manufacturer byte is always the same */
|
||||
#define SIG1 0x1E // Yep, Atmel is the only manufacturer of AVR micros. Single source :(
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
#define SIG2 0x96
|
||||
#define SIG3 0x0A
|
||||
#elif defined(__AVR_ATmega644__)
|
||||
#define SIG2 0x96
|
||||
#define SIG3 0x09
|
||||
#elif defined(__AVR_ATmega324P__)
|
||||
#define SIG2 0x95
|
||||
#define SIG3 0x08
|
||||
#endif
|
||||
#define PAGE_SIZE 0x080U //128 words
|
||||
#define PAGE_SIZE_BYTES 0x100U //256 bytes
|
||||
|
||||
/* function prototypes */
|
||||
void putch(char);
|
||||
char getch(void);
|
||||
void getNch(uint8_t);
|
||||
void byte_response(uint8_t);
|
||||
void nothing_response(void);
|
||||
char gethex(void);
|
||||
void puthex(char);
|
||||
void flash_led(uint8_t);
|
||||
|
||||
/* some variables */
|
||||
union address_union
|
||||
{
|
||||
uint16_t word;
|
||||
uint8_t byte[2];
|
||||
} address;
|
||||
|
||||
union length_union
|
||||
{
|
||||
uint16_t word;
|
||||
uint8_t byte[2];
|
||||
} length;
|
||||
|
||||
struct flags_struct
|
||||
{
|
||||
unsigned eeprom : 1;
|
||||
unsigned rampz : 1;
|
||||
} flags;
|
||||
|
||||
uint8_t buff[256];
|
||||
|
||||
uint8_t error_count = 0;
|
||||
uint8_t sreg;
|
||||
|
||||
void (*app_start)(void) = 0x0000;
|
||||
|
||||
/* main program starts here */
|
||||
int main(void)
|
||||
{
|
||||
uint8_t ch,ch2;
|
||||
uint16_t w;
|
||||
uint16_t i;
|
||||
|
||||
asm volatile("nop\n\t");
|
||||
|
||||
#ifdef ADABOOT // BBR/LF 10/8/2007 & 9/13/2008
|
||||
ch = MCUSR;
|
||||
MCUSR = 0;
|
||||
|
||||
WDTCSR |= _BV(WDCE) | _BV(WDE);
|
||||
WDTCSR = 0;
|
||||
|
||||
// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
|
||||
if (! (ch & _BV(EXTRF))) // if it's a not an external reset...
|
||||
app_start(); // skip bootloader
|
||||
#endif
|
||||
|
||||
|
||||
//initialize our serial port.
|
||||
UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
|
||||
UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
|
||||
UCSR0B = (1<<RXEN0) | (1<<TXEN0);
|
||||
UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
|
||||
|
||||
/* Enable internal pull-up resistor on pin D0 (RX), in order
|
||||
to supress line noise that prevents the bootloader from
|
||||
timing out (DAM: 20070509) */
|
||||
DDRD &= ~_BV(PIND0);
|
||||
PORTD |= _BV(PIND0);
|
||||
|
||||
/* set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
|
||||
/* flash onboard LED to signal entering of bootloader */
|
||||
/* ADABOOT will do two series of flashes. first 4 - signifying ADABOOT */
|
||||
/* then a pause and another flash series signifying ADABOOT sub-version */
|
||||
|
||||
|
||||
flash_led(NUM_LED_FLASHES);
|
||||
|
||||
#ifdef ADABOOT
|
||||
flash_led(ADABOOT_VER); // BBR 9/13/2008
|
||||
#endif
|
||||
|
||||
/* forever loop */
|
||||
for (;;)
|
||||
{
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
|
||||
/* A bunch of if...else if... gives smaller code than switch...case ! */
|
||||
|
||||
/* Hello is anyone home ? */
|
||||
if(ch=='0')
|
||||
nothing_response();
|
||||
|
||||
|
||||
/* Request programmer ID */
|
||||
/* Not using PROGMEM string due to boot block in m128 being beyond 64kB boundry */
|
||||
/* Would need to selectively manipulate RAMPZ, and it's only 9 characters anyway so who cares. */
|
||||
else if(ch=='1')
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch('A');
|
||||
putch('V');
|
||||
putch('R');
|
||||
putch(' ');
|
||||
putch('I');
|
||||
putch('S');
|
||||
putch('P');
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AVR ISP/STK500 board commands DON'T CARE so default nothing_response */
|
||||
else if(ch=='@')
|
||||
{
|
||||
ch2 = getch();
|
||||
if (ch2 > 0x85)
|
||||
getch();
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* AVR ISP/STK500 board requests */
|
||||
else if(ch=='A')
|
||||
{
|
||||
ch2 = getch();
|
||||
if(ch2 == 0x80)
|
||||
byte_response(HW_VER); // Hardware version
|
||||
else if(ch2==0x81)
|
||||
byte_response(SW_MAJOR); // Software major version
|
||||
else if(ch2==0x82)
|
||||
byte_response(SW_MINOR); // Software minor version
|
||||
else if(ch2==0x98)
|
||||
byte_response(0x03); // Unknown but seems to be required by avr studio 3.56
|
||||
else
|
||||
byte_response(0x00); // Covers various unnecessary responses we don't care about
|
||||
}
|
||||
|
||||
|
||||
/* Device Parameters DON'T CARE, DEVICE IS FIXED */
|
||||
else if(ch=='B')
|
||||
{
|
||||
getNch(20);
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Parallel programming stuff DON'T CARE */
|
||||
else if(ch=='E')
|
||||
{
|
||||
getNch(5);
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Enter programming mode */
|
||||
else if(ch=='P')
|
||||
{
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Leave programming mode */
|
||||
else if(ch=='Q')
|
||||
{
|
||||
nothing_response();
|
||||
#ifdef ADABOOT
|
||||
// autoreset via watchdog (sneaky!) BBR/LF 9/13/2008
|
||||
WDTCSR = _BV(WDE);
|
||||
while (1); // 16 ms
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Erase device, don't care as we will erase one page at a time anyway. */
|
||||
else if(ch=='R')
|
||||
{
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Set address, little endian. EEPROM in bytes, FLASH in words */
|
||||
/* Perhaps extra address bytes may be added in future to support > 128kB FLASH. */
|
||||
/* This might explain why little endian was used here, big endian used everywhere else. */
|
||||
else if(ch=='U')
|
||||
{
|
||||
address.byte[0] = getch();
|
||||
address.byte[1] = getch();
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Universal SPI programming command, disabled. Would be used for fuses and lock bits. */
|
||||
else if(ch=='V')
|
||||
{
|
||||
getNch(4);
|
||||
byte_response(0x00);
|
||||
}
|
||||
|
||||
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch=='d')
|
||||
{
|
||||
length.byte[1] = getch();
|
||||
length.byte[0] = getch();
|
||||
|
||||
flags.eeprom = 0;
|
||||
if (getch() == 'E')
|
||||
flags.eeprom = 1;
|
||||
|
||||
for (i=0; i<PAGE_SIZE; i++)
|
||||
buff[i] = 0;
|
||||
|
||||
for (w = 0; w < length.word; w++)
|
||||
{
|
||||
// Store data in buffer, can't keep up with serial data stream whilst programming pages
|
||||
buff[w] = getch();
|
||||
}
|
||||
|
||||
if (getch() == ' ')
|
||||
{
|
||||
if (flags.eeprom)
|
||||
{
|
||||
//Write to EEPROM one byte at a time
|
||||
for(w=0;w<length.word;w++)
|
||||
{
|
||||
while(EECR & (1<<EEPE));
|
||||
|
||||
EEAR = (uint16_t)(void *)address.word;
|
||||
EEDR = buff[w];
|
||||
EECR |= (1<<EEMPE);
|
||||
EECR |= (1<<EEPE);
|
||||
|
||||
address.word++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//address * 2 -> byte location
|
||||
address.word = address.word << 1;
|
||||
|
||||
//Even up an odd number of bytes
|
||||
if ((length.byte[0] & 0x01))
|
||||
length.word++;
|
||||
|
||||
// HACKME: EEPE used to be EEWE
|
||||
//Wait for previous EEPROM writes to complete
|
||||
//while(bit_is_set(EECR,EEPE));
|
||||
while(EECR & (1<<EEPE));
|
||||
|
||||
asm volatile(
|
||||
"clr r17 \n\t" //page_word_count
|
||||
"lds r30,address \n\t" //Address of FLASH location (in bytes)
|
||||
"lds r31,address+1 \n\t"
|
||||
"ldi r28,lo8(buff) \n\t" //Start of buffer array in RAM
|
||||
"ldi r29,hi8(buff) \n\t"
|
||||
"lds r24,length \n\t" //Length of data to be written (in bytes)
|
||||
"lds r25,length+1 \n\t"
|
||||
"length_loop: \n\t" //Main loop, repeat for number of words in block
|
||||
"cpi r17,0x00 \n\t" //If page_word_count=0 then erase page
|
||||
"brne no_page_erase \n\t"
|
||||
"wait_spm1: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm1 \n\t"
|
||||
"ldi r16,0x03 \n\t" //Erase page pointed to by Z
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"wait_spm2: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm2 \n\t"
|
||||
|
||||
"ldi r16,0x11 \n\t" //Re-enable RWW section
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"no_page_erase: \n\t"
|
||||
"ld r0,Y+ \n\t" //Write 2 bytes into page buffer
|
||||
"ld r1,Y+ \n\t"
|
||||
|
||||
"wait_spm3: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm3 \n\t"
|
||||
"ldi r16,0x01 \n\t" //Load r0,r1 into FLASH page buffer
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
|
||||
"inc r17 \n\t" //page_word_count++
|
||||
"cpi r17,%1 \n\t"
|
||||
"brlo same_page \n\t" //Still same page in FLASH
|
||||
"write_page: \n\t"
|
||||
"clr r17 \n\t" //New page, write current one first
|
||||
"wait_spm4: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm4 \n\t"
|
||||
"ldi r16,0x05 \n\t" //Write page pointed to by Z
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"wait_spm5: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm5 \n\t"
|
||||
"ldi r16,0x11 \n\t" //Re-enable RWW section
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"same_page: \n\t"
|
||||
"adiw r30,2 \n\t" //Next word in FLASH
|
||||
"sbiw r24,2 \n\t" //length-2
|
||||
"breq final_write \n\t" //Finished
|
||||
"rjmp length_loop \n\t"
|
||||
"final_write: \n\t"
|
||||
"cpi r17,0 \n\t"
|
||||
"breq block_done \n\t"
|
||||
"adiw r24,2 \n\t" //length+2, fool above check on length after short page write
|
||||
"rjmp write_page \n\t"
|
||||
"block_done: \n\t"
|
||||
"clr __zero_reg__ \n\t" //restore zero register
|
||||
: "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
|
||||
|
||||
);
|
||||
}
|
||||
putch(0x14);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch=='t')
|
||||
{
|
||||
length.byte[1] = getch();
|
||||
length.byte[0] = getch();
|
||||
|
||||
if (getch() == 'E')
|
||||
flags.eeprom = 1;
|
||||
else
|
||||
{
|
||||
flags.eeprom = 0;
|
||||
address.word = address.word << 1; // address * 2 -> byte location
|
||||
}
|
||||
|
||||
// Command terminator
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
for (w=0; w<length.word; w++)
|
||||
{
|
||||
// Can handle odd and even lengths okay
|
||||
if (flags.eeprom)
|
||||
{
|
||||
// Byte access EEPROM read
|
||||
while(EECR & (1<<EEPE));
|
||||
EEAR = (uint16_t)(void *)address.word;
|
||||
EECR |= (1<<EERE);
|
||||
putch(EEDR);
|
||||
|
||||
address.word++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flags.rampz)
|
||||
putch(pgm_read_byte_near(address.word));
|
||||
|
||||
address.word++;
|
||||
}
|
||||
}
|
||||
putch(0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch=='u')
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch(SIG1);
|
||||
putch(SIG2);
|
||||
putch(SIG3);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read oscillator calibration byte */
|
||||
else if(ch=='v')
|
||||
byte_response(0x00);
|
||||
|
||||
else if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
|
||||
}
|
||||
/* end of forever loop */
|
||||
}
|
||||
|
||||
|
||||
char gethex(void)
|
||||
{
|
||||
char ah,al;
|
||||
|
||||
ah = getch();
|
||||
putch(ah);
|
||||
al = getch();
|
||||
putch(al);
|
||||
|
||||
if(ah >= 'a')
|
||||
ah = ah - 'a' + 0x0a;
|
||||
else if(ah >= '0')
|
||||
ah -= '0';
|
||||
if(al >= 'a')
|
||||
al = al - 'a' + 0x0a;
|
||||
else if(al >= '0')
|
||||
al -= '0';
|
||||
|
||||
return (ah << 4) + al;
|
||||
}
|
||||
|
||||
|
||||
void puthex(char ch)
|
||||
{
|
||||
char ah,al;
|
||||
|
||||
ah = (ch & 0xf0) >> 4;
|
||||
if(ah >= 0x0a)
|
||||
ah = ah - 0x0a + 'a';
|
||||
else
|
||||
ah += '0';
|
||||
|
||||
al = (ch & 0x0f);
|
||||
if(al >= 0x0a)
|
||||
al = al - 0x0a + 'a';
|
||||
else
|
||||
al += '0';
|
||||
|
||||
putch(ah);
|
||||
putch(al);
|
||||
}
|
||||
|
||||
|
||||
void putch(char ch)
|
||||
{
|
||||
while (!(UCSR0A & _BV(UDRE0)));
|
||||
UDR0 = ch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char getch(void)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
||||
#ifdef ADABOOT
|
||||
LED_PORT &= ~_BV(LED); // toggle LED to show activity - BBR/LF 10/3/2007 & 9/13/2008
|
||||
#endif
|
||||
|
||||
while(!(UCSR0A & _BV(RXC0)))
|
||||
{
|
||||
/* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
|
||||
/* HACKME:: here is a good place to count times*/
|
||||
count++;
|
||||
if (count > MAX_TIME_COUNT)
|
||||
app_start();
|
||||
}
|
||||
|
||||
#ifdef ADABOOT
|
||||
LED_PORT |= _BV(LED); // toggle LED to show activity - BBR/LF 10/3/2007 & 9/13/2008
|
||||
#endif
|
||||
|
||||
return UDR0;
|
||||
}
|
||||
|
||||
|
||||
void getNch(uint8_t count)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
while(!(UCSR0A & _BV(RXC0)));
|
||||
UDR0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void byte_response(uint8_t val)
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch(val);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nothing_response(void)
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ADABOOT
|
||||
|
||||
void flash_led(uint8_t count)
|
||||
{
|
||||
/* flash onboard LED count times to signal entering of bootloader */
|
||||
/* l needs to be volatile or the delay loops below might get */
|
||||
/* optimized away if compiling with optimizations (DAM). */
|
||||
|
||||
volatile uint32_t l;
|
||||
|
||||
if (count == 0) {
|
||||
count = ADABOOT;
|
||||
}
|
||||
|
||||
|
||||
int8_t i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
LED_PORT |= _BV(LED); // LED on
|
||||
for(l = 0; l < (F_CPU / 1000); ++l); // delay NGvalue was 1000 for both loops - BBR
|
||||
LED_PORT &= ~_BV(LED); // LED off
|
||||
for(l = 0; l < (F_CPU / 250); ++l); // delay asymmteric for ADA BOOT BBR
|
||||
}
|
||||
|
||||
for(l = 0; l < (F_CPU / 100); ++l); // pause ADA BOOT BBR
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void flash_led(uint8_t count)
|
||||
{
|
||||
/* flash onboard LED three times to signal entering of bootloader */
|
||||
/* l needs to be volatile or the delay loops below might get
|
||||
optimized away if compiling with optimizations (DAM). */
|
||||
volatile uint32_t l;
|
||||
|
||||
if (count == 0) {
|
||||
count = 3;
|
||||
}
|
||||
|
||||
int8_t i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
LED_PORT |= _BV(LED);
|
||||
for(l = 0; l < (F_CPU / 1000); ++l);
|
||||
LED_PORT &= ~_BV(LED);
|
||||
for(l = 0; l < (F_CPU / 1000); ++l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* end of file ATmegaBOOT.c */
|
||||
@@ -1,121 +0,0 @@
|
||||
:10F800000C943E7C0C945B7C0C945B7C0C945B7C39
|
||||
:10F810000C945B7C0C945B7C0C945B7C0C945B7C0C
|
||||
:10F820000C945B7C0C945B7C0C945B7C0C945B7CFC
|
||||
:10F830000C945B7C0C945B7C0C945B7C0C945B7CEC
|
||||
:10F840000C945B7C0C945B7C0C945B7C0C945B7CDC
|
||||
:10F850000C945B7C0C945B7C0C945B7C0C945B7CCC
|
||||
:10F860000C945B7C0C945B7C0C945B7C0C945B7CBC
|
||||
:10F870000C945B7C0C945B7C0C945B7C11241FBE11
|
||||
:10F88000CFEFD8E0DEBFCDBF11E0A0E0B1E0E6E60B
|
||||
:10F89000FFEF02C005900D92A030B107D9F712E03A
|
||||
:10F8A000A0E0B1E001C01D92A930B107E1F70E94CC
|
||||
:10F8B000537D0C94B27F0C94007CCF93DF93CDB733
|
||||
:10F8C000DEB724970FB6F894DEBF0FBECDBF8823F6
|
||||
:10F8D00009F481E020E0482F55274115510509F42E
|
||||
:10F8E0003DC0289A19821A821B821C820BC0898112
|
||||
:10F8F0009A81AB81BC810196A11DB11D89839A8338
|
||||
:10F90000AB83BC8389819A81AB81BC8180589E4343
|
||||
:10F91000A040B04060F3289819821A821B821C8292
|
||||
:10F920000BC089819A81AB81BC810196A11DB11D5B
|
||||
:10F9300089839A83AB83BC8389819A81AB81BC81A3
|
||||
:10F9400080509A4FA040B04060F32F5F822F9927DC
|
||||
:10F9500087FD9095841795070CF4C3CF19821A82FE
|
||||
:10F960001B821C8289819A81AB81BC818050914726
|
||||
:10F97000A240B040A0F489819A81AB81BC810196FC
|
||||
:10F98000A11DB11D89839A83AB83BC8389819A8130
|
||||
:10F99000AB81BC8180509147A240B04060F3249677
|
||||
:10F9A0000FB6F894DEBF0FBECDBFDF91CF910895A3
|
||||
:10F9B000EF92FF920F931F93EE24FF248701289864
|
||||
:10F9C0008091C00087FD17C00894E11CF11C011D47
|
||||
:10F9D000111D81E0E81689E0F8068DE3080780E054
|
||||
:10F9E000180770F3E0910001F091010109958091F1
|
||||
:10F9F000C00087FFE9CF289A8091C600992787FD2C
|
||||
:10FA000090951F910F91FF90EF900895982F8091FE
|
||||
:10FA1000C00085FFFCCF9093C60008950E94D87C5B
|
||||
:10FA2000803271F0809102018F5F809302018530F6
|
||||
:10FA300009F00895E0910001F09101010995089500
|
||||
:10FA400084E10E94067D80E10E94067D0895CF93A7
|
||||
:10FA5000C82F0E94D87C803241F0809102018F5FD4
|
||||
:10FA600080930201853081F40AC084E10E94067D02
|
||||
:10FA70008C2F0E94067D80E10E94067D05C0E091EA
|
||||
:10FA80000001F09101010995CF910895282F90E090
|
||||
:10FA900007C08091C0008823E4F78091C6009F5F73
|
||||
:10FAA0009217B8F30895CFEFD8E0DEBFCDBF0000C6
|
||||
:10FAB00094B714BE809160008861809360001092BA
|
||||
:10FAC000600091FF74C189E18093C4001092C50069
|
||||
:10FAD00088E18093C10086E08093C2005098589AD4
|
||||
:10FAE000209A83E00E945D7C81E00E945D7C0E9400
|
||||
:10FAF000D87C8033B9F18133C1F1803409F456C028
|
||||
:10FB0000813409F45CC0823409F46EC0853409F490
|
||||
:10FB100071C0803539F1813509F4F3C0823511F1B6
|
||||
:10FB2000853509F4D3C0863509F4CBC0843609F491
|
||||
:10FB300065C0843709F4EBC0853709F4D2C0863735
|
||||
:10FB400009F44AC0809102018F5F809302018530E1
|
||||
:10FB500071F6E0910001F091010109950E94D87CB5
|
||||
:10FB6000803349F60E940E7DC2CF0E94D87CC82FF8
|
||||
:10FB7000803241F784E10E94067D81E40E94067D87
|
||||
:10FB800086E50E94067D82E50E94067D8C2F0E94FC
|
||||
:10FB9000067D89E40E94067D83E50E94067D80E55E
|
||||
:10FBA0000E94067D80E10E94067DA1CF0E94D87C44
|
||||
:10FBB0008638C0F20E94D87C0E940E7D98CF0E94A9
|
||||
:10FBC000D87C803809F407C1813809F400C1823833
|
||||
:10FBD00009F4F9C0883921F080E00E94277D87CFA1
|
||||
:10FBE00083E00E94277D83CF84E10E94467D0E94AE
|
||||
:10FBF0000E7D7DCF85E00E94467DF9CF0E94D87CA6
|
||||
:10FC0000809306020E94D87C8093050280910802AE
|
||||
:10FC10008E7F809308020E94D87C853409F44BC003
|
||||
:10FC2000E5E0F1E0119281E0E438F807D9F3D0F390
|
||||
:10FC3000C0E0D0E0809105029091060218161906E6
|
||||
:10FC400078F405E011E00E94D87CF80181938F01DF
|
||||
:10FC500021968091050290910602C817D90798F362
|
||||
:10FC60000E94D87C803209F06DCF8091080280FF1D
|
||||
:10FC7000B6C0C0E0D0E02091050230910602121615
|
||||
:10FC80001306B8F4E0910301F0910401A5E0B1E09E
|
||||
:10FC9000F999FECFF2BDE1BD8D9180BDFA9AF99A36
|
||||
:10FCA00031962196C217D30798F3F0930401E0939D
|
||||
:10FCB000030184E175CF809108028160809308027E
|
||||
:10FCC000AFCF84E00E94467D80E087CF0E94D87C41
|
||||
:10FCD000809303010E94D87C809304010E940E7DD2
|
||||
:10FCE00006CF0E94D87C803209F02CCF84E10E949C
|
||||
:10FCF000067D8EE10E94067D85E90E94067D88E0F2
|
||||
:10FD00004FCF0E940E7D88E080936000FFCF0E945D
|
||||
:10FD1000D87C809306020E94D87C809305020E94C2
|
||||
:10FD2000D87C853409F449C0809108028E7F809385
|
||||
:10FD300008028091030190910401880F991F90930C
|
||||
:10FD40000401809303010E94D87C803209F0CFCE59
|
||||
:10FD500084E10E94067DC0E0D0E020910502309150
|
||||
:10FD600006021216130608F01DCFE0910301F09170
|
||||
:10FD700004018091080280FF96C0F999FECFF2BD80
|
||||
:10FD8000E1BDF89A80B50E94067DE0910301F091F3
|
||||
:10FD900004013196F0930401E093030120910502E0
|
||||
:10FDA000309106022196C217D30718F3FBCEE091DB
|
||||
:10FDB0000001F0910101099586CE809108028160D1
|
||||
:10FDC00080930802C0CF80E10E94277D90CE81E021
|
||||
:10FDD0000E94277D8CCE82E00E94277D88CE809174
|
||||
:10FDE000030190910401880F991F9093040180935F
|
||||
:10FDF00003018091050280FF09C080910502909166
|
||||
:10FE0000060201969093060280930502F999FECFAF
|
||||
:10FE10001127E0910301F0910401C5E0D1E0809148
|
||||
:10FE2000050290910602103091F400915700017084
|
||||
:10FE30000130D9F303E000935700E8950091570093
|
||||
:10FE400001700130D9F301E100935700E895099062
|
||||
:10FE500019900091570001700130D9F301E000932F
|
||||
:10FE60005700E8951395103898F011270091570026
|
||||
:10FE700001700130D9F305E000935700E895009137
|
||||
:10FE8000570001700130D9F301E100935700E89564
|
||||
:10FE90003296029709F0C7CF103011F00296E5CFE5
|
||||
:10FEA000112484E17DCE869580FF06C03196F093C3
|
||||
:10FEB0000401E093030176CF84910E94067D209196
|
||||
:10FEC000050230910602E0910301F0910401EECFAA
|
||||
:10FED0001F93CF930E94D87CC82F0E94067D0E945A
|
||||
:10FEE000D87C182F0E94067DC1362CF0C7551136DC
|
||||
:10FEF0003CF0175508C0C033D4F3C0531136CCF7CB
|
||||
:10FF000010330CF01053C295C07FC10F8C2F99276E
|
||||
:10FF100087FD9095CF911F910895CF93282F992712
|
||||
:10FF200087FD9095807F907095958795959587959D
|
||||
:10FF300095958795959587958A303CF0895AC22F7B
|
||||
:10FF4000CF70CA303CF0C95A06C0805DC22FCF7056
|
||||
:10FF5000CA30CCF7C05D0E94067D8C2F0E94067DC2
|
||||
:06FF6000CF910895FFCFD0
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,120 +0,0 @@
|
||||
:10F800000C94387C0C94557C0C94557C0C94557C51
|
||||
:10F810000C94557C0C94557C0C94557C0C94557C24
|
||||
:10F820000C94557C0C94557C0C94557C0C94557C14
|
||||
:10F830000C94557C0C94557C0C94557C0C94557C04
|
||||
:10F840000C94557C0C94557C0C94557C0C94557CF4
|
||||
:10F850000C94557C0C94557C0C94557C0C94557CE4
|
||||
:10F860000C94557C0C94557C0C94557C0C94557CD4
|
||||
:10F8700011241FBECFEFD0E1DEBFCDBF11E0A0E06D
|
||||
:10F88000B1E0EAE5FFEF02C005900D92A030B107AC
|
||||
:10F89000D9F712E0A0E0B1E001C01D92A930B10794
|
||||
:10F8A000E1F70E944D7D0C94AC7F0C94007CCF93CB
|
||||
:10F8B000DF93CDB7DEB724970FB6F894DEBF0FBE47
|
||||
:10F8C000CDBF882309F481E020E0482F552741155A
|
||||
:10F8D000510509F43DC0289A19821A821B821C82A4
|
||||
:10F8E0000BC089819A81AB81BC810196A11DB11D9C
|
||||
:10F8F00089839A83AB83BC8389819A81AB81BC81E4
|
||||
:10F9000080589E43A040B04060F3289819821A8224
|
||||
:10F910001B821C820BC089819A81AB81BC810196BC
|
||||
:10F92000A11DB11D89839A83AB83BC8389819A8190
|
||||
:10F93000AB81BC8180509A4FA040B04060F32F5FF4
|
||||
:10F94000822F992787FD9095841795070CF4C3CFD4
|
||||
:10F9500019821A821B821C8289819A81AB81BC81A7
|
||||
:10F9600080509147A240B040A0F489819A81AB8138
|
||||
:10F97000BC810196A11DB11D89839A83AB83BC8391
|
||||
:10F9800089819A81AB81BC8180509147A240B0406F
|
||||
:10F9900060F324960FB6F894DEBF0FBECDBFDF91A3
|
||||
:10F9A000CF910895EF92FF920F931F93EE24FF24BF
|
||||
:10F9B000870128988091C00087FD17C00894E11C3A
|
||||
:10F9C000F11C011D111D81E0E81689E0F8068DE3A8
|
||||
:10F9D000080780E0180770F3E0910001F091010141
|
||||
:10F9E00009958091C00087FFE9CF289A8091C600D1
|
||||
:10F9F000992787FD90951F910F91FF90EF900895A3
|
||||
:10FA0000982F8091C00085FFFCCF9093C600089589
|
||||
:10FA10000E94D27C803271F0809102018F5F8093CE
|
||||
:10FA20000201853009F00895E0910001F091010193
|
||||
:10FA30000995089584E10E94007D80E10E94007D87
|
||||
:10FA40000895CF93C82F0E94D27C803241F08091DC
|
||||
:10FA500002018F5F80930201853081F40AC084E146
|
||||
:10FA60000E94007D8C2F0E94007D80E10E94007D1D
|
||||
:10FA700005C0E0910001F09101010995CF91089531
|
||||
:10FA8000282F90E007C08091C0008823E4F7809180
|
||||
:10FA9000C6009F5F9217B8F30895CFEFD0E1DEBFA5
|
||||
:10FAA000CDBF000094B714BE809160008861809340
|
||||
:10FAB00060001092600091FF74C189E18093C400DE
|
||||
:10FAC0001092C50088E18093C10086E08093C20057
|
||||
:10FAD0005098589A209A83E00E94577C81E00E94B7
|
||||
:10FAE000577C0E94D27C8033B9F18133C1F18034DC
|
||||
:10FAF00009F456C0813409F45CC0823409F46EC044
|
||||
:10FB0000853409F471C0803539F1813509F4F3C0C9
|
||||
:10FB1000823511F1853509F4D3C0863509F4CBC09F
|
||||
:10FB2000843609F465C0843709F4EBC0853709F4DD
|
||||
:10FB3000D2C0863709F44AC0809102018F5F80935A
|
||||
:10FB40000201853071F6E0910001F0910101099503
|
||||
:10FB50000E94D27C803349F60E94087DC2CF0E9469
|
||||
:10FB6000D27CC82F803241F784E10E94007D81E47D
|
||||
:10FB70000E94007D86E50E94007D82E50E94007D56
|
||||
:10FB80008C2F0E94007D89E40E94007D83E50E9405
|
||||
:10FB9000007D80E50E94007D80E10E94007DA1CF74
|
||||
:10FBA0000E94D27C8638C0F20E94D27C0E94087DDE
|
||||
:10FBB00098CF0E94D27C803809F407C1813809F4BB
|
||||
:10FBC00000C1823809F4F9C0883921F080E00E9430
|
||||
:10FBD000217D87CF83E00E94217D83CF84E10E9435
|
||||
:10FBE000407D0E94087D7DCF85E00E94407DF9CF59
|
||||
:10FBF0000E94D27C809306020E94D27C80930502F0
|
||||
:10FC0000809108028E7F809308020E94D27C853406
|
||||
:10FC100009F44BC0E5E0F1E0119281E0E438F80727
|
||||
:10FC2000D9F3D0F3C0E0D0E08091050290910602B4
|
||||
:10FC30001816190678F405E011E00E94D27CF8014C
|
||||
:10FC400081938F0121968091050290910602C81739
|
||||
:10FC5000D90798F30E94D27C803209F06DCF809151
|
||||
:10FC6000080280FFB6C0C0E0D0E0209105023091CC
|
||||
:10FC7000060212161306B8F4E0910301F091040194
|
||||
:10FC8000A5E0B1E0F999FECFF2BDE1BD8D9180BD57
|
||||
:10FC9000FA9AF99A31962196C217D30798F3F093FE
|
||||
:10FCA0000401E093030184E175CF80910802816033
|
||||
:10FCB00080930802AFCF84E00E94407D80E087CF30
|
||||
:10FCC0000E94D27C809303010E94D27C8093040125
|
||||
:10FCD0000E94087D06CF0E94D27C803209F02CCF92
|
||||
:10FCE00084E10E94007D8EE10E94007D86E90E94F1
|
||||
:10FCF000007D89E04FCF0E94087D88E080936000FE
|
||||
:10FD0000FFCF0E94D27C809306020E94D27C809317
|
||||
:10FD100005020E94D27C853409F449C08091080212
|
||||
:10FD20008E7F809308028091030190910401880FD7
|
||||
:10FD3000991F90930401809303010E94D27C80322A
|
||||
:10FD400009F0CFCE84E10E94007DC0E0D0E0209198
|
||||
:10FD50000502309106021216130608F01DCFE0913D
|
||||
:10FD60000301F09104018091080280FF96C0F99987
|
||||
:10FD7000FECFF2BDE1BDF89A80B50E94007DE09112
|
||||
:10FD80000301F09104013196F0930401E093030123
|
||||
:10FD900020910502309106022196C217D30718F36D
|
||||
:10FDA000FBCEE0910001F0910101099586CE809192
|
||||
:10FDB0000802816080930802C0CF80E10E94217D0B
|
||||
:10FDC00090CE81E00E94217D8CCE82E00E94217D38
|
||||
:10FDD00088CE8091030190910401880F991F909320
|
||||
:10FDE0000401809303018091050280FF09C0809186
|
||||
:10FDF00005029091060201969093060280930502F7
|
||||
:10FE0000F999FECF1127E0910301F0910401C5E0BB
|
||||
:10FE1000D1E08091050290910602103091F400919A
|
||||
:10FE2000570001700130D9F303E000935700E895C3
|
||||
:10FE30000091570001700130D9F301E100935700A0
|
||||
:10FE4000E895099019900091570001700130D9F39D
|
||||
:10FE500001E000935700E8951395103898F01127AA
|
||||
:10FE60000091570001700130D9F305E0009357006D
|
||||
:10FE7000E8950091570001700130D9F301E100933A
|
||||
:10FE80005700E8953296029709F0C7CF103011F06D
|
||||
:10FE90000296E5CF112484E17DCE869580FF06C0D1
|
||||
:10FEA0003196F0930401E093030176CF84910E9490
|
||||
:10FEB000007D2091050230910602E0910301F0914E
|
||||
:10FEC0000401EECF1F93CF930E94D27CC82F0E94D3
|
||||
:10FED000007D0E94D27C182F0E94007DC1362CF03C
|
||||
:10FEE000C75511363CF0175508C0C033D4F3C05382
|
||||
:10FEF0001136CCF710330CF01053C295C07FC10FF0
|
||||
:10FF00008C2F992787FD9095CF911F910895CF93BE
|
||||
:10FF1000282F992787FD9095807F907095958795DC
|
||||
:10FF20009595879595958795959587958A303CF019
|
||||
:10FF3000895AC22FCF70CA303CF0C95A06C0805DC2
|
||||
:10FF4000C22FCF70CA30CCF7C05D0E94007D8C2FCD
|
||||
:0AFF50000E94007DCF910895FFCFBD
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,121 +0,0 @@
|
||||
:10F800000C943E7C0C945B7C0C945B7C0C945B7C39
|
||||
:10F810000C945B7C0C945B7C0C945B7C0C945B7C0C
|
||||
:10F820000C945B7C0C945B7C0C945B7C0C945B7CFC
|
||||
:10F830000C945B7C0C945B7C0C945B7C0C945B7CEC
|
||||
:10F840000C945B7C0C945B7C0C945B7C0C945B7CDC
|
||||
:10F850000C945B7C0C945B7C0C945B7C0C945B7CCC
|
||||
:10F860000C945B7C0C945B7C0C945B7C0C945B7CBC
|
||||
:10F870000C945B7C0C945B7C0C945B7C11241FBE11
|
||||
:10F88000CFEFD0E1DEBFCDBF11E0A0E0B1E0E6E612
|
||||
:10F89000FFEF02C005900D92A030B107D9F712E03A
|
||||
:10F8A000A0E0B1E001C01D92A930B107E1F70E94CC
|
||||
:10F8B000537D0C94B27F0C94007CCF93DF93CDB733
|
||||
:10F8C000DEB724970FB6F894DEBF0FBECDBF8823F6
|
||||
:10F8D00009F481E020E0482F55274115510509F42E
|
||||
:10F8E0003DC0289A19821A821B821C820BC0898112
|
||||
:10F8F0009A81AB81BC810196A11DB11D89839A8338
|
||||
:10F90000AB83BC8389819A81AB81BC8180589E4343
|
||||
:10F91000A040B04060F3289819821A821B821C8292
|
||||
:10F920000BC089819A81AB81BC810196A11DB11D5B
|
||||
:10F9300089839A83AB83BC8389819A81AB81BC81A3
|
||||
:10F9400080509A4FA040B04060F32F5F822F9927DC
|
||||
:10F9500087FD9095841795070CF4C3CF19821A82FE
|
||||
:10F960001B821C8289819A81AB81BC818050914726
|
||||
:10F97000A240B040A0F489819A81AB81BC810196FC
|
||||
:10F98000A11DB11D89839A83AB83BC8389819A8130
|
||||
:10F99000AB81BC8180509147A240B04060F3249677
|
||||
:10F9A0000FB6F894DEBF0FBECDBFDF91CF910895A3
|
||||
:10F9B000EF92FF920F931F93EE24FF248701289864
|
||||
:10F9C0008091C00087FD17C00894E11CF11C011D47
|
||||
:10F9D000111D81E0E81689E0F8068DE3080780E054
|
||||
:10F9E000180770F3E0910001F091010109958091F1
|
||||
:10F9F000C00087FFE9CF289A8091C600992787FD2C
|
||||
:10FA000090951F910F91FF90EF900895982F8091FE
|
||||
:10FA1000C00085FFFCCF9093C60008950E94D87C5B
|
||||
:10FA2000803271F0809102018F5F809302018530F6
|
||||
:10FA300009F00895E0910001F09101010995089500
|
||||
:10FA400084E10E94067D80E10E94067D0895CF93A7
|
||||
:10FA5000C82F0E94D87C803241F0809102018F5FD4
|
||||
:10FA600080930201853081F40AC084E10E94067D02
|
||||
:10FA70008C2F0E94067D80E10E94067D05C0E091EA
|
||||
:10FA80000001F09101010995CF910895282F90E090
|
||||
:10FA900007C08091C0008823E4F78091C6009F5F73
|
||||
:10FAA0009217B8F30895CFEFD0E1DEBFCDBF0000CD
|
||||
:10FAB00094B714BE809160008861809360001092BA
|
||||
:10FAC000600091FF74C189E18093C4001092C50069
|
||||
:10FAD00088E18093C10086E08093C2005098589AD4
|
||||
:10FAE000209A83E00E945D7C81E00E945D7C0E9400
|
||||
:10FAF000D87C8033B9F18133C1F1803409F456C028
|
||||
:10FB0000813409F45CC0823409F46EC0853409F490
|
||||
:10FB100071C0803539F1813509F4F3C0823511F1B6
|
||||
:10FB2000853509F4D3C0863509F4CBC0843609F491
|
||||
:10FB300065C0843709F4EBC0853709F4D2C0863735
|
||||
:10FB400009F44AC0809102018F5F809302018530E1
|
||||
:10FB500071F6E0910001F091010109950E94D87CB5
|
||||
:10FB6000803349F60E940E7DC2CF0E94D87CC82FF8
|
||||
:10FB7000803241F784E10E94067D81E40E94067D87
|
||||
:10FB800086E50E94067D82E50E94067D8C2F0E94FC
|
||||
:10FB9000067D89E40E94067D83E50E94067D80E55E
|
||||
:10FBA0000E94067D80E10E94067DA1CF0E94D87C44
|
||||
:10FBB0008638C0F20E94D87C0E940E7D98CF0E94A9
|
||||
:10FBC000D87C803809F407C1813809F400C1823833
|
||||
:10FBD00009F4F9C0883921F080E00E94277D87CFA1
|
||||
:10FBE00083E00E94277D83CF84E10E94467D0E94AE
|
||||
:10FBF0000E7D7DCF85E00E94467DF9CF0E94D87CA6
|
||||
:10FC0000809306020E94D87C8093050280910802AE
|
||||
:10FC10008E7F809308020E94D87C853409F44BC003
|
||||
:10FC2000E5E0F1E0119281E0E438F807D9F3D0F390
|
||||
:10FC3000C0E0D0E0809105029091060218161906E6
|
||||
:10FC400078F405E011E00E94D87CF80181938F01DF
|
||||
:10FC500021968091050290910602C817D90798F362
|
||||
:10FC60000E94D87C803209F06DCF8091080280FF1D
|
||||
:10FC7000B6C0C0E0D0E02091050230910602121615
|
||||
:10FC80001306B8F4E0910301F0910401A5E0B1E09E
|
||||
:10FC9000F999FECFF2BDE1BD8D9180BDFA9AF99A36
|
||||
:10FCA00031962196C217D30798F3F0930401E0939D
|
||||
:10FCB000030184E175CF809108028160809308027E
|
||||
:10FCC000AFCF84E00E94467D80E087CF0E94D87C41
|
||||
:10FCD000809303010E94D87C809304010E940E7DD2
|
||||
:10FCE00006CF0E94D87C803209F02CCF84E10E949C
|
||||
:10FCF000067D8EE10E94067D86E90E94067D8AE0EF
|
||||
:10FD00004FCF0E940E7D88E080936000FFCF0E945D
|
||||
:10FD1000D87C809306020E94D87C809305020E94C2
|
||||
:10FD2000D87C853409F449C0809108028E7F809385
|
||||
:10FD300008028091030190910401880F991F90930C
|
||||
:10FD40000401809303010E94D87C803209F0CFCE59
|
||||
:10FD500084E10E94067DC0E0D0E020910502309150
|
||||
:10FD600006021216130608F01DCFE0910301F09170
|
||||
:10FD700004018091080280FF96C0F999FECFF2BD80
|
||||
:10FD8000E1BDF89A80B50E94067DE0910301F091F3
|
||||
:10FD900004013196F0930401E093030120910502E0
|
||||
:10FDA000309106022196C217D30718F3FBCEE091DB
|
||||
:10FDB0000001F0910101099586CE809108028160D1
|
||||
:10FDC00080930802C0CF80E10E94277D90CE81E021
|
||||
:10FDD0000E94277D8CCE82E00E94277D88CE809174
|
||||
:10FDE000030190910401880F991F9093040180935F
|
||||
:10FDF00003018091050280FF09C080910502909166
|
||||
:10FE0000060201969093060280930502F999FECFAF
|
||||
:10FE10001127E0910301F0910401C5E0D1E0809148
|
||||
:10FE2000050290910602103091F400915700017084
|
||||
:10FE30000130D9F303E000935700E8950091570093
|
||||
:10FE400001700130D9F301E100935700E895099062
|
||||
:10FE500019900091570001700130D9F301E000932F
|
||||
:10FE60005700E8951395103898F011270091570026
|
||||
:10FE700001700130D9F305E000935700E895009137
|
||||
:10FE8000570001700130D9F301E100935700E89564
|
||||
:10FE90003296029709F0C7CF103011F00296E5CFE5
|
||||
:10FEA000112484E17DCE869580FF06C03196F093C3
|
||||
:10FEB0000401E093030176CF84910E94067D209196
|
||||
:10FEC000050230910602E0910301F0910401EECFAA
|
||||
:10FED0001F93CF930E94D87CC82F0E94067D0E945A
|
||||
:10FEE000D87C182F0E94067DC1362CF0C7551136DC
|
||||
:10FEF0003CF0175508C0C033D4F3C0531136CCF7CB
|
||||
:10FF000010330CF01053C295C07FC10F8C2F99276E
|
||||
:10FF100087FD9095CF911F910895CF93282F992712
|
||||
:10FF200087FD9095807F907095958795959587959D
|
||||
:10FF300095958795959587958A303CF0895AC22F7B
|
||||
:10FF4000CF70CA303CF0C95A06C0805DC22FCF7056
|
||||
:10FF5000CA30CCF7C05D0E94067D8C2F0E94067DC2
|
||||
:06FF6000CF910895FFCFD0
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,56 +0,0 @@
|
||||
# Makefile for ATmegaBOOT
|
||||
# E.Lins, 18.7.2005
|
||||
# $Id$
|
||||
|
||||
|
||||
# program name should not be changed...
|
||||
PROGRAM = ATmegaBOOT_644P
|
||||
|
||||
# enter the target CPU frequency
|
||||
AVR_FREQ = 16000000L
|
||||
|
||||
MCU_TARGET = atmega644p
|
||||
LDSECTION = --section-start=.text=0xF800
|
||||
|
||||
OBJ = $(PROGRAM).o
|
||||
OPTIMIZE = -O2
|
||||
|
||||
DEFS =
|
||||
LIBS =
|
||||
|
||||
CC = avr-gcc
|
||||
|
||||
|
||||
# Override is only needed by avr-lib build system.
|
||||
|
||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
|
||||
override LDFLAGS = -Wl,$(LDSECTION)
|
||||
#override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
|
||||
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
|
||||
all: CFLAGS += '-DMAX_TIME_COUNT=8000000L>>1' -DADABOOT
|
||||
all: $(PROGRAM).hex
|
||||
|
||||
$(PROGRAM).hex: $(PROGRAM).elf
|
||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||
|
||||
$(PROGRAM).elf: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
$(OBJ): ATmegaBOOT.c
|
||||
avr-gcc $(CFLAGS) $(LDFLAGS) -c -g -O2 -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o
|
||||
|
||||
%.lst: %.elf
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
%.srec: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O srec $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Note: This bootloader support ATmega644, ATmega644P and ATmega324P.
|
||||
To build, set PROGRAM and MCU_TARGET in the Makefile according to your target device.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include "WProgram.h"
|
||||
@@ -1,202 +0,0 @@
|
||||
/*
|
||||
HardwareSerial.cpp - Hardware serial library for Wiring
|
||||
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 23 November 2006 by David A. Mellis
|
||||
Modified 28 September 2010 by Mark Sproul
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "wiring.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
// this next line disables the entire HardwareSerial.cpp,
|
||||
// this is so I can support Attiny series and any other chip without a uart
|
||||
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
|
||||
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
// Define constants and variables for buffering incoming serial data. We're
|
||||
// using a ring buffer (I think), in which rx_buffer_head is the index of the
|
||||
// location to which to write the next incoming character and rx_buffer_tail
|
||||
// is the index of the location from which to read.
|
||||
#define RX_BUFFER_SIZE 128
|
||||
|
||||
struct ring_buffer
|
||||
{
|
||||
unsigned char buffer[RX_BUFFER_SIZE];
|
||||
int head;
|
||||
int tail;
|
||||
};
|
||||
|
||||
ring_buffer rx_buffer = { { 0 }, 0, 0 };
|
||||
|
||||
inline void store_char(unsigned char c, ring_buffer *rx_buffer)
|
||||
{
|
||||
int i = (unsigned int)(rx_buffer->head + 1) & (RX_BUFFER_SIZE -1);
|
||||
|
||||
// if we should be storing the received character into the location
|
||||
// just before the tail (meaning that the head would advance to the
|
||||
// current location of the tail), we're about to overflow the buffer
|
||||
// and so we don't write the character or advance the head.
|
||||
if (i != rx_buffer->tail) {
|
||||
rx_buffer->buffer[rx_buffer->head] = c;
|
||||
rx_buffer->head = i;
|
||||
}
|
||||
}
|
||||
|
||||
// fixed by Mark Sproul this is on the 644/644p
|
||||
//SIGNAL(SIG_USART_RECV)
|
||||
SIGNAL(USART0_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR0;
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
|
||||
|
||||
// Constructors ////////////////////////////////////////////////////////////////
|
||||
|
||||
HardwareSerial::HardwareSerial(ring_buffer *rx_buffer,
|
||||
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
|
||||
volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
|
||||
volatile uint8_t *udr,
|
||||
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x)
|
||||
{
|
||||
_rx_buffer = rx_buffer;
|
||||
_ubrrh = ubrrh;
|
||||
_ubrrl = ubrrl;
|
||||
_ucsra = ucsra;
|
||||
_ucsrb = ucsrb;
|
||||
_udr = udr;
|
||||
_rxen = rxen;
|
||||
_txen = txen;
|
||||
_rxcie = rxcie;
|
||||
_udre = udre;
|
||||
_u2x = u2x;
|
||||
}
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
void HardwareSerial::begin(long baud)
|
||||
{
|
||||
uint16_t baud_setting;
|
||||
bool use_u2x = true;
|
||||
|
||||
#if F_CPU == 16000000UL
|
||||
// hardcoded exception for compatibility with the bootloader shipped
|
||||
// with the Duemilanove and previous boards and the firmware on the 8U2
|
||||
// on the Uno and Mega 2560.
|
||||
if (baud == 57600) {
|
||||
use_u2x = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (use_u2x) {
|
||||
*_ucsra = 1 << _u2x;
|
||||
baud_setting = (F_CPU / 4 / baud - 1) / 2;
|
||||
} else {
|
||||
*_ucsra = 0;
|
||||
baud_setting = (F_CPU / 8 / baud - 1) / 2;
|
||||
}
|
||||
|
||||
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
|
||||
*_ubrrh = baud_setting >> 8;
|
||||
*_ubrrl = baud_setting;
|
||||
|
||||
sbi(*_ucsrb, _rxen);
|
||||
sbi(*_ucsrb, _txen);
|
||||
sbi(*_ucsrb, _rxcie);
|
||||
}
|
||||
|
||||
void HardwareSerial::end()
|
||||
{
|
||||
cbi(*_ucsrb, _rxen);
|
||||
cbi(*_ucsrb, _txen);
|
||||
cbi(*_ucsrb, _rxcie);
|
||||
}
|
||||
|
||||
int HardwareSerial::available(void)
|
||||
{
|
||||
return (unsigned int)(RX_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) & (RX_BUFFER_SIZE-1);
|
||||
}
|
||||
|
||||
int HardwareSerial::peek(void)
|
||||
{
|
||||
if (_rx_buffer->head == _rx_buffer->tail) {
|
||||
return -1;
|
||||
} else {
|
||||
return _rx_buffer->buffer[_rx_buffer->tail];
|
||||
}
|
||||
}
|
||||
|
||||
int HardwareSerial::read(void)
|
||||
{
|
||||
// if the head isn't ahead of the tail, we don't have any characters
|
||||
if (_rx_buffer->head == _rx_buffer->tail) {
|
||||
return -1;
|
||||
} else {
|
||||
unsigned char c = _rx_buffer->buffer[_rx_buffer->tail];
|
||||
_rx_buffer->tail = (unsigned int)(_rx_buffer->tail + 1) & (RX_BUFFER_SIZE-1);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareSerial::flush()
|
||||
{
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// were full, not empty.
|
||||
_rx_buffer->head = _rx_buffer->tail;
|
||||
}
|
||||
|
||||
//
|
||||
// Drakelive 2012-09-04
|
||||
//
|
||||
#if ARDUINO >= 100
|
||||
size_t HardwareSerial::write(uint8_t c)
|
||||
{
|
||||
while (!((*_ucsra) & (1 << _udre)))
|
||||
;
|
||||
|
||||
*_udr = c;
|
||||
}
|
||||
#else
|
||||
void HardwareSerial::write(uint8_t c)
|
||||
{
|
||||
while (!((*_ucsra) & (1 << _udre)))
|
||||
;
|
||||
|
||||
*_udr = c;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Drakelive 2012-09-04
|
||||
|
||||
// Preinstantiate Objects //////////////////////////////////////////////////////
|
||||
HardwareSerial Serial(&rx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRE0, U2X0);
|
||||
|
||||
#endif // whole file
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
/*
|
||||
Print.cpp - Base class that provides print() and println()
|
||||
Copyright (c) 2008 David A. Mellis. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 23 November 2006 by David A. Mellis
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "wiring.h"
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
/* default implementation: may be overridden */
|
||||
void Print::write(const char *str)
|
||||
{
|
||||
while (*str)
|
||||
write(*str++);
|
||||
}
|
||||
|
||||
/* default implementation: may be overridden */
|
||||
void Print::write(const uint8_t *buffer, size_t size)
|
||||
{
|
||||
while (size--)
|
||||
write(*buffer++);
|
||||
}
|
||||
|
||||
void Print::print(const String &s)
|
||||
{
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
write(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void Print::print(const char str[])
|
||||
{
|
||||
write(str);
|
||||
}
|
||||
|
||||
void Print::print(char c, int base)
|
||||
{
|
||||
print((long) c, base);
|
||||
}
|
||||
|
||||
void Print::print(unsigned char b, int base)
|
||||
{
|
||||
print((unsigned long) b, base);
|
||||
}
|
||||
|
||||
void Print::print(int n, int base)
|
||||
{
|
||||
print((long) n, base);
|
||||
}
|
||||
|
||||
void Print::print(unsigned int n, int base)
|
||||
{
|
||||
print((unsigned long) n, base);
|
||||
}
|
||||
|
||||
void Print::print(long n, int base)
|
||||
{
|
||||
if (base == 0) {
|
||||
write(n);
|
||||
} else if (base == 10) {
|
||||
if (n < 0) {
|
||||
print('-');
|
||||
n = -n;
|
||||
}
|
||||
printNumber(n, 10);
|
||||
} else {
|
||||
printNumber(n, base);
|
||||
}
|
||||
}
|
||||
|
||||
void Print::print(unsigned long n, int base)
|
||||
{
|
||||
if (base == 0) write(n);
|
||||
else printNumber(n, base);
|
||||
}
|
||||
|
||||
void Print::print(double n, int digits)
|
||||
{
|
||||
printFloat(n, digits);
|
||||
}
|
||||
|
||||
void Print::println(void)
|
||||
{
|
||||
print('\r');
|
||||
print('\n');
|
||||
}
|
||||
|
||||
void Print::println(const String &s)
|
||||
{
|
||||
print(s);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(const char c[])
|
||||
{
|
||||
print(c);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(char c, int base)
|
||||
{
|
||||
print(c, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned char b, int base)
|
||||
{
|
||||
print(b, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(int n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned int n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(long n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned long n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(double n, int digits)
|
||||
{
|
||||
print(n, digits);
|
||||
println();
|
||||
}
|
||||
|
||||
// Private Methods /////////////////////////////////////////////////////////////
|
||||
|
||||
void Print::printNumber(unsigned long n, uint8_t base)
|
||||
{
|
||||
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
|
||||
unsigned long i = 0;
|
||||
|
||||
if (n == 0) {
|
||||
print('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (n > 0) {
|
||||
buf[i++] = n % base;
|
||||
n /= base;
|
||||
}
|
||||
|
||||
for (; i > 0; i--)
|
||||
print((char) (buf[i - 1] < 10 ?
|
||||
'0' + buf[i - 1] :
|
||||
'A' + buf[i - 1] - 10));
|
||||
}
|
||||
|
||||
void Print::printFloat(double number, uint8_t digits)
|
||||
{
|
||||
// Handle negative numbers
|
||||
if (number < 0.0)
|
||||
{
|
||||
print('-');
|
||||
number = -number;
|
||||
}
|
||||
|
||||
// Round correctly so that print(1.999, 2) prints as "2.00"
|
||||
double rounding = 0.5;
|
||||
for (uint8_t i=0; i<digits; ++i)
|
||||
rounding /= 10.0;
|
||||
|
||||
number += rounding;
|
||||
|
||||
// Extract the integer part of the number and print it
|
||||
unsigned long int_part = (unsigned long)number;
|
||||
double remainder = number - (double)int_part;
|
||||
print(int_part);
|
||||
|
||||
// Print the decimal point, but only if there are digits beyond
|
||||
if (digits > 0)
|
||||
print(".");
|
||||
|
||||
// Extract digits from the remainder one at a time
|
||||
while (digits-- > 0)
|
||||
{
|
||||
remainder *= 10.0;
|
||||
int toPrint = int(remainder);
|
||||
print(toPrint);
|
||||
remainder -= toPrint;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
Print.h - Base class that provides print() and println()
|
||||
Copyright (c) 2008 David A. Mellis. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef Print_h
|
||||
#define Print_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h> // for size_t
|
||||
|
||||
#include "WString.h"
|
||||
|
||||
#define DEC 10
|
||||
#define HEX 16
|
||||
#define OCT 8
|
||||
#define BIN 2
|
||||
#define BYTE 0
|
||||
|
||||
class Print
|
||||
{
|
||||
private:
|
||||
void printNumber(unsigned long, uint8_t);
|
||||
void printFloat(double, uint8_t);
|
||||
public:
|
||||
|
||||
//
|
||||
// Drakelive 2012-09-04
|
||||
//
|
||||
#if ARDUINO >= 100
|
||||
virtual size_t write(uint8_t) = 0;
|
||||
#else
|
||||
virtual void write(uint8_t) = 0;
|
||||
#endif
|
||||
|
||||
// Drakelive 2012-09-04
|
||||
|
||||
virtual void write(const char *str);
|
||||
virtual void write(const uint8_t *buffer, size_t size);
|
||||
|
||||
void print(const String &);
|
||||
void print(const char[]);
|
||||
void print(char, int = BYTE);
|
||||
void print(unsigned char, int = BYTE);
|
||||
void print(int, int = DEC);
|
||||
void print(unsigned int, int = DEC);
|
||||
void print(long, int = DEC);
|
||||
void print(unsigned long, int = DEC);
|
||||
void print(double, int = 2);
|
||||
|
||||
void println(const String &s);
|
||||
void println(const char[]);
|
||||
void println(char, int = BYTE);
|
||||
void println(unsigned char, int = BYTE);
|
||||
void println(int, int = DEC);
|
||||
void println(unsigned int, int = DEC);
|
||||
void println(long, int = DEC);
|
||||
void println(unsigned long, int = DEC);
|
||||
void println(double, int = 2);
|
||||
void println(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
#include "wiring.h"
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifndef WProgram_h
|
||||
#define WProgram_h
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "wiring.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "WCharacter.h"
|
||||
#include "WString.h"
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
uint16_t makeWord(uint16_t w);
|
||||
uint16_t makeWord(byte h, byte l);
|
||||
|
||||
#define word(...) makeWord(__VA_ARGS__)
|
||||
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
|
||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
|
||||
void noTone(uint8_t _pin);
|
||||
|
||||
// WMath prototypes
|
||||
long random(long);
|
||||
long random(long, long);
|
||||
void randomSeed(unsigned int);
|
||||
long map(long, long, long, long, long);
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
const static uint8_t A0 = 54;
|
||||
const static uint8_t A1 = 55;
|
||||
const static uint8_t A2 = 56;
|
||||
const static uint8_t A3 = 57;
|
||||
const static uint8_t A4 = 58;
|
||||
const static uint8_t A5 = 59;
|
||||
const static uint8_t A6 = 60;
|
||||
const static uint8_t A7 = 61;
|
||||
const static uint8_t A8 = 62;
|
||||
const static uint8_t A9 = 63;
|
||||
const static uint8_t A10 = 64;
|
||||
const static uint8_t A11 = 65;
|
||||
const static uint8_t A12 = 66;
|
||||
const static uint8_t A13 = 67;
|
||||
const static uint8_t A14 = 68;
|
||||
const static uint8_t A15 = 69;
|
||||
#else
|
||||
const static uint8_t A0 = 14;
|
||||
const static uint8_t A1 = 15;
|
||||
const static uint8_t A2 = 16;
|
||||
const static uint8_t A3 = 17;
|
||||
const static uint8_t A4 = 18;
|
||||
const static uint8_t A5 = 19;
|
||||
const static uint8_t A6 = 20;
|
||||
const static uint8_t A7 = 21;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,443 +0,0 @@
|
||||
/*
|
||||
WString.cpp - String library for Wiring & Arduino
|
||||
Copyright (c) 2009-10 Hernando Barragan. All rights reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "WProgram.h"
|
||||
#include "WString.h"
|
||||
|
||||
|
||||
String::String( const char *value )
|
||||
{
|
||||
if ( value == NULL )
|
||||
value = "";
|
||||
getBuffer( _length = strlen( value ) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, value );
|
||||
}
|
||||
|
||||
String::String( const String &value )
|
||||
{
|
||||
getBuffer( _length = value._length );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, value._buffer );
|
||||
}
|
||||
|
||||
String::String( const char value )
|
||||
{
|
||||
_length = 1;
|
||||
getBuffer(1);
|
||||
if ( _buffer != NULL ) {
|
||||
_buffer[0] = value;
|
||||
_buffer[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
String::String( const unsigned char value )
|
||||
{
|
||||
_length = 1;
|
||||
getBuffer(1);
|
||||
if ( _buffer != NULL) {
|
||||
_buffer[0] = value;
|
||||
_buffer[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
String::String( const int value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
itoa((signed long)value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const unsigned int value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ultoa((unsigned long)value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const long value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ltoa(value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const unsigned long value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ultoa(value, buf, 10);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
char String::charAt( unsigned int loc ) const
|
||||
{
|
||||
return operator[]( loc );
|
||||
}
|
||||
|
||||
void String::setCharAt( unsigned int loc, const char aChar )
|
||||
{
|
||||
if(_buffer == NULL) return;
|
||||
if(_length > loc) {
|
||||
_buffer[loc] = aChar;
|
||||
}
|
||||
}
|
||||
|
||||
int String::compareTo( const String &s2 ) const
|
||||
{
|
||||
return strcmp( _buffer, s2._buffer );
|
||||
}
|
||||
|
||||
const String & String::concat( const String &s2 )
|
||||
{
|
||||
return (*this) += s2;
|
||||
}
|
||||
|
||||
const String & String::operator=( const String &rhs )
|
||||
{
|
||||
if ( this == &rhs )
|
||||
return *this;
|
||||
|
||||
if ( rhs._length > _length )
|
||||
{
|
||||
free(_buffer);
|
||||
getBuffer( rhs._length );
|
||||
}
|
||||
|
||||
if ( _buffer != NULL ) {
|
||||
_length = rhs._length;
|
||||
strcpy( _buffer, rhs._buffer );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//const String & String::operator+=( const char aChar )
|
||||
//{
|
||||
// if ( _length == _capacity )
|
||||
// doubleBuffer();
|
||||
//
|
||||
// _buffer[ _length++ ] = aChar;
|
||||
// _buffer[ _length ] = '\0';
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
const String & String::operator+=( const String &other )
|
||||
{
|
||||
_length += other._length;
|
||||
if ( _length > _capacity )
|
||||
{
|
||||
char *temp = (char *)realloc(_buffer, _length + 1);
|
||||
if ( temp != NULL ) {
|
||||
_buffer = temp;
|
||||
_capacity = _length;
|
||||
} else {
|
||||
_length -= other._length;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
strcat( _buffer, other._buffer );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
int String::operator==( const String &rhs ) const
|
||||
{
|
||||
return ( _length == rhs._length && strcmp( _buffer, rhs._buffer ) == 0 );
|
||||
}
|
||||
|
||||
int String::operator!=( const String &rhs ) const
|
||||
{
|
||||
return ( _length != rhs.length() || strcmp( _buffer, rhs._buffer ) != 0 );
|
||||
}
|
||||
|
||||
int String::operator<( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) < 0;
|
||||
}
|
||||
|
||||
int String::operator>( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) > 0;
|
||||
}
|
||||
|
||||
int String::operator<=( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) <= 0;
|
||||
}
|
||||
|
||||
int String::operator>=( const String & rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) >= 0;
|
||||
}
|
||||
|
||||
char & String::operator[]( unsigned int index )
|
||||
{
|
||||
static char dummy_writable_char;
|
||||
if (index >= _length || !_buffer) {
|
||||
dummy_writable_char = 0;
|
||||
return dummy_writable_char;
|
||||
}
|
||||
return _buffer[ index ];
|
||||
}
|
||||
|
||||
char String::operator[]( unsigned int index ) const
|
||||
{
|
||||
// need to check for valid index, to do later
|
||||
return _buffer[ index ];
|
||||
}
|
||||
|
||||
boolean String::endsWith( const String &s2 ) const
|
||||
{
|
||||
if ( _length < s2._length )
|
||||
return 0;
|
||||
|
||||
return strcmp( &_buffer[ _length - s2._length], s2._buffer ) == 0;
|
||||
}
|
||||
|
||||
boolean String::equals( const String &s2 ) const
|
||||
{
|
||||
return ( _length == s2._length && strcmp( _buffer,s2._buffer ) == 0 );
|
||||
}
|
||||
|
||||
boolean String::equalsIgnoreCase( const String &s2 ) const
|
||||
{
|
||||
if ( this == &s2 )
|
||||
return true; //1;
|
||||
else if ( _length != s2._length )
|
||||
return false; //0;
|
||||
|
||||
return strcmp(toLowerCase()._buffer, s2.toLowerCase()._buffer) == 0;
|
||||
}
|
||||
|
||||
String String::replace( char findChar, char replaceChar )
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String theReturn = _buffer;
|
||||
char* temp = theReturn._buffer;
|
||||
while( (temp = strchr( temp, findChar )) != 0 )
|
||||
*temp = replaceChar;
|
||||
|
||||
return theReturn;
|
||||
}
|
||||
|
||||
String String::replace( const String& match, const String& replace )
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String temp = _buffer, newString;
|
||||
|
||||
int loc;
|
||||
while ( (loc = temp.indexOf( match )) != -1 )
|
||||
{
|
||||
newString += temp.substring( 0, loc );
|
||||
newString += replace;
|
||||
temp = temp.substring( loc + match._length );
|
||||
}
|
||||
newString += temp;
|
||||
return newString;
|
||||
}
|
||||
|
||||
int String::indexOf( char temp ) const
|
||||
{
|
||||
return indexOf( temp, 0 );
|
||||
}
|
||||
|
||||
int String::indexOf( char ch, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
const char* temp = strchr( &_buffer[fromIndex], ch );
|
||||
if ( temp == NULL )
|
||||
return -1;
|
||||
|
||||
return temp - _buffer;
|
||||
}
|
||||
|
||||
int String::indexOf( const String &s2 ) const
|
||||
{
|
||||
return indexOf( s2, 0 );
|
||||
}
|
||||
|
||||
int String::indexOf( const String &s2, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
const char *theFind = strstr( &_buffer[ fromIndex ], s2._buffer );
|
||||
|
||||
if ( theFind == NULL )
|
||||
return -1;
|
||||
|
||||
return theFind - _buffer; // pointer subtraction
|
||||
}
|
||||
|
||||
int String::lastIndexOf( char theChar ) const
|
||||
{
|
||||
return lastIndexOf( theChar, _length - 1 );
|
||||
}
|
||||
|
||||
int String::lastIndexOf( char ch, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
char tempchar = _buffer[fromIndex + 1];
|
||||
_buffer[fromIndex + 1] = '\0';
|
||||
char* temp = strrchr( _buffer, ch );
|
||||
_buffer[fromIndex + 1] = tempchar;
|
||||
|
||||
if ( temp == NULL )
|
||||
return -1;
|
||||
|
||||
return temp - _buffer;
|
||||
}
|
||||
|
||||
int String::lastIndexOf( const String &s2 ) const
|
||||
{
|
||||
return lastIndexOf( s2, _length - s2._length );
|
||||
}
|
||||
|
||||
int String::lastIndexOf( const String &s2, unsigned int fromIndex ) const
|
||||
{
|
||||
// check for empty strings
|
||||
if ( s2._length == 0 || s2._length - 1 > fromIndex || fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
// matching first character
|
||||
char temp = s2[ 0 ];
|
||||
|
||||
for ( int i = fromIndex; i >= 0; i-- )
|
||||
{
|
||||
if ( _buffer[ i ] == temp && (*this).substring( i, i + s2._length ).equals( s2 ) )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
boolean String::startsWith( const String &s2 ) const
|
||||
{
|
||||
if ( _length < s2._length )
|
||||
return 0;
|
||||
|
||||
return startsWith( s2, 0 );
|
||||
}
|
||||
|
||||
boolean String::startsWith( const String &s2, unsigned int offset ) const
|
||||
{
|
||||
if ( offset > _length - s2._length )
|
||||
return 0;
|
||||
|
||||
return strncmp( &_buffer[offset], s2._buffer, s2._length ) == 0;
|
||||
}
|
||||
|
||||
String String::substring( unsigned int left ) const
|
||||
{
|
||||
return substring( left, _length );
|
||||
}
|
||||
|
||||
String String::substring( unsigned int left, unsigned int right ) const
|
||||
{
|
||||
if ( left > right )
|
||||
{
|
||||
int temp = right;
|
||||
right = left;
|
||||
left = temp;
|
||||
}
|
||||
|
||||
if ( right > _length )
|
||||
{
|
||||
right = _length;
|
||||
}
|
||||
|
||||
char temp = _buffer[ right ]; // save the replaced character
|
||||
_buffer[ right ] = '\0';
|
||||
String outPut = ( _buffer + left ); // pointer arithmetic
|
||||
_buffer[ right ] = temp; //restore character
|
||||
return outPut;
|
||||
}
|
||||
|
||||
String String::toLowerCase() const
|
||||
{
|
||||
String temp = _buffer;
|
||||
|
||||
for ( unsigned int i = 0; i < _length; i++ )
|
||||
temp._buffer[ i ] = (char)tolower( temp._buffer[ i ] );
|
||||
return temp;
|
||||
}
|
||||
|
||||
String String::toUpperCase() const
|
||||
{
|
||||
String temp = _buffer;
|
||||
|
||||
for ( unsigned int i = 0; i < _length; i++ )
|
||||
temp._buffer[ i ] = (char)toupper( temp._buffer[ i ] );
|
||||
return temp;
|
||||
}
|
||||
|
||||
String String::trim() const
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String temp = _buffer;
|
||||
unsigned int i,j;
|
||||
|
||||
for ( i = 0; i < _length; i++ )
|
||||
{
|
||||
if ( !isspace(_buffer[i]) )
|
||||
break;
|
||||
}
|
||||
|
||||
for ( j = temp._length - 1; j > i; j-- )
|
||||
{
|
||||
if ( !isspace(_buffer[j]) )
|
||||
break;
|
||||
}
|
||||
|
||||
return temp.substring( i, j + 1);
|
||||
}
|
||||
|
||||
void String::getBytes(unsigned char *buf, unsigned int bufsize)
|
||||
{
|
||||
if (!bufsize || !buf) return;
|
||||
unsigned int len = bufsize - 1;
|
||||
if (len > _length) len = _length;
|
||||
strncpy((char *)buf, _buffer, len);
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
void String::toCharArray(char *buf, unsigned int bufsize)
|
||||
{
|
||||
if (!bufsize || !buf) return;
|
||||
unsigned int len = bufsize - 1;
|
||||
if (len > _length) len = _length;
|
||||
strncpy(buf, _buffer, len);
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
|
||||
long String::toInt() {
|
||||
return atol(_buffer);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
WString.h - String library for Wiring & Arduino
|
||||
Copyright (c) 2009-10 Hernando Barragan. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef String_h
|
||||
#define String_h
|
||||
|
||||
//#include "WProgram.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
class String
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
String( const char *value = "" );
|
||||
String( const String &value );
|
||||
String( const char );
|
||||
String( const unsigned char );
|
||||
String( const int, const int base=10);
|
||||
String( const unsigned int, const int base=10 );
|
||||
String( const long, const int base=10 );
|
||||
String( const unsigned long, const int base=10 );
|
||||
~String() { free(_buffer); _length = _capacity = 0;} //added _length = _capacity = 0;
|
||||
|
||||
// operators
|
||||
const String & operator = ( const String &rhs );
|
||||
const String & operator +=( const String &rhs );
|
||||
//const String & operator +=( const char );
|
||||
int operator ==( const String &rhs ) const;
|
||||
int operator !=( const String &rhs ) const;
|
||||
int operator < ( const String &rhs ) const;
|
||||
int operator > ( const String &rhs ) const;
|
||||
int operator <=( const String &rhs ) const;
|
||||
int operator >=( const String &rhs ) const;
|
||||
char operator []( unsigned int index ) const;
|
||||
char& operator []( unsigned int index );
|
||||
//operator const char *() const { return _buffer; }
|
||||
|
||||
// general methods
|
||||
char charAt( unsigned int index ) const;
|
||||
int compareTo( const String &anotherString ) const;
|
||||
unsigned char endsWith( const String &suffix ) const;
|
||||
unsigned char equals( const String &anObject ) const;
|
||||
unsigned char equalsIgnoreCase( const String &anotherString ) const;
|
||||
int indexOf( char ch ) const;
|
||||
int indexOf( char ch, unsigned int fromIndex ) const;
|
||||
int indexOf( const String &str ) const;
|
||||
int indexOf( const String &str, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( char ch ) const;
|
||||
int lastIndexOf( char ch, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( const String &str ) const;
|
||||
int lastIndexOf( const String &str, unsigned int fromIndex ) const;
|
||||
const unsigned int length( ) const { return _length; }
|
||||
void setCharAt(unsigned int index, const char ch);
|
||||
unsigned char startsWith( const String &prefix ) const;
|
||||
unsigned char startsWith( const String &prefix, unsigned int toffset ) const;
|
||||
String substring( unsigned int beginIndex ) const;
|
||||
String substring( unsigned int beginIndex, unsigned int endIndex ) const;
|
||||
String toLowerCase( ) const;
|
||||
String toUpperCase( ) const;
|
||||
String trim( ) const;
|
||||
void getBytes(unsigned char *buf, unsigned int bufsize);
|
||||
void toCharArray(char *buf, unsigned int bufsize);
|
||||
long toInt( );
|
||||
const String& concat( const String &str );
|
||||
String replace( char oldChar, char newChar );
|
||||
String replace( const String& match, const String& replace );
|
||||
friend String operator + ( String lhs, const String &rhs );
|
||||
|
||||
protected:
|
||||
char *_buffer; // the actual char array
|
||||
unsigned int _capacity; // the array length minus one (for the '\0')
|
||||
unsigned int _length; // the String length (not counting the '\0')
|
||||
|
||||
void getBuffer(unsigned int maxStrLen);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
// allocate buffer space
|
||||
inline void String::getBuffer(unsigned int maxStrLen)
|
||||
{
|
||||
_capacity = maxStrLen;
|
||||
_buffer = (char *) malloc(_capacity + 1);
|
||||
if (_buffer == NULL) _length = _capacity = 0;
|
||||
}
|
||||
|
||||
inline String operator+( String lhs, const String &rhs )
|
||||
{
|
||||
return lhs += rhs;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <WProgram.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
setup();
|
||||
|
||||
for (;;)
|
||||
loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
pins_arduino.c - pin definitions for the Arduino board
|
||||
Part of Arduino / Wiring Lite
|
||||
|
||||
Copyright (c) 2005 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
// On the Sanguino board, digital pins are also used
|
||||
// for the analog output (software PWM). Analog input
|
||||
// pins are a separate set.
|
||||
|
||||
// ATMEL ATMEGA644P / SANGUINO
|
||||
//
|
||||
// +---\/---+
|
||||
// INT0 (D 0) PB0 1| |40 PA0 (AI 0 / D31)
|
||||
// INT1 (D 1) PB1 2| |39 PA1 (AI 1 / D30)
|
||||
// INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29)
|
||||
// PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28)
|
||||
// PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27)
|
||||
// MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26)
|
||||
// MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
|
||||
// SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
|
||||
// RST 9| |32 AREF
|
||||
// VCC 10| |31 GND
|
||||
// GND 11| |30 AVCC
|
||||
// XTAL2 12| |29 PC7 (D 23)
|
||||
// XTAL1 13| |28 PC6 (D 22)
|
||||
// RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
|
||||
// TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
|
||||
// RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS
|
||||
// TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK
|
||||
// PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
|
||||
// PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
|
||||
// PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
|
||||
// +--------+
|
||||
//
|
||||
|
||||
#define PA 1
|
||||
#define PB 2
|
||||
#define PC 3
|
||||
#define PD 4
|
||||
|
||||
// these arrays map port names (e.g. port B) to the
|
||||
// appropriate addresses for various functions (e.g. reading
|
||||
// and writing)
|
||||
const uint8_t PROGMEM port_to_mode_PGM[] =
|
||||
{
|
||||
NOT_A_PORT,
|
||||
(uint8_t) (uint16_t) &DDRA,
|
||||
(uint8_t) (uint16_t) &DDRB,
|
||||
(uint8_t) (uint16_t) &DDRC,
|
||||
(uint8_t) (uint16_t) &DDRD,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM port_to_output_PGM[] =
|
||||
{
|
||||
NOT_A_PORT,
|
||||
(uint8_t) (uint16_t) &PORTA,
|
||||
(uint8_t) (uint16_t) &PORTB,
|
||||
(uint8_t) (uint16_t) &PORTC,
|
||||
(uint8_t) (uint16_t) &PORTD,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM port_to_input_PGM[] =
|
||||
{
|
||||
NOT_A_PORT,
|
||||
(uint8_t) (uint16_t) &PINA,
|
||||
(uint8_t) (uint16_t) &PINB,
|
||||
(uint8_t) (uint16_t) &PINC,
|
||||
(uint8_t) (uint16_t) &PIND,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] =
|
||||
{
|
||||
PB, /* 0 */
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PD, /* 8 */
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PC, /* 16 */
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PA, /* 24 */
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA /* 31 */
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
|
||||
{
|
||||
_BV(0), /* 0, port B */
|
||||
_BV(1),
|
||||
_BV(2),
|
||||
_BV(3),
|
||||
_BV(4),
|
||||
_BV(5),
|
||||
_BV(6),
|
||||
_BV(7),
|
||||
_BV(0), /* 8, port D */
|
||||
_BV(1),
|
||||
_BV(2),
|
||||
_BV(3),
|
||||
_BV(4),
|
||||
_BV(5),
|
||||
_BV(6),
|
||||
_BV(7),
|
||||
_BV(0), /* 16, port C */
|
||||
_BV(1),
|
||||
_BV(2),
|
||||
_BV(3),
|
||||
_BV(4),
|
||||
_BV(5),
|
||||
_BV(6),
|
||||
_BV(7),
|
||||
_BV(7), /* 24, port A */
|
||||
_BV(6),
|
||||
_BV(5),
|
||||
_BV(4),
|
||||
_BV(3),
|
||||
_BV(2),
|
||||
_BV(1),
|
||||
_BV(0)
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
|
||||
{
|
||||
NOT_ON_TIMER, /* 0 - PB0 */
|
||||
NOT_ON_TIMER, /* 1 - PB1 */
|
||||
NOT_ON_TIMER, /* 2 - PB2 */
|
||||
TIMER0A, /* 3 - PB3 */
|
||||
TIMER0B, /* 4 - PB4 */
|
||||
NOT_ON_TIMER, /* 5 - PB5 */
|
||||
NOT_ON_TIMER, /* 6 - PB6 */
|
||||
NOT_ON_TIMER, /* 7 - PB7 */
|
||||
NOT_ON_TIMER, /* 8 - PD0 */
|
||||
NOT_ON_TIMER, /* 9 - PD1 */
|
||||
NOT_ON_TIMER, /* 10 - PD2 */
|
||||
NOT_ON_TIMER, /* 11 - PD3 */
|
||||
TIMER1B, /* 12 - PD4 */
|
||||
TIMER1A, /* 13 - PD5 */
|
||||
TIMER2B, /* 14 - PD6 */
|
||||
TIMER2A, /* 15 - PD7 */
|
||||
NOT_ON_TIMER, /* 16 - PC0 */
|
||||
NOT_ON_TIMER, /* 17 - PC1 */
|
||||
NOT_ON_TIMER, /* 18 - PC2 */
|
||||
NOT_ON_TIMER, /* 19 - PC3 */
|
||||
NOT_ON_TIMER, /* 20 - PC4 */
|
||||
NOT_ON_TIMER, /* 21 - PC5 */
|
||||
NOT_ON_TIMER, /* 22 - PC6 */
|
||||
NOT_ON_TIMER, /* 23 - PC7 */
|
||||
NOT_ON_TIMER, /* 24 - PA0 */
|
||||
NOT_ON_TIMER, /* 25 - PA1 */
|
||||
NOT_ON_TIMER, /* 26 - PA2 */
|
||||
NOT_ON_TIMER, /* 27 - PA3 */
|
||||
NOT_ON_TIMER, /* 28 - PA4 */
|
||||
NOT_ON_TIMER, /* 29 - PA5 */
|
||||
NOT_ON_TIMER, /* 30 - PA6 */
|
||||
NOT_ON_TIMER /* 31 - PA7 */
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
pins_arduino.h - Pin definition functions for Arduino
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2007 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
|
||||
*/
|
||||
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define NOT_A_PIN 0
|
||||
#define NOT_A_PORT 0
|
||||
|
||||
#define NOT_ON_TIMER 0
|
||||
#define TIMER0A 1
|
||||
#define TIMER0B 2
|
||||
#define TIMER1A 3
|
||||
#define TIMER1B 4
|
||||
#define TIMER2 5
|
||||
#define TIMER2A 6
|
||||
#define TIMER2B 7
|
||||
|
||||
extern const uint8_t PROGMEM port_to_mode_PGM[];
|
||||
extern const uint8_t PROGMEM port_to_input_PGM[];
|
||||
extern const uint8_t PROGMEM port_to_output_PGM[];
|
||||
|
||||
extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
|
||||
extern const uint8_t PROGMEM digital_pin_to_bit_PGM[];
|
||||
extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
|
||||
|
||||
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
||||
|
||||
// Get the bit location within the hardware port of the given virtual pin.
|
||||
// This comes from the pins_*.c file for the active board configuration.
|
||||
//
|
||||
// These perform slightly better as macros compared to inline functions
|
||||
//
|
||||
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
|
||||
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
|
||||
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
|
||||
#define analogInPinToBit(P) (P)
|
||||
#define portOutputRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_output_PGM + (P))) )
|
||||
#define portInputRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_input_PGM + (P))) )
|
||||
#define portModeRegister(P) ( (volatile uint8_t *)( (uint16_t) pgm_read_byte( port_to_mode_PGM + (P))) )
|
||||
|
||||
#endif
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
wiring.h - Partial implementation of the Wiring API for the ATmega8.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef Wiring_h
|
||||
#define Wiring_h
|
||||
|
||||
#include <math.h>
|
||||
#include <avr/io.h>
|
||||
#include <stdlib.h>
|
||||
#include "binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#define HIGH 0x1
|
||||
#define LOW 0x0
|
||||
|
||||
#define INPUT 0x0
|
||||
#define OUTPUT 0x1
|
||||
|
||||
#define true 0x1
|
||||
#define false 0x0
|
||||
|
||||
#define PI 3.1415926535897932384626433832795
|
||||
#define HALF_PI 1.5707963267948966192313216916398
|
||||
#define TWO_PI 6.283185307179586476925286766559
|
||||
#define DEG_TO_RAD 0.017453292519943295769236907684886
|
||||
#define RAD_TO_DEG 57.295779513082320876798154814105
|
||||
|
||||
#define SERIAL 0x0
|
||||
#define DISPLAY 0x1
|
||||
|
||||
#define LSBFIRST 0
|
||||
#define MSBFIRST 1
|
||||
|
||||
#define CHANGE 1
|
||||
#define FALLING 2
|
||||
#define RISING 3
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
#define INTERNAL1V1 2
|
||||
#define INTERNAL2V56 3
|
||||
#else
|
||||
#define INTERNAL 3
|
||||
#endif
|
||||
#define DEFAULT 1
|
||||
#define EXTERNAL 0
|
||||
|
||||
// undefine stdlib's abs if encountered
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif
|
||||
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
#define abs(x) ((x)>0?(x):-(x))
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
|
||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#define interrupts() sei()
|
||||
#define noInterrupts() cli()
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
|
||||
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
|
||||
#define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
|
||||
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
#define highByte(w) ((uint8_t) ((w) >> 8))
|
||||
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
|
||||
typedef unsigned int word;
|
||||
|
||||
#define bit(b) (1UL << (b))
|
||||
|
||||
typedef uint8_t boolean;
|
||||
typedef uint8_t byte;
|
||||
|
||||
void init(void);
|
||||
|
||||
void pinMode(uint8_t, uint8_t);
|
||||
void digitalWrite(uint8_t, uint8_t);
|
||||
int digitalRead(uint8_t);
|
||||
int analogRead(uint8_t);
|
||||
void analogReference(uint8_t mode);
|
||||
void analogWrite(uint8_t, int);
|
||||
|
||||
unsigned long millis(void);
|
||||
unsigned long micros(void);
|
||||
void delay(unsigned long);
|
||||
void delayMicroseconds(unsigned int us);
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
|
||||
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
||||
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
||||
|
||||
void attachInterrupt(uint8_t, void (*)(void), int mode);
|
||||
void detachInterrupt(uint8_t);
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,101 +0,0 @@
|
||||
##############################################################
|
||||
|
||||
Gen7-644-16.name=Gen7 with ATmega644 and 16 MHz
|
||||
Gen7-644-16.upload.protocol=stk500v2
|
||||
Gen7-644-16.upload.maximum_size=63488
|
||||
Gen7-644-16.upload.speed=115200
|
||||
Gen7-644-16.bootloader.low_fuses=0xF7
|
||||
Gen7-644-16.bootloader.high_fuses=0xD4
|
||||
Gen7-644-16.bootloader.extended_fuses=0xFD
|
||||
Gen7-644-16.bootloader.path=Gen7
|
||||
Gen7-644-16.bootloader.file=bootloader-644-16MHz.hex
|
||||
Gen7-644-16.bootloader.unlock_bits=0x3F
|
||||
Gen7-644-16.bootloader.lock_bits=0x0F
|
||||
Gen7-644-16.build.mcu=atmega644
|
||||
Gen7-644-16.build.f_cpu=16000000L
|
||||
Gen7-644-16.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
Gen7-644-20.name=Gen7 with ATmega644 and 20 MHz
|
||||
Gen7-644-20.upload.protocol=stk500v2
|
||||
Gen7-644-20.upload.maximum_size=63488
|
||||
Gen7-644-20.upload.speed=115200
|
||||
Gen7-644-20.bootloader.low_fuses=0xF7
|
||||
Gen7-644-20.bootloader.high_fuses=0xD4
|
||||
Gen7-644-20.bootloader.extended_fuses=0xFD
|
||||
Gen7-644-20.bootloader.path=Gen7
|
||||
Gen7-644-20.bootloader.file=bootloader-644-20MHz.hex
|
||||
Gen7-644-20.bootloader.unlock_bits=0x3F
|
||||
Gen7-644-20.bootloader.lock_bits=0x0F
|
||||
Gen7-644-20.build.mcu=atmega644
|
||||
Gen7-644-20.build.f_cpu=20000000L
|
||||
Gen7-644-20.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
Gen7-644P-16.name=Gen7 with ATmega644P and 16 MHz
|
||||
Gen7-644P-16.upload.protocol=stk500v2
|
||||
Gen7-644P-16.upload.maximum_size=63488
|
||||
Gen7-644P-16.upload.speed=115200
|
||||
Gen7-644P-16.bootloader.low_fuses=0xF7
|
||||
Gen7-644P-16.bootloader.high_fuses=0xD4
|
||||
Gen7-644P-16.bootloader.extended_fuses=0xFD
|
||||
Gen7-644P-16.bootloader.path=Gen7
|
||||
Gen7-644P-16.bootloader.file=bootloader-644P-16MHz.hex
|
||||
Gen7-644P-16.bootloader.unlock_bits=0x3F
|
||||
Gen7-644P-16.bootloader.lock_bits=0x0F
|
||||
Gen7-644P-16.build.mcu=atmega644p
|
||||
Gen7-644P-16.build.f_cpu=16000000L
|
||||
Gen7-644P-16.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
Gen7-644P-20.name=Gen7 with ATmega644P and 20 MHz
|
||||
Gen7-644P-20.upload.protocol=stk500v2
|
||||
Gen7-644P-20.upload.maximum_size=63488
|
||||
Gen7-644P-20.upload.speed=115200
|
||||
Gen7-644P-20.bootloader.low_fuses=0xF7
|
||||
Gen7-644P-20.bootloader.high_fuses=0xD4
|
||||
Gen7-644P-20.bootloader.extended_fuses=0xFD
|
||||
Gen7-644P-20.bootloader.path=Gen7
|
||||
Gen7-644P-20.bootloader.file=bootloader-644P-20MHz.hex
|
||||
Gen7-644P-20.bootloader.unlock_bits=0x3F
|
||||
Gen7-644P-20.bootloader.lock_bits=0x0F
|
||||
Gen7-644P-20.build.mcu=atmega644p
|
||||
Gen7-644P-20.build.f_cpu=20000000L
|
||||
Gen7-644P-20.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
Gen7-1284p-16.name=Gen7 with ATmega1284 and 16 MHz
|
||||
Gen7-1284p-16.upload.protocol=stk500v2
|
||||
Gen7-1284p-16.upload.maximum_size=129024
|
||||
Gen7-1284p-16.upload.speed=115200
|
||||
Gen7-1284p-16.bootloader.low_fuses=0xF7
|
||||
Gen7-1284p-16.bootloader.high_fuses=0xD4
|
||||
Gen7-1284p-16.bootloader.extended_fuses=0xFD
|
||||
Gen7-1284p-16.bootloader.path=Gen7
|
||||
Gen7-1284p-16.bootloader.file=bootloader-1284P-16MHz.hex
|
||||
Gen7-1284p-16.bootloader.unlock_bits=0x3F
|
||||
Gen7-1284p-16.bootloader.lock_bits=0x2F
|
||||
Gen7-1284p-16.build.mcu=atmega1284p
|
||||
Gen7-1284p-16.build.f_cpu=16000000L
|
||||
Gen7-1284p-16.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
Gen7-1284p-20.name=Gen7 with ATmega1284 and 20 MHz
|
||||
Gen7-1284p-20.upload.protocol=stk500v2
|
||||
Gen7-1284p-20.upload.maximum_size=129024
|
||||
Gen7-1284p-20.upload.speed=115200
|
||||
Gen7-1284p-20.bootloader.low_fuses=0xF7
|
||||
Gen7-1284p-20.bootloader.high_fuses=0xD4
|
||||
Gen7-1284p-20.bootloader.extended_fuses=0xFD
|
||||
Gen7-1284p-20.bootloader.path=Gen7
|
||||
Gen7-1284p-20.bootloader.file=bootloader-1284P-16MHz.hex
|
||||
Gen7-1284p-20.bootloader.unlock_bits=0x3F
|
||||
Gen7-1284p-20.bootloader.lock_bits=0x2F
|
||||
Gen7-1284p-20.build.mcu=atmega1284p
|
||||
Gen7-1284p-20.build.f_cpu=20000000L
|
||||
Gen7-1284p-20.build.core=arduino
|
||||
@@ -1,113 +0,0 @@
|
||||
:020000021000EC
|
||||
:10F8000011241FBE8FEF90E49EBF8DBF01C32F92C6
|
||||
:10F810003F924F925F926F927F928F929F92AF92A0
|
||||
:10F82000BF92CF92DF92EF92FF920F931F93DF93DD
|
||||
:10F83000CF93CDB7DEB7C252D1400FB6F894DEBF3A
|
||||
:10F840000FBECDBF44245524DD24C25EDE4F188296
|
||||
:10F85000CE51D1408824992454013AC20E9428FFF5
|
||||
:10F86000282F133059F1143028F4113081F0123060
|
||||
:10F8700000F507C0153081F1153030F1163071F701
|
||||
:10F880003DC08B3159F711E05BE1D52EE7CF8130D8
|
||||
:10F8900041F0C25EDE4F3881CE51D140831709F06E
|
||||
:10F8A00019C2D226C25EDE4F2883CE51D14012E06B
|
||||
:10F8B000D5CFF82EEE24D82613E0D0CF90E0E82A5A
|
||||
:10F8C000F92AD22614E0CACF8E3009F003C2D82616
|
||||
:10F8D00015E044245524C2CFE1E0F0E0EC0FFD1F19
|
||||
:10F8E000E40DF51D80830894411C511CD8264E144C
|
||||
:10F8F0005F0409F0B3CF720116E0B0CF8D1509F0A7
|
||||
:10F90000E9C1EAC1CC2447C08D81803311F090E079
|
||||
:10F910000AC08F81882311F49EE105C0813011F067
|
||||
:10F9200095E001C097E91A821B828D818C838E81BC
|
||||
:10F930008D839E831F8247E0E42EF12C88C11A82BA
|
||||
:10F9400068E06B8383E58C8394E59D83EBE4EE8331
|
||||
:10F9500085E38F8380E3888789878FE58A8782E3C1
|
||||
:10F960008B873BE0E32EF12C72C18A81813941F013
|
||||
:10F97000823941F0803911F48FE005C080E003C086
|
||||
:10F9800082E001C08AE01A828B8323E0E22EF12C10
|
||||
:10F990005EC1CC24C3941A8292E0E92EF12C58C1A6
|
||||
:10F9A0008D81882311F48EE128C0813011F085E02B
|
||||
:10F9B00024C087E922C01A8229E0E1E0F0E0209328
|
||||
:10F9C000570084911BC08B81803589F48C818830ED
|
||||
:10F9D00039F439E0E2E0F0E03093570084910DC053
|
||||
:10F9E00069E0E0E0F0E060935700849106C099E0A0
|
||||
:10F9F000E3E0F0E09093570084911A828B831C829D
|
||||
:10FA000084E0E82EF12C23C18A8190E0A0E0B0E0F0
|
||||
:10FA1000B82EAA24992488248B8190E0A0E0B0E03D
|
||||
:10FA2000DC0199278827882A992AAA2ABB2A8D814E
|
||||
:10FA300090E0A0E0B0E0882A992AAA2ABB2A8C810B
|
||||
:10FA400090E0A0E0B0E0BA2FA92F982F8827882A4D
|
||||
:10FA5000992AAA2ABB2A88C0EA81C05EDE4FE883C1
|
||||
:10FA6000C052D140C15EDE4F1882CF51D1408B8150
|
||||
:10FA7000A82FB0E0C15EDE4F28813981CF51D1403F
|
||||
:10FA8000A22BB32B933109F042C075016401CC0C59
|
||||
:10FA9000DD1CEE1CFF1C33E0F601E0925B003093AE
|
||||
:10FAA0005700E89507B600FCFDCF8E01055F1F4F9C
|
||||
:10FAB000F801808161810E5F1F4FA5019401220F23
|
||||
:10FAC000331F441F551F362E222490E0822993298C
|
||||
:10FAD00061E00C01F90140935B0060935700E895E9
|
||||
:10FAE00011240894811C911CA11CB11C129701F7D0
|
||||
:10FAF00085E0F601E0925B0080935700E89507B639
|
||||
:10FB000000FCFDCF81E180935700E8952DC0FE01F8
|
||||
:10FB10003B9620E030E040E050E011977D0100E0AE
|
||||
:10FB200010E00894E11CF11C011D111D6081F99980
|
||||
:10FB3000FECF1FBAC901880D991D92BD81BD60BD60
|
||||
:10FB40000FB6F894FA9AF99A0FBE2F5F3F4F4F4FB6
|
||||
:10FB50005F4F2E153F054007510711F03196E6CF54
|
||||
:10FB6000820E931EA41EB51E1A826EC09A81CE5DAF
|
||||
:10FB7000DE4F9883C252D140CF5DDE4F1882C15212
|
||||
:10FB8000D1408B81C82EDD24CF5DDE4FE881F98125
|
||||
:10FB9000C152D140CE2ADF2A1A8289818431E1F410
|
||||
:10FBA0009601BE016D5F7F4FD501C401880F991F7B
|
||||
:10FBB000AA1FBB1FABBFFC0187919691FB018083FD
|
||||
:10FBC00091836E5F7F4F0894811C911CA11CB11C16
|
||||
:10FBD0002250304049F72EC0BE016D5F7F4F20E0BC
|
||||
:10FBE00030E040E050E00894C108D108760100E020
|
||||
:10FBF00010E00894C11CD11C0894E11CF11C011DEB
|
||||
:10FC0000111DF999FECFC901880D991D92BD81BDC5
|
||||
:10FC1000F89A80B5FB018193BF012F5F3F4F4F4F93
|
||||
:10FC20005F4F2E153F054007510759F7820E931E6F
|
||||
:10FC3000A41EB51E23E0E22EF12CEC0CFD1CFB01F2
|
||||
:10FC4000108205C080EC8A8392E0E92EF12CCC244E
|
||||
:10FC50008BE10E94C7FEC25EDE4F8881CE51D1404B
|
||||
:10FC60000E94C7FE8F2D0E94C7FE8E2D0E94C7FEE8
|
||||
:10FC70008EE00E94C7FE85E1D82EC25EDE4FF8817D
|
||||
:10FC8000CE51D140DF26DE24DF243E010894611CE2
|
||||
:10FC9000711C0AC0F30111913F01812F0E94C7FE20
|
||||
:10FCA000D1260894E108F108E114F10499F78D2DAB
|
||||
:10FCB0000E94C7FECC2009F044C0C25EDE4FF8812E
|
||||
:10FCC000CE51D140FF5FC25EDE4FF883CE51D140AE
|
||||
:10FCD000EE24FF2410E0C2CD9981933109F4BCCE0B
|
||||
:10FCE0009431B0F4933009F440CE943038F491302C
|
||||
:10FCF00009F425CE923009F0A5CF04CE903109F455
|
||||
:10FD000001CE913109F445CE963009F09BCF7CCEDF
|
||||
:10FD1000983109F458CE993150F4953109F49CCEBC
|
||||
:10FD2000953108F423CF963109F08CCF1FCF9B314A
|
||||
:10FD300009F436CE9D3109F4E7CD9A3109F082CF2E
|
||||
:10FD40003ACECE5DDE4F0FB6F894DEBF0FBECDBF0C
|
||||
:10FD5000CF91DF911F910F91FF90EF90DF90CF90A7
|
||||
:10FD6000BF90AF909F908F907F906F905F904F90DB
|
||||
:10FD70003F902F9008958091C00087FFFCCF089599
|
||||
:10FD80008091C00087FFFCCF8091C6000895982F16
|
||||
:10FD90008091C00085FFFCCF9093C60008959B0121
|
||||
:10FDA000AC0197FF11C08091C00082608093C000B9
|
||||
:10FDB00050954095309521953F4F4F4F5F4F60E0F4
|
||||
:10FDC00074E284EF90E009C08091C0008D7F809341
|
||||
:10FDD000C00060E072E18AE790E00E9447FF2C5F7C
|
||||
:10FDE0003F4F4F4F5F4F83E0569547953795279587
|
||||
:10FDF0008A95D1F7215030403093C5002093C4003C
|
||||
:10FE0000089518B817B81F921F921F920895FFCF38
|
||||
:10FE100084B714BE90E083709070892B39F418B8C1
|
||||
:10FE200017B81F921F921F920895FFCF88E1809309
|
||||
:10FE3000C10060E07EE38EEF9FEF0E94CFFE0E9444
|
||||
:10FE400007FC18B817B81F921F921F920895FFCF92
|
||||
:10FE500020E030E040E050E013C02F5F3F4F4F4FB5
|
||||
:10FE60005F4F21308AE6380788E1480780E058076D
|
||||
:10FE700039F418B817B81F921F921F920895FFCF38
|
||||
:10FE80008091C00087FFE9CF0E94C0FE0895A1E2E3
|
||||
:10FE90001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F04
|
||||
:10FEA000FF1FA217B307E407F50720F0A21BB30B4F
|
||||
:10FEB000E40BF50B661F771F881F991F1A9469F7CB
|
||||
:10FEC00060957095809590959B01AC01BD01CF0127
|
||||
:02FED000089593
|
||||
:040000031000F800F1
|
||||
:00000001FF
|
||||
@@ -1,75 +0,0 @@
|
||||
:10F800008FEF90E19EBF8DBF11241FBE5A9A00C09A
|
||||
:10F81000CDB7DEB7CD51D140DEBFCDBF1092C50010
|
||||
:10F8200088E08093C40088E18093C100EE24FF2427
|
||||
:10F8300020E0552400E010E039E0432E9BE0292E23
|
||||
:10F84000312C2C0E3D1ECFC14150504060407040C5
|
||||
:10F8500011F43FE206C08091C00087FFF5CF3091E0
|
||||
:10F86000C600933021F1943028F4913099F0923011
|
||||
:10F87000C8F407C0953049F1953000F19630D1F5C4
|
||||
:10F8800035C03B3119F491E02BE134C03F3291F5A2
|
||||
:10F890003983BBC1313011F0351559F52327532E6B
|
||||
:10F8A00092E028C0B32FA0E0232793E023C0832F4A
|
||||
:10F8B00090E0A82BB92B232794E01CC03E30C9F45C
|
||||
:10F8C000232795E0EE24FF2415C0E1E0F0E0EC0FE3
|
||||
:10F8D000FD1FEE0DFF1D30830894E11CF11C232752
|
||||
:10F8E000EA16FB0639F4D70196E004C0321709F492
|
||||
:10F8F0008CC190E044E755E962E470E0ACCF90E061
|
||||
:10F9000044C08D81803311F090E00AC08F8188233C
|
||||
:10F9100011F49EE105C0813011F099E001C096E933
|
||||
:10F920001A821B828D818C838E818D839E831F82A0
|
||||
:10F9300047E050E0F4C01A8288E08B8381E48C8336
|
||||
:10F9400086E58D8382E58E8389E48F8383E58887CE
|
||||
:10F9500080E589878FE58A8782E38B874BE050E0DB
|
||||
:10F96000DEC08A81813941F0823941F0803911F459
|
||||
:10F970008FE005C080E003C082E001C08AE01A8207
|
||||
:10F980008B8343E050E0CBC091E01A8242E050E02C
|
||||
:10F99000C7C08D81882311F48EE124C0813011F01D
|
||||
:10F9A00089E020C086E91EC01A82E1E0F0E04092C2
|
||||
:10F9B0005700849118C08B81803579F48C81883010
|
||||
:10F9C00031F4E2E0F0E04092570084910BC0E0E0B7
|
||||
:10F9D000F0E040925700849105C0E3E0F0E04092EF
|
||||
:10F9E000570084911A828B831C8244E050E097C0B8
|
||||
:10F9F000BC80AA248D81082F10E00A291B29000F42
|
||||
:10FA0000111F1A828AC09A8088248B81682F70E027
|
||||
:10FA100068297929933109F033C0F7EF0F3F1F07A9
|
||||
:10FA200010F0A8013FC023E0F80120935700E895AB
|
||||
:10FA300007B600FCFDCFA801D1018C9111962C9145
|
||||
:10FA400011971296D22ECC2490E08C299D2921E08A
|
||||
:10FA5000FA010C0120935700E89511244E5F5F4F87
|
||||
:10FA60006250704051F725E0F80120935700E89567
|
||||
:10FA700007B600FCFDCF81E180935700E89512C0E6
|
||||
:10FA8000A801FB01D10141BD52BD4F5F5F4F8D9178
|
||||
:10FA900080BDFA9AF99AF999FECF3197A1F7A8019A
|
||||
:10FAA000460F571F1A828A0138C07A8066248B81DC
|
||||
:10FAB000A82FB0E0A629B7291A828981843191F450
|
||||
:10FAC000BD019E012D5F3F4FF80185919491F90191
|
||||
:10FAD000808391832E5F3F4F0E5F1F4F62507040B7
|
||||
:10FAE00099F713C0A801BD019E012D5F3F4F41BD95
|
||||
:10FAF00052BD4F5F5F4FF89A80B5F90181939F0126
|
||||
:10FB000061507040A1F70A0F1B1FAD014D5F5F4FA1
|
||||
:10FB1000F901108204C080EC8A8342E050E090E05A
|
||||
:10FB2000FBE1F093C6008091C00086FFFCCF80917E
|
||||
:10FB3000C00080648093C0005092C6008091C000D5
|
||||
:10FB400086FFFCCF8091C00080648093C000652F49
|
||||
:10FB50005093C6008091C00086FFFCCF8091C0000A
|
||||
:10FB600080648093C000342F4093C6008091C00011
|
||||
:10FB700086FFFCCF8091C00080648093C0008EE03F
|
||||
:10FB80008093C6008091C00086FFFCCF8091C000AA
|
||||
:10FB900080648093C00025E1252523272627FE01C8
|
||||
:10FBA000319610C030813093C6008091C00086FF2E
|
||||
:10FBB000FCCF31968091C00080648093C0002327E1
|
||||
:10FBC000415050404115510569F72093C60080917E
|
||||
:10FBD000C00086FFFCCF8091C00080648093C0008D
|
||||
:10FBE000992349F4539444E755E962E470E090E0C6
|
||||
:10FBF000A0E0B0E030CE5A9881E180935700E895BC
|
||||
:10FC000011241F921F920895FFCF9981933109F417
|
||||
:10FC1000FACE9431C8F4963009F4EACE973050F415
|
||||
:10FC2000923009F46CCE933009F49BCE913009F0F8
|
||||
:10FC300072CF81CE913109F4A7CE923108F0E1CE96
|
||||
:10FC4000903109F068CF5BCE983109F4B4CE993188
|
||||
:10FC500050F4953109F4D7CE953108F426CF96317A
|
||||
:10FC600009F059CF22CF9B3109F493CE9C3120F477
|
||||
:10FC70009A3109F050CF98CE9D3109F442CE9F328F
|
||||
:06FC800009F049CFB8CFE6
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,75 +0,0 @@
|
||||
:10F800008FEF90E19EBF8DBF11241FBE5A9A00C09A
|
||||
:10F81000CDB7DEB7CD51D140DEBFCDBF1092C50010
|
||||
:10F820008AE08093C40088E18093C100EE24FF2425
|
||||
:10F8300020E0552400E010E039E0432E9BE0292E23
|
||||
:10F84000312C2C0E3D1ECFC14150504060407040C5
|
||||
:10F8500011F43FE206C08091C00087FFF5CF3091E0
|
||||
:10F86000C600933021F1943028F4913099F0923011
|
||||
:10F87000C8F407C0953049F1953000F19630D1F5C4
|
||||
:10F8800035C03B3119F491E02BE134C03F3291F5A2
|
||||
:10F890003983BBC1313011F0351559F52327532E6B
|
||||
:10F8A00092E028C0B32FA0E0232793E023C0832F4A
|
||||
:10F8B00090E0A82BB92B232794E01CC03E30C9F45C
|
||||
:10F8C000232795E0EE24FF2415C0E1E0F0E0EC0FE3
|
||||
:10F8D000FD1FEE0DFF1D30830894E11CF11C232752
|
||||
:10F8E000EA16FB0639F4D70196E004C0321709F492
|
||||
:10F8F0008CC190E041ED5AE363E570E0ACCF90E05D
|
||||
:10F9000044C08D81803311F090E00AC08F8188233C
|
||||
:10F9100011F49EE105C0813011F099E001C096E933
|
||||
:10F920001A821B828D818C838E818D839E831F82A0
|
||||
:10F9300047E050E0F4C01A8288E08B8381E48C8336
|
||||
:10F9400086E58D8382E58E8389E48F8383E58887CE
|
||||
:10F9500080E589878FE58A8782E38B874BE050E0DB
|
||||
:10F96000DEC08A81813941F0823941F0803911F459
|
||||
:10F970008FE005C080E003C082E001C08AE01A8207
|
||||
:10F980008B8343E050E0CBC091E01A8242E050E02C
|
||||
:10F99000C7C08D81882311F48EE124C0813011F01D
|
||||
:10F9A00089E020C086E91EC01A82E1E0F0E04092C2
|
||||
:10F9B0005700849118C08B81803579F48C81883010
|
||||
:10F9C00031F4E2E0F0E04092570084910BC0E0E0B7
|
||||
:10F9D000F0E040925700849105C0E3E0F0E04092EF
|
||||
:10F9E000570084911A828B831C8244E050E097C0B8
|
||||
:10F9F000BC80AA248D81082F10E00A291B29000F42
|
||||
:10FA0000111F1A828AC09A8088248B81682F70E027
|
||||
:10FA100068297929933109F033C0F7EF0F3F1F07A9
|
||||
:10FA200010F0A8013FC023E0F80120935700E895AB
|
||||
:10FA300007B600FCFDCFA801D1018C9111962C9145
|
||||
:10FA400011971296D22ECC2490E08C299D2921E08A
|
||||
:10FA5000FA010C0120935700E89511244E5F5F4F87
|
||||
:10FA60006250704051F725E0F80120935700E89567
|
||||
:10FA700007B600FCFDCF81E180935700E89512C0E6
|
||||
:10FA8000A801FB01D10141BD52BD4F5F5F4F8D9178
|
||||
:10FA900080BDFA9AF99AF999FECF3197A1F7A8019A
|
||||
:10FAA000460F571F1A828A0138C07A8066248B81DC
|
||||
:10FAB000A82FB0E0A629B7291A828981843191F450
|
||||
:10FAC000BD019E012D5F3F4FF80185919491F90191
|
||||
:10FAD000808391832E5F3F4F0E5F1F4F62507040B7
|
||||
:10FAE00099F713C0A801BD019E012D5F3F4F41BD95
|
||||
:10FAF00052BD4F5F5F4FF89A80B5F90181939F0126
|
||||
:10FB000061507040A1F70A0F1B1FAD014D5F5F4FA1
|
||||
:10FB1000F901108204C080EC8A8342E050E090E05A
|
||||
:10FB2000FBE1F093C6008091C00086FFFCCF80917E
|
||||
:10FB3000C00080648093C0005092C6008091C000D5
|
||||
:10FB400086FFFCCF8091C00080648093C000652F49
|
||||
:10FB50005093C6008091C00086FFFCCF8091C0000A
|
||||
:10FB600080648093C000342F4093C6008091C00011
|
||||
:10FB700086FFFCCF8091C00080648093C0008EE03F
|
||||
:10FB80008093C6008091C00086FFFCCF8091C000AA
|
||||
:10FB900080648093C00025E1252523272627FE01C8
|
||||
:10FBA000319610C030813093C6008091C00086FF2E
|
||||
:10FBB000FCCF31968091C00080648093C0002327E1
|
||||
:10FBC000415050404115510569F72093C60080917E
|
||||
:10FBD000C00086FFFCCF8091C00080648093C0008D
|
||||
:10FBE000992349F4539441ED5AE363E570E090E0C2
|
||||
:10FBF000A0E0B0E030CE5A9881E180935700E895BC
|
||||
:10FC000011241F921F920895FFCF9981933109F417
|
||||
:10FC1000FACE9431C8F4963009F4EACE973050F415
|
||||
:10FC2000923009F46CCE933009F49BCE913009F0F8
|
||||
:10FC300072CF81CE913109F4A7CE923108F0E1CE96
|
||||
:10FC4000903109F068CF5BCE983109F4B4CE993188
|
||||
:10FC500050F4953109F4D7CE953108F426CF96317A
|
||||
:10FC600009F059CF22CF9B3109F493CE9C3120F477
|
||||
:10FC70009A3109F050CF98CE9D3109F442CE9F328F
|
||||
:06FC800009F049CFB8CFE6
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,75 +0,0 @@
|
||||
:10F800008FEF90E19EBF8DBF11241FBE5A9A00C09A
|
||||
:10F81000CDB7DEB7CD51D140DEBFCDBF1092C50010
|
||||
:10F8200088E08093C40088E18093C100EE24FF2427
|
||||
:10F8300020E0552400E010E039E0432E93E0292E2B
|
||||
:10F84000312C2C0E3D1ECDC14150504060407040C7
|
||||
:10F8500011F43FE206C08091C00087FFF5CF3091E0
|
||||
:10F86000C600933021F1943028F4913099F0923011
|
||||
:10F87000C8F407C0953049F1953000F19630D1F5C4
|
||||
:10F8800035C03B3119F491E02BE134C03F3291F5A2
|
||||
:10F890003983B9C1313011F0351559F52327532E6D
|
||||
:10F8A00092E028C0B32FA0E0232793E023C0832F4A
|
||||
:10F8B00090E0A82BB92B232794E01CC03E30C9F45C
|
||||
:10F8C000232795E0EE24FF2415C0E1E0F0E0EC0FE3
|
||||
:10F8D000FD1FEE0DFF1D30830894E11CF11C232752
|
||||
:10F8E000EA16FB0639F4D70196E004C0321709F492
|
||||
:10F8F0008AC190E044E755E962E470E0ACCF90E063
|
||||
:10F9000044C08D81803311F090E00AC08F8188233C
|
||||
:10F9100011F49EE105C0813011F09AE001C096E932
|
||||
:10F920001A821B828D818C838E818D839E831F82A0
|
||||
:10F9300047E050E0F2C01A8288E08B8381E48C8338
|
||||
:10F9400086E58D8382E58E8389E48F8383E58887CE
|
||||
:10F9500080E589878FE58A8782E38B874BE050E0DB
|
||||
:10F96000DCC08A81813941F0823941F0803911F45B
|
||||
:10F970008FE005C080E003C082E001C08AE01A8207
|
||||
:10F980008B8343E050E0C9C091E01A8242E050E02E
|
||||
:10F99000C5C08D81882311F48EE124C0813011F01F
|
||||
:10F9A0008AE020C086E91EC01A82E1E0F0E04092C1
|
||||
:10F9B0005700849118C08B81803579F48C81883010
|
||||
:10F9C00031F4E2E0F0E04092570084910BC0E0E0B7
|
||||
:10F9D000F0E040925700849105C0E3E0F0E04092EF
|
||||
:10F9E000570084911A828B831C8244E050E095C0BA
|
||||
:10F9F000BC80AA248D81082F10E00A291B29000F42
|
||||
:10FA0000111F1A8288C09A8088248B81682F70E029
|
||||
:10FA100068297929933109F034C0F7EF0F3F1F07A8
|
||||
:10FA200010F0A80141C023E0F80120935700E895A9
|
||||
:10FA300007B600FCFDCFA801DE011B968C91119644
|
||||
:10FA40002C9111971296D22ECC2490E08C299D29CE
|
||||
:10FA500021E0FA010C0120935700E89511244E5F34
|
||||
:10FA60005F4F6250704051F725E0F8012093570036
|
||||
:10FA7000E89507B600FCFDCF81E180935700E8953B
|
||||
:10FA800013C0A801FB01DE011B9641BD52BD4F5FB3
|
||||
:10FA90005F4F8D9180BDFA9AF99AF999FECF31970F
|
||||
:10FAA000A1F7A801460F571F1A828A0134C07A8035
|
||||
:10FAB00066248B81A82FB0E0A629B7291A828981F4
|
||||
:10FAC000843181F4BD019101F80185919491F9018E
|
||||
:10FAD000808391832E5F3F4F0E5F1F4F62507040B7
|
||||
:10FAE00099F711C0A801BD01910141BD52BD4F5F01
|
||||
:10FAF0005F4FF89A80B5F90181939F016150704082
|
||||
:10FB0000A1F70A0F1B1FAD014D5F5F4FF901108276
|
||||
:10FB100004C080EC8A8342E050E090E0FBE1F09387
|
||||
:10FB2000C6008091C00086FFFCCF8091C000806439
|
||||
:10FB30008093C0005092C6008091C00086FFFCCF29
|
||||
:10FB40008091C00080648093C000652F5093C600F0
|
||||
:10FB50008091C00086FFFCCF8091C00080648093BC
|
||||
:10FB6000C000342F4093C6008091C00086FFFCCFB8
|
||||
:10FB70008091C00080648093C0008EE08093C600B6
|
||||
:10FB80008091C00086FFFCCF8091C000806480938C
|
||||
:10FB9000C00025E1252523272627FE01319610C028
|
||||
:10FBA00030813093C6008091C00086FFFCCF319633
|
||||
:10FBB0008091C00080648093C00023274150504052
|
||||
:10FBC0004115510569F72093C6008091C00086FF5A
|
||||
:10FBD000FCCF8091C00080648093C000992349F4D9
|
||||
:10FBE000539444E755E962E470E090E0A0E0B0E0AF
|
||||
:10FBF00032CE5A9881E180935700E89511241F92E4
|
||||
:10FC00001F920895FFCF9981933109F4FCCE94316E
|
||||
:10FC1000C8F4963009F4ECCE973050F4923009F4E1
|
||||
:10FC20006ECE933009F49DCE913009F072CF83CE21
|
||||
:10FC3000913109F4A9CE923108F0E3CE903109F068
|
||||
:10FC400068CF5DCE983109F4B6CE993150F4953134
|
||||
:10FC500009F4D9CE953108F42ACF963109F059CF5D
|
||||
:10FC600026CF9B3109F495CE9C3120F49A3109F0CE
|
||||
:10FC700050CF9ACE9D3109F444CE9F3209F049CF3E
|
||||
:02FC8000B8CFFB
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,75 +0,0 @@
|
||||
:10F800008FEF90E19EBF8DBF11241FBE5A9A00C09A
|
||||
:10F81000CDB7DEB7CD51D140DEBFCDBF1092C50010
|
||||
:10F820008AE08093C40088E18093C100EE24FF2425
|
||||
:10F8300020E0552400E010E039E0432E93E0292E2B
|
||||
:10F84000312C2C0E3D1ECDC14150504060407040C7
|
||||
:10F8500011F43FE206C08091C00087FFF5CF3091E0
|
||||
:10F86000C600933021F1943028F4913099F0923011
|
||||
:10F87000C8F407C0953049F1953000F19630D1F5C4
|
||||
:10F8800035C03B3119F491E02BE134C03F3291F5A2
|
||||
:10F890003983B9C1313011F0351559F52327532E6D
|
||||
:10F8A00092E028C0B32FA0E0232793E023C0832F4A
|
||||
:10F8B00090E0A82BB92B232794E01CC03E30C9F45C
|
||||
:10F8C000232795E0EE24FF2415C0E1E0F0E0EC0FE3
|
||||
:10F8D000FD1FEE0DFF1D30830894E11CF11C232752
|
||||
:10F8E000EA16FB0639F4D70196E004C0321709F492
|
||||
:10F8F0008AC190E041ED5AE363E570E0ACCF90E05F
|
||||
:10F9000044C08D81803311F090E00AC08F8188233C
|
||||
:10F9100011F49EE105C0813011F09AE001C096E932
|
||||
:10F920001A821B828D818C838E818D839E831F82A0
|
||||
:10F9300047E050E0F2C01A8288E08B8381E48C8338
|
||||
:10F9400086E58D8382E58E8389E48F8383E58887CE
|
||||
:10F9500080E589878FE58A8782E38B874BE050E0DB
|
||||
:10F96000DCC08A81813941F0823941F0803911F45B
|
||||
:10F970008FE005C080E003C082E001C08AE01A8207
|
||||
:10F980008B8343E050E0C9C091E01A8242E050E02E
|
||||
:10F99000C5C08D81882311F48EE124C0813011F01F
|
||||
:10F9A0008AE020C086E91EC01A82E1E0F0E04092C1
|
||||
:10F9B0005700849118C08B81803579F48C81883010
|
||||
:10F9C00031F4E2E0F0E04092570084910BC0E0E0B7
|
||||
:10F9D000F0E040925700849105C0E3E0F0E04092EF
|
||||
:10F9E000570084911A828B831C8244E050E095C0BA
|
||||
:10F9F000BC80AA248D81082F10E00A291B29000F42
|
||||
:10FA0000111F1A8288C09A8088248B81682F70E029
|
||||
:10FA100068297929933109F034C0F7EF0F3F1F07A8
|
||||
:10FA200010F0A80141C023E0F80120935700E895A9
|
||||
:10FA300007B600FCFDCFA801DE011B968C91119644
|
||||
:10FA40002C9111971296D22ECC2490E08C299D29CE
|
||||
:10FA500021E0FA010C0120935700E89511244E5F34
|
||||
:10FA60005F4F6250704051F725E0F8012093570036
|
||||
:10FA7000E89507B600FCFDCF81E180935700E8953B
|
||||
:10FA800013C0A801FB01DE011B9641BD52BD4F5FB3
|
||||
:10FA90005F4F8D9180BDFA9AF99AF999FECF31970F
|
||||
:10FAA000A1F7A801460F571F1A828A0134C07A8035
|
||||
:10FAB00066248B81A82FB0E0A629B7291A828981F4
|
||||
:10FAC000843181F4BD019101F80185919491F9018E
|
||||
:10FAD000808391832E5F3F4F0E5F1F4F62507040B7
|
||||
:10FAE00099F711C0A801BD01910141BD52BD4F5F01
|
||||
:10FAF0005F4FF89A80B5F90181939F016150704082
|
||||
:10FB0000A1F70A0F1B1FAD014D5F5F4FF901108276
|
||||
:10FB100004C080EC8A8342E050E090E0FBE1F09387
|
||||
:10FB2000C6008091C00086FFFCCF8091C000806439
|
||||
:10FB30008093C0005092C6008091C00086FFFCCF29
|
||||
:10FB40008091C00080648093C000652F5093C600F0
|
||||
:10FB50008091C00086FFFCCF8091C00080648093BC
|
||||
:10FB6000C000342F4093C6008091C00086FFFCCFB8
|
||||
:10FB70008091C00080648093C0008EE08093C600B6
|
||||
:10FB80008091C00086FFFCCF8091C000806480938C
|
||||
:10FB9000C00025E1252523272627FE01319610C028
|
||||
:10FBA00030813093C6008091C00086FFFCCF319633
|
||||
:10FBB0008091C00080648093C00023274150504052
|
||||
:10FBC0004115510569F72093C6008091C00086FF5A
|
||||
:10FBD000FCCF8091C00080648093C000992349F4D9
|
||||
:10FBE000539441ED5AE363E570E090E0A0E0B0E0AB
|
||||
:10FBF00032CE5A9881E180935700E89511241F92E4
|
||||
:10FC00001F920895FFCF9981933109F4FCCE94316E
|
||||
:10FC1000C8F4963009F4ECCE973050F4923009F4E1
|
||||
:10FC20006ECE933009F49DCE913009F072CF83CE21
|
||||
:10FC3000913109F4A9CE923108F0E3CE903109F068
|
||||
:10FC400068CF5DCE983109F4B6CE993150F4953134
|
||||
:10FC500009F4D9CE953108F42ACF963109F059CF5D
|
||||
:10FC600026CF9B3109F495CE9C3120F49A3109F0CE
|
||||
:10FC700050CF9ACE9D3109F444CE9F3209F049CF3E
|
||||
:02FC8000B8CFFB
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,239 +0,0 @@
|
||||
/*
|
||||
HardwareSerial.cpp - Hardware serial library for Wiring
|
||||
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 23 November 2006 by David A. Mellis
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "wiring.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
// Define constants and variables for buffering incoming serial data. We're
|
||||
// using a ring buffer (I think), in which rx_buffer_head is the index of the
|
||||
// location to which to write the next incoming character and rx_buffer_tail
|
||||
// is the index of the location from which to read.
|
||||
#define RX_BUFFER_SIZE 128
|
||||
|
||||
struct ring_buffer {
|
||||
unsigned char buffer[RX_BUFFER_SIZE];
|
||||
int head;
|
||||
int tail;
|
||||
};
|
||||
|
||||
ring_buffer rx_buffer = { { 0 }, 0, 0 };
|
||||
|
||||
#ifdef UDR1
|
||||
ring_buffer rx_buffer1 = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
|
||||
#ifdef UDR2
|
||||
ring_buffer rx_buffer2 = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
#ifdef UDR3
|
||||
ring_buffer rx_buffer3 = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
|
||||
inline void store_char(unsigned char c, ring_buffer *rx_buffer)
|
||||
{
|
||||
int i = (rx_buffer->head + 1) % RX_BUFFER_SIZE;
|
||||
|
||||
// if we should be storing the received character into the location
|
||||
// just before the tail (meaning that the head would advance to the
|
||||
// current location of the tail), we're about to overflow the buffer
|
||||
// and so we don't write the character or advance the head.
|
||||
if (i != rx_buffer->tail) {
|
||||
rx_buffer->buffer[rx_buffer->head] = c;
|
||||
rx_buffer->head = i;
|
||||
}
|
||||
}
|
||||
|
||||
ISR(USART0_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR0;
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
|
||||
#ifdef UDR1
|
||||
ISR(USART1_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR1;
|
||||
store_char(c, &rx_buffer1);
|
||||
}
|
||||
|
||||
#ifdef UDR2
|
||||
ISR(USART2_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR2;
|
||||
store_char(c, &rx_buffer2);
|
||||
}
|
||||
|
||||
#ifdef UDR2
|
||||
ISR(USART3_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR3;
|
||||
store_char(c, &rx_buffer3);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__AVR_ATmega8__)
|
||||
SIGNAL(SIG_UART_RECV)
|
||||
#else
|
||||
SIGNAL(USART_RX_vect)
|
||||
#endif
|
||||
{
|
||||
#if defined(__AVR_ATmega8__)
|
||||
unsigned char c = UDR;
|
||||
#else
|
||||
unsigned char c = UDR0;
|
||||
#endif
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Constructors ////////////////////////////////////////////////////////////////
|
||||
|
||||
HardwareSerial::HardwareSerial(ring_buffer *rx_buffer,
|
||||
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
|
||||
volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
|
||||
volatile uint8_t *udr,
|
||||
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x)
|
||||
{
|
||||
_rx_buffer = rx_buffer;
|
||||
_ubrrh = ubrrh;
|
||||
_ubrrl = ubrrl;
|
||||
_ucsra = ucsra;
|
||||
_ucsrb = ucsrb;
|
||||
_udr = udr;
|
||||
_rxen = rxen;
|
||||
_txen = txen;
|
||||
_rxcie = rxcie;
|
||||
_udre = udre;
|
||||
_u2x = u2x;
|
||||
}
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
void HardwareSerial::begin(long baud)
|
||||
{
|
||||
uint16_t baud_setting;
|
||||
bool use_u2x;
|
||||
|
||||
// U2X mode is needed for baud rates higher than (CPU Hz / 16)
|
||||
if (baud > F_CPU / 16) {
|
||||
use_u2x = true;
|
||||
} else {
|
||||
// figure out if U2X mode would allow for a better connection
|
||||
|
||||
// calculate the percent difference between the baud-rate specified and
|
||||
// the real baud rate for both U2X and non-U2X mode (0-255 error percent)
|
||||
uint8_t nonu2x_baud_error = abs((int)(255-((F_CPU/(16*(((F_CPU/8/baud-1)/2)+1))*255)/baud)));
|
||||
uint8_t u2x_baud_error = abs((int)(255-((F_CPU/(8*(((F_CPU/4/baud-1)/2)+1))*255)/baud)));
|
||||
|
||||
// prefer non-U2X mode because it handles clock skew better
|
||||
use_u2x = (nonu2x_baud_error > u2x_baud_error);
|
||||
}
|
||||
|
||||
if (use_u2x) {
|
||||
*_ucsra = 1 << _u2x;
|
||||
baud_setting = (F_CPU / 4 / baud - 1) / 2;
|
||||
} else {
|
||||
*_ucsra = 0;
|
||||
baud_setting = (F_CPU / 8 / baud - 1) / 2;
|
||||
}
|
||||
|
||||
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
|
||||
*_ubrrh = baud_setting >> 8;
|
||||
*_ubrrl = baud_setting;
|
||||
|
||||
sbi(*_ucsrb, _rxen);
|
||||
sbi(*_ucsrb, _txen);
|
||||
sbi(*_ucsrb, _rxcie);
|
||||
}
|
||||
|
||||
void HardwareSerial::end()
|
||||
{
|
||||
cbi(*_ucsrb, _rxen);
|
||||
cbi(*_ucsrb, _txen);
|
||||
cbi(*_ucsrb, _rxcie);
|
||||
}
|
||||
|
||||
uint8_t HardwareSerial::available(void)
|
||||
{
|
||||
return (RX_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % RX_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
int HardwareSerial::read(void)
|
||||
{
|
||||
// if the head isn't ahead of the tail, we don't have any characters
|
||||
if (_rx_buffer->head == _rx_buffer->tail) {
|
||||
return -1;
|
||||
} else {
|
||||
unsigned char c = _rx_buffer->buffer[_rx_buffer->tail];
|
||||
_rx_buffer->tail = (_rx_buffer->tail + 1) % RX_BUFFER_SIZE;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareSerial::flush()
|
||||
{
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// were full, not empty.
|
||||
_rx_buffer->head = _rx_buffer->tail;
|
||||
}
|
||||
|
||||
void HardwareSerial::write(uint8_t c)
|
||||
{
|
||||
while (!((*_ucsra) & (1 << _udre)))
|
||||
;
|
||||
|
||||
*_udr = c;
|
||||
}
|
||||
|
||||
// Preinstantiate Objects //////////////////////////////////////////////////////
|
||||
|
||||
#if defined(__AVR_ATmega8__)
|
||||
HardwareSerial Serial(&rx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRE, U2X);
|
||||
#else
|
||||
HardwareSerial Serial(&rx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRE0, U2X0);
|
||||
#endif
|
||||
|
||||
#ifdef UDR1
|
||||
HardwareSerial Serial1(&rx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UDR1, RXEN1, TXEN1, RXCIE1, UDRE1, U2X1);
|
||||
#endif
|
||||
|
||||
#ifdef UDR2
|
||||
HardwareSerial Serial2(&rx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UDR2, RXEN2, TXEN2, RXCIE2, UDRE2, U2X2);
|
||||
#endif
|
||||
#ifdef UDR3
|
||||
HardwareSerial Serial3(&rx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UDR3, RXEN3, TXEN3, RXCIE3, UDRE3, U2X3);
|
||||
#endif
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
HardwareSerial.h - Hardware serial library for Wiring
|
||||
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef HardwareSerial_h
|
||||
#define HardwareSerial_h
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
struct ring_buffer;
|
||||
|
||||
class HardwareSerial : public Print
|
||||
{
|
||||
private:
|
||||
ring_buffer *_rx_buffer;
|
||||
volatile uint8_t *_ubrrh;
|
||||
volatile uint8_t *_ubrrl;
|
||||
volatile uint8_t *_ucsra;
|
||||
volatile uint8_t *_ucsrb;
|
||||
volatile uint8_t *_udr;
|
||||
uint8_t _rxen;
|
||||
uint8_t _txen;
|
||||
uint8_t _rxcie;
|
||||
uint8_t _udre;
|
||||
uint8_t _u2x;
|
||||
public:
|
||||
HardwareSerial(ring_buffer *rx_buffer,
|
||||
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
|
||||
volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
|
||||
volatile uint8_t *udr,
|
||||
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x);
|
||||
void begin(long);
|
||||
void end();
|
||||
uint8_t available(void);
|
||||
int read(void);
|
||||
void flush(void);
|
||||
virtual void write(uint8_t);
|
||||
using Print::write; // pull in write(str) and write(buf, size) from Print
|
||||
};
|
||||
|
||||
extern HardwareSerial Serial;
|
||||
|
||||
#if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1280__)
|
||||
extern HardwareSerial Serial1;
|
||||
#endif
|
||||
|
||||
#if defined(__AVR_ATmega1280__)
|
||||
extern HardwareSerial Serial2;
|
||||
extern HardwareSerial Serial3;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,243 +0,0 @@
|
||||
# Arduino 0011 Makefile
|
||||
# Arduino adaptation by mellis, eighthave, oli.keller
|
||||
#
|
||||
# This makefile allows you to build sketches from the command line
|
||||
# without the Arduino environment (or Java).
|
||||
#
|
||||
# Detailed instructions for using the makefile:
|
||||
#
|
||||
# 1. Copy this file into the folder with your sketch. There should be a
|
||||
# file with the same name as the folder and with the extension .pde
|
||||
# (e.g. foo.pde in the foo/ folder).
|
||||
#
|
||||
# 2. Modify the line containg "INSTALL_DIR" to point to the directory that
|
||||
# contains the Arduino installation (for example, under Mac OS X, this
|
||||
# might be /Applications/arduino-0012).
|
||||
#
|
||||
# 3. Modify the line containing "PORT" to refer to the filename
|
||||
# representing the USB or serial connection to your Arduino board
|
||||
# (e.g. PORT = /dev/tty.USB0). If the exact name of this file
|
||||
# changes, you can use * as a wildcard (e.g. PORT = /dev/tty.usb*).
|
||||
#
|
||||
# 4. Set the line containing "MCU" to match your board's processor.
|
||||
# Older one's are atmega8 based, newer ones like Arduino Mini, Bluetooth
|
||||
# or Diecimila have the atmega168. If you're using a LilyPad Arduino,
|
||||
# change F_CPU to 8000000.
|
||||
#
|
||||
# 5. At the command line, change to the directory containing your
|
||||
# program's file and the makefile.
|
||||
#
|
||||
# 6. Type "make" and press enter to compile/verify your program.
|
||||
#
|
||||
# 7. Type "make upload", reset your Arduino board, and press enter to
|
||||
# upload your program to the Arduino board.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
TARGET = $(notdir $(CURDIR))
|
||||
INSTALL_DIR = /Users/dmellis/Source/arduino/trunk/build/macosx/build/work
|
||||
PORT = /dev/tty.usb*
|
||||
UPLOAD_RATE = 19200
|
||||
AVRDUDE_PROGRAMMER = stk500v1
|
||||
MCU = atmega168
|
||||
F_CPU = 16000000
|
||||
|
||||
############################################################################
|
||||
# Below here nothing should be changed...
|
||||
|
||||
ARDUINO = $(INSTALL_DIR)/hardware/cores/arduino
|
||||
AVR_TOOLS_PATH = $(INSTALL_DIR)/hardware/tools/avr/bin
|
||||
SRC = $(ARDUINO)/pins_arduino.c $(ARDUINO)/wiring.c \
|
||||
$(ARDUINO)/wiring_analog.c $(ARDUINO)/wiring_digital.c \
|
||||
$(ARDUINO)/wiring_pulse.c $(ARDUINO)/wiring_serial.c \
|
||||
$(ARDUINO)/wiring_shift.c $(ARDUINO)/WInterrupts.c
|
||||
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WMath.cpp
|
||||
FORMAT = ihex
|
||||
|
||||
|
||||
# Name of this Makefile (used for "make depend").
|
||||
MAKEFILE = Makefile
|
||||
|
||||
# Debugging format.
|
||||
# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
|
||||
# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
|
||||
DEBUG = stabs
|
||||
|
||||
OPT = s
|
||||
|
||||
# Place -D or -U options here
|
||||
CDEFS = -DF_CPU=$(F_CPU)
|
||||
CXXDEFS = -DF_CPU=$(F_CPU)
|
||||
|
||||
# Place -I options here
|
||||
CINCS = -I$(ARDUINO)
|
||||
CXXINCS = -I$(ARDUINO)
|
||||
|
||||
# Compiler flag to set the C Standard level.
|
||||
# c89 - "ANSI" C
|
||||
# gnu89 - c89 plus GCC extensions
|
||||
# c99 - ISO C99 standard (not yet fully implemented)
|
||||
# gnu99 - c99 plus GCC extensions
|
||||
CSTANDARD = -std=gnu99
|
||||
CDEBUG = -g$(DEBUG)
|
||||
CWARN = -Wall -Wstrict-prototypes
|
||||
CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
|
||||
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
|
||||
|
||||
CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA)
|
||||
CXXFLAGS = $(CDEFS) $(CINCS) -O$(OPT)
|
||||
#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
|
||||
LDFLAGS = -lm
|
||||
|
||||
|
||||
# Programming support using avrdude. Settings and variables.
|
||||
AVRDUDE_PORT = $(PORT)
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:applet/$(TARGET).hex
|
||||
AVRDUDE_FLAGS = -V -F -C $(INSTALL_DIR)/hardware/tools/avr/etc/avrdude.conf \
|
||||
-p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) \
|
||||
-b $(UPLOAD_RATE)
|
||||
|
||||
# Program settings
|
||||
CC = $(AVR_TOOLS_PATH)/avr-gcc
|
||||
CXX = $(AVR_TOOLS_PATH)/avr-g++
|
||||
OBJCOPY = $(AVR_TOOLS_PATH)/avr-objcopy
|
||||
OBJDUMP = $(AVR_TOOLS_PATH)/avr-objdump
|
||||
AR = $(AVR_TOOLS_PATH)/avr-ar
|
||||
SIZE = $(AVR_TOOLS_PATH)/avr-size
|
||||
NM = $(AVR_TOOLS_PATH)/avr-nm
|
||||
AVRDUDE = $(AVR_TOOLS_PATH)/avrdude
|
||||
REMOVE = rm -f
|
||||
MV = mv -f
|
||||
|
||||
# Define all object files.
|
||||
OBJ = $(SRC:.c=.o) $(CXXSRC:.cpp=.o) $(ASRC:.S=.o)
|
||||
|
||||
# Define all listing files.
|
||||
LST = $(ASRC:.S=.lst) $(CXXSRC:.cpp=.lst) $(SRC:.c=.lst)
|
||||
|
||||
# Combine all necessary flags and optional flags.
|
||||
# Add target processor to flags.
|
||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
|
||||
ALL_CXXFLAGS = -mmcu=$(MCU) -I. $(CXXFLAGS)
|
||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
|
||||
|
||||
|
||||
# Default target.
|
||||
all: applet_files build sizeafter
|
||||
|
||||
build: elf hex
|
||||
|
||||
applet_files: $(TARGET).pde
|
||||
# Here is the "preprocessing".
|
||||
# It creates a .cpp file based with the same name as the .pde file.
|
||||
# On top of the new .cpp file comes the WProgram.h header.
|
||||
# At the end there is a generic main() function attached.
|
||||
# Then the .cpp file will be compiled. Errors during compile will
|
||||
# refer to this new, automatically generated, file.
|
||||
# Not the original .pde file you actually edit...
|
||||
test -d applet || mkdir applet
|
||||
echo '#include "WProgram.h"' > applet/$(TARGET).cpp
|
||||
cat $(TARGET).pde >> applet/$(TARGET).cpp
|
||||
cat $(ARDUINO)/main.cxx >> applet/$(TARGET).cpp
|
||||
|
||||
elf: applet/$(TARGET).elf
|
||||
hex: applet/$(TARGET).hex
|
||||
eep: applet/$(TARGET).eep
|
||||
lss: applet/$(TARGET).lss
|
||||
sym: applet/$(TARGET).sym
|
||||
|
||||
# Program the device.
|
||||
upload: applet/$(TARGET).hex
|
||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH)
|
||||
|
||||
|
||||
# Display size of file.
|
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) applet/$(TARGET).hex
|
||||
ELFSIZE = $(SIZE) applet/$(TARGET).elf
|
||||
sizebefore:
|
||||
@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(HEXSIZE); echo; fi
|
||||
|
||||
sizeafter:
|
||||
@if [ -f applet/$(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(HEXSIZE); echo; fi
|
||||
|
||||
|
||||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
|
||||
COFFCONVERT=$(OBJCOPY) --debugging \
|
||||
--change-section-address .data-0x800000 \
|
||||
--change-section-address .bss-0x800000 \
|
||||
--change-section-address .noinit-0x800000 \
|
||||
--change-section-address .eeprom-0x810000
|
||||
|
||||
|
||||
coff: applet/$(TARGET).elf
|
||||
$(COFFCONVERT) -O coff-avr applet/$(TARGET).elf $(TARGET).cof
|
||||
|
||||
|
||||
extcoff: $(TARGET).elf
|
||||
$(COFFCONVERT) -O coff-ext-avr applet/$(TARGET).elf $(TARGET).cof
|
||||
|
||||
|
||||
.SUFFIXES: .elf .hex .eep .lss .sym
|
||||
|
||||
.elf.hex:
|
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
|
||||
|
||||
.elf.eep:
|
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
|
||||
|
||||
# Create extended listing file from ELF output file.
|
||||
.elf.lss:
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
# Create a symbol table from ELF output file.
|
||||
.elf.sym:
|
||||
$(NM) -n $< > $@
|
||||
|
||||
# Link: create ELF output file from library.
|
||||
applet/$(TARGET).elf: $(TARGET).pde applet/core.a
|
||||
$(CC) $(ALL_CFLAGS) -o $@ applet/$(TARGET).cpp -L. applet/core.a $(LDFLAGS)
|
||||
|
||||
applet/core.a: $(OBJ)
|
||||
@for i in $(OBJ); do echo $(AR) rcs applet/core.a $$i; $(AR) rcs applet/core.a $$i; done
|
||||
|
||||
|
||||
|
||||
# Compile: create object files from C++ source files.
|
||||
.cpp.o:
|
||||
$(CXX) -c $(ALL_CXXFLAGS) $< -o $@
|
||||
|
||||
# Compile: create object files from C source files.
|
||||
.c.o:
|
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Compile: create assembler files from C source files.
|
||||
.c.s:
|
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@
|
||||
|
||||
|
||||
# Assemble: create object files from assembler source files.
|
||||
.S.o:
|
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
# Target: clean project.
|
||||
clean:
|
||||
$(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
|
||||
applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
|
||||
$(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d)
|
||||
|
||||
depend:
|
||||
if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \
|
||||
then \
|
||||
sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \
|
||||
$(MAKEFILE).$$$$ && \
|
||||
$(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \
|
||||
fi
|
||||
echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \
|
||||
>> $(MAKEFILE); \
|
||||
$(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE)
|
||||
|
||||
.PHONY: all build elf hex eep lss sym program coff extcoff clean depend applet_files sizebefore sizeafter
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
Print.cpp - Base class that provides print() and println()
|
||||
Copyright (c) 2008 David A. Mellis. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 23 November 2006 by David A. Mellis
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include "wiring.h"
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
void Print::print(uint8_t b)
|
||||
{
|
||||
this->write(b);
|
||||
}
|
||||
|
||||
void Print::print(char c)
|
||||
{
|
||||
print((byte) c);
|
||||
}
|
||||
|
||||
void Print::print(const char c[])
|
||||
{
|
||||
while (*c)
|
||||
print(*c++);
|
||||
}
|
||||
|
||||
void Print::print(int n)
|
||||
{
|
||||
print((long) n);
|
||||
}
|
||||
|
||||
void Print::print(unsigned int n)
|
||||
{
|
||||
print((unsigned long) n);
|
||||
}
|
||||
|
||||
void Print::print(long n)
|
||||
{
|
||||
if (n < 0) {
|
||||
print('-');
|
||||
n = -n;
|
||||
}
|
||||
printNumber(n, 10);
|
||||
}
|
||||
|
||||
void Print::print(unsigned long n)
|
||||
{
|
||||
printNumber(n, 10);
|
||||
}
|
||||
|
||||
void Print::print(long n, int base)
|
||||
{
|
||||
if (base == 0)
|
||||
print((char) n);
|
||||
else if (base == 10)
|
||||
print(n);
|
||||
else
|
||||
printNumber(n, base);
|
||||
}
|
||||
|
||||
void Print::print(double n)
|
||||
{
|
||||
printFloat(n, 2);
|
||||
}
|
||||
|
||||
void Print::println(void)
|
||||
{
|
||||
print('\r');
|
||||
print('\n');
|
||||
}
|
||||
|
||||
void Print::println(char c)
|
||||
{
|
||||
print(c);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(const char c[])
|
||||
{
|
||||
print(c);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(uint8_t b)
|
||||
{
|
||||
print(b);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(int n)
|
||||
{
|
||||
print(n);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned int n)
|
||||
{
|
||||
print(n);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(long n)
|
||||
{
|
||||
print(n);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned long n)
|
||||
{
|
||||
print(n);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(long n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(double n)
|
||||
{
|
||||
print(n);
|
||||
println();
|
||||
}
|
||||
|
||||
// Private Methods /////////////////////////////////////////////////////////////
|
||||
|
||||
void Print::printNumber(unsigned long n, uint8_t base)
|
||||
{
|
||||
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
|
||||
unsigned long i = 0;
|
||||
|
||||
if (n == 0) {
|
||||
print('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (n > 0) {
|
||||
buf[i++] = n % base;
|
||||
n /= base;
|
||||
}
|
||||
|
||||
for (; i > 0; i--)
|
||||
print((char) (buf[i - 1] < 10 ?
|
||||
'0' + buf[i - 1] :
|
||||
'A' + buf[i - 1] - 10));
|
||||
}
|
||||
|
||||
void Print::printFloat(double number, uint8_t digits)
|
||||
{
|
||||
// Handle negative numbers
|
||||
if (number < 0.0)
|
||||
{
|
||||
print('-');
|
||||
number = -number;
|
||||
}
|
||||
|
||||
// Round correctly so that print(1.999, 2) prints as "2.00"
|
||||
double rounding = 0.5;
|
||||
for (uint8_t i=0; i<digits; ++i)
|
||||
rounding /= 10.0;
|
||||
|
||||
number += rounding;
|
||||
|
||||
// Extract the integer part of the number and print it
|
||||
unsigned long int_part = (unsigned long)number;
|
||||
double remainder = number - (double)int_part;
|
||||
print(int_part);
|
||||
|
||||
// Print the decimal point, but only if there are digits beyond
|
||||
if (digits > 0)
|
||||
print(".");
|
||||
|
||||
// Extract digits from the remainder one at a time
|
||||
while (digits-- > 0)
|
||||
{
|
||||
remainder *= 10.0;
|
||||
int toPrint = int(remainder);
|
||||
print(toPrint);
|
||||
remainder -= toPrint;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
Print.h - Base class that provides print() and println()
|
||||
Copyright (c) 2008 David A. Mellis. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef Print_h
|
||||
#define Print_h
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define DEC 10
|
||||
#define HEX 16
|
||||
#define OCT 8
|
||||
#define BIN 2
|
||||
#define BYTE 0
|
||||
|
||||
class Print
|
||||
{
|
||||
private:
|
||||
void printNumber(unsigned long, uint8_t);
|
||||
void printFloat(double, uint8_t);
|
||||
public:
|
||||
virtual void write(uint8_t);
|
||||
void print(char);
|
||||
void print(const char[]);
|
||||
void print(uint8_t);
|
||||
void print(int);
|
||||
void print(unsigned int);
|
||||
void print(long);
|
||||
void print(unsigned long);
|
||||
void print(long, int);
|
||||
void print(double);
|
||||
void println(void);
|
||||
void println(char);
|
||||
void println(const char[]);
|
||||
void println(uint8_t);
|
||||
void println(int);
|
||||
void println(unsigned int);
|
||||
void println(long);
|
||||
void println(unsigned long);
|
||||
void println(long, int);
|
||||
void println(double);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
#include "wiring.h"
|
||||
@@ -1,87 +0,0 @@
|
||||
/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Wiring project - http://wiring.uniandes.edu.co
|
||||
|
||||
Copyright (c) 2004-05 Hernando Barragan
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
Modified 24 November 2006 by David A. Mellis
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "WConstants.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
|
||||
// volatile static voidFuncPtr twiIntFunc;
|
||||
|
||||
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
{
|
||||
intFunc[interruptNum] = userFunc;
|
||||
|
||||
//clear the config for the change settings
|
||||
EICRA &= ~(B00000011 << (interruptNum * 2));
|
||||
|
||||
//set our mode.
|
||||
EICRA |= (mode << (interruptNum * 2));
|
||||
|
||||
// Enable the interrupt.
|
||||
EIMSK |= (1 << interruptNum);
|
||||
}
|
||||
}
|
||||
|
||||
void detachInterrupt(uint8_t interruptNum)
|
||||
{
|
||||
if(interruptNum < EXTERNAL_NUM_INTERRUPTS)
|
||||
{
|
||||
// Disable the interrupt.
|
||||
EIMSK &= ~(1 << interruptNum);
|
||||
|
||||
intFunc[interruptNum] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ISR(INT0_vect) {
|
||||
if(intFunc[EXTERNAL_INT_0])
|
||||
intFunc[EXTERNAL_INT_0]();
|
||||
}
|
||||
|
||||
ISR(INT1_vect) {
|
||||
if(intFunc[EXTERNAL_INT_1])
|
||||
intFunc[EXTERNAL_INT_1]();
|
||||
}
|
||||
|
||||
ISR(INT2_vect) {
|
||||
if(intFunc[EXTERNAL_INT_2])
|
||||
intFunc[EXTERNAL_INT_2]();
|
||||
}
|
||||
|
||||
/*
|
||||
SIGNAL(SIG_2WIRE_SERIAL) {
|
||||
if(twiIntFunc)
|
||||
twiIntFunc();
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef WProgram_h
|
||||
#define WProgram_h
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "wiring.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "WCharacter.h"
|
||||
#include "WString.h"
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
uint16_t makeWord(uint16_t w);
|
||||
uint16_t makeWord(byte h, byte l);
|
||||
|
||||
#define word(...) makeWord(__VA_ARGS__)
|
||||
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
|
||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
|
||||
void noTone(uint8_t _pin);
|
||||
|
||||
// WMath prototypes
|
||||
long random(long);
|
||||
long random(long, long);
|
||||
void randomSeed(unsigned int);
|
||||
long map(long, long, long, long, long);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,443 +0,0 @@
|
||||
/*
|
||||
WString.cpp - String library for Wiring & Arduino
|
||||
Copyright (c) 2009-10 Hernando Barragan. All rights reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "WProgram.h"
|
||||
#include "WString.h"
|
||||
|
||||
|
||||
String::String( const char *value )
|
||||
{
|
||||
if ( value == NULL )
|
||||
value = "";
|
||||
getBuffer( _length = strlen( value ) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, value );
|
||||
}
|
||||
|
||||
String::String( const String &value )
|
||||
{
|
||||
getBuffer( _length = value._length );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, value._buffer );
|
||||
}
|
||||
|
||||
String::String( const char value )
|
||||
{
|
||||
_length = 1;
|
||||
getBuffer(1);
|
||||
if ( _buffer != NULL ) {
|
||||
_buffer[0] = value;
|
||||
_buffer[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
String::String( const unsigned char value )
|
||||
{
|
||||
_length = 1;
|
||||
getBuffer(1);
|
||||
if ( _buffer != NULL) {
|
||||
_buffer[0] = value;
|
||||
_buffer[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
String::String( const int value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
itoa((signed long)value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const unsigned int value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ultoa((unsigned long)value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const long value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ltoa(value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const unsigned long value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ultoa(value, buf, 10);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
char String::charAt( unsigned int loc ) const
|
||||
{
|
||||
return operator[]( loc );
|
||||
}
|
||||
|
||||
void String::setCharAt( unsigned int loc, const char aChar )
|
||||
{
|
||||
if(_buffer == NULL) return;
|
||||
if(_length > loc) {
|
||||
_buffer[loc] = aChar;
|
||||
}
|
||||
}
|
||||
|
||||
int String::compareTo( const String &s2 ) const
|
||||
{
|
||||
return strcmp( _buffer, s2._buffer );
|
||||
}
|
||||
|
||||
const String & String::concat( const String &s2 )
|
||||
{
|
||||
return (*this) += s2;
|
||||
}
|
||||
|
||||
const String & String::operator=( const String &rhs )
|
||||
{
|
||||
if ( this == &rhs )
|
||||
return *this;
|
||||
|
||||
if ( rhs._length > _length )
|
||||
{
|
||||
free(_buffer);
|
||||
getBuffer( rhs._length );
|
||||
}
|
||||
|
||||
if ( _buffer != NULL ) {
|
||||
_length = rhs._length;
|
||||
strcpy( _buffer, rhs._buffer );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//const String & String::operator+=( const char aChar )
|
||||
//{
|
||||
// if ( _length == _capacity )
|
||||
// doubleBuffer();
|
||||
//
|
||||
// _buffer[ _length++ ] = aChar;
|
||||
// _buffer[ _length ] = '\0';
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
const String & String::operator+=( const String &other )
|
||||
{
|
||||
_length += other._length;
|
||||
if ( _length > _capacity )
|
||||
{
|
||||
char *temp = (char *)realloc(_buffer, _length + 1);
|
||||
if ( temp != NULL ) {
|
||||
_buffer = temp;
|
||||
_capacity = _length;
|
||||
} else {
|
||||
_length -= other._length;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
strcat( _buffer, other._buffer );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
int String::operator==( const String &rhs ) const
|
||||
{
|
||||
return ( _length == rhs._length && strcmp( _buffer, rhs._buffer ) == 0 );
|
||||
}
|
||||
|
||||
int String::operator!=( const String &rhs ) const
|
||||
{
|
||||
return ( _length != rhs.length() || strcmp( _buffer, rhs._buffer ) != 0 );
|
||||
}
|
||||
|
||||
int String::operator<( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) < 0;
|
||||
}
|
||||
|
||||
int String::operator>( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) > 0;
|
||||
}
|
||||
|
||||
int String::operator<=( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) <= 0;
|
||||
}
|
||||
|
||||
int String::operator>=( const String & rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) >= 0;
|
||||
}
|
||||
|
||||
char & String::operator[]( unsigned int index )
|
||||
{
|
||||
static char dummy_writable_char;
|
||||
if (index >= _length || !_buffer) {
|
||||
dummy_writable_char = 0;
|
||||
return dummy_writable_char;
|
||||
}
|
||||
return _buffer[ index ];
|
||||
}
|
||||
|
||||
char String::operator[]( unsigned int index ) const
|
||||
{
|
||||
// need to check for valid index, to do later
|
||||
return _buffer[ index ];
|
||||
}
|
||||
|
||||
boolean String::endsWith( const String &s2 ) const
|
||||
{
|
||||
if ( _length < s2._length )
|
||||
return 0;
|
||||
|
||||
return strcmp( &_buffer[ _length - s2._length], s2._buffer ) == 0;
|
||||
}
|
||||
|
||||
boolean String::equals( const String &s2 ) const
|
||||
{
|
||||
return ( _length == s2._length && strcmp( _buffer,s2._buffer ) == 0 );
|
||||
}
|
||||
|
||||
boolean String::equalsIgnoreCase( const String &s2 ) const
|
||||
{
|
||||
if ( this == &s2 )
|
||||
return true; //1;
|
||||
else if ( _length != s2._length )
|
||||
return false; //0;
|
||||
|
||||
return strcmp(toLowerCase()._buffer, s2.toLowerCase()._buffer) == 0;
|
||||
}
|
||||
|
||||
String String::replace( char findChar, char replaceChar )
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String theReturn = _buffer;
|
||||
char* temp = theReturn._buffer;
|
||||
while( (temp = strchr( temp, findChar )) != 0 )
|
||||
*temp = replaceChar;
|
||||
|
||||
return theReturn;
|
||||
}
|
||||
|
||||
String String::replace( const String& match, const String& replace )
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String temp = _buffer, newString;
|
||||
|
||||
int loc;
|
||||
while ( (loc = temp.indexOf( match )) != -1 )
|
||||
{
|
||||
newString += temp.substring( 0, loc );
|
||||
newString += replace;
|
||||
temp = temp.substring( loc + match._length );
|
||||
}
|
||||
newString += temp;
|
||||
return newString;
|
||||
}
|
||||
|
||||
int String::indexOf( char temp ) const
|
||||
{
|
||||
return indexOf( temp, 0 );
|
||||
}
|
||||
|
||||
int String::indexOf( char ch, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
const char* temp = strchr( &_buffer[fromIndex], ch );
|
||||
if ( temp == NULL )
|
||||
return -1;
|
||||
|
||||
return temp - _buffer;
|
||||
}
|
||||
|
||||
int String::indexOf( const String &s2 ) const
|
||||
{
|
||||
return indexOf( s2, 0 );
|
||||
}
|
||||
|
||||
int String::indexOf( const String &s2, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
const char *theFind = strstr( &_buffer[ fromIndex ], s2._buffer );
|
||||
|
||||
if ( theFind == NULL )
|
||||
return -1;
|
||||
|
||||
return theFind - _buffer; // pointer subtraction
|
||||
}
|
||||
|
||||
int String::lastIndexOf( char theChar ) const
|
||||
{
|
||||
return lastIndexOf( theChar, _length - 1 );
|
||||
}
|
||||
|
||||
int String::lastIndexOf( char ch, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
char tempchar = _buffer[fromIndex + 1];
|
||||
_buffer[fromIndex + 1] = '\0';
|
||||
char* temp = strrchr( _buffer, ch );
|
||||
_buffer[fromIndex + 1] = tempchar;
|
||||
|
||||
if ( temp == NULL )
|
||||
return -1;
|
||||
|
||||
return temp - _buffer;
|
||||
}
|
||||
|
||||
int String::lastIndexOf( const String &s2 ) const
|
||||
{
|
||||
return lastIndexOf( s2, _length - s2._length );
|
||||
}
|
||||
|
||||
int String::lastIndexOf( const String &s2, unsigned int fromIndex ) const
|
||||
{
|
||||
// check for empty strings
|
||||
if ( s2._length == 0 || s2._length - 1 > fromIndex || fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
// matching first character
|
||||
char temp = s2[ 0 ];
|
||||
|
||||
for ( int i = fromIndex; i >= 0; i-- )
|
||||
{
|
||||
if ( _buffer[ i ] == temp && (*this).substring( i, i + s2._length ).equals( s2 ) )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
boolean String::startsWith( const String &s2 ) const
|
||||
{
|
||||
if ( _length < s2._length )
|
||||
return 0;
|
||||
|
||||
return startsWith( s2, 0 );
|
||||
}
|
||||
|
||||
boolean String::startsWith( const String &s2, unsigned int offset ) const
|
||||
{
|
||||
if ( offset > _length - s2._length )
|
||||
return 0;
|
||||
|
||||
return strncmp( &_buffer[offset], s2._buffer, s2._length ) == 0;
|
||||
}
|
||||
|
||||
String String::substring( unsigned int left ) const
|
||||
{
|
||||
return substring( left, _length );
|
||||
}
|
||||
|
||||
String String::substring( unsigned int left, unsigned int right ) const
|
||||
{
|
||||
if ( left > right )
|
||||
{
|
||||
int temp = right;
|
||||
right = left;
|
||||
left = temp;
|
||||
}
|
||||
|
||||
if ( right > _length )
|
||||
{
|
||||
right = _length;
|
||||
}
|
||||
|
||||
char temp = _buffer[ right ]; // save the replaced character
|
||||
_buffer[ right ] = '\0';
|
||||
String outPut = ( _buffer + left ); // pointer arithmetic
|
||||
_buffer[ right ] = temp; //restore character
|
||||
return outPut;
|
||||
}
|
||||
|
||||
String String::toLowerCase() const
|
||||
{
|
||||
String temp = _buffer;
|
||||
|
||||
for ( unsigned int i = 0; i < _length; i++ )
|
||||
temp._buffer[ i ] = (char)tolower( temp._buffer[ i ] );
|
||||
return temp;
|
||||
}
|
||||
|
||||
String String::toUpperCase() const
|
||||
{
|
||||
String temp = _buffer;
|
||||
|
||||
for ( unsigned int i = 0; i < _length; i++ )
|
||||
temp._buffer[ i ] = (char)toupper( temp._buffer[ i ] );
|
||||
return temp;
|
||||
}
|
||||
|
||||
String String::trim() const
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String temp = _buffer;
|
||||
unsigned int i,j;
|
||||
|
||||
for ( i = 0; i < _length; i++ )
|
||||
{
|
||||
if ( !isspace(_buffer[i]) )
|
||||
break;
|
||||
}
|
||||
|
||||
for ( j = temp._length - 1; j > i; j-- )
|
||||
{
|
||||
if ( !isspace(_buffer[j]) )
|
||||
break;
|
||||
}
|
||||
|
||||
return temp.substring( i, j + 1);
|
||||
}
|
||||
|
||||
void String::getBytes(unsigned char *buf, unsigned int bufsize)
|
||||
{
|
||||
if (!bufsize || !buf) return;
|
||||
unsigned int len = bufsize - 1;
|
||||
if (len > _length) len = _length;
|
||||
strncpy((char *)buf, _buffer, len);
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
void String::toCharArray(char *buf, unsigned int bufsize)
|
||||
{
|
||||
if (!bufsize || !buf) return;
|
||||
unsigned int len = bufsize - 1;
|
||||
if (len > _length) len = _length;
|
||||
strncpy(buf, _buffer, len);
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
|
||||
long String::toInt() {
|
||||
return atol(_buffer);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
WString.h - String library for Wiring & Arduino
|
||||
Copyright (c) 2009-10 Hernando Barragan. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef String_h
|
||||
#define String_h
|
||||
|
||||
//#include "WProgram.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
class String
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
String( const char *value = "" );
|
||||
String( const String &value );
|
||||
String( const char );
|
||||
String( const unsigned char );
|
||||
String( const int, const int base=10);
|
||||
String( const unsigned int, const int base=10 );
|
||||
String( const long, const int base=10 );
|
||||
String( const unsigned long, const int base=10 );
|
||||
~String() { free(_buffer); _length = _capacity = 0;} //added _length = _capacity = 0;
|
||||
|
||||
// operators
|
||||
const String & operator = ( const String &rhs );
|
||||
const String & operator +=( const String &rhs );
|
||||
//const String & operator +=( const char );
|
||||
int operator ==( const String &rhs ) const;
|
||||
int operator !=( const String &rhs ) const;
|
||||
int operator < ( const String &rhs ) const;
|
||||
int operator > ( const String &rhs ) const;
|
||||
int operator <=( const String &rhs ) const;
|
||||
int operator >=( const String &rhs ) const;
|
||||
char operator []( unsigned int index ) const;
|
||||
char& operator []( unsigned int index );
|
||||
//operator const char *() const { return _buffer; }
|
||||
|
||||
// general methods
|
||||
char charAt( unsigned int index ) const;
|
||||
int compareTo( const String &anotherString ) const;
|
||||
unsigned char endsWith( const String &suffix ) const;
|
||||
unsigned char equals( const String &anObject ) const;
|
||||
unsigned char equalsIgnoreCase( const String &anotherString ) const;
|
||||
int indexOf( char ch ) const;
|
||||
int indexOf( char ch, unsigned int fromIndex ) const;
|
||||
int indexOf( const String &str ) const;
|
||||
int indexOf( const String &str, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( char ch ) const;
|
||||
int lastIndexOf( char ch, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( const String &str ) const;
|
||||
int lastIndexOf( const String &str, unsigned int fromIndex ) const;
|
||||
const unsigned int length( ) const { return _length; }
|
||||
void setCharAt(unsigned int index, const char ch);
|
||||
unsigned char startsWith( const String &prefix ) const;
|
||||
unsigned char startsWith( const String &prefix, unsigned int toffset ) const;
|
||||
String substring( unsigned int beginIndex ) const;
|
||||
String substring( unsigned int beginIndex, unsigned int endIndex ) const;
|
||||
String toLowerCase( ) const;
|
||||
String toUpperCase( ) const;
|
||||
String trim( ) const;
|
||||
void getBytes(unsigned char *buf, unsigned int bufsize);
|
||||
void toCharArray(char *buf, unsigned int bufsize);
|
||||
long toInt( );
|
||||
const String& concat( const String &str );
|
||||
String replace( char oldChar, char newChar );
|
||||
String replace( const String& match, const String& replace );
|
||||
friend String operator + ( String lhs, const String &rhs );
|
||||
|
||||
protected:
|
||||
char *_buffer; // the actual char array
|
||||
unsigned int _capacity; // the array length minus one (for the '\0')
|
||||
unsigned int _length; // the String length (not counting the '\0')
|
||||
|
||||
void getBuffer(unsigned int maxStrLen);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
// allocate buffer space
|
||||
inline void String::getBuffer(unsigned int maxStrLen)
|
||||
{
|
||||
_capacity = maxStrLen;
|
||||
_buffer = (char *) malloc(_capacity + 1);
|
||||
if (_buffer == NULL) _length = _capacity = 0;
|
||||
}
|
||||
|
||||
inline String operator+( String lhs, const String &rhs )
|
||||
{
|
||||
return lhs += rhs;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <WProgram.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
setup();
|
||||
|
||||
for (;;)
|
||||
loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
setup();
|
||||
|
||||
for (;;)
|
||||
loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
pins_arduino.c - pin definitions for the Arduino board
|
||||
Part of Arduino / Wiring Lite
|
||||
|
||||
Copyright (c) 2005 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
|
||||
*/
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
// On the Sanguino board, digital pins are also used
|
||||
// for the analog output (software PWM). Analog input
|
||||
// pins are a separate set.
|
||||
|
||||
// ATMEL ATMEGA644P / SANGUINO
|
||||
//
|
||||
// +---\/---+
|
||||
// INT0 (D 0) PB0 1| |40 PA0 (AI 0 / D31)
|
||||
// INT1 (D 1) PB1 2| |39 PA1 (AI 1 / D30)
|
||||
// INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29)
|
||||
// PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28)
|
||||
// PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27)
|
||||
// MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26)
|
||||
// MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
|
||||
// SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
|
||||
// RST 9| |32 AREF
|
||||
// VCC 10| |31 GND
|
||||
// GND 11| |30 AVCC
|
||||
// XTAL2 12| |29 PC7 (D 23)
|
||||
// XTAL1 13| |28 PC6 (D 22)
|
||||
// RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
|
||||
// TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
|
||||
// RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS
|
||||
// TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK
|
||||
// PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
|
||||
// PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
|
||||
// PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
|
||||
// +--------+
|
||||
//
|
||||
|
||||
#define PA 1
|
||||
#define PB 2
|
||||
#define PC 3
|
||||
#define PD 4
|
||||
|
||||
// these arrays map port names (e.g. port B) to the
|
||||
// appropriate addresses for various functions (e.g. reading
|
||||
// and writing)
|
||||
const uint8_t PROGMEM port_to_mode_PGM[] =
|
||||
{
|
||||
NOT_A_PORT,
|
||||
(uint8_t) &DDRA,
|
||||
(uint8_t) &DDRB,
|
||||
(uint8_t) &DDRC,
|
||||
(uint8_t) &DDRD,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM port_to_output_PGM[] =
|
||||
{
|
||||
NOT_A_PORT,
|
||||
(uint8_t) &PORTA,
|
||||
(uint8_t) &PORTB,
|
||||
(uint8_t) &PORTC,
|
||||
(uint8_t) &PORTD,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM port_to_input_PGM[] =
|
||||
{
|
||||
NOT_A_PORT,
|
||||
(uint8_t) &PINA,
|
||||
(uint8_t) &PINB,
|
||||
(uint8_t) &PINC,
|
||||
(uint8_t) &PIND,
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_port_PGM[] =
|
||||
{
|
||||
PB, /* 0 */
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PB,
|
||||
PD, /* 8 */
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PD,
|
||||
PC, /* 16 */
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PC,
|
||||
PA, /* 24 */
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA,
|
||||
PA /* 31 */
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
|
||||
{
|
||||
_BV(0), /* 0, port B */
|
||||
_BV(1),
|
||||
_BV(2),
|
||||
_BV(3),
|
||||
_BV(4),
|
||||
_BV(5),
|
||||
_BV(6),
|
||||
_BV(7),
|
||||
_BV(0), /* 8, port D */
|
||||
_BV(1),
|
||||
_BV(2),
|
||||
_BV(3),
|
||||
_BV(4),
|
||||
_BV(5),
|
||||
_BV(6),
|
||||
_BV(7),
|
||||
_BV(0), /* 16, port C */
|
||||
_BV(1),
|
||||
_BV(2),
|
||||
_BV(3),
|
||||
_BV(4),
|
||||
_BV(5),
|
||||
_BV(6),
|
||||
_BV(7),
|
||||
_BV(7), /* 24, port A */
|
||||
_BV(6),
|
||||
_BV(5),
|
||||
_BV(4),
|
||||
_BV(3),
|
||||
_BV(2),
|
||||
_BV(1),
|
||||
_BV(0)
|
||||
};
|
||||
|
||||
const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
|
||||
{
|
||||
NOT_ON_TIMER, /* 0 - PB0 */
|
||||
NOT_ON_TIMER, /* 1 - PB1 */
|
||||
NOT_ON_TIMER, /* 2 - PB2 */
|
||||
TIMER0A, /* 3 - PB3 */
|
||||
TIMER0B, /* 4 - PB4 */
|
||||
NOT_ON_TIMER, /* 5 - PB5 */
|
||||
NOT_ON_TIMER, /* 6 - PB6 */
|
||||
NOT_ON_TIMER, /* 7 - PB7 */
|
||||
NOT_ON_TIMER, /* 8 - PD0 */
|
||||
NOT_ON_TIMER, /* 9 - PD1 */
|
||||
NOT_ON_TIMER, /* 10 - PD2 */
|
||||
NOT_ON_TIMER, /* 11 - PD3 */
|
||||
TIMER1B, /* 12 - PD4 */
|
||||
TIMER1A, /* 13 - PD5 */
|
||||
TIMER2B, /* 14 - PD6 */
|
||||
TIMER2A, /* 15 - PD7 */
|
||||
NOT_ON_TIMER, /* 16 - PC0 */
|
||||
NOT_ON_TIMER, /* 17 - PC1 */
|
||||
NOT_ON_TIMER, /* 18 - PC2 */
|
||||
NOT_ON_TIMER, /* 19 - PC3 */
|
||||
NOT_ON_TIMER, /* 20 - PC4 */
|
||||
NOT_ON_TIMER, /* 21 - PC5 */
|
||||
NOT_ON_TIMER, /* 22 - PC6 */
|
||||
NOT_ON_TIMER, /* 23 - PC7 */
|
||||
NOT_ON_TIMER, /* 24 - PA0 */
|
||||
NOT_ON_TIMER, /* 25 - PA1 */
|
||||
NOT_ON_TIMER, /* 26 - PA2 */
|
||||
NOT_ON_TIMER, /* 27 - PA3 */
|
||||
NOT_ON_TIMER, /* 28 - PA4 */
|
||||
NOT_ON_TIMER, /* 29 - PA5 */
|
||||
NOT_ON_TIMER, /* 30 - PA6 */
|
||||
NOT_ON_TIMER /* 31 - PA7 */
|
||||
};
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
pins_arduino.h - Pin definition functions for Arduino
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2007 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
|
||||
*/
|
||||
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define NOT_A_PIN 0
|
||||
#define NOT_A_PORT 0
|
||||
|
||||
#define NOT_ON_TIMER 0
|
||||
#define TIMER0A 1
|
||||
#define TIMER0B 2
|
||||
#define TIMER1A 3
|
||||
#define TIMER1B 4
|
||||
#define TIMER2 5
|
||||
#define TIMER2A 6
|
||||
#define TIMER2B 7
|
||||
|
||||
extern const uint8_t PROGMEM port_to_mode_PGM[];
|
||||
extern const uint8_t PROGMEM port_to_input_PGM[];
|
||||
extern const uint8_t PROGMEM port_to_output_PGM[];
|
||||
|
||||
extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
|
||||
extern const uint8_t PROGMEM digital_pin_to_bit_PGM[];
|
||||
extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
|
||||
|
||||
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
||||
|
||||
// Get the bit location within the hardware port of the given virtual pin.
|
||||
// This comes from the pins_*.c file for the active board configuration.
|
||||
//
|
||||
// These perform slightly better as macros compared to inline functions
|
||||
//
|
||||
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
|
||||
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
|
||||
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
|
||||
#define analogInPinToBit(P) (P)
|
||||
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_output_PGM + (P))) )
|
||||
#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_input_PGM + (P))) )
|
||||
#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_byte( port_to_mode_PGM + (P))) )
|
||||
|
||||
#endif
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
wiring.c - Partial implementation of the Wiring API for the ATmega8.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.c 388 2008-03-08 22:05:23Z mellis $
|
||||
*/
|
||||
|
||||
#include "wiring_private.h"
|
||||
|
||||
volatile unsigned long timer0_overflow_count = 0;
|
||||
volatile unsigned long timer0_clock_cycles = 0;
|
||||
volatile unsigned long timer0_millis = 0;
|
||||
|
||||
SIGNAL(TIMER0_OVF_vect)
|
||||
{
|
||||
timer0_overflow_count++;
|
||||
// timer 0 prescale factor is 64 and the timer overflows at 256
|
||||
timer0_clock_cycles += 64UL * 256UL;
|
||||
while (timer0_clock_cycles > clockCyclesPerMicrosecond() * 1000UL) {
|
||||
timer0_clock_cycles -= clockCyclesPerMicrosecond() * 1000UL;
|
||||
timer0_millis++;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long millis()
|
||||
{
|
||||
unsigned long m;
|
||||
uint8_t oldSREG = SREG;
|
||||
|
||||
// disable interrupts while we read timer0_millis or we might get an
|
||||
// inconsistent value (e.g. in the middle of the timer0_millis++)
|
||||
cli();
|
||||
m = timer0_millis;
|
||||
SREG = oldSREG;
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
unsigned long micros() {
|
||||
unsigned long m, t;
|
||||
uint8_t oldSREG = SREG;
|
||||
|
||||
cli();
|
||||
t = TCNT0;
|
||||
|
||||
#ifdef TIFR0
|
||||
if ((TIFR0 & _BV(TOV0)) && (t == 0))
|
||||
t = 256;
|
||||
#else
|
||||
if ((TIFR & _BV(TOV0)) && (t == 0))
|
||||
t = 256;
|
||||
#endif
|
||||
|
||||
m = timer0_overflow_count;
|
||||
SREG = oldSREG;
|
||||
|
||||
return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond());
|
||||
}
|
||||
|
||||
void delay(unsigned long ms)
|
||||
{
|
||||
unsigned long start = millis();
|
||||
|
||||
while (millis() - start <= ms)
|
||||
;
|
||||
}
|
||||
|
||||
/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock.
|
||||
* Disables interrupts, which will disrupt the millis() function if used
|
||||
* too frequently. */
|
||||
void delayMicroseconds(unsigned int us)
|
||||
{
|
||||
uint8_t oldSREG;
|
||||
|
||||
// calling avrlib's delay_us() function with low values (e.g. 1 or
|
||||
// 2 microseconds) gives delays longer than desired.
|
||||
//delay_us(us);
|
||||
|
||||
#if F_CPU >= 16000000L
|
||||
// for the 16 MHz clock on most Arduino boards
|
||||
|
||||
// for a one-microsecond delay, simply return. the overhead
|
||||
// of the function call yields a delay of approximately 1 1/8 us.
|
||||
if (--us == 0)
|
||||
return;
|
||||
|
||||
// the following loop takes a quarter of a microsecond (4 cycles)
|
||||
// per iteration, so execute it four times for each microsecond of
|
||||
// delay requested.
|
||||
us <<= 2;
|
||||
|
||||
// account for the time taken in the preceeding commands.
|
||||
us -= 2;
|
||||
#else
|
||||
// for the 8 MHz internal clock on the ATmega168
|
||||
|
||||
// for a one- or two-microsecond delay, simply return. the overhead of
|
||||
// the function calls takes more than two microseconds. can't just
|
||||
// subtract two, since us is unsigned; we'd overflow.
|
||||
if (--us == 0)
|
||||
return;
|
||||
if (--us == 0)
|
||||
return;
|
||||
|
||||
// the following loop takes half of a microsecond (4 cycles)
|
||||
// per iteration, so execute it twice for each microsecond of
|
||||
// delay requested.
|
||||
us <<= 1;
|
||||
|
||||
// partially compensate for the time taken by the preceeding commands.
|
||||
// we can't subtract any more than this or we'd overflow w/ small delays.
|
||||
us--;
|
||||
#endif
|
||||
|
||||
// disable interrupts, otherwise the timer 0 overflow interrupt that
|
||||
// tracks milliseconds will make us delay longer than we want.
|
||||
oldSREG = SREG;
|
||||
cli();
|
||||
|
||||
// busy wait
|
||||
__asm__ __volatile__ (
|
||||
"1: sbiw %0,1" "\n\t" // 2 cycles
|
||||
"brne 1b" : "=w" (us) : "0" (us) // 2 cycles
|
||||
);
|
||||
|
||||
// reenable interrupts.
|
||||
SREG = oldSREG;
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
// this needs to be called before setup() or some functions won't
|
||||
// work there
|
||||
sei();
|
||||
|
||||
// on the ATmega168, timer 0 is also used for fast hardware pwm
|
||||
// (using phase-correct PWM would mean that timer 0 overflowed half as often
|
||||
// resulting in different millis() behavior on the ATmega8 and ATmega168)
|
||||
sbi(TCCR0A, WGM01);
|
||||
sbi(TCCR0A, WGM00);
|
||||
|
||||
// set timer 0 prescale factor to 64
|
||||
sbi(TCCR0B, CS01);
|
||||
sbi(TCCR0B, CS00);
|
||||
|
||||
// enable timer 0 overflow interrupt
|
||||
sbi(TIMSK0, TOIE0);
|
||||
|
||||
// timers 1 and 2 are used for phase-correct hardware pwm
|
||||
// this is better for motors as it ensures an even waveform
|
||||
// note, however, that fast pwm mode can achieve a frequency of up
|
||||
// 8 MHz (with a 16 MHz clock) at 50% duty cycle
|
||||
|
||||
// set timer 1 prescale factor to 64
|
||||
sbi(TCCR1B, CS11);
|
||||
sbi(TCCR1B, CS10);
|
||||
|
||||
// put timer 1 in 8-bit phase correct pwm mode
|
||||
sbi(TCCR1A, WGM10);
|
||||
|
||||
// set timer 2 prescale factor to 64
|
||||
sbi(TCCR2B, CS22);
|
||||
|
||||
// configure timer 2 for phase correct pwm (8-bit)
|
||||
sbi(TCCR2A, WGM20);
|
||||
|
||||
// set a2d prescale factor to 128
|
||||
// 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range.
|
||||
// XXX: this will not work properly for other clock speeds, and
|
||||
// this code should use F_CPU to determine the prescale factor.
|
||||
sbi(ADCSRA, ADPS2);
|
||||
sbi(ADCSRA, ADPS1);
|
||||
sbi(ADCSRA, ADPS0);
|
||||
|
||||
// enable a2d conversions
|
||||
sbi(ADCSRA, ADEN);
|
||||
|
||||
// the bootloader connects pins 0 and 1 to the USART; disconnect them
|
||||
// here so they can be used as normal digital i/o; they will be
|
||||
// reconnected in Serial.begin()
|
||||
UCSR0B = 0;
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
//TODO: test to see if disabling this helps?
|
||||
//UCSR1B = 0;
|
||||
#endif
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
wiring.h - Partial implementation of the Wiring API for the ATmega8.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.h 387 2008-03-08 21:30:00Z mellis $
|
||||
*/
|
||||
|
||||
#ifndef Wiring_h
|
||||
#define Wiring_h
|
||||
|
||||
#include <avr/io.h>
|
||||
#include "binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#define HIGH 0x1
|
||||
#define LOW 0x0
|
||||
|
||||
#define INPUT 0x0
|
||||
#define OUTPUT 0x1
|
||||
|
||||
#define true 0x1
|
||||
#define false 0x0
|
||||
|
||||
#define PI 3.14159265
|
||||
#define HALF_PI 1.57079
|
||||
#define TWO_PI 6.283185
|
||||
#define DEG_TO_RAD 0.01745329
|
||||
#define RAD_TO_DEG 57.2957786
|
||||
|
||||
#define SERIAL 0x0
|
||||
#define DISPLAY 0x1
|
||||
|
||||
#define LSBFIRST 0
|
||||
#define MSBFIRST 1
|
||||
|
||||
#define CHANGE 1
|
||||
#define FALLING 2
|
||||
#define RISING 3
|
||||
|
||||
#define INTERNAL 3
|
||||
#define DEFAULT 1
|
||||
#define EXTERNAL 0
|
||||
|
||||
// undefine stdlib's abs if encountered
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif
|
||||
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
#define abs(x) ((x)>0?(x):-(x))
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
#if __AVR_LIBC_VERSION__ < 10701UL
|
||||
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
|
||||
#endif
|
||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#define interrupts() sei()
|
||||
#define noInterrupts() cli()
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
|
||||
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
|
||||
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
|
||||
|
||||
#define lowByte(w) ((w) & 0xff)
|
||||
#define highByte(w) ((w) >> 8)
|
||||
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
typedef unsigned int word;
|
||||
|
||||
#define bit(b) (1 << (b))
|
||||
|
||||
typedef uint8_t boolean;
|
||||
typedef uint8_t byte;
|
||||
|
||||
void init(void);
|
||||
|
||||
void pinMode(uint8_t, uint8_t);
|
||||
void digitalWrite(uint8_t, uint8_t);
|
||||
int digitalRead(uint8_t);
|
||||
int analogRead(uint8_t);
|
||||
void analogReference(uint8_t mode);
|
||||
void analogWrite(uint8_t, int);
|
||||
|
||||
void beginSerial(uint8_t, long);
|
||||
void serialWrite(uint8_t, unsigned char);
|
||||
int serialAvailable(uint8_t);
|
||||
int serialRead(uint8_t);
|
||||
void serialFlush(uint8_t);
|
||||
|
||||
unsigned long millis(void);
|
||||
unsigned long micros(void);
|
||||
void delay(unsigned long);
|
||||
void delayMicroseconds(unsigned int us);
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
|
||||
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val);
|
||||
|
||||
void attachInterrupt(uint8_t, void (*)(void), int mode);
|
||||
void detachInterrupt(uint8_t);
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
wiring_analog.c - analog input and output
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
|
||||
*/
|
||||
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
uint8_t analog_reference = DEFAULT;
|
||||
|
||||
void analogReference(uint8_t mode)
|
||||
{
|
||||
// can't actually set the register here because the default setting
|
||||
// will connect AVCC and the AREF pin, which would cause a short if
|
||||
// there's something connected to AREF.
|
||||
analog_reference = mode;
|
||||
}
|
||||
|
||||
int analogRead(uint8_t pin)
|
||||
{
|
||||
uint8_t low, high, ch = analogInPinToBit(pin);
|
||||
|
||||
// set the analog reference (high two bits of ADMUX) and select the
|
||||
// channel (low 4 bits). this also sets ADLAR (left-adjust result)
|
||||
// to 0 (the default).
|
||||
// the final AND is to clear the pos/neg reference bits
|
||||
ADMUX = ((analog_reference << 6) | (pin & 0x0f)) & B11000111;
|
||||
|
||||
// without a delay, we seem to read from the wrong channel
|
||||
//delay(1);
|
||||
|
||||
// start the conversion
|
||||
sbi(ADCSRA, ADSC);
|
||||
|
||||
// ADSC is cleared when the conversion finishes
|
||||
while (bit_is_set(ADCSRA, ADSC));
|
||||
|
||||
// we have to read ADCL first; doing so locks both ADCL
|
||||
// and ADCH until ADCH is read. reading ADCL second would
|
||||
// cause the results of each conversion to be discarded,
|
||||
// as ADCL and ADCH would be locked when it completed.
|
||||
low = ADCL;
|
||||
high = ADCH;
|
||||
|
||||
// combine the two bytes
|
||||
return (high << 8) | low;
|
||||
}
|
||||
|
||||
// Right now, PWM output only works on the pins with
|
||||
// hardware support. These are defined in the appropriate
|
||||
// pins_*.c file. For the rest of the pins, we default
|
||||
// to digital output.
|
||||
void analogWrite(uint8_t pin, int val)
|
||||
{
|
||||
// We need to make sure the PWM output is enabled for those pins
|
||||
// that support it, as we turn it off when digitally reading or
|
||||
// writing with them. Also, make sure the pin is in output mode
|
||||
// for consistenty with Wiring, which doesn't require a pinMode
|
||||
// call for the analog output pins.
|
||||
pinMode(pin, OUTPUT);
|
||||
|
||||
if (digitalPinToTimer(pin) == TIMER1A) {
|
||||
// connect pwm to pin on timer 1, channel A
|
||||
sbi(TCCR1A, COM1A1);
|
||||
// set pwm duty
|
||||
OCR1A = val;
|
||||
} else if (digitalPinToTimer(pin) == TIMER1B) {
|
||||
// connect pwm to pin on timer 1, channel B
|
||||
sbi(TCCR1A, COM1B1);
|
||||
// set pwm duty
|
||||
OCR1B = val;
|
||||
} else if (digitalPinToTimer(pin) == TIMER0A) {
|
||||
// connect pwm to pin on timer 0, channel A
|
||||
sbi(TCCR0A, COM0A1);
|
||||
// set pwm duty
|
||||
OCR0A = val;
|
||||
} else if (digitalPinToTimer(pin) == TIMER0B) {
|
||||
// connect pwm to pin on timer 0, channel B
|
||||
sbi(TCCR0A, COM0B1);
|
||||
// set pwm duty
|
||||
OCR0B = val;
|
||||
} else if (digitalPinToTimer(pin) == TIMER2A) {
|
||||
// connect pwm to pin on timer 2, channel A
|
||||
sbi(TCCR2A, COM2A1);
|
||||
// set pwm duty
|
||||
OCR2A = val;
|
||||
} else if (digitalPinToTimer(pin) == TIMER2B) {
|
||||
// connect pwm to pin on timer 2, channel B
|
||||
sbi(TCCR2A, COM2B1);
|
||||
// set pwm duty
|
||||
OCR2B = val;
|
||||
} else if (val < 128)
|
||||
//fail semi-intelligently
|
||||
digitalWrite(pin, LOW);
|
||||
else
|
||||
digitalWrite(pin, HIGH);
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
wiring_digital.c - digital input and output functions
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
|
||||
*/
|
||||
|
||||
#include "wiring_private.h"
|
||||
#include "pins_arduino.h"
|
||||
|
||||
void pinMode(uint8_t pin, uint8_t mode)
|
||||
{
|
||||
uint8_t bit = digitalPinToBitMask(pin);
|
||||
uint8_t port = digitalPinToPort(pin);
|
||||
volatile uint8_t *reg;
|
||||
|
||||
if (port == NOT_A_PIN) return;
|
||||
|
||||
// JWS: can I let the optimizer do this?
|
||||
reg = portModeRegister(port);
|
||||
|
||||
if (mode == INPUT) *reg &= ~bit;
|
||||
else *reg |= bit;
|
||||
}
|
||||
|
||||
// Forcing this inline keeps the callers from having to push their own stuff
|
||||
// on the stack. It is a good performance win and only takes 1 more byte per
|
||||
// user than calling. (It will take more bytes on the 168.)
|
||||
//
|
||||
// But shouldn't this be moved into pinMode? Seems silly to check and do on
|
||||
// each digitalread or write.
|
||||
//
|
||||
static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline));
|
||||
static inline void turnOffPWM(uint8_t timer)
|
||||
{
|
||||
if (timer == TIMER0A) cbi(TCCR0A, COM0A1);
|
||||
if (timer == TIMER0B) cbi(TCCR0A, COM0B1);
|
||||
if (timer == TIMER1A) cbi(TCCR1A, COM1A1);
|
||||
if (timer == TIMER1B) cbi(TCCR1A, COM1B1);
|
||||
if (timer == TIMER2A) cbi(TCCR2A, COM2A1);
|
||||
if (timer == TIMER2B) cbi(TCCR2A, COM2B1);
|
||||
}
|
||||
|
||||
void digitalWrite(uint8_t pin, uint8_t val)
|
||||
{
|
||||
uint8_t timer = digitalPinToTimer(pin);
|
||||
uint8_t bit = digitalPinToBitMask(pin);
|
||||
uint8_t port = digitalPinToPort(pin);
|
||||
volatile uint8_t *out;
|
||||
|
||||
if (port == NOT_A_PIN) return;
|
||||
|
||||
// If the pin that support PWM output, we need to turn it off
|
||||
// before doing a digital write.
|
||||
if (timer != NOT_ON_TIMER) turnOffPWM(timer);
|
||||
|
||||
out = portOutputRegister(port);
|
||||
|
||||
if (val == LOW) *out &= ~bit;
|
||||
else *out |= bit;
|
||||
}
|
||||
|
||||
int digitalRead(uint8_t pin)
|
||||
{
|
||||
uint8_t timer = digitalPinToTimer(pin);
|
||||
uint8_t bit = digitalPinToBitMask(pin);
|
||||
uint8_t port = digitalPinToPort(pin);
|
||||
|
||||
if (port == NOT_A_PIN) return LOW;
|
||||
|
||||
// If the pin that support PWM output, we need to turn it off
|
||||
// before getting a digital reading.
|
||||
if (timer != NOT_ON_TIMER) turnOffPWM(timer);
|
||||
|
||||
if (*portInputRegister(port) & bit) return HIGH;
|
||||
|
||||
return LOW;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
wiring_serial.c - serial functions.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
Modified 29 January 2009, Marius Kintel for Sanguino - http://www.sanguino.cc/
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.c 248 2007-02-03 15:36:30Z mellis $
|
||||
*/
|
||||
|
||||
|
||||
#include "wiring_private.h"
|
||||
|
||||
// Define constants and variables for buffering incoming serial data. We're
|
||||
// using a ring buffer (I think), in which rx_buffer_head is the index of the
|
||||
// location to which to write the next incoming character and rx_buffer_tail
|
||||
// is the index of the location from which to read.
|
||||
#define RX_BUFFER_SIZE 128
|
||||
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
unsigned char rx_buffer[2][RX_BUFFER_SIZE];
|
||||
int rx_buffer_head[2] = {0, 0};
|
||||
int rx_buffer_tail[2] = {0, 0};
|
||||
#else
|
||||
unsigned char rx_buffer[1][RX_BUFFER_SIZE];
|
||||
int rx_buffer_head[1] = {0};
|
||||
int rx_buffer_tail[1] = {0};
|
||||
#endif
|
||||
|
||||
|
||||
#define BEGIN_SERIAL(uart_, baud_) \
|
||||
{ \
|
||||
UBRR##uart_##H = ((F_CPU / 16 + baud / 2) / baud - 1) >> 8; \
|
||||
UBRR##uart_##L = ((F_CPU / 16 + baud / 2) / baud - 1); \
|
||||
\
|
||||
/* reset config for UART */ \
|
||||
UCSR##uart_##A = 0; \
|
||||
UCSR##uart_##B = 0; \
|
||||
UCSR##uart_##C = 0; \
|
||||
\
|
||||
/* enable rx and tx */ \
|
||||
sbi(UCSR##uart_##B, RXEN##uart_);\
|
||||
sbi(UCSR##uart_##B, TXEN##uart_);\
|
||||
\
|
||||
/* enable interrupt on complete reception of a byte */ \
|
||||
sbi(UCSR##uart_##B, RXCIE##uart_); \
|
||||
UCSR##uart_##C = _BV(UCSZ##uart_##1)|_BV(UCSZ##uart_##0); \
|
||||
/* defaults to 8-bit, no parity, 1 stop bit */ \
|
||||
}
|
||||
|
||||
void beginSerial(uint8_t uart, long baud)
|
||||
{
|
||||
if (uart == 0) BEGIN_SERIAL(0, baud)
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
else BEGIN_SERIAL(1, baud)
|
||||
#endif
|
||||
}
|
||||
|
||||
#define SERIAL_WRITE(uart_, c_) \
|
||||
while (!(UCSR##uart_##A & (1 << UDRE##uart_))) \
|
||||
; \
|
||||
UDR##uart_ = c
|
||||
|
||||
void serialWrite(uint8_t uart, unsigned char c)
|
||||
{
|
||||
if (uart == 0) {
|
||||
SERIAL_WRITE(0, c);
|
||||
}
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
else {
|
||||
SERIAL_WRITE(1, c);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int serialAvailable(uint8_t uart)
|
||||
{
|
||||
return (RX_BUFFER_SIZE + rx_buffer_head[uart] - rx_buffer_tail[uart]) % RX_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
int serialRead(uint8_t uart)
|
||||
{
|
||||
// if the head isn't ahead of the tail, we don't have any characters
|
||||
if (rx_buffer_head[uart] == rx_buffer_tail[uart]) {
|
||||
return -1;
|
||||
} else {
|
||||
unsigned char c = rx_buffer[uart][rx_buffer_tail[uart]];
|
||||
rx_buffer_tail[uart] = (rx_buffer_tail[uart] + 1) % RX_BUFFER_SIZE;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
void serialFlush(uint8_t uart)
|
||||
{
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// were full, not empty.
|
||||
rx_buffer_head[uart] = rx_buffer_tail[uart];
|
||||
}
|
||||
|
||||
#define UART_ISR(uart_) \
|
||||
ISR(USART##uart_##_RX_vect) \
|
||||
{ \
|
||||
unsigned char c = UDR##uart_; \
|
||||
\
|
||||
int i = (rx_buffer_head[uart_] + 1) % RX_BUFFER_SIZE; \
|
||||
\
|
||||
/* if we should be storing the received character into the location \
|
||||
just before the tail (meaning that the head would advance to the \
|
||||
current location of the tail), we're about to overflow the buffer \
|
||||
and so we don't write the character or advance the head. */ \
|
||||
if (i != rx_buffer_tail[uart_]) { \
|
||||
rx_buffer[uart_][rx_buffer_head[uart_]] = c; \
|
||||
rx_buffer_head[uart_] = i; \
|
||||
} \
|
||||
}
|
||||
|
||||
UART_ISR(0)
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
UART_ISR(1)
|
||||
#endif
|
||||
@@ -1,99 +0,0 @@
|
||||
##############################################################
|
||||
|
||||
sanguino.name=Sanguino
|
||||
sanguino.upload.protocol=stk500
|
||||
sanguino.upload.maximum_size=63488
|
||||
sanguino.upload.speed=38400
|
||||
sanguino.bootloader.low_fuses=0xFF
|
||||
sanguino.bootloader.high_fuses=0xDC
|
||||
sanguino.bootloader.extended_fuses=0xFD
|
||||
sanguino.bootloader.path=atmega644p
|
||||
sanguino.bootloader.file=ATmegaBOOT_644P.hex
|
||||
sanguino.bootloader.unlock_bits=0x3F
|
||||
sanguino.bootloader.lock_bits=0x0F
|
||||
sanguino.build.mcu=atmega644p
|
||||
sanguino.build.f_cpu=16000000L
|
||||
sanguino.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega644.name=Sanguino W/ ATmega644P
|
||||
|
||||
atmega644.upload.protocol=stk500
|
||||
atmega644.upload.maximum_size=63488
|
||||
atmega644.upload.speed=57600
|
||||
|
||||
atmega644.bootloader.low_fuses=0xFF
|
||||
atmega644.bootloader.high_fuses=0x9A
|
||||
atmega644.bootloader.extended_fuses=0xFF
|
||||
atmega644.bootloader.path=atmega
|
||||
atmega644.bootloader.file=ATmegaBOOT_168_atmega644p.hex
|
||||
#atmega644.bootloader.file=ATmegaBOOT_644P.hex
|
||||
atmega644.bootloader.unlock_bits=0x3F
|
||||
atmega644.bootloader.lock_bits=0x0F
|
||||
|
||||
atmega644.build.mcu=atmega644p
|
||||
atmega644.build.f_cpu=16000000L
|
||||
atmega644.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega12848m.name=Sanguino W/ ATmega1284p 8mhz
|
||||
|
||||
atmega12848m.upload.protocol=stk500
|
||||
atmega12848m.upload.maximum_size=131072
|
||||
atmega12848m.upload.speed=19200
|
||||
|
||||
atmega12848m.bootloader.low_fuses=0xD6
|
||||
atmega12848m.bootloader.high_fuses=0xDA
|
||||
atmega12848m.bootloader.extended_fuses=0xFD
|
||||
atmega12848m.bootloader.path=atmega
|
||||
atmega12848m.bootloader.file=ATmegaBOOT_168_atmega1284p_8m.hex
|
||||
atmega12848m.bootloader.unlock_bits=0x3F
|
||||
atmega12848m.bootloader.lock_bits=0x0F
|
||||
|
||||
atmega12848m.build.mcu=atmega1284p
|
||||
atmega12848m.build.f_cpu=8000000L
|
||||
atmega12848m.build.core=arduino
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega1284.name=Sanguino W/ ATmega1284p 16mhz
|
||||
|
||||
atmega1284.upload.protocol=stk500
|
||||
atmega1284.upload.maximum_size=131072
|
||||
atmega1284.upload.speed=57600
|
||||
|
||||
atmega1284.bootloader.low_fuses=0xD6
|
||||
atmega1284.bootloader.high_fuses=0xDA
|
||||
atmega1284.bootloader.extended_fuses=0xFD
|
||||
atmega1284.bootloader.path=atmega
|
||||
atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
|
||||
atmega1284.bootloader.unlock_bits=0x3F
|
||||
atmega1284.bootloader.lock_bits=0x0F
|
||||
|
||||
atmega1284.build.mcu=atmega1284p
|
||||
atmega1284.build.f_cpu=16000000L
|
||||
atmega1284.build.core=arduino
|
||||
|
||||
|
||||
##############################################################
|
||||
|
||||
atmega1284s.name=Sanguino W/ ATmega1284p 20mhz
|
||||
|
||||
atmega1284s.upload.protocol=stk500
|
||||
atmega1284s.upload.maximum_size=131072
|
||||
atmega1284s.upload.speed=57600
|
||||
|
||||
atmega1284s.bootloader.low_fuses=0xD6
|
||||
atmega1284s.bootloader.high_fuses=0xDA
|
||||
atmega1284s.bootloader.extended_fuses=0xFD
|
||||
atmega1284s.bootloader.path=atmega
|
||||
atmega1284s.bootloader.file=ATmegaBOOT_168_atmega1284p.hex
|
||||
atmega1284s.bootloader.unlock_bits=0x3F
|
||||
atmega1284s.bootloader.lock_bits=0x0F
|
||||
|
||||
atmega1284s.build.mcu=atmega1284p
|
||||
atmega1284s.build.f_cpu=20000000L
|
||||
atmega1284s.build.core=arduino
|
||||
#
|
||||
@@ -1,470 +0,0 @@
|
||||
# Makefile for ATmegaBOOT
|
||||
# E.Lins, 18.7.2005
|
||||
# $Id$
|
||||
#
|
||||
# Instructions
|
||||
#
|
||||
# To make bootloader .hex file:
|
||||
# make diecimila
|
||||
# make lilypad
|
||||
# make ng
|
||||
# etc...
|
||||
#
|
||||
# To burn bootloader .hex file:
|
||||
# make diecimila_isp
|
||||
# make lilypad_isp
|
||||
# make ng_isp
|
||||
# etc...
|
||||
|
||||
# program name should not be changed...
|
||||
PROGRAM = optiboot
|
||||
|
||||
# The default behavior is to build using tools that are in the users
|
||||
# current path variables, but we can also build using an installed
|
||||
# Arduino user IDE setup, or the Arduino source tree.
|
||||
# Uncomment this next lines to build within the arduino environment,
|
||||
# using the arduino-included avrgcc toolset (mac and pc)
|
||||
# ENV ?= arduino
|
||||
# ENV ?= arduinodev
|
||||
# OS ?= macosx
|
||||
# OS ?= windows
|
||||
|
||||
|
||||
# enter the parameters for the avrdude isp tool
|
||||
ISPTOOL = stk500v2
|
||||
ISPPORT = usb
|
||||
ISPSPEED = -b 115200
|
||||
|
||||
MCU_TARGET = atmega168
|
||||
LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe
|
||||
|
||||
# Build environments
|
||||
# Start of some ugly makefile-isms to allow optiboot to be built
|
||||
# in several different environments. See the README.TXT file for
|
||||
# details.
|
||||
|
||||
# default
|
||||
fixpath = $(1)
|
||||
|
||||
ifeq ($(ENV), arduino)
|
||||
# For Arduino, we assume that we're connected to the optiboot directory
|
||||
# included with the arduino distribution, which means that the full set
|
||||
# of avr-tools are "right up there" in standard places.
|
||||
TOOLROOT = ../../../tools
|
||||
GCCROOT = $(TOOLROOT)/avr/bin/
|
||||
AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
|
||||
|
||||
ifeq ($(OS), windows)
|
||||
# On windows, SOME of the tool paths will need to have backslashes instead
|
||||
# of forward slashes (because they use windows cmd.exe for execution instead
|
||||
# of a unix/mingw shell?) We also have to ensure that a consistent shell
|
||||
# is used even if a unix shell is installed (ie as part of WINAVR)
|
||||
fixpath = $(subst /,\,$1)
|
||||
SHELL = cmd.exe
|
||||
endif
|
||||
|
||||
else ifeq ($(ENV), arduinodev)
|
||||
# Arduino IDE source code environment. Use the unpacked compilers created
|
||||
# by the build (you'll need to do "ant build" first.)
|
||||
ifeq ($(OS), macosx)
|
||||
TOOLROOT = ../../../../build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools
|
||||
endif
|
||||
ifeq ($(OS), windows)
|
||||
TOOLROOT = ../../../../build/windows/work/hardware/tools
|
||||
endif
|
||||
|
||||
GCCROOT = $(TOOLROOT)/avr/bin/
|
||||
AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf
|
||||
|
||||
else
|
||||
GCCROOT =
|
||||
AVRDUDE_CONF =
|
||||
endif
|
||||
#
|
||||
# End of build environment code.
|
||||
|
||||
|
||||
# the efuse should really be 0xf8; since, however, only the lower
|
||||
# three bits of that byte are used on the atmega168, avrdude gets
|
||||
# confused if you specify 1's for the higher bits, see:
|
||||
# http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/
|
||||
#
|
||||
# similarly, the lock bits should be 0xff instead of 0x3f (to
|
||||
# unlock the bootloader section) and 0xcf instead of 0x2f (to
|
||||
# lock it), but since the high two bits of the lock byte are
|
||||
# unused, avrdude would get confused.
|
||||
|
||||
ISPFUSES = $(GCCROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \
|
||||
-p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \
|
||||
-e -u -U lock:w:0x3f:m -U efuse:w:0x$(EFUSE):m \
|
||||
-U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m
|
||||
ISPFLASH = $(GCCROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \
|
||||
-p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \
|
||||
-U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x2f:m
|
||||
|
||||
STK500 = "C:\Program Files\Atmel\AVR Tools\STK500\Stk500.exe"
|
||||
STK500-1 = $(STK500) -e -d$(MCU_TARGET) -pf -vf -if$(PROGRAM)_$(TARGET).hex \
|
||||
-lFF -LFF -f$(HFUSE)$(LFUSE) -EF8 -ms -q -cUSB -I200kHz -s -wt
|
||||
STK500-2 = $(STK500) -d$(MCU_TARGET) -ms -q -lCF -LCF -cUSB -I200kHz -s -wt
|
||||
|
||||
OBJ = $(PROGRAM).o
|
||||
OPTIMIZE = -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls
|
||||
|
||||
DEFS =
|
||||
LIBS =
|
||||
|
||||
CC = $(GCCROOT)avr-gcc
|
||||
|
||||
# Override is only needed by avr-lib build system.
|
||||
|
||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
|
||||
override LDFLAGS = $(LDSECTIONS) -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib
|
||||
|
||||
OBJCOPY = $(GCCROOT)avr-objcopy
|
||||
OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump)
|
||||
|
||||
SIZE = $(GCCROOT)avr-size
|
||||
|
||||
# Test platforms
|
||||
# Virtual boot block test
|
||||
virboot328: TARGET = atmega328
|
||||
virboot328: MCU_TARGET = atmega328p
|
||||
virboot328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DVIRTUAL_BOOT'
|
||||
virboot328: AVR_FREQ = 16000000L
|
||||
virboot328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
|
||||
virboot328: $(PROGRAM)_atmega328.hex
|
||||
virboot328: $(PROGRAM)_atmega328.lst
|
||||
|
||||
# 20MHz clocked platforms
|
||||
#
|
||||
# These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
|
||||
#
|
||||
|
||||
pro20: TARGET = pro_20mhz
|
||||
pro20: MCU_TARGET = atmega168
|
||||
pro20: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
pro20: AVR_FREQ = 20000000L
|
||||
pro20: $(PROGRAM)_pro_20mhz.hex
|
||||
pro20: $(PROGRAM)_pro_20mhz.lst
|
||||
|
||||
pro20_isp: pro20
|
||||
pro20_isp: TARGET = pro_20mhz
|
||||
# 2.7V brownout
|
||||
pro20_isp: HFUSE = DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
pro20_isp: LFUSE = C6
|
||||
# 512 byte boot
|
||||
pro20_isp: EFUSE = 04
|
||||
pro20_isp: isp
|
||||
|
||||
# 16MHz clocked platforms
|
||||
#
|
||||
# These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue)
|
||||
#
|
||||
|
||||
pro16: TARGET = pro_16MHz
|
||||
pro16: MCU_TARGET = atmega168
|
||||
pro16: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
pro16: AVR_FREQ = 16000000L
|
||||
pro16: $(PROGRAM)_pro_16MHz.hex
|
||||
pro16: $(PROGRAM)_pro_16MHz.lst
|
||||
|
||||
pro16_isp: pro16
|
||||
pro16_isp: TARGET = pro_16MHz
|
||||
# 2.7V brownout
|
||||
pro16_isp: HFUSE = DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
pro16_isp: LFUSE = C6
|
||||
# 512 byte boot
|
||||
pro16_isp: EFUSE = 04
|
||||
pro16_isp: isp
|
||||
|
||||
# Diecimila, Duemilanove with m168, and NG use identical bootloaders
|
||||
# Call it "atmega168" for generality and clarity, keep "diecimila" for
|
||||
# backward compatibility of makefile
|
||||
#
|
||||
atmega168: TARGET = atmega168
|
||||
atmega168: MCU_TARGET = atmega168
|
||||
atmega168: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
atmega168: AVR_FREQ = 16000000L
|
||||
atmega168: $(PROGRAM)_atmega168.hex
|
||||
atmega168: $(PROGRAM)_atmega168.lst
|
||||
|
||||
atmega168_isp: atmega168
|
||||
atmega168_isp: TARGET = atmega168
|
||||
# 2.7V brownout
|
||||
atmega168_isp: HFUSE = DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega168_isp: LFUSE = FF
|
||||
# 512 byte boot
|
||||
atmega168_isp: EFUSE = 04
|
||||
atmega168_isp: isp
|
||||
|
||||
diecimila: TARGET = diecimila
|
||||
diecimila: MCU_TARGET = atmega168
|
||||
diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
diecimila: AVR_FREQ = 16000000L
|
||||
diecimila: $(PROGRAM)_diecimila.hex
|
||||
diecimila: $(PROGRAM)_diecimila.lst
|
||||
|
||||
diecimila_isp: diecimila
|
||||
diecimila_isp: TARGET = diecimila
|
||||
# 2.7V brownout
|
||||
diecimila_isp: HFUSE = DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
diecimila_isp: LFUSE = FF
|
||||
# 512 byte boot
|
||||
diecimila_isp: EFUSE = 04
|
||||
diecimila_isp: isp
|
||||
|
||||
atmega328: TARGET = atmega328
|
||||
atmega328: MCU_TARGET = atmega328p
|
||||
atmega328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
atmega328: AVR_FREQ = 16000000L
|
||||
atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
|
||||
atmega328: $(PROGRAM)_atmega328.hex
|
||||
atmega328: $(PROGRAM)_atmega328.lst
|
||||
|
||||
atmega328_isp: atmega328
|
||||
atmega328_isp: TARGET = atmega328
|
||||
atmega328_isp: MCU_TARGET = atmega328p
|
||||
# 512 byte boot, SPIEN
|
||||
atmega328_isp: HFUSE = DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega328_isp: LFUSE = FF
|
||||
# 2.7V brownout
|
||||
atmega328_isp: EFUSE = 05
|
||||
atmega328_isp: isp
|
||||
|
||||
atmega1284: TARGET = atmega1284p
|
||||
atmega1284: MCU_TARGET = atmega1284p
|
||||
atmega1284: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
|
||||
atmega1284: AVR_FREQ = 16000000L
|
||||
atmega1284: LDSECTIONS = -Wl,--section-start=.text=0x1fc00
|
||||
atmega1284: $(PROGRAM)_atmega1284p.hex
|
||||
atmega1284: $(PROGRAM)_atmega1284p.lst
|
||||
|
||||
atmega1284_isp: atmega1284
|
||||
atmega1284_isp: TARGET = atmega1284p
|
||||
atmega1284_isp: MCU_TARGET = atmega1284p
|
||||
# 1024 byte boot
|
||||
atmega1284_isp: HFUSE = DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega1284_isp: LFUSE = FF
|
||||
# 2.7V brownout
|
||||
atmega1284_isp: EFUSE = FD
|
||||
atmega1284_isp: isp
|
||||
|
||||
# Sanguino has a minimum boot size of 1024 bytes, so enable extra functions
|
||||
#
|
||||
sanguino: TARGET = atmega644p
|
||||
sanguino: MCU_TARGET = atmega644p
|
||||
sanguino: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
|
||||
sanguino: AVR_FREQ = 16000000L
|
||||
sanguino: LDSECTIONS = -Wl,--section-start=.text=0xfc00
|
||||
sanguino: $(PROGRAM)_atmega644p.hex
|
||||
sanguino: $(PROGRAM)_atmega644p.lst
|
||||
|
||||
sanguino_isp: sanguino
|
||||
sanguino_isp: TARGET = atmega644p
|
||||
sanguino_isp: MCU_TARGET = atmega644p
|
||||
# 1024 byte boot
|
||||
sanguino_isp: HFUSE = DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
sanguino_isp: LFUSE = FF
|
||||
# 2.7V brownout
|
||||
sanguino_isp: EFUSE = 05
|
||||
sanguino_isp: isp
|
||||
|
||||
# Mega has a minimum boot size of 1024 bytes, so enable extra functions
|
||||
#mega: TARGET = atmega1280
|
||||
mega: MCU_TARGET = atmega1280
|
||||
mega: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT'
|
||||
mega: AVR_FREQ = 16000000L
|
||||
mega: LDSECTIONS = -Wl,--section-start=.text=0x1fc00
|
||||
mega: $(PROGRAM)_atmega1280.hex
|
||||
mega: $(PROGRAM)_atmega1280.lst
|
||||
|
||||
mega_isp: mega
|
||||
mega_isp: TARGET = atmega1280
|
||||
mega_isp: MCU_TARGET = atmega1280
|
||||
# 1024 byte boot
|
||||
mega_isp: HFUSE = DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
mega_isp: LFUSE = FF
|
||||
# 2.7V brownout
|
||||
mega_isp: EFUSE = 05
|
||||
mega_isp: isp
|
||||
|
||||
# ATmega8
|
||||
#
|
||||
atmega8: TARGET = atmega8
|
||||
atmega8: MCU_TARGET = atmega8
|
||||
atmega8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
atmega8: AVR_FREQ = 16000000L
|
||||
atmega8: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe
|
||||
atmega8: $(PROGRAM)_atmega8.hex
|
||||
atmega8: $(PROGRAM)_atmega8.lst
|
||||
|
||||
atmega8_isp: atmega8
|
||||
atmega8_isp: TARGET = atmega8
|
||||
atmega8_isp: MCU_TARGET = atmega8
|
||||
# SPIEN, CKOPT, Bootsize=512B
|
||||
atmega8_isp: HFUSE = CC
|
||||
# 2.7V brownout, Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega8_isp: LFUSE = BF
|
||||
atmega8_isp: isp
|
||||
|
||||
# ATmega88
|
||||
#
|
||||
atmega88: TARGET = atmega88
|
||||
atmega88: MCU_TARGET = atmega88
|
||||
atmega88: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
atmega88: AVR_FREQ = 16000000L
|
||||
atmega88: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe
|
||||
atmega88: $(PROGRAM)_atmega88.hex
|
||||
atmega88: $(PROGRAM)_atmega88.lst
|
||||
|
||||
atmega88_isp: atmega88
|
||||
atmega88_isp: TARGET = atmega88
|
||||
atmega88_isp: MCU_TARGET = atmega88
|
||||
# 2.7V brownout
|
||||
atmega88_isp: HFUSE = DD
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atemga88_isp: LFUSE = FF
|
||||
# 512 byte boot
|
||||
atmega88_isp: EFUSE = 04
|
||||
atmega88_isp: isp
|
||||
|
||||
|
||||
# 8MHz clocked platforms
|
||||
#
|
||||
# These are capable of 115200 baud
|
||||
#
|
||||
|
||||
lilypad: TARGET = lilypad
|
||||
lilypad: MCU_TARGET = atmega168
|
||||
lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
lilypad: AVR_FREQ = 8000000L
|
||||
lilypad: $(PROGRAM)_lilypad.hex
|
||||
lilypad: $(PROGRAM)_lilypad.lst
|
||||
|
||||
lilypad_isp: lilypad
|
||||
lilypad_isp: TARGET = lilypad
|
||||
# 2.7V brownout
|
||||
lilypad_isp: HFUSE = DD
|
||||
# Internal 8MHz osc (8MHz) Slow rising power
|
||||
lilypad_isp: LFUSE = E2
|
||||
# 512 byte boot
|
||||
lilypad_isp: EFUSE = 04
|
||||
lilypad_isp: isp
|
||||
|
||||
lilypad_resonator: TARGET = lilypad_resonator
|
||||
lilypad_resonator: MCU_TARGET = atmega168
|
||||
lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
lilypad_resonator: AVR_FREQ = 8000000L
|
||||
lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
|
||||
lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst
|
||||
|
||||
lilypad_resonator_isp: lilypad_resonator
|
||||
lilypad_resonator_isp: TARGET = lilypad_resonator
|
||||
# 2.7V brownout
|
||||
lilypad_resonator_isp: HFUSE = DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
lilypad_resonator_isp: LFUSE = C6
|
||||
# 512 byte boot
|
||||
lilypad_resonator_isp: EFUSE = 04
|
||||
lilypad_resonator_isp: isp
|
||||
|
||||
pro8: TARGET = pro_8MHz
|
||||
pro8: MCU_TARGET = atmega168
|
||||
pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
pro8: AVR_FREQ = 8000000L
|
||||
pro8: $(PROGRAM)_pro_8MHz.hex
|
||||
pro8: $(PROGRAM)_pro_8MHz.lst
|
||||
|
||||
pro8_isp: pro8
|
||||
pro8_isp: TARGET = pro_8MHz
|
||||
# 2.7V brownout
|
||||
pro8_isp: HFUSE = DD
|
||||
# Full swing xtal (20MHz) 258CK/14CK+4.1ms
|
||||
pro8_isp: LFUSE = C6
|
||||
# 512 byte boot
|
||||
pro8_isp: EFUSE = 04
|
||||
pro8_isp: isp
|
||||
|
||||
atmega328_pro8: TARGET = atmega328_pro_8MHz
|
||||
atmega328_pro8: MCU_TARGET = atmega328p
|
||||
atmega328_pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
|
||||
atmega328_pro8: AVR_FREQ = 8000000L
|
||||
atmega328_pro8: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
|
||||
atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.hex
|
||||
atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst
|
||||
|
||||
atmega328_pro8_isp: atmega328_pro8
|
||||
atmega328_pro8_isp: TARGET = atmega328_pro_8MHz
|
||||
atmega328_pro8_isp: MCU_TARGET = atmega328p
|
||||
# 512 byte boot, SPIEN
|
||||
atmega328_pro8_isp: HFUSE = DE
|
||||
# Low power xtal (16MHz) 16KCK/14CK+65ms
|
||||
atmega328_pro8_isp: LFUSE = FF
|
||||
# 2.7V brownout
|
||||
atmega328_pro8_isp: EFUSE = 05
|
||||
atmega328_pro8_isp: isp
|
||||
|
||||
# 1MHz clocked platforms
|
||||
#
|
||||
# These are capable of 9600 baud
|
||||
#
|
||||
|
||||
luminet: TARGET = luminet
|
||||
luminet: MCU_TARGET = attiny84
|
||||
luminet: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=9600'
|
||||
luminet: CFLAGS += '-DVIRTUAL_BOOT_PARTITION'
|
||||
luminet: AVR_FREQ = 1000000L
|
||||
luminet: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe
|
||||
luminet: $(PROGRAM)_luminet.hex
|
||||
luminet: $(PROGRAM)_luminet.lst
|
||||
|
||||
luminet_isp: luminet
|
||||
luminet_isp: TARGET = luminet
|
||||
luminet_isp: MCU_TARGET = attiny84
|
||||
# Brownout disabled
|
||||
luminet_isp: HFUSE = DF
|
||||
# 1MHz internal oscillator, slowly rising power
|
||||
luminet_isp: LFUSE = 62
|
||||
# Self-programming enable
|
||||
luminet_isp: EFUSE = FE
|
||||
luminet_isp: isp
|
||||
|
||||
#
|
||||
# Generic build instructions
|
||||
#
|
||||
#
|
||||
|
||||
isp: $(TARGET)
|
||||
$(ISPFUSES)
|
||||
$(ISPFLASH)
|
||||
|
||||
isp-stk500: $(PROGRAM)_$(TARGET).hex
|
||||
$(STK500-1)
|
||||
$(STK500-2)
|
||||
|
||||
%.elf: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
$(SIZE) $@
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex
|
||||
|
||||
%.lst: %.elf
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
%.hex: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex $< $@
|
||||
|
||||
%.srec: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O srec $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O binary $< $@
|
||||
@@ -1,848 +0,0 @@
|
||||
/* Modified to use out for SPM access
|
||||
** Peter Knight, Optiboot project http://optiboot.googlecode.com
|
||||
**
|
||||
** Todo: Tidy up
|
||||
**
|
||||
** "_short" routines execute 1 cycle faster and use 1 less word of flash
|
||||
** by using "out" instruction instead of "sts".
|
||||
**
|
||||
** Additional elpm variants that trust the value of RAMPZ
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 Eric B. Weddington
|
||||
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.
|
||||
* Neither the name of the copyright holders nor the names of
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
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 OWNER 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. */
|
||||
|
||||
/* $Id: boot.h,v 1.27.2.3 2008/09/30 13:58:48 arcanum Exp $ */
|
||||
|
||||
#ifndef _AVR_BOOT_H_
|
||||
#define _AVR_BOOT_H_ 1
|
||||
|
||||
/** \file */
|
||||
/** \defgroup avr_boot <avr/boot.h>: Bootloader Support Utilities
|
||||
\code
|
||||
#include <avr/io.h>
|
||||
#include <avr/boot.h>
|
||||
\endcode
|
||||
|
||||
The macros in this module provide a C language interface to the
|
||||
bootloader support functionality of certain AVR processors. These
|
||||
macros are designed to work with all sizes of flash memory.
|
||||
|
||||
Global interrupts are not automatically disabled for these macros. It
|
||||
is left up to the programmer to do this. See the code example below.
|
||||
Also see the processor datasheet for caveats on having global interrupts
|
||||
enabled during writing of the Flash.
|
||||
|
||||
\note Not all AVR processors provide bootloader support. See your
|
||||
processor datasheet to see if it provides bootloader support.
|
||||
|
||||
\todo From email with Marek: On smaller devices (all except ATmega64/128),
|
||||
__SPM_REG is in the I/O space, accessible with the shorter "in" and "out"
|
||||
instructions - since the boot loader has a limited size, this could be an
|
||||
important optimization.
|
||||
|
||||
\par API Usage Example
|
||||
The following code shows typical usage of the boot API.
|
||||
|
||||
\code
|
||||
#include <inttypes.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
void boot_program_page (uint32_t page, uint8_t *buf)
|
||||
{
|
||||
uint16_t i;
|
||||
uint8_t sreg;
|
||||
|
||||
// Disable interrupts.
|
||||
|
||||
sreg = SREG;
|
||||
cli();
|
||||
|
||||
eeprom_busy_wait ();
|
||||
|
||||
boot_page_erase (page);
|
||||
boot_spm_busy_wait (); // Wait until the memory is erased.
|
||||
|
||||
for (i=0; i<SPM_PAGESIZE; i+=2)
|
||||
{
|
||||
// Set up little-endian word.
|
||||
|
||||
uint16_t w = *buf++;
|
||||
w += (*buf++) << 8;
|
||||
|
||||
boot_page_fill (page + i, w);
|
||||
}
|
||||
|
||||
boot_page_write (page); // Store buffer in flash page.
|
||||
boot_spm_busy_wait(); // Wait until the memory is written.
|
||||
|
||||
// Reenable RWW-section again. We need this if we want to jump back
|
||||
// to the application after bootloading.
|
||||
|
||||
boot_rww_enable ();
|
||||
|
||||
// Re-enable interrupts (if they were ever enabled).
|
||||
|
||||
SREG = sreg;
|
||||
}\endcode */
|
||||
|
||||
#include <avr/eeprom.h>
|
||||
#include <avr/io.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* Check for SPM Control Register in processor. */
|
||||
#if defined (SPMCSR)
|
||||
# define __SPM_REG SPMCSR
|
||||
#elif defined (SPMCR)
|
||||
# define __SPM_REG SPMCR
|
||||
#else
|
||||
# error AVR processor does not provide bootloader support!
|
||||
#endif
|
||||
|
||||
|
||||
/* Check for SPM Enable bit. */
|
||||
#if defined(SPMEN)
|
||||
# define __SPM_ENABLE SPMEN
|
||||
#elif defined(SELFPRGEN)
|
||||
# define __SPM_ENABLE SELFPRGEN
|
||||
#else
|
||||
# error Cannot find SPM Enable bit definition!
|
||||
#endif
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def BOOTLOADER_SECTION
|
||||
|
||||
Used to declare a function or variable to be placed into a
|
||||
new section called .bootloader. This section and its contents
|
||||
can then be relocated to any address (such as the bootloader
|
||||
NRWW area) at link-time. */
|
||||
|
||||
#define BOOTLOADER_SECTION __attribute__ ((section (".bootloader")))
|
||||
|
||||
/* Create common bit definitions. */
|
||||
#ifdef ASB
|
||||
#define __COMMON_ASB ASB
|
||||
#else
|
||||
#define __COMMON_ASB RWWSB
|
||||
#endif
|
||||
|
||||
#ifdef ASRE
|
||||
#define __COMMON_ASRE ASRE
|
||||
#else
|
||||
#define __COMMON_ASRE RWWSRE
|
||||
#endif
|
||||
|
||||
/* Define the bit positions of the Boot Lock Bits. */
|
||||
|
||||
#define BLB12 5
|
||||
#define BLB11 4
|
||||
#define BLB02 3
|
||||
#define BLB01 2
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_spm_interrupt_enable()
|
||||
Enable the SPM interrupt. */
|
||||
|
||||
#define boot_spm_interrupt_enable() (__SPM_REG |= (uint8_t)_BV(SPMIE))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_spm_interrupt_disable()
|
||||
Disable the SPM interrupt. */
|
||||
|
||||
#define boot_spm_interrupt_disable() (__SPM_REG &= (uint8_t)~_BV(SPMIE))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_is_spm_interrupt()
|
||||
Check if the SPM interrupt is enabled. */
|
||||
|
||||
#define boot_is_spm_interrupt() (__SPM_REG & (uint8_t)_BV(SPMIE))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_rww_busy()
|
||||
Check if the RWW section is busy. */
|
||||
|
||||
#define boot_rww_busy() (__SPM_REG & (uint8_t)_BV(__COMMON_ASB))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_spm_busy()
|
||||
Check if the SPM instruction is busy. */
|
||||
|
||||
#define boot_spm_busy() (__SPM_REG & (uint8_t)_BV(__SPM_ENABLE))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_spm_busy_wait()
|
||||
Wait while the SPM instruction is busy. */
|
||||
|
||||
#define boot_spm_busy_wait() do{}while(boot_spm_busy())
|
||||
|
||||
#define __BOOT_PAGE_ERASE (_BV(__SPM_ENABLE) | _BV(PGERS))
|
||||
#define __BOOT_PAGE_WRITE (_BV(__SPM_ENABLE) | _BV(PGWRT))
|
||||
#define __BOOT_PAGE_FILL _BV(__SPM_ENABLE)
|
||||
#define __BOOT_RWW_ENABLE (_BV(__SPM_ENABLE) | _BV(__COMMON_ASRE))
|
||||
#define __BOOT_LOCK_BITS_SET (_BV(__SPM_ENABLE) | _BV(BLBSET))
|
||||
|
||||
#define __boot_page_fill_short(address, data) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r0, %3\n\t" \
|
||||
"out %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
"clr r1\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_FILL), \
|
||||
"z" ((uint16_t)address), \
|
||||
"r" ((uint16_t)data) \
|
||||
: "r0" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_fill_normal(address, data) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r0, %3\n\t" \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
"clr r1\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_FILL), \
|
||||
"z" ((uint16_t)address), \
|
||||
"r" ((uint16_t)data) \
|
||||
: "r0" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_fill_alternate(address, data)\
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r0, %3\n\t" \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
".word 0xffff\n\t" \
|
||||
"nop\n\t" \
|
||||
"clr r1\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_FILL), \
|
||||
"z" ((uint16_t)address), \
|
||||
"r" ((uint16_t)data) \
|
||||
: "r0" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_fill_extended(address, data) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r0, %4\n\t" \
|
||||
"movw r30, %A3\n\t" \
|
||||
"sts %1, %C3\n\t" \
|
||||
"sts %0, %2\n\t" \
|
||||
"spm\n\t" \
|
||||
"clr r1\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"i" (_SFR_MEM_ADDR(RAMPZ)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_FILL), \
|
||||
"r" ((uint32_t)address), \
|
||||
"r" ((uint16_t)data) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_fill_extended_short(address, data) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r0, %4\n\t" \
|
||||
"movw r30, %A3\n\t" \
|
||||
"out %1, %C3\n\t" \
|
||||
"out %0, %2\n\t" \
|
||||
"spm\n\t" \
|
||||
"clr r1\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"i" (_SFR_IO_ADDR(RAMPZ)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_FILL), \
|
||||
"r" ((uint32_t)address), \
|
||||
"r" ((uint16_t)data) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_erase_short(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"out %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_ERASE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
|
||||
#define __boot_page_erase_normal(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_ERASE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_erase_alternate(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
".word 0xffff\n\t" \
|
||||
"nop\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_ERASE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_erase_extended(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r30, %A3\n\t" \
|
||||
"sts %1, %C3\n\t" \
|
||||
"sts %0, %2\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"i" (_SFR_MEM_ADDR(RAMPZ)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_ERASE), \
|
||||
"r" ((uint32_t)address) \
|
||||
: "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
#define __boot_page_erase_extended_short(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r30, %A3\n\t" \
|
||||
"out %1, %C3\n\t" \
|
||||
"out %0, %2\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"i" (_SFR_IO_ADDR(RAMPZ)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_ERASE), \
|
||||
"r" ((uint32_t)address) \
|
||||
: "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_write_short(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"out %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_WRITE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_write_normal(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_WRITE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_write_alternate(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
".word 0xffff\n\t" \
|
||||
"nop\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_WRITE), \
|
||||
"z" ((uint16_t)address) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_page_write_extended(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r30, %A3\n\t" \
|
||||
"sts %1, %C3\n\t" \
|
||||
"sts %0, %2\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"i" (_SFR_MEM_ADDR(RAMPZ)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_WRITE), \
|
||||
"r" ((uint32_t)address) \
|
||||
: "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
#define __boot_page_write_extended_short(address) \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"movw r30, %A3\n\t" \
|
||||
"out %1, %C3\n\t" \
|
||||
"out %0, %2\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"i" (_SFR_IO_ADDR(RAMPZ)), \
|
||||
"r" ((uint8_t)__BOOT_PAGE_WRITE), \
|
||||
"r" ((uint32_t)address) \
|
||||
: "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_rww_enable_short() \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"out %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_RWW_ENABLE) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_rww_enable() \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_RWW_ENABLE) \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_rww_enable_alternate() \
|
||||
(__extension__({ \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
".word 0xffff\n\t" \
|
||||
"nop\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_RWW_ENABLE) \
|
||||
); \
|
||||
}))
|
||||
|
||||
/* From the mega16/mega128 data sheets (maybe others):
|
||||
|
||||
Bits by SPM To set the Boot Loader Lock bits, write the desired data to
|
||||
R0, write "X0001001" to SPMCR and execute SPM within four clock cycles
|
||||
after writing SPMCR. The only accessible Lock bits are the Boot Lock bits
|
||||
that may prevent the Application and Boot Loader section from any
|
||||
software update by the MCU.
|
||||
|
||||
If bits 5..2 in R0 are cleared (zero), the corresponding Boot Lock bit
|
||||
will be programmed if an SPM instruction is executed within four cycles
|
||||
after BLBSET and SPMEN (or SELFPRGEN) are set in SPMCR. The Z-pointer is
|
||||
don't care during this operation, but for future compatibility it is
|
||||
recommended to load the Z-pointer with $0001 (same as used for reading the
|
||||
Lock bits). For future compatibility It is also recommended to set bits 7,
|
||||
6, 1, and 0 in R0 to 1 when writing the Lock bits. When programming the
|
||||
Lock bits the entire Flash can be read during the operation. */
|
||||
|
||||
#define __boot_lock_bits_set_short(lock_bits) \
|
||||
(__extension__({ \
|
||||
uint8_t value = (uint8_t)(~(lock_bits)); \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"ldi r30, 1\n\t" \
|
||||
"ldi r31, 0\n\t" \
|
||||
"mov r0, %2\n\t" \
|
||||
"out %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_LOCK_BITS_SET), \
|
||||
"r" (value) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_lock_bits_set(lock_bits) \
|
||||
(__extension__({ \
|
||||
uint8_t value = (uint8_t)(~(lock_bits)); \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"ldi r30, 1\n\t" \
|
||||
"ldi r31, 0\n\t" \
|
||||
"mov r0, %2\n\t" \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_LOCK_BITS_SET), \
|
||||
"r" (value) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
#define __boot_lock_bits_set_alternate(lock_bits) \
|
||||
(__extension__({ \
|
||||
uint8_t value = (uint8_t)(~(lock_bits)); \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"ldi r30, 1\n\t" \
|
||||
"ldi r31, 0\n\t" \
|
||||
"mov r0, %2\n\t" \
|
||||
"sts %0, %1\n\t" \
|
||||
"spm\n\t" \
|
||||
".word 0xffff\n\t" \
|
||||
"nop\n\t" \
|
||||
: \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_LOCK_BITS_SET), \
|
||||
"r" (value) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
}))
|
||||
|
||||
/*
|
||||
Reading lock and fuse bits:
|
||||
|
||||
Similarly to writing the lock bits above, set BLBSET and SPMEN (or
|
||||
SELFPRGEN) bits in __SPMREG, and then (within four clock cycles) issue an
|
||||
LPM instruction.
|
||||
|
||||
Z address: contents:
|
||||
0x0000 low fuse bits
|
||||
0x0001 lock bits
|
||||
0x0002 extended fuse bits
|
||||
0x0003 high fuse bits
|
||||
|
||||
Sounds confusing, doesn't it?
|
||||
|
||||
Unlike the macros in pgmspace.h, no need to care for non-enhanced
|
||||
cores here as these old cores do not provide SPM support anyway.
|
||||
*/
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def GET_LOW_FUSE_BITS
|
||||
address to read the low fuse bits, using boot_lock_fuse_bits_get
|
||||
*/
|
||||
#define GET_LOW_FUSE_BITS (0x0000)
|
||||
/** \ingroup avr_boot
|
||||
\def GET_LOCK_BITS
|
||||
address to read the lock bits, using boot_lock_fuse_bits_get
|
||||
*/
|
||||
#define GET_LOCK_BITS (0x0001)
|
||||
/** \ingroup avr_boot
|
||||
\def GET_EXTENDED_FUSE_BITS
|
||||
address to read the extended fuse bits, using boot_lock_fuse_bits_get
|
||||
*/
|
||||
#define GET_EXTENDED_FUSE_BITS (0x0002)
|
||||
/** \ingroup avr_boot
|
||||
\def GET_HIGH_FUSE_BITS
|
||||
address to read the high fuse bits, using boot_lock_fuse_bits_get
|
||||
*/
|
||||
#define GET_HIGH_FUSE_BITS (0x0003)
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_lock_fuse_bits_get(address)
|
||||
|
||||
Read the lock or fuse bits at \c address.
|
||||
|
||||
Parameter \c address can be any of GET_LOW_FUSE_BITS,
|
||||
GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS.
|
||||
|
||||
\note The lock and fuse bits returned are the physical values,
|
||||
i.e. a bit returned as 0 means the corresponding fuse or lock bit
|
||||
is programmed.
|
||||
*/
|
||||
#define boot_lock_fuse_bits_get_short(address) \
|
||||
(__extension__({ \
|
||||
uint8_t __result; \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"ldi r30, %3\n\t" \
|
||||
"ldi r31, 0\n\t" \
|
||||
"out %1, %2\n\t" \
|
||||
"lpm %0, Z\n\t" \
|
||||
: "=r" (__result) \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_LOCK_BITS_SET), \
|
||||
"M" (address) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
__result; \
|
||||
}))
|
||||
|
||||
#define boot_lock_fuse_bits_get(address) \
|
||||
(__extension__({ \
|
||||
uint8_t __result; \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"ldi r30, %3\n\t" \
|
||||
"ldi r31, 0\n\t" \
|
||||
"sts %1, %2\n\t" \
|
||||
"lpm %0, Z\n\t" \
|
||||
: "=r" (__result) \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t)__BOOT_LOCK_BITS_SET), \
|
||||
"M" (address) \
|
||||
: "r0", "r30", "r31" \
|
||||
); \
|
||||
__result; \
|
||||
}))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_signature_byte_get(address)
|
||||
|
||||
Read the Signature Row byte at \c address. For some MCU types,
|
||||
this function can also retrieve the factory-stored oscillator
|
||||
calibration bytes.
|
||||
|
||||
Parameter \c address can be 0-0x1f as documented by the datasheet.
|
||||
\note The values are MCU type dependent.
|
||||
*/
|
||||
|
||||
#define __BOOT_SIGROW_READ (_BV(__SPM_ENABLE) | _BV(SIGRD))
|
||||
|
||||
#define boot_signature_byte_get_short(addr) \
|
||||
(__extension__({ \
|
||||
uint16_t __addr16 = (uint16_t)(addr); \
|
||||
uint8_t __result; \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"out %1, %2\n\t" \
|
||||
"lpm %0, Z" "\n\t" \
|
||||
: "=r" (__result) \
|
||||
: "i" (_SFR_IO_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t) __BOOT_SIGROW_READ), \
|
||||
"z" (__addr16) \
|
||||
); \
|
||||
__result; \
|
||||
}))
|
||||
|
||||
#define boot_signature_byte_get(addr) \
|
||||
(__extension__({ \
|
||||
uint16_t __addr16 = (uint16_t)(addr); \
|
||||
uint8_t __result; \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"sts %1, %2\n\t" \
|
||||
"lpm %0, Z" "\n\t" \
|
||||
: "=r" (__result) \
|
||||
: "i" (_SFR_MEM_ADDR(__SPM_REG)), \
|
||||
"r" ((uint8_t) __BOOT_SIGROW_READ), \
|
||||
"z" (__addr16) \
|
||||
); \
|
||||
__result; \
|
||||
}))
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_page_fill(address, data)
|
||||
|
||||
Fill the bootloader temporary page buffer for flash
|
||||
address with data word.
|
||||
|
||||
\note The address is a byte address. The data is a word. The AVR
|
||||
writes data to the buffer a word at a time, but addresses the buffer
|
||||
per byte! So, increment your address by 2 between calls, and send 2
|
||||
data bytes in a word format! The LSB of the data is written to the lower
|
||||
address; the MSB of the data is written to the higher address.*/
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_page_erase(address)
|
||||
|
||||
Erase the flash page that contains address.
|
||||
|
||||
\note address is a byte address in flash, not a word address. */
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_page_write(address)
|
||||
|
||||
Write the bootloader temporary page buffer
|
||||
to flash page that contains address.
|
||||
|
||||
\note address is a byte address in flash, not a word address. */
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_rww_enable()
|
||||
|
||||
Enable the Read-While-Write memory section. */
|
||||
|
||||
/** \ingroup avr_boot
|
||||
\def boot_lock_bits_set(lock_bits)
|
||||
|
||||
Set the bootloader lock bits.
|
||||
|
||||
\param lock_bits A mask of which Boot Loader Lock Bits to set.
|
||||
|
||||
\note In this context, a 'set bit' will be written to a zero value.
|
||||
Note also that only BLBxx bits can be programmed by this command.
|
||||
|
||||
For example, to disallow the SPM instruction from writing to the Boot
|
||||
Loader memory section of flash, you would use this macro as such:
|
||||
|
||||
\code
|
||||
boot_lock_bits_set (_BV (BLB11));
|
||||
\endcode
|
||||
|
||||
\note Like any lock bits, the Boot Loader Lock Bits, once set,
|
||||
cannot be cleared again except by a chip erase which will in turn
|
||||
also erase the boot loader itself. */
|
||||
|
||||
/* Normal versions of the macros use 16-bit addresses.
|
||||
Extended versions of the macros use 32-bit addresses.
|
||||
Alternate versions of the macros use 16-bit addresses and require special
|
||||
instruction sequences after LPM.
|
||||
|
||||
FLASHEND is defined in the ioXXXX.h file.
|
||||
USHRT_MAX is defined in <limits.h>. */
|
||||
|
||||
#if defined(__AVR_ATmega161__) || defined(__AVR_ATmega163__) \
|
||||
|| defined(__AVR_ATmega323__)
|
||||
|
||||
/* Alternate: ATmega161/163/323 and 16 bit address */
|
||||
#define boot_page_fill(address, data) __boot_page_fill_alternate(address, data)
|
||||
#define boot_page_erase(address) __boot_page_erase_alternate(address)
|
||||
#define boot_page_write(address) __boot_page_write_alternate(address)
|
||||
#define boot_rww_enable() __boot_rww_enable_alternate()
|
||||
#define boot_lock_bits_set(lock_bits) __boot_lock_bits_set_alternate(lock_bits)
|
||||
|
||||
#elif (FLASHEND > USHRT_MAX)
|
||||
|
||||
/* Extended: >16 bit address */
|
||||
#define boot_page_fill(address, data) __boot_page_fill_extended_short(address, data)
|
||||
#define boot_page_erase(address) __boot_page_erase_extended_short(address)
|
||||
#define boot_page_write(address) __boot_page_write_extended_short(address)
|
||||
#define boot_rww_enable() __boot_rww_enable_short()
|
||||
#define boot_lock_bits_set(lock_bits) __boot_lock_bits_set_short(lock_bits)
|
||||
|
||||
#else
|
||||
|
||||
/* Normal: 16 bit address */
|
||||
#define boot_page_fill(address, data) __boot_page_fill_short(address, data)
|
||||
#define boot_page_erase(address) __boot_page_erase_short(address)
|
||||
#define boot_page_write(address) __boot_page_write_short(address)
|
||||
#define boot_rww_enable() __boot_rww_enable_short()
|
||||
#define boot_lock_bits_set(lock_bits) __boot_lock_bits_set_short(lock_bits)
|
||||
|
||||
#endif
|
||||
|
||||
/** \ingroup avr_boot
|
||||
|
||||
Same as boot_page_fill() except it waits for eeprom and spm operations to
|
||||
complete before filling the page. */
|
||||
|
||||
#define boot_page_fill_safe(address, data) \
|
||||
do { \
|
||||
boot_spm_busy_wait(); \
|
||||
eeprom_busy_wait(); \
|
||||
boot_page_fill(address, data); \
|
||||
} while (0)
|
||||
|
||||
/** \ingroup avr_boot
|
||||
|
||||
Same as boot_page_erase() except it waits for eeprom and spm operations to
|
||||
complete before erasing the page. */
|
||||
|
||||
#define boot_page_erase_safe(address) \
|
||||
do { \
|
||||
boot_spm_busy_wait(); \
|
||||
eeprom_busy_wait(); \
|
||||
boot_page_erase (address); \
|
||||
} while (0)
|
||||
|
||||
/** \ingroup avr_boot
|
||||
|
||||
Same as boot_page_write() except it waits for eeprom and spm operations to
|
||||
complete before writing the page. */
|
||||
|
||||
#define boot_page_write_safe(address) \
|
||||
do { \
|
||||
boot_spm_busy_wait(); \
|
||||
eeprom_busy_wait(); \
|
||||
boot_page_write (address); \
|
||||
} while (0)
|
||||
|
||||
/** \ingroup avr_boot
|
||||
|
||||
Same as boot_rww_enable() except waits for eeprom and spm operations to
|
||||
complete before enabling the RWW mameory. */
|
||||
|
||||
#define boot_rww_enable_safe() \
|
||||
do { \
|
||||
boot_spm_busy_wait(); \
|
||||
eeprom_busy_wait(); \
|
||||
boot_rww_enable(); \
|
||||
} while (0)
|
||||
|
||||
/** \ingroup avr_boot
|
||||
|
||||
Same as boot_lock_bits_set() except waits for eeprom and spm operations to
|
||||
complete before setting the lock bits. */
|
||||
|
||||
#define boot_lock_bits_set_safe(lock_bits) \
|
||||
do { \
|
||||
boot_spm_busy_wait(); \
|
||||
eeprom_busy_wait(); \
|
||||
boot_lock_bits_set (lock_bits); \
|
||||
} while (0)
|
||||
|
||||
#endif /* _AVR_BOOT_H_ */
|
||||
@@ -1,724 +0,0 @@
|
||||
/**********************************************************/
|
||||
/* -Wl,-section-start=bootloader=0x1fc00 */
|
||||
/* Optiboot bootloader for Arduino */
|
||||
/* */
|
||||
/* http://optiboot.googlecode.com */
|
||||
/* */
|
||||
/* Arduino-maintained version : See README.TXT */
|
||||
/* http://code.google.com/p/arduino/ */
|
||||
/* */
|
||||
/* Heavily optimised bootloader that is faster and */
|
||||
/* smaller than the Arduino standard bootloader */
|
||||
/* */
|
||||
/* Enhancements: */
|
||||
/* Fits in 512 bytes, saving 1.5K of code space */
|
||||
/* Background page erasing speeds up programming */
|
||||
/* Higher baud rate speeds up programming */
|
||||
/* Written almost entirely in C */
|
||||
/* Customisable timeout with accurate timeconstant */
|
||||
/* Optional virtual UART. No hardware UART required. */
|
||||
/* Optional virtual boot partition for devices without. */
|
||||
/* */
|
||||
/* What you lose: */
|
||||
/* Implements a skeleton STK500 protocol which is */
|
||||
/* missing several features including EEPROM */
|
||||
/* programming and non-page-aligned writes */
|
||||
/* High baud rate breaks compatibility with standard */
|
||||
/* Arduino flash settings */
|
||||
/* */
|
||||
/* Fully supported: */
|
||||
/* ATmega168 based devices (Diecimila etc) */
|
||||
/* ATmega328P based devices (Duemilanove etc) */
|
||||
/* */
|
||||
/* Alpha test */
|
||||
/* ATmega1280 based devices (Arduino Mega) */
|
||||
/* */
|
||||
/* Work in progress: */
|
||||
/* ATmega644P based devices (Sanguino) */
|
||||
/* ATtiny84 based devices (Luminet) */
|
||||
/* */
|
||||
/* Does not support: */
|
||||
/* USB based devices (eg. Teensy) */
|
||||
/* */
|
||||
/* Assumptions: */
|
||||
/* The code makes several assumptions that reduce the */
|
||||
/* code size. They are all true after a hardware reset, */
|
||||
/* but may not be true if the bootloader is called by */
|
||||
/* other means or on other hardware. */
|
||||
/* No interrupts can occur */
|
||||
/* UART and Timer 1 are set to their reset state */
|
||||
/* SP points to RAMEND */
|
||||
/* */
|
||||
/* Code builds on code, libraries and optimisations from: */
|
||||
/* stk500boot.c by Jason P. Kyle */
|
||||
/* Arduino bootloader http://arduino.cc */
|
||||
/* Spiff's 1K bootloader http://spiffie.org/know/arduino_1k_bootloader/bootloader.shtml */
|
||||
/* avr-libc project http://nongnu.org/avr-libc */
|
||||
/* Adaboot http://www.ladyada.net/library/arduino/bootloader.html */
|
||||
/* AVR305 Atmel Application Note */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it */
|
||||
/* and/or modify it under the terms of the GNU General */
|
||||
/* Public License as published by the Free Software */
|
||||
/* Foundation; either version 2 of the License, or */
|
||||
/* (at your option) any later version. */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will */
|
||||
/* be useful, but WITHOUT ANY WARRANTY; without even the */
|
||||
/* implied warranty of MERCHANTABILITY or FITNESS FOR A */
|
||||
/* PARTICULAR PURPOSE. See the GNU General Public */
|
||||
/* License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General */
|
||||
/* Public License along with this program; if not, write */
|
||||
/* to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
/* */
|
||||
/* Licence can be viewed at */
|
||||
/* http://www.fsf.org/licenses/gpl.txt */
|
||||
/* */
|
||||
/**********************************************************/
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
/* */
|
||||
/* Optional defines: */
|
||||
/* */
|
||||
/**********************************************************/
|
||||
/* */
|
||||
/* BIG_BOOT: */
|
||||
/* Build a 1k bootloader, not 512 bytes. This turns on */
|
||||
/* extra functionality. */
|
||||
/* */
|
||||
/* BAUD_RATE: */
|
||||
/* Set bootloader baud rate. */
|
||||
/* */
|
||||
/* LUDICROUS_SPEED: */
|
||||
/* 230400 baud :-) */
|
||||
/* */
|
||||
/* SOFT_UART: */
|
||||
/* Use AVR305 soft-UART instead of hardware UART. */
|
||||
/* */
|
||||
/* LED_START_FLASHES: */
|
||||
/* Number of LED flashes on bootup. */
|
||||
/* */
|
||||
/* LED_DATA_FLASH: */
|
||||
/* Flash LED when transferring data. For boards without */
|
||||
/* TX or RX LEDs, or for people who like blinky lights. */
|
||||
/* */
|
||||
/* SUPPORT_EEPROM: */
|
||||
/* Support reading and writing from EEPROM. This is not */
|
||||
/* used by Arduino, so off by default. */
|
||||
/* */
|
||||
/* TIMEOUT_MS: */
|
||||
/* Bootloader timeout period, in milliseconds. */
|
||||
/* 500,1000,2000,4000,8000 supported. */
|
||||
/* */
|
||||
/**********************************************************/
|
||||
|
||||
/**********************************************************/
|
||||
/* Version Numbers! */
|
||||
/* */
|
||||
/* Arduino Optiboot now includes this Version number in */
|
||||
/* the source and object code. */
|
||||
/* */
|
||||
/* Version 3 was released as zip from the optiboot */
|
||||
/* repository and was distributed with Arduino 0022. */
|
||||
/* Version 4 starts with the arduino repository commit */
|
||||
/* that brought the arduino repository up-to-date with */
|
||||
/* the optiboot source tree changes since v3. */
|
||||
/* */
|
||||
/**********************************************************/
|
||||
|
||||
/**********************************************************/
|
||||
/* Edit History: */
|
||||
/* */
|
||||
/* Jan 2012: */
|
||||
/* 4.5 WestfW: fix NRWW value for m1284. */
|
||||
/* 4.4 WestfW: use attribute OS_main instead of naked for */
|
||||
/* main(). This allows optimizations that we */
|
||||
/* count on, which are prohibited in naked */
|
||||
/* functions due to PR42240. (keeps us less */
|
||||
/* than 512 bytes when compiler is gcc4.5 */
|
||||
/* (code from 4.3.2 remains the same.) */
|
||||
/* 4.4 WestfW and Maniacbug: Add m1284 support. This */
|
||||
/* does not change the 328 binary, so the */
|
||||
/* version number didn't change either. (?) */
|
||||
/* June 2011: */
|
||||
/* 4.4 WestfW: remove automatic soft_uart detect (didn't */
|
||||
/* know what it was doing or why.) Added a */
|
||||
/* check of the calculated BRG value instead. */
|
||||
/* Version stays 4.4; existing binaries are */
|
||||
/* not changed. */
|
||||
/* 4.4 WestfW: add initialization of address to keep */
|
||||
/* the compiler happy. Change SC'ed targets. */
|
||||
/* Return the SW version via READ PARAM */
|
||||
/* 4.3 WestfW: catch framing errors in getch(), so that */
|
||||
/* AVRISP works without HW kludges. */
|
||||
/* http://code.google.com/p/arduino/issues/detail?id=368n*/
|
||||
/* 4.2 WestfW: reduce code size, fix timeouts, change */
|
||||
/* verifySpace to use WDT instead of appstart */
|
||||
/* 4.1 WestfW: put version number in binary. */
|
||||
/**********************************************************/
|
||||
|
||||
#define OPTIBOOT_MAJVER 4
|
||||
#define OPTIBOOT_MINVER 5
|
||||
|
||||
#define MAKESTR(a) #a
|
||||
#define MAKEVER(a, b) MAKESTR(a*256+b)
|
||||
|
||||
asm(" .section .version\n"
|
||||
"optiboot_version: .word " MAKEVER(OPTIBOOT_MAJVER, OPTIBOOT_MINVER) "\n"
|
||||
" .section .text\n");
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
// <avr/boot.h> uses sts instructions, but this version uses out instructions
|
||||
// This saves cycles and program memory.
|
||||
#include "boot.h"
|
||||
|
||||
|
||||
// We don't use <avr/wdt.h> as those routines have interrupt overhead we don't need.
|
||||
|
||||
#include "pin_defs.h"
|
||||
#include "stk500.h"
|
||||
|
||||
#ifndef LED_START_FLASHES
|
||||
#define LED_START_FLASHES 0
|
||||
#endif
|
||||
|
||||
#ifdef LUDICROUS_SPEED
|
||||
#define BAUD_RATE 230400L
|
||||
#endif
|
||||
|
||||
/* set the UART baud rate defaults */
|
||||
#ifndef BAUD_RATE
|
||||
#if F_CPU >= 8000000L
|
||||
#define BAUD_RATE 115200L // Highest rate Avrdude win32 will support
|
||||
#elsif F_CPU >= 1000000L
|
||||
#define BAUD_RATE 9600L // 19200 also supported, but with significant error
|
||||
#elsif F_CPU >= 128000L
|
||||
#define BAUD_RATE 4800L // Good for 128kHz internal RC
|
||||
#else
|
||||
#define BAUD_RATE 1200L // Good even at 32768Hz
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* Switch in soft UART for hard baud rates */
|
||||
/*
|
||||
* I don't understand what this was supposed to accomplish, where the
|
||||
* constant "280" came from, or why automatically (and perhaps unexpectedly)
|
||||
* switching to a soft uart is a good thing, so I'm undoing this in favor
|
||||
* of a range check using the same calc used to config the BRG...
|
||||
*/
|
||||
#if (F_CPU/BAUD_RATE) > 280 // > 57600 for 16MHz
|
||||
#ifndef SOFT_UART
|
||||
#define SOFT_UART
|
||||
#endif
|
||||
#endif
|
||||
#else // 0
|
||||
#if (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 > 250
|
||||
#error Unachievable baud rate (too slow) BAUD_RATE
|
||||
#endif // baud rate slow check
|
||||
#if (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 < 3
|
||||
#error Unachievable baud rate (too fast) BAUD_RATE
|
||||
#endif // baud rate fastn check
|
||||
#endif
|
||||
|
||||
/* Watchdog settings */
|
||||
#define WATCHDOG_OFF (0)
|
||||
#define WATCHDOG_16MS (_BV(WDE))
|
||||
#define WATCHDOG_32MS (_BV(WDP0) | _BV(WDE))
|
||||
#define WATCHDOG_64MS (_BV(WDP1) | _BV(WDE))
|
||||
#define WATCHDOG_125MS (_BV(WDP1) | _BV(WDP0) | _BV(WDE))
|
||||
#define WATCHDOG_250MS (_BV(WDP2) | _BV(WDE))
|
||||
#define WATCHDOG_500MS (_BV(WDP2) | _BV(WDP0) | _BV(WDE))
|
||||
#define WATCHDOG_1S (_BV(WDP2) | _BV(WDP1) | _BV(WDE))
|
||||
#define WATCHDOG_2S (_BV(WDP2) | _BV(WDP1) | _BV(WDP0) | _BV(WDE))
|
||||
#ifndef __AVR_ATmega8__
|
||||
#define WATCHDOG_4S (_BV(WDP3) | _BV(WDE))
|
||||
#define WATCHDOG_8S (_BV(WDP3) | _BV(WDP0) | _BV(WDE))
|
||||
#endif
|
||||
|
||||
/* Function Prototypes */
|
||||
/* The main function is in init9, which removes the interrupt vector table */
|
||||
/* we don't need. It is also 'naked', which means the compiler does not */
|
||||
/* generate any entry or exit code itself. */
|
||||
int main(void) __attribute__ ((OS_main)) __attribute__ ((section (".init9")));
|
||||
void putch(char);
|
||||
uint8_t getch(void);
|
||||
static inline void getNch(uint8_t); /* "static inline" is a compiler hint to reduce code size */
|
||||
void verifySpace();
|
||||
static inline void flash_led(uint8_t);
|
||||
uint8_t getLen();
|
||||
static inline void watchdogReset();
|
||||
void watchdogConfig(uint8_t x);
|
||||
#ifdef SOFT_UART
|
||||
void uartDelay() __attribute__ ((naked));
|
||||
#endif
|
||||
void appStart() __attribute__ ((naked));
|
||||
|
||||
/*
|
||||
* NRWW memory
|
||||
* Addresses below NRWW (Non-Read-While-Write) can be programmed while
|
||||
* continuing to run code from flash, slightly speeding up programming
|
||||
* time. Beware that Atmel data sheets specify this as a WORD address,
|
||||
* while optiboot will be comparing against a 16-bit byte address. This
|
||||
* means that on a part with 128kB of memory, the upper part of the lower
|
||||
* 64k will get NRWW processing as well, even though it doesn't need it.
|
||||
* That's OK. In fact, you can disable the overlapping processing for
|
||||
* a part entirely by setting NRWWSTART to zero. This reduces code
|
||||
* space a bit, at the expense of being slightly slower, overall.
|
||||
*
|
||||
* RAMSTART should be self-explanatory. It's bigger on parts with a
|
||||
* lot of peripheral registers.
|
||||
*/
|
||||
#if defined(__AVR_ATmega168__)
|
||||
#define RAMSTART (0x100)
|
||||
#define NRWWSTART (0x3800)
|
||||
#elif defined(__AVR_ATmega328P__)
|
||||
#define RAMSTART (0x100)
|
||||
#define NRWWSTART (0x7000)
|
||||
#elif defined (__AVR_ATmega644P__)
|
||||
#define RAMSTART (0x100)
|
||||
#define NRWWSTART (0xE000)
|
||||
#elif defined (__AVR_ATmega1284P__)
|
||||
#define RAMSTART (0x100)
|
||||
#define NRWWSTART (0xE000)
|
||||
#elif defined(__AVR_ATtiny84__)
|
||||
#define RAMSTART (0x100)
|
||||
#define NRWWSTART (0x0000)
|
||||
#elif defined(__AVR_ATmega1280__)
|
||||
#define RAMSTART (0x200)
|
||||
#define NRWWSTART (0xE000)
|
||||
#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
|
||||
#define RAMSTART (0x100)
|
||||
#define NRWWSTART (0x1800)
|
||||
#endif
|
||||
|
||||
/* C zero initialises all global variables. However, that requires */
|
||||
/* These definitions are NOT zero initialised, but that doesn't matter */
|
||||
/* This allows us to drop the zero init code, saving us memory */
|
||||
#define buff ((uint8_t*)(RAMSTART))
|
||||
#ifdef VIRTUAL_BOOT_PARTITION
|
||||
#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4))
|
||||
#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
|
||||
#endif
|
||||
|
||||
/* main program starts here */
|
||||
int main(void) {
|
||||
uint8_t ch;
|
||||
|
||||
/*
|
||||
* Making these local and in registers prevents the need for initializing
|
||||
* them, and also saves space because code no longer stores to memory.
|
||||
* (initializing address keeps the compiler happy, but isn't really
|
||||
* necessary, and uses 4 bytes of flash.)
|
||||
*/
|
||||
register uint16_t address = 0;
|
||||
register uint8_t length;
|
||||
|
||||
// After the zero init loop, this is the first code to run.
|
||||
//
|
||||
// This code makes the following assumptions:
|
||||
// No interrupts will execute
|
||||
// SP points to RAMEND
|
||||
// r1 contains zero
|
||||
//
|
||||
// If not, uncomment the following instructions:
|
||||
// cli();
|
||||
asm volatile ("clr __zero_reg__");
|
||||
#ifdef __AVR_ATmega8__
|
||||
SP=RAMEND; // This is done by hardware reset
|
||||
#endif
|
||||
|
||||
// Adaboot no-wait mod
|
||||
ch = MCUSR;
|
||||
MCUSR = 0;
|
||||
if (!(ch & _BV(EXTRF))) appStart();
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
// Set up Timer 1 for timeout counter
|
||||
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
||||
#endif
|
||||
#ifndef SOFT_UART
|
||||
#ifdef __AVR_ATmega8__
|
||||
UCSRA = _BV(U2X); //Double speed mode USART
|
||||
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
||||
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
||||
UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#else
|
||||
UCSR0A = _BV(U2X0); //Double speed mode USART0
|
||||
UCSR0B = _BV(RXEN0) | _BV(TXEN0);
|
||||
UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
|
||||
UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Set up watchdog to trigger after 500ms
|
||||
watchdogConfig(WATCHDOG_1S);
|
||||
|
||||
/* Set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
|
||||
#ifdef SOFT_UART
|
||||
/* Set TX pin as output */
|
||||
UART_DDR |= _BV(UART_TX_BIT);
|
||||
#endif
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
/* Flash onboard LED to signal entering of bootloader */
|
||||
flash_led(LED_START_FLASHES * 2);
|
||||
#endif
|
||||
|
||||
/* Forever loop */
|
||||
for (;;) {
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
|
||||
if(ch == STK_GET_PARAMETER) {
|
||||
unsigned char which = getch();
|
||||
verifySpace();
|
||||
if (which == 0x82) {
|
||||
/*
|
||||
* Send optiboot version as "minor SW version"
|
||||
*/
|
||||
putch(OPTIBOOT_MINVER);
|
||||
} else if (which == 0x81) {
|
||||
putch(OPTIBOOT_MAJVER);
|
||||
} else {
|
||||
/*
|
||||
* GET PARAMETER returns a generic 0x03 reply for
|
||||
* other parameters - enough to keep Avrdude happy
|
||||
*/
|
||||
putch(0x03);
|
||||
}
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE) {
|
||||
// SET DEVICE is ignored
|
||||
getNch(20);
|
||||
}
|
||||
else if(ch == STK_SET_DEVICE_EXT) {
|
||||
// SET DEVICE EXT is ignored
|
||||
getNch(5);
|
||||
}
|
||||
else if(ch == STK_LOAD_ADDRESS) {
|
||||
// LOAD ADDRESS
|
||||
uint16_t newAddress;
|
||||
newAddress = getch();
|
||||
newAddress = (newAddress & 0xff) | (getch() << 8);
|
||||
#ifdef RAMPZ
|
||||
// Transfer top bit to RAMPZ
|
||||
RAMPZ = (newAddress & 0x8000) ? 1 : 0;
|
||||
#endif
|
||||
newAddress += newAddress; // Convert from word address to byte address
|
||||
address = newAddress;
|
||||
verifySpace();
|
||||
}
|
||||
else if(ch == STK_UNIVERSAL) {
|
||||
// UNIVERSAL command is ignored
|
||||
getNch(4);
|
||||
putch(0x00);
|
||||
}
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch == STK_PROG_PAGE) {
|
||||
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
||||
uint8_t *bufPtr;
|
||||
uint16_t addrPtr;
|
||||
|
||||
getch(); /* getlen() */
|
||||
length = getch();
|
||||
getch();
|
||||
|
||||
// If we are in RWW section, immediately start page erase
|
||||
if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
|
||||
|
||||
// While that is going on, read in page contents
|
||||
bufPtr = buff;
|
||||
do *bufPtr++ = getch();
|
||||
while (--length);
|
||||
|
||||
// If we are in NRWW section, page erase has to be delayed until now.
|
||||
// Todo: Take RAMPZ into account
|
||||
if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
|
||||
|
||||
// Read command terminator, start reply
|
||||
verifySpace();
|
||||
|
||||
// If only a partial page is to be programmed, the erase might not be complete.
|
||||
// So check that here
|
||||
boot_spm_busy_wait();
|
||||
|
||||
#ifdef VIRTUAL_BOOT_PARTITION
|
||||
if ((uint16_t)(void*)address == 0) {
|
||||
// This is the reset vector page. We need to live-patch the code so the
|
||||
// bootloader runs.
|
||||
//
|
||||
// Move RESET vector to WDT vector
|
||||
uint16_t vect = buff[0] | (buff[1]<<8);
|
||||
rstVect = vect;
|
||||
wdtVect = buff[8] | (buff[9]<<8);
|
||||
vect -= 4; // Instruction is a relative jump (rjmp), so recalculate.
|
||||
buff[8] = vect & 0xff;
|
||||
buff[9] = vect >> 8;
|
||||
|
||||
// Add jump to bootloader at RESET vector
|
||||
buff[0] = 0x7f;
|
||||
buff[1] = 0xce; // rjmp 0x1d00 instruction
|
||||
}
|
||||
#endif
|
||||
|
||||
// Copy buffer into programming buffer
|
||||
bufPtr = buff;
|
||||
addrPtr = (uint16_t)(void*)address;
|
||||
ch = SPM_PAGESIZE / 2;
|
||||
do {
|
||||
uint16_t a;
|
||||
a = *bufPtr++;
|
||||
a |= (*bufPtr++) << 8;
|
||||
__boot_page_fill_short((uint16_t)(void*)addrPtr,a);
|
||||
addrPtr += 2;
|
||||
} while (--ch);
|
||||
|
||||
// Write from programming buffer
|
||||
__boot_page_write_short((uint16_t)(void*)address);
|
||||
boot_spm_busy_wait();
|
||||
|
||||
#if defined(RWWSRE)
|
||||
// Reenable read access to flash
|
||||
boot_rww_enable();
|
||||
#endif
|
||||
|
||||
}
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch == STK_READ_PAGE) {
|
||||
// READ PAGE - we only read flash
|
||||
getch(); /* getlen() */
|
||||
length = getch();
|
||||
getch();
|
||||
|
||||
verifySpace();
|
||||
#ifdef VIRTUAL_BOOT_PARTITION
|
||||
do {
|
||||
// Undo vector patch in bottom page so verify passes
|
||||
if (address == 0) ch=rstVect & 0xff;
|
||||
else if (address == 1) ch=rstVect >> 8;
|
||||
else if (address == 8) ch=wdtVect & 0xff;
|
||||
else if (address == 9) ch=wdtVect >> 8;
|
||||
else ch = pgm_read_byte_near(address);
|
||||
address++;
|
||||
putch(ch);
|
||||
} while (--length);
|
||||
#else
|
||||
#ifdef RAMPZ
|
||||
// Since RAMPZ should already be set, we need to use EPLM directly.
|
||||
// do putch(pgm_read_byte_near(address++));
|
||||
// while (--length);
|
||||
do {
|
||||
uint8_t result;
|
||||
__asm__ ("elpm %0,Z\n":"=r"(result):"z"(address));
|
||||
putch(result);
|
||||
address++;
|
||||
}
|
||||
while (--length);
|
||||
#else
|
||||
do putch(pgm_read_byte_near(address++));
|
||||
while (--length);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch == STK_READ_SIGN) {
|
||||
// READ SIGN - return what Avrdude wants to hear
|
||||
verifySpace();
|
||||
putch(SIGNATURE_0);
|
||||
putch(SIGNATURE_1);
|
||||
putch(SIGNATURE_2);
|
||||
}
|
||||
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
||||
// Adaboot no-wait mod
|
||||
watchdogConfig(WATCHDOG_16MS);
|
||||
verifySpace();
|
||||
}
|
||||
else {
|
||||
// This covers the response to commands like STK_ENTER_PROGMODE
|
||||
verifySpace();
|
||||
}
|
||||
putch(STK_OK);
|
||||
}
|
||||
}
|
||||
|
||||
void putch(char ch) {
|
||||
#ifndef SOFT_UART
|
||||
while (!(UCSR0A & _BV(UDRE0)));
|
||||
UDR0 = ch;
|
||||
#else
|
||||
__asm__ __volatile__ (
|
||||
" com %[ch]\n" // ones complement, carry set
|
||||
" sec\n"
|
||||
"1: brcc 2f\n"
|
||||
" cbi %[uartPort],%[uartBit]\n"
|
||||
" rjmp 3f\n"
|
||||
"2: sbi %[uartPort],%[uartBit]\n"
|
||||
" nop\n"
|
||||
"3: rcall uartDelay\n"
|
||||
" rcall uartDelay\n"
|
||||
" lsr %[ch]\n"
|
||||
" dec %[bitcnt]\n"
|
||||
" brne 1b\n"
|
||||
:
|
||||
:
|
||||
[bitcnt] "d" (10),
|
||||
[ch] "r" (ch),
|
||||
[uartPort] "I" (_SFR_IO_ADDR(UART_PORT)),
|
||||
[uartBit] "I" (UART_TX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t getch(void) {
|
||||
uint8_t ch;
|
||||
|
||||
#ifdef LED_DATA_FLASH
|
||||
#ifdef __AVR_ATmega8__
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_UART
|
||||
__asm__ __volatile__ (
|
||||
"1: sbic %[uartPin],%[uartBit]\n" // Wait for start edge
|
||||
" rjmp 1b\n"
|
||||
" rcall uartDelay\n" // Get to middle of start bit
|
||||
"2: rcall uartDelay\n" // Wait 1 bit period
|
||||
" rcall uartDelay\n" // Wait 1 bit period
|
||||
" clc\n"
|
||||
" sbic %[uartPin],%[uartBit]\n"
|
||||
" sec\n"
|
||||
" dec %[bitCnt]\n"
|
||||
" breq 3f\n"
|
||||
" ror %[ch]\n"
|
||||
" rjmp 2b\n"
|
||||
"3:\n"
|
||||
:
|
||||
[ch] "=r" (ch)
|
||||
:
|
||||
[bitCnt] "d" (9),
|
||||
[uartPin] "I" (_SFR_IO_ADDR(UART_PIN)),
|
||||
[uartBit] "I" (UART_RX_BIT)
|
||||
:
|
||||
"r25"
|
||||
);
|
||||
#else
|
||||
while(!(UCSR0A & _BV(RXC0)))
|
||||
;
|
||||
if (!(UCSR0A & _BV(FE0))) {
|
||||
/*
|
||||
* A Framing Error indicates (probably) that something is talking
|
||||
* to us at the wrong bit rate. Assume that this is because it
|
||||
* expects to be talking to the application, and DON'T reset the
|
||||
* watchdog. This should cause the bootloader to abort and run
|
||||
* the application "soon", if it keeps happening. (Note that we
|
||||
* don't care that an invalid char is returned...)
|
||||
*/
|
||||
watchdogReset();
|
||||
}
|
||||
|
||||
ch = UDR0;
|
||||
#endif
|
||||
|
||||
#ifdef LED_DATA_FLASH
|
||||
#ifdef __AVR_ATmega8__
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
#ifdef SOFT_UART
|
||||
// AVR305 equation: #define UART_B_VALUE (((F_CPU/BAUD_RATE)-23)/6)
|
||||
// Adding 3 to numerator simulates nearest rounding for more accurate baud rates
|
||||
#define UART_B_VALUE (((F_CPU/BAUD_RATE)-20)/6)
|
||||
#if UART_B_VALUE > 255
|
||||
#error Baud rate too slow for soft UART
|
||||
#endif
|
||||
|
||||
void uartDelay() {
|
||||
__asm__ __volatile__ (
|
||||
"ldi r25,%[count]\n"
|
||||
"1:dec r25\n"
|
||||
"brne 1b\n"
|
||||
"ret\n"
|
||||
::[count] "M" (UART_B_VALUE)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
void getNch(uint8_t count) {
|
||||
do getch(); while (--count);
|
||||
verifySpace();
|
||||
}
|
||||
|
||||
void verifySpace() {
|
||||
if (getch() != CRC_EOP) {
|
||||
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
||||
while (1) // and busy-loop so that WD causes
|
||||
; // a reset and app start.
|
||||
}
|
||||
putch(STK_INSYNC);
|
||||
}
|
||||
|
||||
#if LED_START_FLASHES > 0
|
||||
void flash_led(uint8_t count) {
|
||||
do {
|
||||
TCNT1 = -(F_CPU/(1024*16));
|
||||
TIFR1 = _BV(TOV1);
|
||||
while(!(TIFR1 & _BV(TOV1)));
|
||||
#ifdef __AVR_ATmega8__
|
||||
LED_PORT ^= _BV(LED);
|
||||
#else
|
||||
LED_PIN |= _BV(LED);
|
||||
#endif
|
||||
watchdogReset();
|
||||
} while (--count);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Watchdog functions. These are only safe with interrupts turned off.
|
||||
void watchdogReset() {
|
||||
__asm__ __volatile__ (
|
||||
"wdr\n"
|
||||
);
|
||||
}
|
||||
|
||||
void watchdogConfig(uint8_t x) {
|
||||
WDTCSR = _BV(WDCE) | _BV(WDE);
|
||||
WDTCSR = x;
|
||||
}
|
||||
|
||||
void appStart() {
|
||||
watchdogConfig(WATCHDOG_OFF);
|
||||
__asm__ __volatile__ (
|
||||
#ifdef VIRTUAL_BOOT_PARTITION
|
||||
// Jump to WDT vector
|
||||
"ldi r30,4\n"
|
||||
"clr r31\n"
|
||||
#else
|
||||
// Jump to RST vector
|
||||
"clr r30\n"
|
||||
"clr r31\n"
|
||||
#endif
|
||||
"ijmp\n"
|
||||
);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
:020000021000EC
|
||||
:10FE00000F92CDB7DEB7112484B714BE81FFDFD0C7
|
||||
:10FE100082E08093C00088E18093C10086E08093F7
|
||||
:10FE2000C2008AE28093C4008EE0BBD0209A00E03A
|
||||
:10FE300010E0EE24E394E1E1DE2EF3E0FF2EA5D006
|
||||
:10FE4000813471F4A2D08983B2D08981823809F4D7
|
||||
:10FE50008BC0813811F484E001C083E08FD08BC067
|
||||
:10FE6000823411F484E103C0853419F485E0A7D00D
|
||||
:10FE700082C0853591F489D0A82EBB2486D0082F66
|
||||
:10FE800010E0102F00270A291B29812F881F88279F
|
||||
:10FE9000881F8BBF000F111F6DC0863521F484E0D1
|
||||
:10FEA0008ED080E0DBCF843609F040C06ED06DD0BC
|
||||
:10FEB000C82E6BD080EE0030180718F4F801F7BE9A
|
||||
:10FEC000E895A12C51E0B52E60D0F50181935F013A
|
||||
:10FED000CE16D1F7F0EE00301F0718F0F801F7BE8C
|
||||
:10FEE000E89565D007B600FCFDCFF801A0E0B1E0D1
|
||||
:10FEF0002C9130E011968C91119790E0982F8827E3
|
||||
:10FF0000822B932B12960C01E7BEE89511243296B2
|
||||
:10FF100082E0A030B80761F785E0F80187BFE89577
|
||||
:10FF200007B600FCFDCFD7BEE89525C08437A9F4FD
|
||||
:10FF30002CD02BD0B82E29D03AD0CB2C4801F401AC
|
||||
:10FF400086911CD00894811C911CCA94C1F70F5F44
|
||||
:10FF50001F4FBA940B0D111D0EC0853739F427D0F1
|
||||
:10FF60008EE10CD087E90AD085E078CF813511F495
|
||||
:10FF700088E017D01CD080E101D061CF9091C00003
|
||||
:10FF800095FFFCCF8093C60008958091C00087FF45
|
||||
:10FF9000FCCF8091C00084FD01C0A8958091C6006F
|
||||
:10FFA0000895E0E6F0E098E1908380830895EDDF26
|
||||
:10FFB000803219F088E0F5DFFFCF84E1DFCFCF9307
|
||||
:10FFC000C82FE3DFC150E9F7F2DFCF91089580E059
|
||||
:08FFD000E8DFEE27FF2709948A
|
||||
:040000031000FE00EB
|
||||
:00000001FF
|
||||
@@ -1,81 +0,0 @@
|
||||
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
|
||||
/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB5
|
||||
|
||||
/* Ports for soft UART */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTD
|
||||
#define UART_PIN PIND
|
||||
#define UART_DDR DDRD
|
||||
#define UART_TX_BIT 1
|
||||
#define UART_RX_BIT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__AVR_ATmega8__)
|
||||
//Name conversion R.Wiersma
|
||||
#define UCSR0A UCSRA
|
||||
#define UDR0 UDR
|
||||
#define UDRE0 UDRE
|
||||
#define RXC0 RXC
|
||||
#define FE0 FE
|
||||
#define TIFR1 TIFR
|
||||
#define WDTCSR WDTCR
|
||||
#endif
|
||||
|
||||
/* Luminet support */
|
||||
#if defined(__AVR_ATtiny84__)
|
||||
/* Red LED is connected to pin PA4 */
|
||||
#define LED_DDR DDRA
|
||||
#define LED_PORT PORTA
|
||||
#define LED_PIN PINA
|
||||
#define LED PINA4
|
||||
/* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTA
|
||||
#define UART_PIN PINA
|
||||
#define UART_DDR DDRA
|
||||
#define UART_TX_BIT 2
|
||||
#define UART_RX_BIT 3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Sanguino support */
|
||||
#if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
|
||||
/* Onboard LED is connected to pin PB0 on Sanguino */
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB0
|
||||
|
||||
/* Ports for soft UART */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTD
|
||||
#define UART_PIN PIND
|
||||
#define UART_DDR DDRD
|
||||
#define UART_TX_BIT 1
|
||||
#define UART_RX_BIT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Mega support */
|
||||
#if defined(__AVR_ATmega1280__)
|
||||
/* Onboard LED is connected to pin PB7 on Arduino Mega */
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB7
|
||||
|
||||
/* Ports for soft UART */
|
||||
#ifdef SOFT_UART
|
||||
#define UART_PORT PORTE
|
||||
#define UART_PIN PINE
|
||||
#define UART_DDR DDRE
|
||||
#define UART_TX_BIT 1
|
||||
#define UART_RX_BIT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/* STK500 constants list, from AVRDUDE */
|
||||
#define STK_OK 0x10
|
||||
#define STK_FAILED 0x11 // Not used
|
||||
#define STK_UNKNOWN 0x12 // Not used
|
||||
#define STK_NODEVICE 0x13 // Not used
|
||||
#define STK_INSYNC 0x14 // ' '
|
||||
#define STK_NOSYNC 0x15 // Not used
|
||||
#define ADC_CHANNEL_ERROR 0x16 // Not used
|
||||
#define ADC_MEASURE_OK 0x17 // Not used
|
||||
#define PWM_CHANNEL_ERROR 0x18 // Not used
|
||||
#define PWM_ADJUST_OK 0x19 // Not used
|
||||
#define CRC_EOP 0x20 // 'SPACE'
|
||||
#define STK_GET_SYNC 0x30 // '0'
|
||||
#define STK_GET_SIGN_ON 0x31 // '1'
|
||||
#define STK_SET_PARAMETER 0x40 // '@'
|
||||
#define STK_GET_PARAMETER 0x41 // 'A'
|
||||
#define STK_SET_DEVICE 0x42 // 'B'
|
||||
#define STK_SET_DEVICE_EXT 0x45 // 'E'
|
||||
#define STK_ENTER_PROGMODE 0x50 // 'P'
|
||||
#define STK_LEAVE_PROGMODE 0x51 // 'Q'
|
||||
#define STK_CHIP_ERASE 0x52 // 'R'
|
||||
#define STK_CHECK_AUTOINC 0x53 // 'S'
|
||||
#define STK_LOAD_ADDRESS 0x55 // 'U'
|
||||
#define STK_UNIVERSAL 0x56 // 'V'
|
||||
#define STK_PROG_FLASH 0x60 // '`'
|
||||
#define STK_PROG_DATA 0x61 // 'a'
|
||||
#define STK_PROG_FUSE 0x62 // 'b'
|
||||
#define STK_PROG_LOCK 0x63 // 'c'
|
||||
#define STK_PROG_PAGE 0x64 // 'd'
|
||||
#define STK_PROG_FUSE_EXT 0x65 // 'e'
|
||||
#define STK_READ_FLASH 0x70 // 'p'
|
||||
#define STK_READ_DATA 0x71 // 'q'
|
||||
#define STK_READ_FUSE 0x72 // 'r'
|
||||
#define STK_READ_LOCK 0x73 // 's'
|
||||
#define STK_READ_PAGE 0x74 // 't'
|
||||
#define STK_READ_SIGN 0x75 // 'u'
|
||||
#define STK_READ_OSCCAL 0x76 // 'v'
|
||||
#define STK_READ_FUSE_EXT 0x77 // 'w'
|
||||
#define STK_READ_OSCCAL_EXT 0x78 // 'x'
|
||||
@@ -1,713 +0,0 @@
|
||||
/**********************************************************/
|
||||
/* Serial Bootloader for Atmel megaAVR Controllers */
|
||||
/* */
|
||||
/* tested with ATmega644 and ATmega644P */
|
||||
/* should work with other mega's, see code for details */
|
||||
/* */
|
||||
/* ATmegaBOOT.c */
|
||||
/* */
|
||||
/* 20090131: Added 324P support from Alex Leone */
|
||||
/* Marius Kintel */
|
||||
/* 20080915: applied ADABoot mods for Sanguino 644P */
|
||||
/* Brian Riley */
|
||||
/* 20080711: hacked for Sanguino by Zach Smith */
|
||||
/* and Justin Day */
|
||||
/* 20070626: hacked for Arduino Diecimila (which auto- */
|
||||
/* resets when a USB connection is made to it) */
|
||||
/* by D. Mellis */
|
||||
/* 20060802: hacked for Arduino by D. Cuartielles */
|
||||
/* based on a previous hack by D. Mellis */
|
||||
/* and D. Cuartielles */
|
||||
/* */
|
||||
/* Monitor and debug functions were added to the original */
|
||||
/* code by Dr. Erik Lins, chip45.com. (See below) */
|
||||
/* */
|
||||
/* Thanks to Karl Pitrich for fixing a bootloader pin */
|
||||
/* problem and more informative LED blinking! */
|
||||
/* */
|
||||
/* For the latest version see: */
|
||||
/* http://www.chip45.com/ */
|
||||
/* */
|
||||
/* ------------------------------------------------------ */
|
||||
/* */
|
||||
/* based on stk500boot.c */
|
||||
/* Copyright (c) 2003, Jason P. Kyle */
|
||||
/* All rights reserved. */
|
||||
/* see avr1.org for original file and information */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it */
|
||||
/* and/or modify it under the terms of the GNU General */
|
||||
/* Public License as published by the Free Software */
|
||||
/* Foundation; either version 2 of the License, or */
|
||||
/* (at your option) any later version. */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will */
|
||||
/* be useful, but WITHOUT ANY WARRANTY; without even the */
|
||||
/* implied warranty of MERCHANTABILITY or FITNESS FOR A */
|
||||
/* PARTICULAR PURPOSE. See the GNU General Public */
|
||||
/* License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General */
|
||||
/* Public License along with this program; if not, write */
|
||||
/* to the Free Software Foundation, Inc., */
|
||||
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
/* */
|
||||
/* Licence can be viewed at */
|
||||
/* http://www.fsf.org/licenses/gpl.txt */
|
||||
/* */
|
||||
/* Target = Atmel AVR m128,m64,m32,m16,m8,m162,m163,m169, */
|
||||
/* m8515,m8535. ATmega161 has a very small boot block so */
|
||||
/* isn't supported. */
|
||||
/* */
|
||||
/* Tested with m168 */
|
||||
/**********************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
/* some includes */
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <avr/boot.h>
|
||||
|
||||
#ifdef ADABOOT
|
||||
#define NUM_LED_FLASHES 3
|
||||
#define ADABOOT_VER 1
|
||||
#endif
|
||||
|
||||
|
||||
/* 20070707: hacked by David A. Mellis - after this many errors give up and launch application */
|
||||
#define MAX_ERROR_COUNT 5
|
||||
|
||||
/* set the UART baud rate */
|
||||
/* 20080711: hack by Zach Hoeken */
|
||||
#define BAUD_RATE 38400
|
||||
|
||||
/* SW_MAJOR and MINOR needs to be updated from time to time to avoid warning message from AVR Studio */
|
||||
/* never allow AVR Studio to do an update !!!! */
|
||||
#define HW_VER 0x02
|
||||
#define SW_MAJOR 0x01
|
||||
#define SW_MINOR 0x10
|
||||
|
||||
/* onboard LED is used to indicate, that the bootloader was entered (3x flashing) */
|
||||
/* if monitor functions are included, LED goes on after monitor was entered */
|
||||
#define LED_DDR DDRB
|
||||
#define LED_PORT PORTB
|
||||
#define LED_PIN PINB
|
||||
#define LED PINB0
|
||||
|
||||
/* define various device id's */
|
||||
/* manufacturer byte is always the same */
|
||||
#define SIG1 0x1E // Yep, Atmel is the only manufacturer of AVR micros. Single source :(
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
#define SIG2 0x96
|
||||
#define SIG3 0x0A
|
||||
#elif defined(__AVR_ATmega644__)
|
||||
#define SIG2 0x96
|
||||
#define SIG3 0x09
|
||||
#elif defined(__AVR_ATmega324P__)
|
||||
#define SIG2 0x95
|
||||
#define SIG3 0x08
|
||||
#endif
|
||||
#define PAGE_SIZE 0x080U //128 words
|
||||
#define PAGE_SIZE_BYTES 0x100U //256 bytes
|
||||
|
||||
/* function prototypes */
|
||||
void putch(char);
|
||||
char getch(void);
|
||||
void getNch(uint8_t);
|
||||
void byte_response(uint8_t);
|
||||
void nothing_response(void);
|
||||
char gethex(void);
|
||||
void puthex(char);
|
||||
void flash_led(uint8_t);
|
||||
|
||||
/* some variables */
|
||||
union address_union
|
||||
{
|
||||
uint16_t word;
|
||||
uint8_t byte[2];
|
||||
} address;
|
||||
|
||||
union length_union
|
||||
{
|
||||
uint16_t word;
|
||||
uint8_t byte[2];
|
||||
} length;
|
||||
|
||||
struct flags_struct
|
||||
{
|
||||
unsigned eeprom : 1;
|
||||
unsigned rampz : 1;
|
||||
} flags;
|
||||
|
||||
uint8_t buff[256];
|
||||
|
||||
uint8_t error_count = 0;
|
||||
uint8_t sreg;
|
||||
|
||||
void (*app_start)(void) = 0x0000;
|
||||
|
||||
/* main program starts here */
|
||||
int main(void)
|
||||
{
|
||||
uint8_t ch,ch2;
|
||||
uint16_t w;
|
||||
uint16_t i;
|
||||
|
||||
asm volatile("nop\n\t");
|
||||
|
||||
#ifdef ADABOOT // BBR/LF 10/8/2007 & 9/13/2008
|
||||
ch = MCUSR;
|
||||
MCUSR = 0;
|
||||
|
||||
WDTCSR |= _BV(WDCE) | _BV(WDE);
|
||||
WDTCSR = 0;
|
||||
|
||||
// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
|
||||
if (! (ch & _BV(EXTRF))) // if it's a not an external reset...
|
||||
app_start(); // skip bootloader
|
||||
#endif
|
||||
|
||||
|
||||
//initialize our serial port.
|
||||
UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1);
|
||||
UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
|
||||
UCSR0B = (1<<RXEN0) | (1<<TXEN0);
|
||||
UCSR0C = (1<<UCSZ00) | (1<<UCSZ01);
|
||||
|
||||
/* Enable internal pull-up resistor on pin D0 (RX), in order
|
||||
to supress line noise that prevents the bootloader from
|
||||
timing out (DAM: 20070509) */
|
||||
DDRD &= ~_BV(PIND0);
|
||||
PORTD |= _BV(PIND0);
|
||||
|
||||
/* set LED pin as output */
|
||||
LED_DDR |= _BV(LED);
|
||||
|
||||
/* flash onboard LED to signal entering of bootloader */
|
||||
/* ADABOOT will do two series of flashes. first 4 - signifying ADABOOT */
|
||||
/* then a pause and another flash series signifying ADABOOT sub-version */
|
||||
|
||||
|
||||
flash_led(NUM_LED_FLASHES);
|
||||
|
||||
#ifdef ADABOOT
|
||||
flash_led(ADABOOT_VER); // BBR 9/13/2008
|
||||
#endif
|
||||
|
||||
/* forever loop */
|
||||
for (;;)
|
||||
{
|
||||
/* get character from UART */
|
||||
ch = getch();
|
||||
|
||||
/* A bunch of if...else if... gives smaller code than switch...case ! */
|
||||
|
||||
/* Hello is anyone home ? */
|
||||
if(ch=='0')
|
||||
nothing_response();
|
||||
|
||||
|
||||
/* Request programmer ID */
|
||||
/* Not using PROGMEM string due to boot block in m128 being beyond 64kB boundry */
|
||||
/* Would need to selectively manipulate RAMPZ, and it's only 9 characters anyway so who cares. */
|
||||
else if(ch=='1')
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch('A');
|
||||
putch('V');
|
||||
putch('R');
|
||||
putch(' ');
|
||||
putch('I');
|
||||
putch('S');
|
||||
putch('P');
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* AVR ISP/STK500 board commands DON'T CARE so default nothing_response */
|
||||
else if(ch=='@')
|
||||
{
|
||||
ch2 = getch();
|
||||
if (ch2 > 0x85)
|
||||
getch();
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* AVR ISP/STK500 board requests */
|
||||
else if(ch=='A')
|
||||
{
|
||||
ch2 = getch();
|
||||
if(ch2 == 0x80)
|
||||
byte_response(HW_VER); // Hardware version
|
||||
else if(ch2==0x81)
|
||||
byte_response(SW_MAJOR); // Software major version
|
||||
else if(ch2==0x82)
|
||||
byte_response(SW_MINOR); // Software minor version
|
||||
else if(ch2==0x98)
|
||||
byte_response(0x03); // Unknown but seems to be required by avr studio 3.56
|
||||
else
|
||||
byte_response(0x00); // Covers various unnecessary responses we don't care about
|
||||
}
|
||||
|
||||
|
||||
/* Device Parameters DON'T CARE, DEVICE IS FIXED */
|
||||
else if(ch=='B')
|
||||
{
|
||||
getNch(20);
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Parallel programming stuff DON'T CARE */
|
||||
else if(ch=='E')
|
||||
{
|
||||
getNch(5);
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Enter programming mode */
|
||||
else if(ch=='P')
|
||||
{
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Leave programming mode */
|
||||
else if(ch=='Q')
|
||||
{
|
||||
nothing_response();
|
||||
#ifdef ADABOOT
|
||||
// autoreset via watchdog (sneaky!) BBR/LF 9/13/2008
|
||||
WDTCSR = _BV(WDE);
|
||||
while (1); // 16 ms
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* Erase device, don't care as we will erase one page at a time anyway. */
|
||||
else if(ch=='R')
|
||||
{
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Set address, little endian. EEPROM in bytes, FLASH in words */
|
||||
/* Perhaps extra address bytes may be added in future to support > 128kB FLASH. */
|
||||
/* This might explain why little endian was used here, big endian used everywhere else. */
|
||||
else if(ch=='U')
|
||||
{
|
||||
address.byte[0] = getch();
|
||||
address.byte[1] = getch();
|
||||
nothing_response();
|
||||
}
|
||||
|
||||
|
||||
/* Universal SPI programming command, disabled. Would be used for fuses and lock bits. */
|
||||
else if(ch=='V')
|
||||
{
|
||||
getNch(4);
|
||||
byte_response(0x00);
|
||||
}
|
||||
|
||||
|
||||
/* Write memory, length is big endian and is in bytes */
|
||||
else if(ch=='d')
|
||||
{
|
||||
length.byte[1] = getch();
|
||||
length.byte[0] = getch();
|
||||
|
||||
flags.eeprom = 0;
|
||||
if (getch() == 'E')
|
||||
flags.eeprom = 1;
|
||||
|
||||
for (i=0; i<PAGE_SIZE; i++)
|
||||
buff[i] = 0;
|
||||
|
||||
for (w = 0; w < length.word; w++)
|
||||
{
|
||||
// Store data in buffer, can't keep up with serial data stream whilst programming pages
|
||||
buff[w] = getch();
|
||||
}
|
||||
|
||||
if (getch() == ' ')
|
||||
{
|
||||
if (flags.eeprom)
|
||||
{
|
||||
//Write to EEPROM one byte at a time
|
||||
for(w=0;w<length.word;w++)
|
||||
{
|
||||
while(EECR & (1<<EEPE));
|
||||
|
||||
EEAR = (uint16_t)(void *)address.word;
|
||||
EEDR = buff[w];
|
||||
EECR |= (1<<EEMPE);
|
||||
EECR |= (1<<EEPE);
|
||||
|
||||
address.word++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//address * 2 -> byte location
|
||||
address.word = address.word << 1;
|
||||
|
||||
//Even up an odd number of bytes
|
||||
if ((length.byte[0] & 0x01))
|
||||
length.word++;
|
||||
|
||||
// HACKME: EEPE used to be EEWE
|
||||
//Wait for previous EEPROM writes to complete
|
||||
//while(bit_is_set(EECR,EEPE));
|
||||
while(EECR & (1<<EEPE));
|
||||
|
||||
asm volatile(
|
||||
"clr r17 \n\t" //page_word_count
|
||||
"lds r30,address \n\t" //Address of FLASH location (in bytes)
|
||||
"lds r31,address+1 \n\t"
|
||||
"ldi r28,lo8(buff) \n\t" //Start of buffer array in RAM
|
||||
"ldi r29,hi8(buff) \n\t"
|
||||
"lds r24,length \n\t" //Length of data to be written (in bytes)
|
||||
"lds r25,length+1 \n\t"
|
||||
"length_loop: \n\t" //Main loop, repeat for number of words in block
|
||||
"cpi r17,0x00 \n\t" //If page_word_count=0 then erase page
|
||||
"brne no_page_erase \n\t"
|
||||
"wait_spm1: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm1 \n\t"
|
||||
"ldi r16,0x03 \n\t" //Erase page pointed to by Z
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"wait_spm2: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm2 \n\t"
|
||||
|
||||
"ldi r16,0x11 \n\t" //Re-enable RWW section
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"no_page_erase: \n\t"
|
||||
"ld r0,Y+ \n\t" //Write 2 bytes into page buffer
|
||||
"ld r1,Y+ \n\t"
|
||||
|
||||
"wait_spm3: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm3 \n\t"
|
||||
"ldi r16,0x01 \n\t" //Load r0,r1 into FLASH page buffer
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
|
||||
"inc r17 \n\t" //page_word_count++
|
||||
"cpi r17,%1 \n\t"
|
||||
"brlo same_page \n\t" //Still same page in FLASH
|
||||
"write_page: \n\t"
|
||||
"clr r17 \n\t" //New page, write current one first
|
||||
"wait_spm4: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm4 \n\t"
|
||||
"ldi r16,0x05 \n\t" //Write page pointed to by Z
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"wait_spm5: \n\t"
|
||||
"lds r16,%0 \n\t" //Wait for previous spm to complete
|
||||
"andi r16,1 \n\t"
|
||||
"cpi r16,1 \n\t"
|
||||
"breq wait_spm5 \n\t"
|
||||
"ldi r16,0x11 \n\t" //Re-enable RWW section
|
||||
"sts %0,r16 \n\t"
|
||||
"spm \n\t"
|
||||
"same_page: \n\t"
|
||||
"adiw r30,2 \n\t" //Next word in FLASH
|
||||
"sbiw r24,2 \n\t" //length-2
|
||||
"breq final_write \n\t" //Finished
|
||||
"rjmp length_loop \n\t"
|
||||
"final_write: \n\t"
|
||||
"cpi r17,0 \n\t"
|
||||
"breq block_done \n\t"
|
||||
"adiw r24,2 \n\t" //length+2, fool above check on length after short page write
|
||||
"rjmp write_page \n\t"
|
||||
"block_done: \n\t"
|
||||
"clr __zero_reg__ \n\t" //restore zero register
|
||||
: "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
|
||||
|
||||
);
|
||||
}
|
||||
putch(0x14);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
/* Read memory block mode, length is big endian. */
|
||||
else if(ch=='t')
|
||||
{
|
||||
length.byte[1] = getch();
|
||||
length.byte[0] = getch();
|
||||
|
||||
if (getch() == 'E')
|
||||
flags.eeprom = 1;
|
||||
else
|
||||
{
|
||||
flags.eeprom = 0;
|
||||
address.word = address.word << 1; // address * 2 -> byte location
|
||||
}
|
||||
|
||||
// Command terminator
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
for (w=0; w<length.word; w++)
|
||||
{
|
||||
// Can handle odd and even lengths okay
|
||||
if (flags.eeprom)
|
||||
{
|
||||
// Byte access EEPROM read
|
||||
while(EECR & (1<<EEPE));
|
||||
EEAR = (uint16_t)(void *)address.word;
|
||||
EECR |= (1<<EERE);
|
||||
putch(EEDR);
|
||||
|
||||
address.word++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!flags.rampz)
|
||||
putch(pgm_read_byte_near(address.word));
|
||||
|
||||
address.word++;
|
||||
}
|
||||
}
|
||||
putch(0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get device signature bytes */
|
||||
else if(ch=='u')
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch(SIG1);
|
||||
putch(SIG2);
|
||||
putch(SIG3);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Read oscillator calibration byte */
|
||||
else if(ch=='v')
|
||||
byte_response(0x00);
|
||||
|
||||
else if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
|
||||
}
|
||||
/* end of forever loop */
|
||||
}
|
||||
|
||||
|
||||
char gethex(void)
|
||||
{
|
||||
char ah,al;
|
||||
|
||||
ah = getch();
|
||||
putch(ah);
|
||||
al = getch();
|
||||
putch(al);
|
||||
|
||||
if(ah >= 'a')
|
||||
ah = ah - 'a' + 0x0a;
|
||||
else if(ah >= '0')
|
||||
ah -= '0';
|
||||
if(al >= 'a')
|
||||
al = al - 'a' + 0x0a;
|
||||
else if(al >= '0')
|
||||
al -= '0';
|
||||
|
||||
return (ah << 4) + al;
|
||||
}
|
||||
|
||||
|
||||
void puthex(char ch)
|
||||
{
|
||||
char ah,al;
|
||||
|
||||
ah = (ch & 0xf0) >> 4;
|
||||
if(ah >= 0x0a)
|
||||
ah = ah - 0x0a + 'a';
|
||||
else
|
||||
ah += '0';
|
||||
|
||||
al = (ch & 0x0f);
|
||||
if(al >= 0x0a)
|
||||
al = al - 0x0a + 'a';
|
||||
else
|
||||
al += '0';
|
||||
|
||||
putch(ah);
|
||||
putch(al);
|
||||
}
|
||||
|
||||
|
||||
void putch(char ch)
|
||||
{
|
||||
while (!(UCSR0A & _BV(UDRE0)));
|
||||
UDR0 = ch;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
char getch(void)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
||||
#ifdef ADABOOT
|
||||
LED_PORT &= ~_BV(LED); // toggle LED to show activity - BBR/LF 10/3/2007 & 9/13/2008
|
||||
#endif
|
||||
|
||||
while(!(UCSR0A & _BV(RXC0)))
|
||||
{
|
||||
/* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
|
||||
/* HACKME:: here is a good place to count times*/
|
||||
count++;
|
||||
if (count > MAX_TIME_COUNT)
|
||||
app_start();
|
||||
}
|
||||
|
||||
#ifdef ADABOOT
|
||||
LED_PORT |= _BV(LED); // toggle LED to show activity - BBR/LF 10/3/2007 & 9/13/2008
|
||||
#endif
|
||||
|
||||
return UDR0;
|
||||
}
|
||||
|
||||
|
||||
void getNch(uint8_t count)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
while(!(UCSR0A & _BV(RXC0)));
|
||||
UDR0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void byte_response(uint8_t val)
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch(val);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nothing_response(void)
|
||||
{
|
||||
if (getch() == ' ')
|
||||
{
|
||||
putch(0x14);
|
||||
putch(0x10);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (++error_count == MAX_ERROR_COUNT)
|
||||
app_start();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ADABOOT
|
||||
|
||||
void flash_led(uint8_t count)
|
||||
{
|
||||
/* flash onboard LED count times to signal entering of bootloader */
|
||||
/* l needs to be volatile or the delay loops below might get */
|
||||
/* optimized away if compiling with optimizations (DAM). */
|
||||
|
||||
volatile uint32_t l;
|
||||
|
||||
if (count == 0) {
|
||||
count = ADABOOT;
|
||||
}
|
||||
|
||||
|
||||
int8_t i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
LED_PORT |= _BV(LED); // LED on
|
||||
for(l = 0; l < (F_CPU / 1000); ++l); // delay NGvalue was 1000 for both loops - BBR
|
||||
LED_PORT &= ~_BV(LED); // LED off
|
||||
for(l = 0; l < (F_CPU / 250); ++l); // delay asymmteric for ADA BOOT BBR
|
||||
}
|
||||
|
||||
for(l = 0; l < (F_CPU / 100); ++l); // pause ADA BOOT BBR
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void flash_led(uint8_t count)
|
||||
{
|
||||
/* flash onboard LED three times to signal entering of bootloader */
|
||||
/* l needs to be volatile or the delay loops below might get
|
||||
optimized away if compiling with optimizations (DAM). */
|
||||
volatile uint32_t l;
|
||||
|
||||
if (count == 0) {
|
||||
count = 3;
|
||||
}
|
||||
|
||||
int8_t i;
|
||||
for (i = 0; i < count; ++i) {
|
||||
LED_PORT |= _BV(LED);
|
||||
for(l = 0; l < (F_CPU / 1000); ++l);
|
||||
LED_PORT &= ~_BV(LED);
|
||||
for(l = 0; l < (F_CPU / 1000); ++l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* end of file ATmegaBOOT.c */
|
||||
@@ -1,121 +0,0 @@
|
||||
:10F800000C943E7C0C945B7C0C945B7C0C945B7C39
|
||||
:10F810000C945B7C0C945B7C0C945B7C0C945B7C0C
|
||||
:10F820000C945B7C0C945B7C0C945B7C0C945B7CFC
|
||||
:10F830000C945B7C0C945B7C0C945B7C0C945B7CEC
|
||||
:10F840000C945B7C0C945B7C0C945B7C0C945B7CDC
|
||||
:10F850000C945B7C0C945B7C0C945B7C0C945B7CCC
|
||||
:10F860000C945B7C0C945B7C0C945B7C0C945B7CBC
|
||||
:10F870000C945B7C0C945B7C0C945B7C11241FBE11
|
||||
:10F88000CFEFD8E0DEBFCDBF11E0A0E0B1E0E6E60B
|
||||
:10F89000FFEF02C005900D92A030B107D9F712E03A
|
||||
:10F8A000A0E0B1E001C01D92A930B107E1F70E94CC
|
||||
:10F8B000537D0C94B27F0C94007CCF93DF93CDB733
|
||||
:10F8C000DEB724970FB6F894DEBF0FBECDBF8823F6
|
||||
:10F8D00009F481E020E0482F55274115510509F42E
|
||||
:10F8E0003DC0289A19821A821B821C820BC0898112
|
||||
:10F8F0009A81AB81BC810196A11DB11D89839A8338
|
||||
:10F90000AB83BC8389819A81AB81BC8180589E4343
|
||||
:10F91000A040B04060F3289819821A821B821C8292
|
||||
:10F920000BC089819A81AB81BC810196A11DB11D5B
|
||||
:10F9300089839A83AB83BC8389819A81AB81BC81A3
|
||||
:10F9400080509A4FA040B04060F32F5F822F9927DC
|
||||
:10F9500087FD9095841795070CF4C3CF19821A82FE
|
||||
:10F960001B821C8289819A81AB81BC818050914726
|
||||
:10F97000A240B040A0F489819A81AB81BC810196FC
|
||||
:10F98000A11DB11D89839A83AB83BC8389819A8130
|
||||
:10F99000AB81BC8180509147A240B04060F3249677
|
||||
:10F9A0000FB6F894DEBF0FBECDBFDF91CF910895A3
|
||||
:10F9B000EF92FF920F931F93EE24FF248701289864
|
||||
:10F9C0008091C00087FD17C00894E11CF11C011D47
|
||||
:10F9D000111D81E0E81689E0F8068DE3080780E054
|
||||
:10F9E000180770F3E0910001F091010109958091F1
|
||||
:10F9F000C00087FFE9CF289A8091C600992787FD2C
|
||||
:10FA000090951F910F91FF90EF900895982F8091FE
|
||||
:10FA1000C00085FFFCCF9093C60008950E94D87C5B
|
||||
:10FA2000803271F0809102018F5F809302018530F6
|
||||
:10FA300009F00895E0910001F09101010995089500
|
||||
:10FA400084E10E94067D80E10E94067D0895CF93A7
|
||||
:10FA5000C82F0E94D87C803241F0809102018F5FD4
|
||||
:10FA600080930201853081F40AC084E10E94067D02
|
||||
:10FA70008C2F0E94067D80E10E94067D05C0E091EA
|
||||
:10FA80000001F09101010995CF910895282F90E090
|
||||
:10FA900007C08091C0008823E4F78091C6009F5F73
|
||||
:10FAA0009217B8F30895CFEFD8E0DEBFCDBF0000C6
|
||||
:10FAB00094B714BE809160008861809360001092BA
|
||||
:10FAC000600091FF74C189E18093C4001092C50069
|
||||
:10FAD00088E18093C10086E08093C2005098589AD4
|
||||
:10FAE000209A83E00E945D7C81E00E945D7C0E9400
|
||||
:10FAF000D87C8033B9F18133C1F1803409F456C028
|
||||
:10FB0000813409F45CC0823409F46EC0853409F490
|
||||
:10FB100071C0803539F1813509F4F3C0823511F1B6
|
||||
:10FB2000853509F4D3C0863509F4CBC0843609F491
|
||||
:10FB300065C0843709F4EBC0853709F4D2C0863735
|
||||
:10FB400009F44AC0809102018F5F809302018530E1
|
||||
:10FB500071F6E0910001F091010109950E94D87CB5
|
||||
:10FB6000803349F60E940E7DC2CF0E94D87CC82FF8
|
||||
:10FB7000803241F784E10E94067D81E40E94067D87
|
||||
:10FB800086E50E94067D82E50E94067D8C2F0E94FC
|
||||
:10FB9000067D89E40E94067D83E50E94067D80E55E
|
||||
:10FBA0000E94067D80E10E94067DA1CF0E94D87C44
|
||||
:10FBB0008638C0F20E94D87C0E940E7D98CF0E94A9
|
||||
:10FBC000D87C803809F407C1813809F400C1823833
|
||||
:10FBD00009F4F9C0883921F080E00E94277D87CFA1
|
||||
:10FBE00083E00E94277D83CF84E10E94467D0E94AE
|
||||
:10FBF0000E7D7DCF85E00E94467DF9CF0E94D87CA6
|
||||
:10FC0000809306020E94D87C8093050280910802AE
|
||||
:10FC10008E7F809308020E94D87C853409F44BC003
|
||||
:10FC2000E5E0F1E0119281E0E438F807D9F3D0F390
|
||||
:10FC3000C0E0D0E0809105029091060218161906E6
|
||||
:10FC400078F405E011E00E94D87CF80181938F01DF
|
||||
:10FC500021968091050290910602C817D90798F362
|
||||
:10FC60000E94D87C803209F06DCF8091080280FF1D
|
||||
:10FC7000B6C0C0E0D0E02091050230910602121615
|
||||
:10FC80001306B8F4E0910301F0910401A5E0B1E09E
|
||||
:10FC9000F999FECFF2BDE1BD8D9180BDFA9AF99A36
|
||||
:10FCA00031962196C217D30798F3F0930401E0939D
|
||||
:10FCB000030184E175CF809108028160809308027E
|
||||
:10FCC000AFCF84E00E94467D80E087CF0E94D87C41
|
||||
:10FCD000809303010E94D87C809304010E940E7DD2
|
||||
:10FCE00006CF0E94D87C803209F02CCF84E10E949C
|
||||
:10FCF000067D8EE10E94067D85E90E94067D88E0F2
|
||||
:10FD00004FCF0E940E7D88E080936000FFCF0E945D
|
||||
:10FD1000D87C809306020E94D87C809305020E94C2
|
||||
:10FD2000D87C853409F449C0809108028E7F809385
|
||||
:10FD300008028091030190910401880F991F90930C
|
||||
:10FD40000401809303010E94D87C803209F0CFCE59
|
||||
:10FD500084E10E94067DC0E0D0E020910502309150
|
||||
:10FD600006021216130608F01DCFE0910301F09170
|
||||
:10FD700004018091080280FF96C0F999FECFF2BD80
|
||||
:10FD8000E1BDF89A80B50E94067DE0910301F091F3
|
||||
:10FD900004013196F0930401E093030120910502E0
|
||||
:10FDA000309106022196C217D30718F3FBCEE091DB
|
||||
:10FDB0000001F0910101099586CE809108028160D1
|
||||
:10FDC00080930802C0CF80E10E94277D90CE81E021
|
||||
:10FDD0000E94277D8CCE82E00E94277D88CE809174
|
||||
:10FDE000030190910401880F991F9093040180935F
|
||||
:10FDF00003018091050280FF09C080910502909166
|
||||
:10FE0000060201969093060280930502F999FECFAF
|
||||
:10FE10001127E0910301F0910401C5E0D1E0809148
|
||||
:10FE2000050290910602103091F400915700017084
|
||||
:10FE30000130D9F303E000935700E8950091570093
|
||||
:10FE400001700130D9F301E100935700E895099062
|
||||
:10FE500019900091570001700130D9F301E000932F
|
||||
:10FE60005700E8951395103898F011270091570026
|
||||
:10FE700001700130D9F305E000935700E895009137
|
||||
:10FE8000570001700130D9F301E100935700E89564
|
||||
:10FE90003296029709F0C7CF103011F00296E5CFE5
|
||||
:10FEA000112484E17DCE869580FF06C03196F093C3
|
||||
:10FEB0000401E093030176CF84910E94067D209196
|
||||
:10FEC000050230910602E0910301F0910401EECFAA
|
||||
:10FED0001F93CF930E94D87CC82F0E94067D0E945A
|
||||
:10FEE000D87C182F0E94067DC1362CF0C7551136DC
|
||||
:10FEF0003CF0175508C0C033D4F3C0531136CCF7CB
|
||||
:10FF000010330CF01053C295C07FC10F8C2F99276E
|
||||
:10FF100087FD9095CF911F910895CF93282F992712
|
||||
:10FF200087FD9095807F907095958795959587959D
|
||||
:10FF300095958795959587958A303CF0895AC22F7B
|
||||
:10FF4000CF70CA303CF0C95A06C0805DC22FCF7056
|
||||
:10FF5000CA30CCF7C05D0E94067D8C2F0E94067DC2
|
||||
:06FF6000CF910895FFCFD0
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,120 +0,0 @@
|
||||
:10F800000C94387C0C94557C0C94557C0C94557C51
|
||||
:10F810000C94557C0C94557C0C94557C0C94557C24
|
||||
:10F820000C94557C0C94557C0C94557C0C94557C14
|
||||
:10F830000C94557C0C94557C0C94557C0C94557C04
|
||||
:10F840000C94557C0C94557C0C94557C0C94557CF4
|
||||
:10F850000C94557C0C94557C0C94557C0C94557CE4
|
||||
:10F860000C94557C0C94557C0C94557C0C94557CD4
|
||||
:10F8700011241FBECFEFD0E1DEBFCDBF11E0A0E06D
|
||||
:10F88000B1E0EAE5FFEF02C005900D92A030B107AC
|
||||
:10F89000D9F712E0A0E0B1E001C01D92A930B10794
|
||||
:10F8A000E1F70E944D7D0C94AC7F0C94007CCF93CB
|
||||
:10F8B000DF93CDB7DEB724970FB6F894DEBF0FBE47
|
||||
:10F8C000CDBF882309F481E020E0482F552741155A
|
||||
:10F8D000510509F43DC0289A19821A821B821C82A4
|
||||
:10F8E0000BC089819A81AB81BC810196A11DB11D9C
|
||||
:10F8F00089839A83AB83BC8389819A81AB81BC81E4
|
||||
:10F9000080589E43A040B04060F3289819821A8224
|
||||
:10F910001B821C820BC089819A81AB81BC810196BC
|
||||
:10F92000A11DB11D89839A83AB83BC8389819A8190
|
||||
:10F93000AB81BC8180509A4FA040B04060F32F5FF4
|
||||
:10F94000822F992787FD9095841795070CF4C3CFD4
|
||||
:10F9500019821A821B821C8289819A81AB81BC81A7
|
||||
:10F9600080509147A240B040A0F489819A81AB8138
|
||||
:10F97000BC810196A11DB11D89839A83AB83BC8391
|
||||
:10F9800089819A81AB81BC8180509147A240B0406F
|
||||
:10F9900060F324960FB6F894DEBF0FBECDBFDF91A3
|
||||
:10F9A000CF910895EF92FF920F931F93EE24FF24BF
|
||||
:10F9B000870128988091C00087FD17C00894E11C3A
|
||||
:10F9C000F11C011D111D81E0E81689E0F8068DE3A8
|
||||
:10F9D000080780E0180770F3E0910001F091010141
|
||||
:10F9E00009958091C00087FFE9CF289A8091C600D1
|
||||
:10F9F000992787FD90951F910F91FF90EF900895A3
|
||||
:10FA0000982F8091C00085FFFCCF9093C600089589
|
||||
:10FA10000E94D27C803271F0809102018F5F8093CE
|
||||
:10FA20000201853009F00895E0910001F091010193
|
||||
:10FA30000995089584E10E94007D80E10E94007D87
|
||||
:10FA40000895CF93C82F0E94D27C803241F08091DC
|
||||
:10FA500002018F5F80930201853081F40AC084E146
|
||||
:10FA60000E94007D8C2F0E94007D80E10E94007D1D
|
||||
:10FA700005C0E0910001F09101010995CF91089531
|
||||
:10FA8000282F90E007C08091C0008823E4F7809180
|
||||
:10FA9000C6009F5F9217B8F30895CFEFD0E1DEBFA5
|
||||
:10FAA000CDBF000094B714BE809160008861809340
|
||||
:10FAB00060001092600091FF74C189E18093C400DE
|
||||
:10FAC0001092C50088E18093C10086E08093C20057
|
||||
:10FAD0005098589A209A83E00E94577C81E00E94B7
|
||||
:10FAE000577C0E94D27C8033B9F18133C1F18034DC
|
||||
:10FAF00009F456C0813409F45CC0823409F46EC044
|
||||
:10FB0000853409F471C0803539F1813509F4F3C0C9
|
||||
:10FB1000823511F1853509F4D3C0863509F4CBC09F
|
||||
:10FB2000843609F465C0843709F4EBC0853709F4DD
|
||||
:10FB3000D2C0863709F44AC0809102018F5F80935A
|
||||
:10FB40000201853071F6E0910001F0910101099503
|
||||
:10FB50000E94D27C803349F60E94087DC2CF0E9469
|
||||
:10FB6000D27CC82F803241F784E10E94007D81E47D
|
||||
:10FB70000E94007D86E50E94007D82E50E94007D56
|
||||
:10FB80008C2F0E94007D89E40E94007D83E50E9405
|
||||
:10FB9000007D80E50E94007D80E10E94007DA1CF74
|
||||
:10FBA0000E94D27C8638C0F20E94D27C0E94087DDE
|
||||
:10FBB00098CF0E94D27C803809F407C1813809F4BB
|
||||
:10FBC00000C1823809F4F9C0883921F080E00E9430
|
||||
:10FBD000217D87CF83E00E94217D83CF84E10E9435
|
||||
:10FBE000407D0E94087D7DCF85E00E94407DF9CF59
|
||||
:10FBF0000E94D27C809306020E94D27C80930502F0
|
||||
:10FC0000809108028E7F809308020E94D27C853406
|
||||
:10FC100009F44BC0E5E0F1E0119281E0E438F80727
|
||||
:10FC2000D9F3D0F3C0E0D0E08091050290910602B4
|
||||
:10FC30001816190678F405E011E00E94D27CF8014C
|
||||
:10FC400081938F0121968091050290910602C81739
|
||||
:10FC5000D90798F30E94D27C803209F06DCF809151
|
||||
:10FC6000080280FFB6C0C0E0D0E0209105023091CC
|
||||
:10FC7000060212161306B8F4E0910301F091040194
|
||||
:10FC8000A5E0B1E0F999FECFF2BDE1BD8D9180BD57
|
||||
:10FC9000FA9AF99A31962196C217D30798F3F093FE
|
||||
:10FCA0000401E093030184E175CF80910802816033
|
||||
:10FCB00080930802AFCF84E00E94407D80E087CF30
|
||||
:10FCC0000E94D27C809303010E94D27C8093040125
|
||||
:10FCD0000E94087D06CF0E94D27C803209F02CCF92
|
||||
:10FCE00084E10E94007D8EE10E94007D86E90E94F1
|
||||
:10FCF000007D89E04FCF0E94087D88E080936000FE
|
||||
:10FD0000FFCF0E94D27C809306020E94D27C809317
|
||||
:10FD100005020E94D27C853409F449C08091080212
|
||||
:10FD20008E7F809308028091030190910401880FD7
|
||||
:10FD3000991F90930401809303010E94D27C80322A
|
||||
:10FD400009F0CFCE84E10E94007DC0E0D0E0209198
|
||||
:10FD50000502309106021216130608F01DCFE0913D
|
||||
:10FD60000301F09104018091080280FF96C0F99987
|
||||
:10FD7000FECFF2BDE1BDF89A80B50E94007DE09112
|
||||
:10FD80000301F09104013196F0930401E093030123
|
||||
:10FD900020910502309106022196C217D30718F36D
|
||||
:10FDA000FBCEE0910001F0910101099586CE809192
|
||||
:10FDB0000802816080930802C0CF80E10E94217D0B
|
||||
:10FDC00090CE81E00E94217D8CCE82E00E94217D38
|
||||
:10FDD00088CE8091030190910401880F991F909320
|
||||
:10FDE0000401809303018091050280FF09C0809186
|
||||
:10FDF00005029091060201969093060280930502F7
|
||||
:10FE0000F999FECF1127E0910301F0910401C5E0BB
|
||||
:10FE1000D1E08091050290910602103091F400919A
|
||||
:10FE2000570001700130D9F303E000935700E895C3
|
||||
:10FE30000091570001700130D9F301E100935700A0
|
||||
:10FE4000E895099019900091570001700130D9F39D
|
||||
:10FE500001E000935700E8951395103898F01127AA
|
||||
:10FE60000091570001700130D9F305E0009357006D
|
||||
:10FE7000E8950091570001700130D9F301E100933A
|
||||
:10FE80005700E8953296029709F0C7CF103011F06D
|
||||
:10FE90000296E5CF112484E17DCE869580FF06C0D1
|
||||
:10FEA0003196F0930401E093030176CF84910E9490
|
||||
:10FEB000007D2091050230910602E0910301F0914E
|
||||
:10FEC0000401EECF1F93CF930E94D27CC82F0E94D3
|
||||
:10FED000007D0E94D27C182F0E94007DC1362CF03C
|
||||
:10FEE000C75511363CF0175508C0C033D4F3C05382
|
||||
:10FEF0001136CCF710330CF01053C295C07FC10FF0
|
||||
:10FF00008C2F992787FD9095CF911F910895CF93BE
|
||||
:10FF1000282F992787FD9095807F907095958795DC
|
||||
:10FF20009595879595958795959587958A303CF019
|
||||
:10FF3000895AC22FCF70CA303CF0C95A06C0805DC2
|
||||
:10FF4000C22FCF70CA30CCF7C05D0E94007D8C2FCD
|
||||
:0AFF50000E94007DCF910895FFCFBD
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,121 +0,0 @@
|
||||
:10F800000C943E7C0C945B7C0C945B7C0C945B7C39
|
||||
:10F810000C945B7C0C945B7C0C945B7C0C945B7C0C
|
||||
:10F820000C945B7C0C945B7C0C945B7C0C945B7CFC
|
||||
:10F830000C945B7C0C945B7C0C945B7C0C945B7CEC
|
||||
:10F840000C945B7C0C945B7C0C945B7C0C945B7CDC
|
||||
:10F850000C945B7C0C945B7C0C945B7C0C945B7CCC
|
||||
:10F860000C945B7C0C945B7C0C945B7C0C945B7CBC
|
||||
:10F870000C945B7C0C945B7C0C945B7C11241FBE11
|
||||
:10F88000CFEFD0E1DEBFCDBF11E0A0E0B1E0E6E612
|
||||
:10F89000FFEF02C005900D92A030B107D9F712E03A
|
||||
:10F8A000A0E0B1E001C01D92A930B107E1F70E94CC
|
||||
:10F8B000537D0C94B27F0C94007CCF93DF93CDB733
|
||||
:10F8C000DEB724970FB6F894DEBF0FBECDBF8823F6
|
||||
:10F8D00009F481E020E0482F55274115510509F42E
|
||||
:10F8E0003DC0289A19821A821B821C820BC0898112
|
||||
:10F8F0009A81AB81BC810196A11DB11D89839A8338
|
||||
:10F90000AB83BC8389819A81AB81BC8180589E4343
|
||||
:10F91000A040B04060F3289819821A821B821C8292
|
||||
:10F920000BC089819A81AB81BC810196A11DB11D5B
|
||||
:10F9300089839A83AB83BC8389819A81AB81BC81A3
|
||||
:10F9400080509A4FA040B04060F32F5F822F9927DC
|
||||
:10F9500087FD9095841795070CF4C3CF19821A82FE
|
||||
:10F960001B821C8289819A81AB81BC818050914726
|
||||
:10F97000A240B040A0F489819A81AB81BC810196FC
|
||||
:10F98000A11DB11D89839A83AB83BC8389819A8130
|
||||
:10F99000AB81BC8180509147A240B04060F3249677
|
||||
:10F9A0000FB6F894DEBF0FBECDBFDF91CF910895A3
|
||||
:10F9B000EF92FF920F931F93EE24FF248701289864
|
||||
:10F9C0008091C00087FD17C00894E11CF11C011D47
|
||||
:10F9D000111D81E0E81689E0F8068DE3080780E054
|
||||
:10F9E000180770F3E0910001F091010109958091F1
|
||||
:10F9F000C00087FFE9CF289A8091C600992787FD2C
|
||||
:10FA000090951F910F91FF90EF900895982F8091FE
|
||||
:10FA1000C00085FFFCCF9093C60008950E94D87C5B
|
||||
:10FA2000803271F0809102018F5F809302018530F6
|
||||
:10FA300009F00895E0910001F09101010995089500
|
||||
:10FA400084E10E94067D80E10E94067D0895CF93A7
|
||||
:10FA5000C82F0E94D87C803241F0809102018F5FD4
|
||||
:10FA600080930201853081F40AC084E10E94067D02
|
||||
:10FA70008C2F0E94067D80E10E94067D05C0E091EA
|
||||
:10FA80000001F09101010995CF910895282F90E090
|
||||
:10FA900007C08091C0008823E4F78091C6009F5F73
|
||||
:10FAA0009217B8F30895CFEFD0E1DEBFCDBF0000CD
|
||||
:10FAB00094B714BE809160008861809360001092BA
|
||||
:10FAC000600091FF74C189E18093C4001092C50069
|
||||
:10FAD00088E18093C10086E08093C2005098589AD4
|
||||
:10FAE000209A83E00E945D7C81E00E945D7C0E9400
|
||||
:10FAF000D87C8033B9F18133C1F1803409F456C028
|
||||
:10FB0000813409F45CC0823409F46EC0853409F490
|
||||
:10FB100071C0803539F1813509F4F3C0823511F1B6
|
||||
:10FB2000853509F4D3C0863509F4CBC0843609F491
|
||||
:10FB300065C0843709F4EBC0853709F4D2C0863735
|
||||
:10FB400009F44AC0809102018F5F809302018530E1
|
||||
:10FB500071F6E0910001F091010109950E94D87CB5
|
||||
:10FB6000803349F60E940E7DC2CF0E94D87CC82FF8
|
||||
:10FB7000803241F784E10E94067D81E40E94067D87
|
||||
:10FB800086E50E94067D82E50E94067D8C2F0E94FC
|
||||
:10FB9000067D89E40E94067D83E50E94067D80E55E
|
||||
:10FBA0000E94067D80E10E94067DA1CF0E94D87C44
|
||||
:10FBB0008638C0F20E94D87C0E940E7D98CF0E94A9
|
||||
:10FBC000D87C803809F407C1813809F400C1823833
|
||||
:10FBD00009F4F9C0883921F080E00E94277D87CFA1
|
||||
:10FBE00083E00E94277D83CF84E10E94467D0E94AE
|
||||
:10FBF0000E7D7DCF85E00E94467DF9CF0E94D87CA6
|
||||
:10FC0000809306020E94D87C8093050280910802AE
|
||||
:10FC10008E7F809308020E94D87C853409F44BC003
|
||||
:10FC2000E5E0F1E0119281E0E438F807D9F3D0F390
|
||||
:10FC3000C0E0D0E0809105029091060218161906E6
|
||||
:10FC400078F405E011E00E94D87CF80181938F01DF
|
||||
:10FC500021968091050290910602C817D90798F362
|
||||
:10FC60000E94D87C803209F06DCF8091080280FF1D
|
||||
:10FC7000B6C0C0E0D0E02091050230910602121615
|
||||
:10FC80001306B8F4E0910301F0910401A5E0B1E09E
|
||||
:10FC9000F999FECFF2BDE1BD8D9180BDFA9AF99A36
|
||||
:10FCA00031962196C217D30798F3F0930401E0939D
|
||||
:10FCB000030184E175CF809108028160809308027E
|
||||
:10FCC000AFCF84E00E94467D80E087CF0E94D87C41
|
||||
:10FCD000809303010E94D87C809304010E940E7DD2
|
||||
:10FCE00006CF0E94D87C803209F02CCF84E10E949C
|
||||
:10FCF000067D8EE10E94067D86E90E94067D8AE0EF
|
||||
:10FD00004FCF0E940E7D88E080936000FFCF0E945D
|
||||
:10FD1000D87C809306020E94D87C809305020E94C2
|
||||
:10FD2000D87C853409F449C0809108028E7F809385
|
||||
:10FD300008028091030190910401880F991F90930C
|
||||
:10FD40000401809303010E94D87C803209F0CFCE59
|
||||
:10FD500084E10E94067DC0E0D0E020910502309150
|
||||
:10FD600006021216130608F01DCFE0910301F09170
|
||||
:10FD700004018091080280FF96C0F999FECFF2BD80
|
||||
:10FD8000E1BDF89A80B50E94067DE0910301F091F3
|
||||
:10FD900004013196F0930401E093030120910502E0
|
||||
:10FDA000309106022196C217D30718F3FBCEE091DB
|
||||
:10FDB0000001F0910101099586CE809108028160D1
|
||||
:10FDC00080930802C0CF80E10E94277D90CE81E021
|
||||
:10FDD0000E94277D8CCE82E00E94277D88CE809174
|
||||
:10FDE000030190910401880F991F9093040180935F
|
||||
:10FDF00003018091050280FF09C080910502909166
|
||||
:10FE0000060201969093060280930502F999FECFAF
|
||||
:10FE10001127E0910301F0910401C5E0D1E0809148
|
||||
:10FE2000050290910602103091F400915700017084
|
||||
:10FE30000130D9F303E000935700E8950091570093
|
||||
:10FE400001700130D9F301E100935700E895099062
|
||||
:10FE500019900091570001700130D9F301E000932F
|
||||
:10FE60005700E8951395103898F011270091570026
|
||||
:10FE700001700130D9F305E000935700E895009137
|
||||
:10FE8000570001700130D9F301E100935700E89564
|
||||
:10FE90003296029709F0C7CF103011F00296E5CFE5
|
||||
:10FEA000112484E17DCE869580FF06C03196F093C3
|
||||
:10FEB0000401E093030176CF84910E94067D209196
|
||||
:10FEC000050230910602E0910301F0910401EECFAA
|
||||
:10FED0001F93CF930E94D87CC82F0E94067D0E945A
|
||||
:10FEE000D87C182F0E94067DC1362CF0C7551136DC
|
||||
:10FEF0003CF0175508C0C033D4F3C0531136CCF7CB
|
||||
:10FF000010330CF01053C295C07FC10F8C2F99276E
|
||||
:10FF100087FD9095CF911F910895CF93282F992712
|
||||
:10FF200087FD9095807F907095958795959587959D
|
||||
:10FF300095958795959587958A303CF0895AC22F7B
|
||||
:10FF4000CF70CA303CF0C95A06C0805DC22FCF7056
|
||||
:10FF5000CA30CCF7C05D0E94067D8C2F0E94067DC2
|
||||
:06FF6000CF910895FFCFD0
|
||||
:040000030000F80001
|
||||
:00000001FF
|
||||
@@ -1,56 +0,0 @@
|
||||
# Makefile for ATmegaBOOT
|
||||
# E.Lins, 18.7.2005
|
||||
# $Id$
|
||||
|
||||
|
||||
# program name should not be changed...
|
||||
PROGRAM = ATmegaBOOT_644P
|
||||
|
||||
# enter the target CPU frequency
|
||||
AVR_FREQ = 16000000L
|
||||
|
||||
MCU_TARGET = atmega644p
|
||||
LDSECTION = --section-start=.text=0xF800
|
||||
|
||||
OBJ = $(PROGRAM).o
|
||||
OPTIMIZE = -O2
|
||||
|
||||
DEFS =
|
||||
LIBS =
|
||||
|
||||
CC = avr-gcc
|
||||
|
||||
|
||||
# Override is only needed by avr-lib build system.
|
||||
|
||||
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS)
|
||||
override LDFLAGS = -Wl,$(LDSECTION)
|
||||
#override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION)
|
||||
|
||||
OBJCOPY = avr-objcopy
|
||||
OBJDUMP = avr-objdump
|
||||
|
||||
all: CFLAGS += '-DMAX_TIME_COUNT=8000000L>>1' -DADABOOT
|
||||
all: $(PROGRAM).hex
|
||||
|
||||
$(PROGRAM).hex: $(PROGRAM).elf
|
||||
$(OBJCOPY) -j .text -j .data -O ihex $< $@
|
||||
|
||||
$(PROGRAM).elf: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
$(OBJ): ATmegaBOOT.c
|
||||
avr-gcc $(CFLAGS) $(LDFLAGS) -c -g -O2 -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o
|
||||
|
||||
%.lst: %.elf
|
||||
$(OBJDUMP) -h -S $< > $@
|
||||
|
||||
%.srec: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O srec $< $@
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -j .text -j .data -O binary $< $@
|
||||
|
||||
clean:
|
||||
rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Note: This bootloader support ATmega644, ATmega644P and ATmega324P.
|
||||
To build, set PROGRAM and MCU_TARGET in the Makefile according to your target device.
|
||||
|
||||
@@ -1,303 +0,0 @@
|
||||
/*
|
||||
HardwareSerial.cpp - Hardware serial library for Wiring
|
||||
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 23 November 2006 by David A. Mellis
|
||||
Modified 28 September 2010 by Mark Sproul
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "wiring.h"
|
||||
#include "wiring_private.h"
|
||||
|
||||
// this next line disables the entire HardwareSerial.cpp,
|
||||
// this is so I can support Attiny series and any other chip without a uart
|
||||
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
|
||||
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
// Define constants and variables for buffering incoming serial data. We're
|
||||
// using a ring buffer (I think), in which rx_buffer_head is the index of the
|
||||
// location to which to write the next incoming character and rx_buffer_tail
|
||||
// is the index of the location from which to read.
|
||||
#if (RAMEND < 1000)
|
||||
#define RX_BUFFER_SIZE 32
|
||||
#else
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
|
||||
struct ring_buffer
|
||||
{
|
||||
unsigned char buffer[RX_BUFFER_SIZE];
|
||||
int head;
|
||||
int tail;
|
||||
};
|
||||
|
||||
#if defined(UBRRH) || defined(UBRR0H)
|
||||
ring_buffer rx_buffer = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
#if defined(UBRR1H)
|
||||
ring_buffer rx_buffer1 = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
#if defined(UBRR2H)
|
||||
ring_buffer rx_buffer2 = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
#if defined(UBRR3H)
|
||||
ring_buffer rx_buffer3 = { { 0 }, 0, 0 };
|
||||
#endif
|
||||
|
||||
inline void store_char(unsigned char c, ring_buffer *rx_buffer)
|
||||
{
|
||||
int i = (unsigned int)(rx_buffer->head + 1) % RX_BUFFER_SIZE;
|
||||
|
||||
// if we should be storing the received character into the location
|
||||
// just before the tail (meaning that the head would advance to the
|
||||
// current location of the tail), we're about to overflow the buffer
|
||||
// and so we don't write the character or advance the head.
|
||||
if (i != rx_buffer->tail) {
|
||||
rx_buffer->buffer[rx_buffer->head] = c;
|
||||
rx_buffer->head = i;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USART_RX_vect)
|
||||
SIGNAL(USART_RX_vect)
|
||||
{
|
||||
#if defined(UDR0)
|
||||
unsigned char c = UDR0;
|
||||
#elif defined(UDR)
|
||||
unsigned char c = UDR; // atmega8535
|
||||
#else
|
||||
#error UDR not defined
|
||||
#endif
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
#elif defined(SIG_USART0_RECV) && defined(UDR0)
|
||||
SIGNAL(SIG_USART0_RECV)
|
||||
{
|
||||
unsigned char c = UDR0;
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
#elif defined(SIG_UART0_RECV) && defined(UDR0)
|
||||
SIGNAL(SIG_UART0_RECV)
|
||||
{
|
||||
unsigned char c = UDR0;
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
//#elif defined(SIG_USART_RECV)
|
||||
#elif defined(USART0_RX_vect)
|
||||
// fixed by Mark Sproul this is on the 644/644p
|
||||
//SIGNAL(SIG_USART_RECV)
|
||||
SIGNAL(USART0_RX_vect)
|
||||
{
|
||||
#if defined(UDR0)
|
||||
unsigned char c = UDR0;
|
||||
#elif defined(UDR)
|
||||
unsigned char c = UDR; // atmega8, atmega32
|
||||
#else
|
||||
#error UDR not defined
|
||||
#endif
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
#elif defined(SIG_UART_RECV)
|
||||
// this is for atmega8
|
||||
SIGNAL(SIG_UART_RECV)
|
||||
{
|
||||
#if defined(UDR0)
|
||||
unsigned char c = UDR0; // atmega645
|
||||
#elif defined(UDR)
|
||||
unsigned char c = UDR; // atmega8
|
||||
#endif
|
||||
store_char(c, &rx_buffer);
|
||||
}
|
||||
#elif defined(USBCON)
|
||||
#warning No interrupt handler for usart 0
|
||||
#warning Serial(0) is on USB interface
|
||||
#else
|
||||
#error No interrupt handler for usart 0
|
||||
#endif
|
||||
|
||||
//#if defined(SIG_USART1_RECV)
|
||||
#if defined(USART1_RX_vect)
|
||||
//SIGNAL(SIG_USART1_RECV)
|
||||
SIGNAL(USART1_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR1;
|
||||
store_char(c, &rx_buffer1);
|
||||
}
|
||||
#elif defined(SIG_USART1_RECV)
|
||||
#error SIG_USART1_RECV
|
||||
#endif
|
||||
|
||||
#if defined(USART2_RX_vect) && defined(UDR2)
|
||||
SIGNAL(USART2_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR2;
|
||||
store_char(c, &rx_buffer2);
|
||||
}
|
||||
#elif defined(SIG_USART2_RECV)
|
||||
#error SIG_USART2_RECV
|
||||
#endif
|
||||
|
||||
#if defined(USART3_RX_vect) && defined(UDR3)
|
||||
SIGNAL(USART3_RX_vect)
|
||||
{
|
||||
unsigned char c = UDR3;
|
||||
store_char(c, &rx_buffer3);
|
||||
}
|
||||
#elif defined(SIG_USART3_RECV)
|
||||
#error SIG_USART3_RECV
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Constructors ////////////////////////////////////////////////////////////////
|
||||
|
||||
HardwareSerial::HardwareSerial(ring_buffer *rx_buffer,
|
||||
volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
|
||||
volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
|
||||
volatile uint8_t *udr,
|
||||
uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x)
|
||||
{
|
||||
_rx_buffer = rx_buffer;
|
||||
_ubrrh = ubrrh;
|
||||
_ubrrl = ubrrl;
|
||||
_ucsra = ucsra;
|
||||
_ucsrb = ucsrb;
|
||||
_udr = udr;
|
||||
_rxen = rxen;
|
||||
_txen = txen;
|
||||
_rxcie = rxcie;
|
||||
_udre = udre;
|
||||
_u2x = u2x;
|
||||
}
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
void HardwareSerial::begin(long baud)
|
||||
{
|
||||
uint16_t baud_setting;
|
||||
bool use_u2x = true;
|
||||
|
||||
#if F_CPU == 16000000UL
|
||||
// hardcoded exception for compatibility with the bootloader shipped
|
||||
// with the Duemilanove and previous boards and the firmware on the 8U2
|
||||
// on the Uno and Mega 2560.
|
||||
if (baud == 57600) {
|
||||
use_u2x = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (use_u2x) {
|
||||
*_ucsra = 1 << _u2x;
|
||||
baud_setting = (F_CPU / 4 / baud - 1) / 2;
|
||||
} else {
|
||||
*_ucsra = 0;
|
||||
baud_setting = (F_CPU / 8 / baud - 1) / 2;
|
||||
}
|
||||
|
||||
// assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
|
||||
*_ubrrh = baud_setting >> 8;
|
||||
*_ubrrl = baud_setting;
|
||||
|
||||
sbi(*_ucsrb, _rxen);
|
||||
sbi(*_ucsrb, _txen);
|
||||
sbi(*_ucsrb, _rxcie);
|
||||
}
|
||||
|
||||
void HardwareSerial::end()
|
||||
{
|
||||
cbi(*_ucsrb, _rxen);
|
||||
cbi(*_ucsrb, _txen);
|
||||
cbi(*_ucsrb, _rxcie);
|
||||
}
|
||||
|
||||
int HardwareSerial::available(void)
|
||||
{
|
||||
return (unsigned int)(RX_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % RX_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
int HardwareSerial::peek(void)
|
||||
{
|
||||
if (_rx_buffer->head == _rx_buffer->tail) {
|
||||
return -1;
|
||||
} else {
|
||||
return _rx_buffer->buffer[_rx_buffer->tail];
|
||||
}
|
||||
}
|
||||
|
||||
int HardwareSerial::read(void)
|
||||
{
|
||||
// if the head isn't ahead of the tail, we don't have any characters
|
||||
if (_rx_buffer->head == _rx_buffer->tail) {
|
||||
return -1;
|
||||
} else {
|
||||
unsigned char c = _rx_buffer->buffer[_rx_buffer->tail];
|
||||
_rx_buffer->tail = (unsigned int)(_rx_buffer->tail + 1) % RX_BUFFER_SIZE;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
void HardwareSerial::flush()
|
||||
{
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// don't reverse this or there may be problems if the RX interrupt
|
||||
// occurs after reading the value of rx_buffer_head but before writing
|
||||
// the value to rx_buffer_tail; the previous value of rx_buffer_head
|
||||
// may be written to rx_buffer_tail, making it appear as if the buffer
|
||||
// were full, not empty.
|
||||
_rx_buffer->head = _rx_buffer->tail;
|
||||
}
|
||||
|
||||
void HardwareSerial::write(uint8_t c)
|
||||
{
|
||||
while (!((*_ucsra) & (1 << _udre)))
|
||||
;
|
||||
|
||||
*_udr = c;
|
||||
}
|
||||
|
||||
// Preinstantiate Objects //////////////////////////////////////////////////////
|
||||
|
||||
#if defined(UBRRH) && defined(UBRRL)
|
||||
HardwareSerial Serial(&rx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRE, U2X);
|
||||
#elif defined(UBRR0H) && defined(UBRR0L)
|
||||
HardwareSerial Serial(&rx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRE0, U2X0);
|
||||
#elif defined(USBCON)
|
||||
#warning no serial port defined (port 0)
|
||||
#else
|
||||
#error no serial port defined (port 0)
|
||||
#endif
|
||||
|
||||
#if defined(UBRR1H)
|
||||
HardwareSerial Serial1(&rx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UDR1, RXEN1, TXEN1, RXCIE1, UDRE1, U2X1);
|
||||
#endif
|
||||
#if defined(UBRR2H)
|
||||
HardwareSerial Serial2(&rx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UDR2, RXEN2, TXEN2, RXCIE2, UDRE2, U2X2);
|
||||
#endif
|
||||
#if defined(UBRR3H)
|
||||
HardwareSerial Serial3(&rx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UDR3, RXEN3, TXEN3, RXCIE3, UDRE3, U2X3);
|
||||
#endif
|
||||
|
||||
#endif // whole file
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
/*
|
||||
Print.cpp - Base class that provides print() and println()
|
||||
Copyright (c) 2008 David A. Mellis. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Modified 23 November 2006 by David A. Mellis
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "wiring.h"
|
||||
|
||||
#include "Print.h"
|
||||
|
||||
// Public Methods //////////////////////////////////////////////////////////////
|
||||
|
||||
/* default implementation: may be overridden */
|
||||
void Print::write(const char *str)
|
||||
{
|
||||
while (*str)
|
||||
write(*str++);
|
||||
}
|
||||
|
||||
/* default implementation: may be overridden */
|
||||
void Print::write(const uint8_t *buffer, size_t size)
|
||||
{
|
||||
while (size--)
|
||||
write(*buffer++);
|
||||
}
|
||||
|
||||
void Print::print(const String &s)
|
||||
{
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
write(s[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void Print::print(const char str[])
|
||||
{
|
||||
write(str);
|
||||
}
|
||||
|
||||
void Print::print(char c, int base)
|
||||
{
|
||||
print((long) c, base);
|
||||
}
|
||||
|
||||
void Print::print(unsigned char b, int base)
|
||||
{
|
||||
print((unsigned long) b, base);
|
||||
}
|
||||
|
||||
void Print::print(int n, int base)
|
||||
{
|
||||
print((long) n, base);
|
||||
}
|
||||
|
||||
void Print::print(unsigned int n, int base)
|
||||
{
|
||||
print((unsigned long) n, base);
|
||||
}
|
||||
|
||||
void Print::print(long n, int base)
|
||||
{
|
||||
if (base == 0) {
|
||||
write(n);
|
||||
} else if (base == 10) {
|
||||
if (n < 0) {
|
||||
print('-');
|
||||
n = -n;
|
||||
}
|
||||
printNumber(n, 10);
|
||||
} else {
|
||||
printNumber(n, base);
|
||||
}
|
||||
}
|
||||
|
||||
void Print::print(unsigned long n, int base)
|
||||
{
|
||||
if (base == 0) write(n);
|
||||
else printNumber(n, base);
|
||||
}
|
||||
|
||||
void Print::print(double n, int digits)
|
||||
{
|
||||
printFloat(n, digits);
|
||||
}
|
||||
|
||||
void Print::println(void)
|
||||
{
|
||||
print('\r');
|
||||
print('\n');
|
||||
}
|
||||
|
||||
void Print::println(const String &s)
|
||||
{
|
||||
print(s);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(const char c[])
|
||||
{
|
||||
print(c);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(char c, int base)
|
||||
{
|
||||
print(c, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned char b, int base)
|
||||
{
|
||||
print(b, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(int n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned int n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(long n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(unsigned long n, int base)
|
||||
{
|
||||
print(n, base);
|
||||
println();
|
||||
}
|
||||
|
||||
void Print::println(double n, int digits)
|
||||
{
|
||||
print(n, digits);
|
||||
println();
|
||||
}
|
||||
|
||||
// Private Methods /////////////////////////////////////////////////////////////
|
||||
|
||||
void Print::printNumber(unsigned long n, uint8_t base)
|
||||
{
|
||||
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
|
||||
unsigned long i = 0;
|
||||
|
||||
if (n == 0) {
|
||||
print('0');
|
||||
return;
|
||||
}
|
||||
|
||||
while (n > 0) {
|
||||
buf[i++] = n % base;
|
||||
n /= base;
|
||||
}
|
||||
|
||||
for (; i > 0; i--)
|
||||
print((char) (buf[i - 1] < 10 ?
|
||||
'0' + buf[i - 1] :
|
||||
'A' + buf[i - 1] - 10));
|
||||
}
|
||||
|
||||
void Print::printFloat(double number, uint8_t digits)
|
||||
{
|
||||
// Handle negative numbers
|
||||
if (number < 0.0)
|
||||
{
|
||||
print('-');
|
||||
number = -number;
|
||||
}
|
||||
|
||||
// Round correctly so that print(1.999, 2) prints as "2.00"
|
||||
double rounding = 0.5;
|
||||
for (uint8_t i=0; i<digits; ++i)
|
||||
rounding /= 10.0;
|
||||
|
||||
number += rounding;
|
||||
|
||||
// Extract the integer part of the number and print it
|
||||
unsigned long int_part = (unsigned long)number;
|
||||
double remainder = number - (double)int_part;
|
||||
print(int_part);
|
||||
|
||||
// Print the decimal point, but only if there are digits beyond
|
||||
if (digits > 0)
|
||||
print(".");
|
||||
|
||||
// Extract digits from the remainder one at a time
|
||||
while (digits-- > 0)
|
||||
{
|
||||
remainder *= 10.0;
|
||||
int toPrint = int(remainder);
|
||||
print(toPrint);
|
||||
remainder -= toPrint;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
Print.h - Base class that provides print() and println()
|
||||
Copyright (c) 2008 David A. Mellis. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef Print_h
|
||||
#define Print_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h> // for size_t
|
||||
|
||||
#include "WString.h"
|
||||
|
||||
#define DEC 10
|
||||
#define HEX 16
|
||||
#define OCT 8
|
||||
#define BIN 2
|
||||
#define BYTE 0
|
||||
|
||||
class Print
|
||||
{
|
||||
private:
|
||||
void printNumber(unsigned long, uint8_t);
|
||||
void printFloat(double, uint8_t);
|
||||
public:
|
||||
virtual void write(uint8_t) = 0;
|
||||
virtual void write(const char *str);
|
||||
virtual void write(const uint8_t *buffer, size_t size);
|
||||
|
||||
void print(const String &);
|
||||
void print(const char[]);
|
||||
void print(char, int = BYTE);
|
||||
void print(unsigned char, int = BYTE);
|
||||
void print(int, int = DEC);
|
||||
void print(unsigned int, int = DEC);
|
||||
void print(long, int = DEC);
|
||||
void print(unsigned long, int = DEC);
|
||||
void print(double, int = 2);
|
||||
|
||||
void println(const String &s);
|
||||
void println(const char[]);
|
||||
void println(char, int = BYTE);
|
||||
void println(unsigned char, int = BYTE);
|
||||
void println(int, int = DEC);
|
||||
void println(unsigned int, int = DEC);
|
||||
void println(long, int = DEC);
|
||||
void println(unsigned long, int = DEC);
|
||||
void println(double, int = 2);
|
||||
void println(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
#include "wiring.h"
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifndef WProgram_h
|
||||
#define WProgram_h
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "wiring.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "WCharacter.h"
|
||||
#include "WString.h"
|
||||
#include "HardwareSerial.h"
|
||||
|
||||
uint16_t makeWord(uint16_t w);
|
||||
uint16_t makeWord(byte h, byte l);
|
||||
|
||||
#define word(...) makeWord(__VA_ARGS__)
|
||||
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
|
||||
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
|
||||
void noTone(uint8_t _pin);
|
||||
|
||||
// WMath prototypes
|
||||
long random(long);
|
||||
long random(long, long);
|
||||
void randomSeed(unsigned int);
|
||||
long map(long, long, long, long, long);
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
const static uint8_t A0 = 54;
|
||||
const static uint8_t A1 = 55;
|
||||
const static uint8_t A2 = 56;
|
||||
const static uint8_t A3 = 57;
|
||||
const static uint8_t A4 = 58;
|
||||
const static uint8_t A5 = 59;
|
||||
const static uint8_t A6 = 60;
|
||||
const static uint8_t A7 = 61;
|
||||
const static uint8_t A8 = 62;
|
||||
const static uint8_t A9 = 63;
|
||||
const static uint8_t A10 = 64;
|
||||
const static uint8_t A11 = 65;
|
||||
const static uint8_t A12 = 66;
|
||||
const static uint8_t A13 = 67;
|
||||
const static uint8_t A14 = 68;
|
||||
const static uint8_t A15 = 69;
|
||||
#else
|
||||
const static uint8_t A0 = 14;
|
||||
const static uint8_t A1 = 15;
|
||||
const static uint8_t A2 = 16;
|
||||
const static uint8_t A3 = 17;
|
||||
const static uint8_t A4 = 18;
|
||||
const static uint8_t A5 = 19;
|
||||
const static uint8_t A6 = 20;
|
||||
const static uint8_t A7 = 21;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,443 +0,0 @@
|
||||
/*
|
||||
WString.cpp - String library for Wiring & Arduino
|
||||
Copyright (c) 2009-10 Hernando Barragan. All rights reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "WProgram.h"
|
||||
#include "WString.h"
|
||||
|
||||
|
||||
String::String( const char *value )
|
||||
{
|
||||
if ( value == NULL )
|
||||
value = "";
|
||||
getBuffer( _length = strlen( value ) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, value );
|
||||
}
|
||||
|
||||
String::String( const String &value )
|
||||
{
|
||||
getBuffer( _length = value._length );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, value._buffer );
|
||||
}
|
||||
|
||||
String::String( const char value )
|
||||
{
|
||||
_length = 1;
|
||||
getBuffer(1);
|
||||
if ( _buffer != NULL ) {
|
||||
_buffer[0] = value;
|
||||
_buffer[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
String::String( const unsigned char value )
|
||||
{
|
||||
_length = 1;
|
||||
getBuffer(1);
|
||||
if ( _buffer != NULL) {
|
||||
_buffer[0] = value;
|
||||
_buffer[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
String::String( const int value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
itoa((signed long)value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const unsigned int value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ultoa((unsigned long)value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const long value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ltoa(value, buf, base);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
String::String( const unsigned long value, const int base )
|
||||
{
|
||||
char buf[33];
|
||||
ultoa(value, buf, 10);
|
||||
getBuffer( _length = strlen(buf) );
|
||||
if ( _buffer != NULL )
|
||||
strcpy( _buffer, buf );
|
||||
}
|
||||
|
||||
char String::charAt( unsigned int loc ) const
|
||||
{
|
||||
return operator[]( loc );
|
||||
}
|
||||
|
||||
void String::setCharAt( unsigned int loc, const char aChar )
|
||||
{
|
||||
if(_buffer == NULL) return;
|
||||
if(_length > loc) {
|
||||
_buffer[loc] = aChar;
|
||||
}
|
||||
}
|
||||
|
||||
int String::compareTo( const String &s2 ) const
|
||||
{
|
||||
return strcmp( _buffer, s2._buffer );
|
||||
}
|
||||
|
||||
const String & String::concat( const String &s2 )
|
||||
{
|
||||
return (*this) += s2;
|
||||
}
|
||||
|
||||
const String & String::operator=( const String &rhs )
|
||||
{
|
||||
if ( this == &rhs )
|
||||
return *this;
|
||||
|
||||
if ( rhs._length > _length )
|
||||
{
|
||||
free(_buffer);
|
||||
getBuffer( rhs._length );
|
||||
}
|
||||
|
||||
if ( _buffer != NULL ) {
|
||||
_length = rhs._length;
|
||||
strcpy( _buffer, rhs._buffer );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//const String & String::operator+=( const char aChar )
|
||||
//{
|
||||
// if ( _length == _capacity )
|
||||
// doubleBuffer();
|
||||
//
|
||||
// _buffer[ _length++ ] = aChar;
|
||||
// _buffer[ _length ] = '\0';
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
const String & String::operator+=( const String &other )
|
||||
{
|
||||
_length += other._length;
|
||||
if ( _length > _capacity )
|
||||
{
|
||||
char *temp = (char *)realloc(_buffer, _length + 1);
|
||||
if ( temp != NULL ) {
|
||||
_buffer = temp;
|
||||
_capacity = _length;
|
||||
} else {
|
||||
_length -= other._length;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
strcat( _buffer, other._buffer );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
int String::operator==( const String &rhs ) const
|
||||
{
|
||||
return ( _length == rhs._length && strcmp( _buffer, rhs._buffer ) == 0 );
|
||||
}
|
||||
|
||||
int String::operator!=( const String &rhs ) const
|
||||
{
|
||||
return ( _length != rhs.length() || strcmp( _buffer, rhs._buffer ) != 0 );
|
||||
}
|
||||
|
||||
int String::operator<( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) < 0;
|
||||
}
|
||||
|
||||
int String::operator>( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) > 0;
|
||||
}
|
||||
|
||||
int String::operator<=( const String &rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) <= 0;
|
||||
}
|
||||
|
||||
int String::operator>=( const String & rhs ) const
|
||||
{
|
||||
return strcmp( _buffer, rhs._buffer ) >= 0;
|
||||
}
|
||||
|
||||
char & String::operator[]( unsigned int index )
|
||||
{
|
||||
static char dummy_writable_char;
|
||||
if (index >= _length || !_buffer) {
|
||||
dummy_writable_char = 0;
|
||||
return dummy_writable_char;
|
||||
}
|
||||
return _buffer[ index ];
|
||||
}
|
||||
|
||||
char String::operator[]( unsigned int index ) const
|
||||
{
|
||||
// need to check for valid index, to do later
|
||||
return _buffer[ index ];
|
||||
}
|
||||
|
||||
boolean String::endsWith( const String &s2 ) const
|
||||
{
|
||||
if ( _length < s2._length )
|
||||
return 0;
|
||||
|
||||
return strcmp( &_buffer[ _length - s2._length], s2._buffer ) == 0;
|
||||
}
|
||||
|
||||
boolean String::equals( const String &s2 ) const
|
||||
{
|
||||
return ( _length == s2._length && strcmp( _buffer,s2._buffer ) == 0 );
|
||||
}
|
||||
|
||||
boolean String::equalsIgnoreCase( const String &s2 ) const
|
||||
{
|
||||
if ( this == &s2 )
|
||||
return true; //1;
|
||||
else if ( _length != s2._length )
|
||||
return false; //0;
|
||||
|
||||
return strcmp(toLowerCase()._buffer, s2.toLowerCase()._buffer) == 0;
|
||||
}
|
||||
|
||||
String String::replace( char findChar, char replaceChar )
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String theReturn = _buffer;
|
||||
char* temp = theReturn._buffer;
|
||||
while( (temp = strchr( temp, findChar )) != 0 )
|
||||
*temp = replaceChar;
|
||||
|
||||
return theReturn;
|
||||
}
|
||||
|
||||
String String::replace( const String& match, const String& replace )
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String temp = _buffer, newString;
|
||||
|
||||
int loc;
|
||||
while ( (loc = temp.indexOf( match )) != -1 )
|
||||
{
|
||||
newString += temp.substring( 0, loc );
|
||||
newString += replace;
|
||||
temp = temp.substring( loc + match._length );
|
||||
}
|
||||
newString += temp;
|
||||
return newString;
|
||||
}
|
||||
|
||||
int String::indexOf( char temp ) const
|
||||
{
|
||||
return indexOf( temp, 0 );
|
||||
}
|
||||
|
||||
int String::indexOf( char ch, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
const char* temp = strchr( &_buffer[fromIndex], ch );
|
||||
if ( temp == NULL )
|
||||
return -1;
|
||||
|
||||
return temp - _buffer;
|
||||
}
|
||||
|
||||
int String::indexOf( const String &s2 ) const
|
||||
{
|
||||
return indexOf( s2, 0 );
|
||||
}
|
||||
|
||||
int String::indexOf( const String &s2, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
const char *theFind = strstr( &_buffer[ fromIndex ], s2._buffer );
|
||||
|
||||
if ( theFind == NULL )
|
||||
return -1;
|
||||
|
||||
return theFind - _buffer; // pointer subtraction
|
||||
}
|
||||
|
||||
int String::lastIndexOf( char theChar ) const
|
||||
{
|
||||
return lastIndexOf( theChar, _length - 1 );
|
||||
}
|
||||
|
||||
int String::lastIndexOf( char ch, unsigned int fromIndex ) const
|
||||
{
|
||||
if ( fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
char tempchar = _buffer[fromIndex + 1];
|
||||
_buffer[fromIndex + 1] = '\0';
|
||||
char* temp = strrchr( _buffer, ch );
|
||||
_buffer[fromIndex + 1] = tempchar;
|
||||
|
||||
if ( temp == NULL )
|
||||
return -1;
|
||||
|
||||
return temp - _buffer;
|
||||
}
|
||||
|
||||
int String::lastIndexOf( const String &s2 ) const
|
||||
{
|
||||
return lastIndexOf( s2, _length - s2._length );
|
||||
}
|
||||
|
||||
int String::lastIndexOf( const String &s2, unsigned int fromIndex ) const
|
||||
{
|
||||
// check for empty strings
|
||||
if ( s2._length == 0 || s2._length - 1 > fromIndex || fromIndex >= _length )
|
||||
return -1;
|
||||
|
||||
// matching first character
|
||||
char temp = s2[ 0 ];
|
||||
|
||||
for ( int i = fromIndex; i >= 0; i-- )
|
||||
{
|
||||
if ( _buffer[ i ] == temp && (*this).substring( i, i + s2._length ).equals( s2 ) )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
boolean String::startsWith( const String &s2 ) const
|
||||
{
|
||||
if ( _length < s2._length )
|
||||
return 0;
|
||||
|
||||
return startsWith( s2, 0 );
|
||||
}
|
||||
|
||||
boolean String::startsWith( const String &s2, unsigned int offset ) const
|
||||
{
|
||||
if ( offset > _length - s2._length )
|
||||
return 0;
|
||||
|
||||
return strncmp( &_buffer[offset], s2._buffer, s2._length ) == 0;
|
||||
}
|
||||
|
||||
String String::substring( unsigned int left ) const
|
||||
{
|
||||
return substring( left, _length );
|
||||
}
|
||||
|
||||
String String::substring( unsigned int left, unsigned int right ) const
|
||||
{
|
||||
if ( left > right )
|
||||
{
|
||||
int temp = right;
|
||||
right = left;
|
||||
left = temp;
|
||||
}
|
||||
|
||||
if ( right > _length )
|
||||
{
|
||||
right = _length;
|
||||
}
|
||||
|
||||
char temp = _buffer[ right ]; // save the replaced character
|
||||
_buffer[ right ] = '\0';
|
||||
String outPut = ( _buffer + left ); // pointer arithmetic
|
||||
_buffer[ right ] = temp; //restore character
|
||||
return outPut;
|
||||
}
|
||||
|
||||
String String::toLowerCase() const
|
||||
{
|
||||
String temp = _buffer;
|
||||
|
||||
for ( unsigned int i = 0; i < _length; i++ )
|
||||
temp._buffer[ i ] = (char)tolower( temp._buffer[ i ] );
|
||||
return temp;
|
||||
}
|
||||
|
||||
String String::toUpperCase() const
|
||||
{
|
||||
String temp = _buffer;
|
||||
|
||||
for ( unsigned int i = 0; i < _length; i++ )
|
||||
temp._buffer[ i ] = (char)toupper( temp._buffer[ i ] );
|
||||
return temp;
|
||||
}
|
||||
|
||||
String String::trim() const
|
||||
{
|
||||
if ( _buffer == NULL ) return *this;
|
||||
String temp = _buffer;
|
||||
unsigned int i,j;
|
||||
|
||||
for ( i = 0; i < _length; i++ )
|
||||
{
|
||||
if ( !isspace(_buffer[i]) )
|
||||
break;
|
||||
}
|
||||
|
||||
for ( j = temp._length - 1; j > i; j-- )
|
||||
{
|
||||
if ( !isspace(_buffer[j]) )
|
||||
break;
|
||||
}
|
||||
|
||||
return temp.substring( i, j + 1);
|
||||
}
|
||||
|
||||
void String::getBytes(unsigned char *buf, unsigned int bufsize)
|
||||
{
|
||||
if (!bufsize || !buf) return;
|
||||
unsigned int len = bufsize - 1;
|
||||
if (len > _length) len = _length;
|
||||
strncpy((char *)buf, _buffer, len);
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
void String::toCharArray(char *buf, unsigned int bufsize)
|
||||
{
|
||||
if (!bufsize || !buf) return;
|
||||
unsigned int len = bufsize - 1;
|
||||
if (len > _length) len = _length;
|
||||
strncpy(buf, _buffer, len);
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
|
||||
long String::toInt() {
|
||||
return atol(_buffer);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
WString.h - String library for Wiring & Arduino
|
||||
Copyright (c) 2009-10 Hernando Barragan. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef String_h
|
||||
#define String_h
|
||||
|
||||
//#include "WProgram.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
class String
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
String( const char *value = "" );
|
||||
String( const String &value );
|
||||
String( const char );
|
||||
String( const unsigned char );
|
||||
String( const int, const int base=10);
|
||||
String( const unsigned int, const int base=10 );
|
||||
String( const long, const int base=10 );
|
||||
String( const unsigned long, const int base=10 );
|
||||
~String() { free(_buffer); _length = _capacity = 0;} //added _length = _capacity = 0;
|
||||
|
||||
// operators
|
||||
const String & operator = ( const String &rhs );
|
||||
const String & operator +=( const String &rhs );
|
||||
//const String & operator +=( const char );
|
||||
int operator ==( const String &rhs ) const;
|
||||
int operator !=( const String &rhs ) const;
|
||||
int operator < ( const String &rhs ) const;
|
||||
int operator > ( const String &rhs ) const;
|
||||
int operator <=( const String &rhs ) const;
|
||||
int operator >=( const String &rhs ) const;
|
||||
char operator []( unsigned int index ) const;
|
||||
char& operator []( unsigned int index );
|
||||
//operator const char *() const { return _buffer; }
|
||||
|
||||
// general methods
|
||||
char charAt( unsigned int index ) const;
|
||||
int compareTo( const String &anotherString ) const;
|
||||
unsigned char endsWith( const String &suffix ) const;
|
||||
unsigned char equals( const String &anObject ) const;
|
||||
unsigned char equalsIgnoreCase( const String &anotherString ) const;
|
||||
int indexOf( char ch ) const;
|
||||
int indexOf( char ch, unsigned int fromIndex ) const;
|
||||
int indexOf( const String &str ) const;
|
||||
int indexOf( const String &str, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( char ch ) const;
|
||||
int lastIndexOf( char ch, unsigned int fromIndex ) const;
|
||||
int lastIndexOf( const String &str ) const;
|
||||
int lastIndexOf( const String &str, unsigned int fromIndex ) const;
|
||||
const unsigned int length( ) const { return _length; }
|
||||
void setCharAt(unsigned int index, const char ch);
|
||||
unsigned char startsWith( const String &prefix ) const;
|
||||
unsigned char startsWith( const String &prefix, unsigned int toffset ) const;
|
||||
String substring( unsigned int beginIndex ) const;
|
||||
String substring( unsigned int beginIndex, unsigned int endIndex ) const;
|
||||
String toLowerCase( ) const;
|
||||
String toUpperCase( ) const;
|
||||
String trim( ) const;
|
||||
void getBytes(unsigned char *buf, unsigned int bufsize);
|
||||
void toCharArray(char *buf, unsigned int bufsize);
|
||||
long toInt( );
|
||||
const String& concat( const String &str );
|
||||
String replace( char oldChar, char newChar );
|
||||
String replace( const String& match, const String& replace );
|
||||
friend String operator + ( String lhs, const String &rhs );
|
||||
|
||||
protected:
|
||||
char *_buffer; // the actual char array
|
||||
unsigned int _capacity; // the array length minus one (for the '\0')
|
||||
unsigned int _length; // the String length (not counting the '\0')
|
||||
|
||||
void getBuffer(unsigned int maxStrLen);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
// allocate buffer space
|
||||
inline void String::getBuffer(unsigned int maxStrLen)
|
||||
{
|
||||
_capacity = maxStrLen;
|
||||
_buffer = (char *) malloc(_capacity + 1);
|
||||
if (_buffer == NULL) _length = _capacity = 0;
|
||||
}
|
||||
|
||||
inline String operator+( String lhs, const String &rhs )
|
||||
{
|
||||
return lhs += rhs;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <WProgram.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
init();
|
||||
|
||||
setup();
|
||||
|
||||
for (;;)
|
||||
loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
pins_arduino.h - Pin definition functions for Arduino
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2007 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id: wiring.h 249 2007-02-03 16:52:51Z mellis $
|
||||
*/
|
||||
|
||||
#ifndef Pins_Arduino_h
|
||||
#define Pins_Arduino_h
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define NOT_A_PIN 0
|
||||
#define NOT_A_PORT 0
|
||||
|
||||
#define NOT_ON_TIMER 0
|
||||
#define TIMER0A 1
|
||||
#define TIMER0B 2
|
||||
#define TIMER1A 3
|
||||
#define TIMER1B 4
|
||||
#define TIMER2 5
|
||||
#define TIMER2A 6
|
||||
#define TIMER2B 7
|
||||
|
||||
#define TIMER3A 8
|
||||
#define TIMER3B 9
|
||||
#define TIMER3C 10
|
||||
#define TIMER4A 11
|
||||
#define TIMER4B 12
|
||||
#define TIMER4C 13
|
||||
#define TIMER5A 14
|
||||
#define TIMER5B 15
|
||||
#define TIMER5C 16
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
const static uint8_t SS = 53;
|
||||
const static uint8_t MOSI = 51;
|
||||
const static uint8_t MISO = 50;
|
||||
const static uint8_t SCK = 52;
|
||||
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
|
||||
const static uint8_t SS = 4;
|
||||
const static uint8_t MOSI = 5;
|
||||
const static uint8_t MISO = 6;
|
||||
const static uint8_t SCK = 7;
|
||||
|
||||
#else
|
||||
const static uint8_t SS = 10;
|
||||
const static uint8_t MOSI = 11;
|
||||
const static uint8_t MISO = 12;
|
||||
const static uint8_t SCK = 13;
|
||||
#endif
|
||||
|
||||
// On the ATmega1280, the addresses of some of the port registers are
|
||||
// greater than 255, so we can't store them in uint8_t's.
|
||||
extern const uint16_t PROGMEM port_to_mode_PGM[];
|
||||
extern const uint16_t PROGMEM port_to_input_PGM[];
|
||||
extern const uint16_t PROGMEM port_to_output_PGM[];
|
||||
|
||||
extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
|
||||
// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[];
|
||||
extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
|
||||
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
|
||||
|
||||
// Get the bit location within the hardware port of the given virtual pin.
|
||||
// This comes from the pins_*.c file for the active board configuration.
|
||||
//
|
||||
// These perform slightly better as macros compared to inline functions
|
||||
//
|
||||
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
|
||||
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
|
||||
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
|
||||
#define analogInPinToBit(P) (P)
|
||||
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) )
|
||||
#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) )
|
||||
#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) )
|
||||
|
||||
#endif
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
wiring.h - Partial implementation of the Wiring API for the ATmega8.
|
||||
Part of Arduino - http://www.arduino.cc/
|
||||
|
||||
Copyright (c) 2005-2006 David A. Mellis
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef Wiring_h
|
||||
#define Wiring_h
|
||||
|
||||
#include <avr/io.h>
|
||||
#include <stdlib.h>
|
||||
#include "binary.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#define HIGH 0x1
|
||||
#define LOW 0x0
|
||||
|
||||
#define INPUT 0x0
|
||||
#define OUTPUT 0x1
|
||||
|
||||
#define true 0x1
|
||||
#define false 0x0
|
||||
|
||||
#define PI 3.1415926535897932384626433832795
|
||||
#define HALF_PI 1.5707963267948966192313216916398
|
||||
#define TWO_PI 6.283185307179586476925286766559
|
||||
#define DEG_TO_RAD 0.017453292519943295769236907684886
|
||||
#define RAD_TO_DEG 57.295779513082320876798154814105
|
||||
|
||||
#define SERIAL 0x0
|
||||
#define DISPLAY 0x1
|
||||
|
||||
#define LSBFIRST 0
|
||||
#define MSBFIRST 1
|
||||
|
||||
#define CHANGE 1
|
||||
#define FALLING 2
|
||||
#define RISING 3
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
#define INTERNAL1V1 2
|
||||
#define INTERNAL2V56 3
|
||||
#else
|
||||
#define INTERNAL 3
|
||||
#endif
|
||||
#define DEFAULT 1
|
||||
#define EXTERNAL 0
|
||||
|
||||
// undefine stdlib's abs if encountered
|
||||
#ifdef abs
|
||||
#undef abs
|
||||
#endif
|
||||
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
#define abs(x) ((x)>0?(x):-(x))
|
||||
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
|
||||
|
||||
// Removed to work with newer AVRLIBC
|
||||
//#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
|
||||
|
||||
#define radians(deg) ((deg)*DEG_TO_RAD)
|
||||
#define degrees(rad) ((rad)*RAD_TO_DEG)
|
||||
#define sq(x) ((x)*(x))
|
||||
|
||||
#define interrupts() sei()
|
||||
#define noInterrupts() cli()
|
||||
|
||||
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
|
||||
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
|
||||
#define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
|
||||
|
||||
#define lowByte(w) ((uint8_t) ((w) & 0xff))
|
||||
#define highByte(w) ((uint8_t) ((w) >> 8))
|
||||
|
||||
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
|
||||
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
|
||||
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
|
||||
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
|
||||
|
||||
|
||||
typedef unsigned int word;
|
||||
|
||||
#define bit(b) (1UL << (b))
|
||||
|
||||
typedef uint8_t boolean;
|
||||
typedef uint8_t byte;
|
||||
|
||||
void init(void);
|
||||
|
||||
void pinMode(uint8_t, uint8_t);
|
||||
void digitalWrite(uint8_t, uint8_t);
|
||||
int digitalRead(uint8_t);
|
||||
int analogRead(uint8_t);
|
||||
void analogReference(uint8_t mode);
|
||||
void analogWrite(uint8_t, int);
|
||||
|
||||
unsigned long millis(void);
|
||||
unsigned long micros(void);
|
||||
void delay(unsigned long);
|
||||
void delayMicroseconds(unsigned int us);
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
|
||||
|
||||
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
|
||||
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
|
||||
|
||||
void attachInterrupt(uint8_t, void (*)(void), int mode);
|
||||
void detachInterrupt(uint8_t);
|
||||
|
||||
void setup(void);
|
||||
void loop(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,20 +0,0 @@
|
||||
avrisp.name=AVR ISP
|
||||
avrisp.communication=serial
|
||||
avrisp.protocol=stk500v1
|
||||
|
||||
avrispmkii.name=AVRISP mkII
|
||||
avrispmkii.communication=usb
|
||||
avrispmkii.protocol=stk500v2
|
||||
|
||||
usbtinyisp.name=USBtinyISP
|
||||
usbtinyisp.protocol=usbtiny
|
||||
|
||||
parallel.name=Parallel Programmer
|
||||
parallel.protocol=dapa
|
||||
parallel.force=true
|
||||
# parallel.delay=200
|
||||
|
||||
arduinoisp.name=Arduino as ISP
|
||||
arduinoisp.communication=serial
|
||||
arduinoisp.protocol=stk500v1
|
||||
arduinoisp.speed=19200
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,249 +0,0 @@
|
||||
/*
|
||||
|
||||
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"
|
||||
|
||||
static uint8_t u8g_i2c_err_code;
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(__AVR__)
|
||||
#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
|
||||
|
||||
F_CPU/(2*100000)-8 --> calculate TWBR value for 100KHz
|
||||
*/
|
||||
TWSR = 0;
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
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;
|
||||
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();
|
||||
}
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
|
||||
u8g_ellipse.c
|
||||
|
||||
Utility to draw empty and filled ellipses.
|
||||
|
||||
Universal 8bit Graphics Library
|
||||
|
||||
Copyright (c) 2011, bjthom@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 as of 02/29/12
|
||||
Adapted from Bresenham's Algorithm and the following websites:
|
||||
http://free.pages.at/easyfilter/bresenham.html
|
||||
http://homepage.smc.edu/kennedy_john/belipse.pdf
|
||||
|
||||
*/
|
||||
|
||||
#include "u8g.h"
|
||||
|
||||
|
||||
#ifdef WORK_IN_PROGRESS
|
||||
|
||||
void u8g_DrawEllipseRect(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t x1, u8g_uint_t y1)
|
||||
{
|
||||
int a = abs(x1 - x0);
|
||||
int b = abs(y1 - y0); //get diameters
|
||||
int b1 = b&1;
|
||||
long dx = 4*(1-a)*b*b;
|
||||
long dy = 4*(b1+1)*a*a;
|
||||
long err = dx+dy+b1*a*a;
|
||||
long e2;
|
||||
|
||||
if (x0 > x1) { x0 = x1; x1 += a; }
|
||||
if (y0 > y1) { y0 = y1; }
|
||||
y0 += (b+1)/2;
|
||||
y1 = y0-b1;
|
||||
a *= 8*a;
|
||||
b1 = 8*b*b;
|
||||
|
||||
do {
|
||||
u8g_DrawPixel(u8g, x1, y0);
|
||||
u8g_DrawPixel(u8g, x0, y0);
|
||||
u8g_DrawPixel(u8g, x0, y1);
|
||||
u8g_DrawPixel(u8g, x1, y1);
|
||||
e2 = 2*err;
|
||||
if (e2 >= dx) {
|
||||
x0++;
|
||||
x1--;
|
||||
err += dx += b1;
|
||||
}
|
||||
if (e2 <= dy) {
|
||||
y0++;
|
||||
y1--;
|
||||
err += dy += a;
|
||||
}
|
||||
} while (x0 <= x1);
|
||||
|
||||
while (y0-y1 < b) {
|
||||
u8g_DrawPixel(u8g, x0-1, y0);
|
||||
u8g_DrawPixel(u8g, x1+1, y0++);
|
||||
u8g_DrawPixel(u8g, x0-1, y1);
|
||||
u8g_DrawPixel(u8g, x1+1, y1--);
|
||||
}
|
||||
}
|
||||
|
||||
void u8g_DrawEllipse(u8g_t *u8g, u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t xr, u8g_uint_t yr)
|
||||
{
|
||||
u8g_DrawPixel(u8g, x0, y0+yr);
|
||||
u8g_DrawPixel(u8g, x0, y0-yr);
|
||||
u8g_DrawPixel(u8g, x0+xr, y0);
|
||||
u8g_DrawPixel(u8g, x0-xr, y0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -107,7 +107,55 @@ u8glib ChangeLog
|
||||
* Sleep Mode
|
||||
* 4x mode for ST7920
|
||||
* New C++ interface for ST7920
|
||||
|
||||
2013-03-24 v1.12 Oliver Kraus <olikraus@gmail.com>
|
||||
* Added touch panel examples
|
||||
2013-06-30 v1.13 Oliver Kraus <olikraus@gmail.com>
|
||||
* Fixed missing "Arduino.h" in u8g_delay.c
|
||||
* Disable interrupt for port/pin access (AVR), issue 19
|
||||
* Support for HT1632: U8GLIB_HT1632_24X16 u8g(wr, data, cs), issue 165
|
||||
* Support for SSD1351 OLED, issue 168
|
||||
* Cleaned up several compiler warnings
|
||||
* Fixed conflict with scheduler (Arduino Due), issue 155
|
||||
* HW SPI for Arduino Due, issue 180
|
||||
* Performance improvement for ST7920, issue 177
|
||||
* Added ":" to the "n"umeric variant of the fonts, issue 166
|
||||
* Added additional argument u8g_InitCom(). Use U8G_SPI_CLK_CYCLE_NONE by default.
|
||||
* Added double buffer option for many ST7565 devices
|
||||
* Tested with Arduino 1.0.5
|
||||
2013-10-03 v1.14 Oliver Kraus <olikraus@gmail.com>
|
||||
* Support for ARM controller
|
||||
* Support for the A2 micro printer (issue 191)
|
||||
* Ellipse drawing primitive (issue 187)
|
||||
* Added software reset for UC1701
|
||||
* Fixed compiler warning (issue 196)
|
||||
* Support for Freetronics SSD1351 OLED (issue 195)
|
||||
* Several other fixes and improvements
|
||||
2014-01-25 v1.15 Oliver Kraus <olikraus@gmail.com>
|
||||
* Fixed a bug with the rotation procs: Occupied too much flash ROM (issue 219)
|
||||
* Fixed issue with more than one SPI controller (SW SPI, issue 227)
|
||||
* Added "drawTriangle" (issue 226)
|
||||
* Added support for UC1608 (issue 214)
|
||||
* Added ProFont family of fonts (issue 234)
|
||||
* SW SPI support for Teensy 3 (issue 230)
|
||||
* Removed Arduino/AVR specific files from ARM port (issue 209)
|
||||
2014-07-05 v1.16 Oliver Kraus <olikraus@gmail.com>
|
||||
* Added support for LD7032 60x32 OLED
|
||||
* Added support for SSD1306 OLED, which does not send I2C ACK (issue 239)
|
||||
* Added support for SH1106 128x64 OLED
|
||||
* Added support for T6963 128x128 displays
|
||||
* Added U8GLIB_SSD1306_ADAFRUIT_128X64 constructor
|
||||
2014-12-21 v1.17 Oliver Kraus <olikraus@gmail.com>
|
||||
* Added U8GLIB_UC1611_DOGM240 constructor (Issue 284)
|
||||
* Added U8GLIB_UC1611_DOGXL240 constructor
|
||||
* Added support for UC1608 controller (Issue 300)
|
||||
* Added U8GLIB_SSD1306_ADAFRUIT_128X64 for Adafruit OLEDs (Issue 289)
|
||||
* Bufix in the sleep on/off sequence (CS has not been releases, issue 298)
|
||||
* helvB and helvR number only fonts (Issue 271)
|
||||
* 400KHz option for I2C with U8G_I2C_OPT_FAST available for Due and Uno (Issue 303)
|
||||
* I2C support for Arduino Due. 100KHz/400KHz, TWI & TWI1, ACK will be ignored (issue 285)
|
||||
* Unifont update (Issue 297)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
U8GLIB
|
||||
http://code.google.com/p/u8glib/
|
||||
|
||||
|
||||
Install instructions for the Arduino environment.
|
||||
|
||||
1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder
|
||||
1. Start Arduino IDE
|
||||
2. In the Arduino IDE, import the library from the "Add Library" Menu.
|
||||
|
||||
Alternative install instructions for the Arduino environment.
|
||||
|
||||
1. Unzip u8glib_arduino_vX.XX.zip into the "libraries" folder of the
|
||||
Arduino install directory
|
||||
2. Start Arduino IDE
|
||||
|
||||
Install instructions for the Chipkit (Arduino) environment.
|
||||
|
||||
@@ -77,4 +77,3 @@ uint8_t U8GLIB::initRW8Bit(u8g_dev_t *dev, uint8_t d0, uint8_t d1, uint8_t d2, u
|
||||
return u8g_InitRW8Bit(&u8g, dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,10 +57,8 @@ class U8GLIB : public Print
|
||||
protected:
|
||||
uint8_t init8BitFixedPort(u8g_dev_t *dev, uint8_t en, uint8_t cs, uint8_t di, uint8_t rw, uint8_t reset);
|
||||
private:
|
||||
uint8_t 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 = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE);
|
||||
uint8_t 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);
|
||||
uint8_t 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 = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE);
|
||||
uint8_t 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);
|
||||
public:
|
||||
|
||||
/* constructor */
|
||||
@@ -68,17 +66,17 @@ class U8GLIB : public Print
|
||||
{ }
|
||||
U8GLIB(u8g_dev_t *dev)
|
||||
{ prepare(); u8g_Init(&u8g, dev); }
|
||||
U8GLIB(u8g_dev_t *dev, u8g_com_fnptr com_fn)
|
||||
{ prepare(); u8g_InitComFn(&u8g, dev, com_fn); }
|
||||
U8GLIB(u8g_dev_t *dev, uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset)
|
||||
{ initSPI(dev, sck, mosi, cs, a0, reset); }
|
||||
U8GLIB(u8g_dev_t *dev, uint8_t cs, uint8_t a0, uint8_t reset)
|
||||
{ initHWSPI(dev, cs, a0, reset); }
|
||||
U8GLIB(u8g_dev_t *dev, uint8_t options)
|
||||
{ initI2C(dev, options); }
|
||||
U8GLIB(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)
|
||||
U8GLIB(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)
|
||||
{ init8Bit(dev, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, cs2, di, rw, reset); }
|
||||
U8GLIB(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)
|
||||
U8GLIB(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)
|
||||
{ initRW8Bit(dev, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset); }
|
||||
|
||||
uint8_t begin(void) { is_begin = 1; return u8g_Begin(&u8g); }
|
||||
@@ -114,6 +112,11 @@ class U8GLIB : public Print
|
||||
void sleepOff(void) { u8g_SleepOff(&u8g); }
|
||||
|
||||
/* graphic primitives */
|
||||
void setColorEntry(uint8_t color_index, uint8_t r, uint8_t g, uint8_t b) { u8g_SetColorEntry(&u8g, color_index, r, g, b); }
|
||||
void setHiColor(uint16_t rgb) { u8g_SetHiColor(&u8g, rgb); }
|
||||
void setHiColorByRGB(uint8_t r, uint8_t g, uint8_t b) { u8g_SetHiColorByRGB(&u8g, r, g, b); }
|
||||
void setRGB(uint8_t r, uint8_t g, uint8_t b) { u8g_SetRGB(&u8g, r, g, b); }
|
||||
|
||||
void setColorIndex(uint8_t color_index) { u8g_SetColorIndex(&u8g, color_index); }
|
||||
uint8_t getColorIndex(void) { return u8g_GetColorIndex(&u8g); }
|
||||
|
||||
@@ -138,6 +141,14 @@ class U8GLIB : public Print
|
||||
void drawCircle(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawCircle(&u8g, x0, y0, rad, opt); }
|
||||
void drawDisc(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rad, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawDisc(&u8g, x0, y0, rad, opt); }
|
||||
|
||||
void drawEllipse(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rx, u8g_uint_t ry, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawEllipse(&u8g, x0, y0, rx, ry, opt); }
|
||||
void drawFilledEllipse(u8g_uint_t x0, u8g_uint_t y0, u8g_uint_t rx, u8g_uint_t ry, uint8_t opt = U8G_DRAW_ALL) { u8g_DrawFilledEllipse(&u8g, x0, y0, rx, ry, opt); }
|
||||
|
||||
void drawTriangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2)
|
||||
{ u8g_DrawTriangle(&u8g, x0, y0, x1, y1, x2, y2); }
|
||||
|
||||
|
||||
|
||||
/* bitmap handling */
|
||||
void drawBitmap(u8g_uint_t x, u8g_uint_t y, u8g_uint_t cnt, u8g_uint_t h, const uint8_t *bitmap)
|
||||
{ u8g_DrawBitmap(&u8g, x, y, cnt, h, bitmap); }
|
||||
@@ -223,6 +234,17 @@ class U8GLIB_DOGS102 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_DOGS102_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_DOGS102_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1701_dogs102_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_DOGS102_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1701_dogs102_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_MINI12864 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -234,6 +256,17 @@ class U8GLIB_MINI12864 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_MINI12864_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_MINI12864_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1701_mini12864_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_MINI12864_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1701_mini12864_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_DOGM132 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -260,6 +293,14 @@ class U8GLIB_NHD_C12832 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_NHD_C12832_USART : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_NHD_C12832_USART(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_nhd_c12832_hw_usart_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_DOGM128 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -269,6 +310,25 @@ class U8GLIB_DOGM128 : public U8GLIB
|
||||
U8GLIB_DOGM128(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_dogm128_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_DOGM128(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_dogm128_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_DOGM128_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_DOGM128_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_dogm128_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_DOGM128_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_dogm128_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_DOGM128_2X(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_dogm128_2x_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_LM6059 : public U8GLIB
|
||||
@@ -282,6 +342,17 @@ class U8GLIB_LM6059 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_LM6059_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_LM6059_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_lm6059_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_LM6059_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_lm6059_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_LM6063 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -293,6 +364,17 @@ class U8GLIB_LM6063 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_LM6063_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_LM6063_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_lm6063_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_LM6063_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_lm6063_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_64128N : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -302,6 +384,25 @@ class U8GLIB_64128N : public U8GLIB
|
||||
U8GLIB_64128N(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_64128n_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_64128N(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_64128n_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_64128N_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_64128N_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_64128n_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_64128N_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_64128n_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_64128N_2X(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_64128n_2x_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_NHD_C12864 : public U8GLIB
|
||||
@@ -315,6 +416,111 @@ class U8GLIB_NHD_C12864 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_NHD_C12864_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_NHD_C12864_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_nhd_c12864_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_NHD_C12864_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7565_nhd_c12864_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1601_C128032 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1601_C128032(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1601_c128032_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1601_C128032(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1601_c128032_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1601_C128032_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1601_C128032_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1601_c128032_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1601_C128032_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1601_c128032_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1608_240X64 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1608_240X64(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x64_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1608_240X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x64_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1608_240X64_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1608_240X64_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x64_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1608_240X64_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x64_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1608_240X128 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1608_240X128(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x128_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1608_240X128(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x128_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1608_240X128_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1608_240X128_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x128_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1608_240X128_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1608_240x128_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
class U8GLIB_UC1611_DOGM240 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1611_DOGM240(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1611_dogm240_i2c, options)
|
||||
{}
|
||||
U8GLIB_UC1611_DOGM240(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1611_dogm240_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1611_DOGM240(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1611_dogm240_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_UC1611_DOGXL240 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_UC1611_DOGXL240(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1611_dogxl240_i2c, options)
|
||||
{}
|
||||
U8GLIB_UC1611_DOGXL240(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1611_dogxl240_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_UC1611_DOGXL240(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_uc1611_dogxl240_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_ST7920_128X64 : public U8GLIB
|
||||
{
|
||||
@@ -349,6 +555,14 @@ class U8GLIB_ST7920_128X64_1X : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_ST7920_128X64_CUSTOM_1X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_ST7920_128X64_CUSTOM_1X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7920_128x64_custom, sck, mosi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_ST7920_128X64_4X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -364,6 +578,13 @@ class U8GLIB_ST7920_128X64_4X : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_ST7920_128X64_CUSTOM_4X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_ST7920_128X64_CUSTOM_4X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_st7920_128x64_4x_custom, sck, mosi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
class U8GLIB_ST7920_192X32 : public U8GLIB // OBSOLETE, use U8GLIB_ST7920_192X32_1X instead
|
||||
@@ -485,7 +706,7 @@ class U8GLIB_LC7981_240X128 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
// 16 bit mode required: Remove comment from "#define U8G_16BIT 1" in utility/u8g.h
|
||||
// 16 bit mode required: Remove comment from "#define U8G_16BIT 1" in utility/utility/u8g.h
|
||||
class U8GLIB_LC7981_320X64 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -581,6 +802,10 @@ class U8GLIB_NHD31OLED_BW : public U8GLIB
|
||||
U8GLIB_NHD31OLED_BW(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1322_nhd31oled_bw_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_NHD31OLED_BW(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1322_nhd31oled_bw_parallel, d0, d1, d2, d3, d4, d5, d6, d7, U8G_PIN_NONE, cs, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_NHD31OLED_2X_BW : public U8GLIB
|
||||
@@ -603,6 +828,10 @@ class U8GLIB_NHD31OLED_GR : public U8GLIB
|
||||
U8GLIB_NHD31OLED_GR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1322_nhd31oled_gr_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_NHD31OLED_GR(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1322_nhd31oled_gr_parallel, d0, d1, d2, d3, d4, d5, d6, d7, U8G_PIN_NONE, cs, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_NHD31OLED_2X_GR : public U8GLIB
|
||||
@@ -629,7 +858,63 @@ class U8GLIB_SSD1306_128X64 : public U8GLIB
|
||||
U8GLIB_SSD1306_128X64(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x64_i2c, options)
|
||||
{ }
|
||||
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1306_ADAFRUIT_128X64 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1306_ADAFRUIT_128X64(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_adafruit_128x64_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1306_ADAFRUIT_128X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_adafruit_128x64_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1306_ADAFRUIT_128X64(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_adafruit_128x64_i2c, options)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
class U8GLIB_SSD1306_128X64_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1306_128X64_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x64_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1306_128X64_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x64_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1306_128X64_2X(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x64_2x_i2c, options)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SH1106_128X64 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SH1106_128X64(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_sh1106_128x64_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SH1106_128X64(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_sh1106_128x64_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SH1106_128X64(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_sh1106_128x64_i2c, options)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SH1106_128X64_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SH1106_128X64_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_sh1106_128x64_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SH1106_128X64_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_sh1106_128x64_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SH1106_128X64_2X(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_sh1106_128x64_2x_i2c, options)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1309_128X64 : public U8GLIB
|
||||
@@ -644,7 +929,6 @@ class U8GLIB_SSD1309_128X64 : public U8GLIB
|
||||
U8GLIB_SSD1309_128X64(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1309_128x64_i2c, options)
|
||||
{ }
|
||||
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1306_128X32 : public U8GLIB
|
||||
@@ -659,7 +943,20 @@ class U8GLIB_SSD1306_128X32 : public U8GLIB
|
||||
U8GLIB_SSD1306_128X32(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x32_i2c, options)
|
||||
{ }
|
||||
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1306_128X32_2X : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1306_128X32_2X(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x32_2x_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1306_128X32_2X(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x32_2x_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1306_128X32_2X(uint8_t options = U8G_I2C_OPT_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1306_128x32_2x_i2c, options)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@@ -713,12 +1010,43 @@ class U8GLIB_SSD1327_96X96_2X_GR : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
class U8GLIB_LD7032_60x32 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_LD7032_60x32(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ld7032_60x32_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_LD7032_60x32(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ld7032_60x32_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_LD7032_60x32(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 di, uint8_t rw = U8G_PIN_NONE, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ld7032_60x32_parallel, d0, d1, d2, d3, d4, d5, d6, d7, en, cs1, U8G_PIN_NONE, di, rw, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class U8GLIB_HT1632_24X16 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_HT1632_24X16(uint8_t wr, uint8_t data, uint8_t cs)
|
||||
: U8GLIB(&u8g_dev_ht1632_24x16, wr, data, cs, U8G_PIN_NONE, U8G_PIN_NONE)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class U8GLIB_PCF8812 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_PCF8812(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_pcf8812_96x65_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_PCF8812(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_pcf8812_96x65_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_PCD8544 : public U8GLIB
|
||||
@@ -727,6 +1055,9 @@ class U8GLIB_PCD8544 : public U8GLIB
|
||||
U8GLIB_PCD8544(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_pcd8544_84x48_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_PCD8544(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_pcd8544_84x48_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_TLS8204_84X48 : public U8GLIB
|
||||
@@ -764,6 +1095,15 @@ class U8GLIB_T6963_240X128 : public U8GLIB
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_T6963_128X128 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_T6963_128X128(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 = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_t6963_128x128_8bit, d0, d1, d2, d3, d4, d5, d6, d7, cs, a0, wr, rd, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_T6963_240X64 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
@@ -808,6 +1148,108 @@ class U8GLIB_ILI9325D_320x240 : public U8GLIB
|
||||
{ init8BitFixedPort(&u8g_dev_ili9325d_320x240_8bit, en, cs1, di, rw, reset); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class U8GLIB_SSD1351_128X128_332 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_332_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_332_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128_4X_332 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128_4X_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_4x_332_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128_4X_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_4x_332_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128GH_332 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128GH_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_332_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128GH_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_332_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128GH_4X_332 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128GH_4X_332(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_332_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128GH_4X_332(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_332_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128_IDX : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128_IDX(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_idx_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128_IDX(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_idx_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128_HICOLOR : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_hicolor_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_hicolor_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128_4X_HICOLOR : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128_4X_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_4x_hicolor_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128_4X_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128_4x_hicolor_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128GH_HICOLOR : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128GH_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_hicolor_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128GH_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_hicolor_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
class U8GLIB_SSD1351_128X128GH_4X_HICOLOR : public U8GLIB
|
||||
{
|
||||
public:
|
||||
U8GLIB_SSD1351_128X128GH_4X_HICOLOR(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_hicolor_sw_spi, sck, mosi, cs, a0, reset)
|
||||
{ }
|
||||
U8GLIB_SSD1351_128X128GH_4X_HICOLOR(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE)
|
||||
: U8GLIB(&u8g_dev_ssd1351_128x128gh_4x_hicolor_hw_spi, cs, a0, reset)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
class U8GLIB_FLIPDISC_2X7 : public U8GLIB
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
|
||||
A2Printer.pde
|
||||
|
||||
Special example code for the A2 Mciro Printer (https://www.sparkfun.com/products/10438)
|
||||
|
||||
|
||||
Universal 8bit Graphics Library, http://code.google.com/p/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);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
const uint8_t rook_bitmap[] PROGMEM = {
|
||||
0x00, // 00000000
|
||||
@@ -43,8 +43,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -53,9 +53,10 @@
|
||||
//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); // 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
|
||||
@@ -85,19 +86,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
|
||||
// DOGS102 shield configuration values
|
||||
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
|
||||
Color.pde
|
||||
|
||||
"Hello World!" example code with color.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, http://code.google.com/p/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: http://code.google.com/p/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) {
|
||||
|
||||
if ( u8g.getMode() == U8G_MODE_HICOLOR || u8g.getMode() == U8G_MODE_R3G3B2) {
|
||||
/* draw background (area is 128x128) */
|
||||
u8g_uint_t r, g, b;
|
||||
for( b = 0; b < 4; b++ )
|
||||
{
|
||||
for( g = 0; g < 32; g++ )
|
||||
{
|
||||
for( r = 0; r < 32; r++ )
|
||||
{
|
||||
u8g.setRGB(r<<3, g<<3, b<<4 );
|
||||
u8g.drawPixel(g + b*32, r);
|
||||
u8g.setRGB(r<<3, g<<3, (b<<4)+64 );
|
||||
u8g.drawPixel(g + b*32, r+32);
|
||||
u8g.setRGB(r<<3, g<<3, (b<<4)+128 );
|
||||
u8g.drawPixel(g + b*32, r+32+32);
|
||||
u8g.setRGB(r<<3, g<<3, (b<<4)+128+64 );
|
||||
u8g.drawPixel(g + b*32, r+32+32+32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
u8g.setFont(u8g_font_unifont);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
// picture loop
|
||||
u8g.firstPage();
|
||||
do {
|
||||
draw();
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(500);
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
|
||||
// setup input buffer
|
||||
@@ -44,8 +44,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -54,9 +54,10 @@
|
||||
//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); // 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
|
||||
@@ -86,19 +87,54 @@
|
||||
//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); // 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); // 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
|
||||
@@ -0,0 +1,398 @@
|
||||
/*
|
||||
|
||||
FPS.pde
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, http://code.google.com/p/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: http://code.google.com/p/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)
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -51,9 +51,10 @@
|
||||
//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); // 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
|
||||
@@ -83,19 +84,54 @@
|
||||
//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); // 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); // 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 u8g_prepare(void) {
|
||||
u8g.setFont(u8g_font_6x10);
|
||||
@@ -143,6 +179,15 @@ void u8g_line(uint8_t a) {
|
||||
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;
|
||||
@@ -167,6 +212,45 @@ void u8g_ascii_2() {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -178,8 +262,10 @@ void draw(void) {
|
||||
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_ascii_1(); break;
|
||||
case 6: u8g_ascii_2(); 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,15 +274,6 @@ void setup(void) {
|
||||
// flip screen, if required
|
||||
//u8g.setRot180();
|
||||
|
||||
// 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
|
||||
|
||||
//u8g.setContrast(0x30);
|
||||
|
||||
pinMode(13, OUTPUT);
|
||||
digitalWrite(13, HIGH);
|
||||
@@ -212,11 +289,11 @@ void loop(void) {
|
||||
|
||||
// increase the state
|
||||
draw_state++;
|
||||
if ( draw_state >= 7*8 )
|
||||
if ( draw_state >= 9*8 )
|
||||
draw_state = 0;
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(150);
|
||||
//delay(150);
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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) {
|
||||
@@ -107,7 +143,6 @@ void draw(void) {
|
||||
}
|
||||
|
||||
void setup(void) {
|
||||
|
||||
// flip screen, if required
|
||||
// u8g.setRot180();
|
||||
|
||||
@@ -115,12 +150,18 @@ void setup(void) {
|
||||
//u8g.setHardwareBackup(u8g_backup_avr_spi);
|
||||
|
||||
// assign default color value
|
||||
if ( u8g.getMode() == U8G_MODE_R3G3B2 )
|
||||
if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
|
||||
u8g.setColorIndex(255); // white
|
||||
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT )
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
|
||||
u8g.setColorIndex(3); // max intensity
|
||||
else if ( u8g.getMode() == U8G_MODE_BW )
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_BW ) {
|
||||
u8g.setColorIndex(1); // pixel on
|
||||
}
|
||||
else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
|
||||
u8g.setHiColorByRGB(255,255,255);
|
||||
}
|
||||
}
|
||||
|
||||
void loop(void) {
|
||||
@@ -131,6 +172,6 @@ void loop(void) {
|
||||
} while( u8g.nextPage() );
|
||||
|
||||
// rebuild the picture after some delay
|
||||
delay(500);
|
||||
delay(50);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// 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: http://code.google.com/p/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
|
||||
@@ -53,9 +56,10 @@
|
||||
//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); // 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
|
||||
@@ -85,19 +89,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
|
||||
#define KEY_NONE 0
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
HelloWorld.pde
|
||||
Rotation.pde
|
||||
|
||||
"Hello World!" example code.
|
||||
Example code for RotXXX functions.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
uint8_t offset = 0;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
HelloWorld.pde
|
||||
Scale.pde
|
||||
|
||||
"Hello World!" example code.
|
||||
Example code for the 2x2 scale function.
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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) {
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
// graphic commands to redraw the complete screen should be placed here
|
||||
void draw(void) {
|
||||
@@ -0,0 +1,348 @@
|
||||
/*
|
||||
|
||||
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, http://code.google.com/p/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: http://code.google.com/p/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)
|
||||
|
||||
//================================================================
|
||||
// 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() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
|
||||
Touch4WTest.pde
|
||||
|
||||
>>> Before compiling: Please remove comment from the constructor of the
|
||||
>>> connected graphics display (see below).
|
||||
|
||||
Universal 8bit Graphics Library, http://code.google.com/p/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: http://code.google.com/p/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)
|
||||
|
||||
//================================================================
|
||||
// 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() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,20 +85,56 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
//#define MINI_LOGO
|
||||
|
||||
void drawColorBox(void)
|
||||
{
|
||||
@@ -117,19 +154,32 @@ void drawColorBox(void)
|
||||
|
||||
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);
|
||||
#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 )
|
||||
{
|
||||
@@ -140,6 +190,7 @@ void drawURL(void)
|
||||
{
|
||||
u8g.drawStr(1,54,"code.google.com/p/u8glib");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#include "U8glib.h"
|
||||
|
||||
// setup u8g object, please remove comment from one of the following constructor calls
|
||||
// IMPORTANT NOTE: The complete list of supported devices is here: http://code.google.com/p/u8glib/wiki/device
|
||||
|
||||
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported
|
||||
// devices with all constructor calls is here: http://code.google.com/p/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
|
||||
@@ -52,9 +52,10 @@
|
||||
//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); // 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
|
||||
@@ -84,19 +85,54 @@
|
||||
//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); // 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); // 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)
|
||||
|
||||
#define u8g_logo_width 38
|
||||
#define u8g_logo_height 24
|
||||
@@ -78,3 +78,4 @@ 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.
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
- Castling: Need to check for fields under attack
|
||||
--> done
|
||||
|
||||
- Check for WIN / LOSE situation, perhaps call ce_Eval() once on the top-level board setup
|
||||
- Check for WIN / LOOSE situation, perhaps call ce_Eval() once on the top-level board setup
|
||||
just after the real move
|
||||
- cleanup cu_Move
|
||||
--> almost done
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user