Compare commits
685 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b788ce25f5 | |||
| 1a9a5b82a8 | |||
| cb9f103421 | |||
| 9479cd9ce7 | |||
| 477b70eccf | |||
| b2dd2dc217 | |||
| b106f59eb4 | |||
| 38f483c4a6 | |||
| f4eafed188 | |||
| 5987a5464b | |||
| 3a888e956b | |||
| 4cddc61eda | |||
| c7de99b141 | |||
| 9ad55840bb | |||
| 81011a71b1 | |||
| 2a8c00bdeb | |||
| 4ae2a76492 | |||
| a5d097abe6 | |||
| 5e0a8d2124 | |||
| 994aa9f692 | |||
| 6e67ad51b7 | |||
| 52693f72af | |||
| 991f433ac1 | |||
| 54b7da18cb | |||
| f8771e9ad5 | |||
| be1dee7caf | |||
| 68b7802fc1 | |||
| 6d407767e7 | |||
| 4a9e102c2e | |||
| 1ac6428c82 | |||
| 7c159a20e5 | |||
| 5b74e25108 | |||
| f02fa6339f | |||
| 832e1ca0e7 | |||
| 3b6f1bff8b | |||
| 1d615717e8 | |||
| 99c570212d | |||
| 13e82fa44a | |||
| 95878df30d | |||
| 5d1ede08aa | |||
| 2203505182 | |||
| 06dc7f4f52 | |||
| e6f1b074df | |||
| f605c045e3 | |||
| 2d97f082e5 | |||
| ba91fa09b7 | |||
| 1aeee2cd1f | |||
| 4e23e52a89 | |||
| 88cf3cb1e0 | |||
| 59d26e463a | |||
| cc641d796d | |||
| 9d324f7b1f | |||
| 654e7a84ff | |||
| d903a5ef43 | |||
| 15f26b4021 | |||
| 10d80eb894 | |||
| 858954baad | |||
| 3840663410 | |||
| bd36644d85 | |||
| c485f513d7 | |||
| 06b9e40042 | |||
| 7603023928 | |||
| dbf81f40de | |||
| bb557e5195 | |||
| 89fdfcfaf9 | |||
| d9a388bab8 | |||
| b44e68e2ab | |||
| 0f09554929 | |||
| 18b0dbb501 | |||
| fa8d2bd108 | |||
| d1ebaba71d | |||
| 71e0275a4c | |||
| 205b0a679e | |||
| 3029a6b1aa | |||
| 342048b1df | |||
| ec060f979f | |||
| 56ac5d03ed | |||
| ec7ab5a277 | |||
| 2c5468ce33 | |||
| dbdb2ecdf7 | |||
| c18294d83c | |||
| 401ba6613b | |||
| 19617b79db | |||
| eeacf76cfd | |||
| 738584d342 | |||
| f69effd2eb | |||
| 67d7562609 | |||
| 0ede16cd5a | |||
| 4a89ef6273 | |||
| 145ab7b1ec | |||
| 3f9c2f89fc | |||
| 00298e6681 | |||
| 68ab7f6bb7 | |||
| 7ab63cde62 | |||
| b90133813a | |||
| 75da3555ee | |||
| 8bce9dec90 | |||
| fef74398e4 | |||
| 775c6bb20e | |||
| 06710e54de | |||
| 81cfa23882 | |||
| f3fd9e28f5 | |||
| b94a335493 | |||
| 01aa87c307 | |||
| 473817f2f4 | |||
| a1c3a2b03a | |||
| bdfe4a108c | |||
| 10fe229aad | |||
| dfec58e5dc | |||
| 6c04cf40f4 | |||
| fe7203ee55 | |||
| 483b8dcc05 | |||
| a41e16ffee | |||
| 425af4240b | |||
| 4a4c1db606 | |||
| 2b1375c8ea | |||
| 065440891b | |||
| d58168a03f | |||
| 8cf936ccb1 | |||
| d5d45e85e4 | |||
| 0d4f41fb6d | |||
| 1c1c473910 | |||
| dde878db04 | |||
| 1a42c38e0e | |||
| e695c473af | |||
| bd6eb83250 | |||
| c484228c56 | |||
| f265fb5943 | |||
| b17d3d3e9c | |||
| c53844ff91 | |||
| e393c7fa0e | |||
| b55678a7d0 | |||
| fe8266b591 | |||
| 3d8e3c3c9a | |||
| 61349dc6d3 | |||
| 95821b07b1 | |||
| d62ee95d28 | |||
| b962014087 | |||
| 921198e81c | |||
| 3457952854 | |||
| f4228cc4c1 | |||
| dabcd65903 | |||
| 8fa4f5a40f | |||
| b95aa36b01 | |||
| 7a96a082b7 | |||
| b78f0012e9 | |||
| e958b6da9e | |||
| 86338ca835 | |||
| 8a110b80bf | |||
| 9a12f06f19 | |||
| 7d334775d0 | |||
| 0a86a5f39c | |||
| e7cf0e12ea | |||
| e41df97c42 | |||
| 20a26d5053 | |||
| 924d7769ec | |||
| 8ff937c7d8 | |||
| ae695e8309 | |||
| e98e307d17 | |||
| bd872a7a98 | |||
| fd3de02a37 | |||
| 1bee537a09 | |||
| ded942a4e4 | |||
| bf61e52390 | |||
| 2d9262cc5a | |||
| 993cc9463e | |||
| c2376d62e2 | |||
| f3473495d0 | |||
| c5b267162c | |||
| 8322848c35 | |||
| 61cb98dc0f | |||
| 2b1666fcb0 | |||
| 6ae2cde663 | |||
| cc8f7c83da | |||
| 20445b8e83 | |||
| 12881d5576 | |||
| b88cb86069 | |||
| 3d3be15665 | |||
| 0142783836 | |||
| 006768ab58 | |||
| 376673df28 | |||
| f830756356 | |||
| 1fceb7c580 | |||
| 5287cfbb59 | |||
| f345f60f73 | |||
| e2c8015199 | |||
| aed577271f | |||
| f50ca52c57 | |||
| 36e66bdd9f | |||
| 19869d3a7d | |||
| c8118c3a58 | |||
| 7fe07dc4ce | |||
| 3e8a5b6151 | |||
| 28bc19720a | |||
| a8cb89b3da | |||
| df2251e23e | |||
| 31154278b3 | |||
| 613b4105a2 | |||
| 10e06e1970 | |||
| c751dcfcf9 | |||
| 178938d957 | |||
| a8313c3b7e | |||
| dc26531207 | |||
| c74e6ad868 | |||
| a62eec4ae3 | |||
| 235ad4dd9d | |||
| d06923d0e7 | |||
| 7f59b65fc8 | |||
| 884a3249fe | |||
| d159ec5c90 | |||
| 7c43f4e696 | |||
| 7c8ea8e0e0 | |||
| 573eae8d95 | |||
| bf0acc9611 | |||
| ddc310fc4b | |||
| 10782c770d | |||
| b2758208c7 | |||
| bf5612c0ed | |||
| 83bdfeb5cb | |||
| 9a6c2635ee | |||
| 3341683db2 | |||
| 0bdbf52bc6 | |||
| e4e85e39b3 | |||
| 0621594442 | |||
| dba613fadd | |||
| 5ac4ebad78 | |||
| cb044d989c | |||
| 0d42196d11 | |||
| cac742009c | |||
| 76f938309e | |||
| 24cf29b6a8 | |||
| 41a6f2bc8d | |||
| e0767f8675 | |||
| 5523c12cfd | |||
| a6c8afc5a9 | |||
| cb8df74a9c | |||
| 050439ccba | |||
| 6907df0bd6 | |||
| 5a259a7266 | |||
| b082f1a2b8 | |||
| c666b492c4 | |||
| aa0671fb32 | |||
| f82d0109e4 | |||
| 2a88e76002 | |||
| b25f523aca | |||
| 046439a5a1 | |||
| bcd07c2c91 | |||
| e9b04ada1d | |||
| ff5eb5de29 | |||
| fd62c42faa | |||
| 089d075c8f | |||
| 45a6e9614e | |||
| 9e6d0ea610 | |||
| c345087b41 | |||
| 8de007021a | |||
| f72588595b | |||
| 797ea5efa7 | |||
| 156e7c1c54 | |||
| b8b1aa345c | |||
| b0ece8f8df | |||
| 4b0b00c8da | |||
| 6d3122d4e8 | |||
| 0f27e38eb9 | |||
| 6156050024 | |||
| cacbe005b5 | |||
| caca5636ce | |||
| 6a35ab6557 | |||
| 87de4c134b | |||
| 7944628400 | |||
| 251a84b741 | |||
| d695e5f7bc | |||
| 4744997c16 | |||
| 5bd39ba73f | |||
| 7f887f2342 | |||
| e7e77d9612 | |||
| a7a3abb9bf | |||
| 6f68da5be4 | |||
| e9b9d634c4 | |||
| 6d301a282e | |||
| 61591fd233 | |||
| e97d82f77b | |||
| b58d5dabf8 | |||
| 047bce0cdd | |||
| c81e217334 | |||
| 9cd341c2c3 | |||
| f0ad1e9b70 | |||
| 414b1f8327 | |||
| e68320ee2b | |||
| 7fa643a11e | |||
| 375e724dee | |||
| 6c0f4bbafd | |||
| 4cab75115f | |||
| 014609ad87 | |||
| f7a3172c20 | |||
| b799f7d1f3 | |||
| f3851408fe | |||
| 03cf2b577b | |||
| b3b6f23320 | |||
| 821ba43131 | |||
| 31bf73b89b | |||
| 229ea71421 | |||
| f085e2ca93 | |||
| db98f06110 | |||
| bbb5aacc48 | |||
| 91ab18d1d2 | |||
| 273cbc6871 | |||
| 596d1ff104 | |||
| 896492442c | |||
| b9e58cd3ea | |||
| d961dbae8d | |||
| be031e1850 | |||
| 15dfbabc9c | |||
| 102de7dac3 | |||
| 7338a2fec8 | |||
| d56136f06c | |||
| 34a0c9d143 | |||
| 11f98adcce | |||
| 209fadd2e6 | |||
| 8fa6a4da2e | |||
| 4613f85bb7 | |||
| e1121a4cd0 | |||
| 20fec98f70 | |||
| adfc787a45 | |||
| 86be9a85d0 | |||
| f6de698fc8 | |||
| edc7379546 | |||
| ab8af7fa9c | |||
| fb74caebb5 | |||
| 88cdf487b4 | |||
| be91eaed2c | |||
| b5a08c2518 | |||
| b02ea02dbb | |||
| d69ce77503 | |||
| d1803ec044 | |||
| f2665e597f | |||
| db5ead4230 | |||
| f7d5188b2f | |||
| 1d17c34e12 | |||
| 49ead19d00 | |||
| 7e7dcb8692 | |||
| cf50240e82 | |||
| 79f6d9bdac | |||
| 6af6060aa0 | |||
| 2bac7835e8 | |||
| fd41757aef | |||
| f338f65bdf | |||
| 867f5e9069 | |||
| 88f5e2c639 | |||
| ca0209b868 | |||
| 4f691e622f | |||
| fecadaca82 | |||
| 709def5e7b | |||
| a5e4b4bd7d | |||
| a817794444 | |||
| ffef8f1b29 | |||
| 205a679959 | |||
| b956001d81 | |||
| 1dd3c9e73f | |||
| 8d74a63e4b | |||
| 27fd97a8bb | |||
| 4d89db5209 | |||
| f66323ecfb | |||
| 863198a73f | |||
| ad112b4d3d | |||
| c088081c00 | |||
| 06d46a0ef9 | |||
| 27e68a61fa | |||
| 4e31fa66e2 | |||
| 2cc52318e3 | |||
| d602fb9421 | |||
| 8c1e4b5250 | |||
| d2a5d2d220 | |||
| 9ff3500dda | |||
| 30e5554171 | |||
| 190204e6b8 | |||
| 9d4aff6eab | |||
| d74ecde544 | |||
| ad4cf3e332 | |||
| 701ab0db8e | |||
| b3f2f44124 | |||
| a03ee01cee | |||
| 9bb87da816 | |||
| 5fbb7cbe6a | |||
| 8af96b8cdd | |||
| 5cdc4527d3 | |||
| 0206af6c07 | |||
| fb5dd40949 | |||
| 9c1366ed99 | |||
| e7c505d415 | |||
| e304aa9da7 | |||
| c1775c9005 | |||
| dbd9321380 | |||
| 7f6622e6ac | |||
| 04ffe9493b | |||
| 6c39286626 | |||
| 86b9e7ee13 | |||
| 6566031ec6 | |||
| e7a6c77d74 | |||
| 2436e2463c | |||
| 9fffe26c20 | |||
| 3ab1c95ab3 | |||
| 7f32519aa9 | |||
| ff91016e81 | |||
| 4615345773 | |||
| 25ff9813c6 | |||
| 8ba8ae85c4 | |||
| dc1cd03897 | |||
| 304ca54aba | |||
| e175f3f729 | |||
| 641fc9c833 | |||
| 6e2597593a | |||
| c29a949a13 | |||
| 26268313c4 | |||
| da8412db6a | |||
| 9bf6c900c4 | |||
| aa6e7b0300 | |||
| 0663c5a372 | |||
| ad42498dfb | |||
| 662d03896b | |||
| 8b09d27cd9 | |||
| d7c8cf3a9e | |||
| c9ae761066 | |||
| 7bed426de3 | |||
| 048de70ee6 | |||
| 6049f226bc | |||
| c02083677a | |||
| 64ed7aff53 | |||
| a694291420 | |||
| d1eb100806 | |||
| 1d3c53ae2f | |||
| 97d5da4c11 | |||
| 359e0641c4 | |||
| 2c4e4edade | |||
| c6ae6c53a8 | |||
| c596e9f3f0 | |||
| 37ebee1cef | |||
| 76cbaeeb2e | |||
| 79b8ad13f1 | |||
| d0a8bc29be | |||
| 10901d9092 | |||
| dddc232294 | |||
| 1419f2637e | |||
| 91b08d2deb | |||
| 2f3af1c9da | |||
| 2d6a5201cf | |||
| a390a348d0 | |||
| b3a732b43a | |||
| bb6d74383e | |||
| 9e8b2121dd | |||
| af91b4d29f | |||
| 609325a8b4 | |||
| 3bd861bf19 | |||
| ed3de53587 | |||
| 82eddcd6e7 | |||
| 3929349c1b | |||
| e095f94f9f | |||
| 9127ec6bd7 | |||
| 7a9d26d1a0 | |||
| af0b517e8f | |||
| aeb062b33e | |||
| 15fe76dd6a | |||
| 7265db1b36 | |||
| c5104c1d2b | |||
| 8b91d1d255 | |||
| 9518cb0f2e | |||
| c2bd4928a5 | |||
| 7120df3b85 | |||
| f25156971b | |||
| 650ca3baa6 | |||
| 3ceb4a5c46 | |||
| 8511d9e781 | |||
| 7aa6d3ef09 | |||
| f7fdbb4eb3 | |||
| 7d0cd9ccf5 | |||
| ead8d29316 | |||
| 58a6d42db6 | |||
| 50833c9836 | |||
| 5d704b8494 | |||
| 3621a0a3f6 | |||
| 10b9e5ca34 | |||
| bcef7ad91b | |||
| 1666980b5b | |||
| 58a6d1b8d4 | |||
| 2151f4c50b | |||
| ee7e532761 | |||
| 4a7665a1e9 | |||
| 1e4d50b6e8 | |||
| 3ae543dd30 | |||
| 041959f903 | |||
| df922ed7c8 | |||
| 41534e78f8 | |||
| fabdb6a51e | |||
| fac1a75596 | |||
| bd5ded15e7 | |||
| 530e807bcd | |||
| 251a0268c4 | |||
| 4fdded0e2d | |||
| f4e26c785f | |||
| 9100ed15fa | |||
| dc82db35d4 | |||
| 610fb6fd35 | |||
| 594882f7a9 | |||
| 4e160fea16 | |||
| 99d5ad3b09 | |||
| a9f6080931 | |||
| 1b0301c89f | |||
| 94798e4465 | |||
| 65b59a6646 | |||
| 09f5b5d00a | |||
| 3487cbad21 | |||
| da8e07b697 | |||
| 402a13a980 | |||
| 56f7a03a5c | |||
| 3113388293 | |||
| eecfc0479a | |||
| 9984643e4c | |||
| 58114b32ba | |||
| 50a6fb637f | |||
| d71b12cd8b | |||
| 42842f71e0 | |||
| 5213de4eaa | |||
| 602c9fffe0 | |||
| 4d73906008 | |||
| 0da50d80ef | |||
| f0bbc163c6 | |||
| 78aec86650 | |||
| 6bd2a602ca | |||
| 6b923de48d | |||
| a645efd189 | |||
| a717a3eacb | |||
| da03b84eff | |||
| aa6d23c7cb | |||
| 2a1826f1ed | |||
| 8e79ea09e4 | |||
| e29dbb946e | |||
| b1f8fa881d | |||
| c2a2d04b50 | |||
| 84d0a5ebd1 | |||
| 6ed5c22d7c | |||
| 07246fdc30 | |||
| 14899ca3f7 | |||
| 2d0972d35d | |||
| c43828b2e3 | |||
| bc13685c46 | |||
| 14d374dc2b | |||
| 5dc45f2ceb | |||
| 8ed81063a2 | |||
| cb92d78a46 | |||
| d94a20e63a | |||
| b2ff518c27 | |||
| 4c1d5e8fcf | |||
| e13d6ba012 | |||
| ec08edd240 | |||
| 1c890a9da0 | |||
| e070ce987f | |||
| 45b75301a8 | |||
| 491cfc6ae0 | |||
| d42b24369f | |||
| 8280cfef43 | |||
| 785da0db6c | |||
| eaad3c451c | |||
| fd751bd3fe | |||
| 0785d312f7 | |||
| 5dc96c7324 | |||
| 2532ef1049 | |||
| dd2d4df3dc | |||
| a583d8998f | |||
| 953cf6f7d6 | |||
| fcd4fa4ab7 | |||
| 123a2b28fc | |||
| 28261437f8 | |||
| c0a48e4fe2 | |||
| 5b2353a2ab | |||
| cafd4ff6a6 | |||
| f98aff039c | |||
| 5e93e09c1a | |||
| ca5c5fdd40 | |||
| 71c1b8ca6d | |||
| e5c2fbd6ac | |||
| 3618b9c7be | |||
| 7ab7cfc96d | |||
| 92db4f2d84 | |||
| e2ce5865c9 | |||
| 6815edf8d6 | |||
| f8ff1c8d6a | |||
| 6ab5745875 | |||
| 8bb6a9b44a | |||
| 52ec2a266f | |||
| 33f6219f06 | |||
| dd6153f317 | |||
| 05af0cbb55 | |||
| ff39019034 | |||
| a5eefa9ffa | |||
| 109e8f88ce | |||
| 00413994dd | |||
| 8e39965b2d | |||
| 87f6e91f51 | |||
| 0cb0df6bee | |||
| 80e2ab6ed6 | |||
| e406791b6f | |||
| 438eb8ebb3 | |||
| 206b5ab014 | |||
| 2ab7fa652c | |||
| 87d1df38de | |||
| c392cb6d9d | |||
| 7ae0805095 | |||
| a2f86e84a4 | |||
| b8a2160f82 | |||
| 99d49108c1 | |||
| e6671b3065 | |||
| df82a0e497 | |||
| 1832269181 | |||
| 8341f282ee | |||
| 4fdf747445 | |||
| 61b6a0ea9f | |||
| 5006ca07be | |||
| 8579af67a2 | |||
| 8f49610d3a | |||
| 8fd08ba1f8 | |||
| c0c4f77c36 | |||
| b6cbad224b | |||
| c765c7484c | |||
| 3242d3dca2 | |||
| 58f774e98d | |||
| 79ff336b2b | |||
| 0d367432e6 | |||
| 959919bcfe | |||
| 4f7289e022 | |||
| af8be03165 | |||
| 88ce2c94f8 | |||
| 0a52d5c032 | |||
| 38286d9805 | |||
| 0ece75536c | |||
| 4b377bb032 | |||
| 0392a56193 | |||
| 58654b3664 | |||
| 8b324e08d9 | |||
| 1bf3881adc | |||
| e2c1ca3bca | |||
| 234b15a12c | |||
| 80a0c3b028 | |||
| e73644f3fe | |||
| 9a6d6a4405 | |||
| 777abb71b5 | |||
| ac4ffdb4e5 | |||
| 691a297b6a | |||
| bec97532ee | |||
| 406cd0cc83 | |||
| 62af625be4 | |||
| 26917ebf96 | |||
| 3d8bfb036d | |||
| a0f0af5da8 | |||
| 27c99f74ad | |||
| 050cef7b48 | |||
| 5d74ace99f | |||
| 3130fd9532 | |||
| f0c531abb6 | |||
| ce2874b732 | |||
| a55cef1165 | |||
| 682b0b440d | |||
| 7025912957 | |||
| bb6b23891c | |||
| 1b211947b8 | |||
| ea15d3edab | |||
| 47c6f8a98b | |||
| ccb2c3bb85 | |||
| e74b9776e5 | |||
| e61bbe1499 | |||
| ffd7062e21 | |||
| 7255ca0bc6 | |||
| f7c56bc5e4 | |||
| e4c973487b | |||
| d4ab268bbf | |||
| b4dbf606b7 | |||
| f6a1d772c2 | |||
| ae208fa92f | |||
| f11d496899 | |||
| a3d0fe53cf | |||
| 395d11b06f | |||
| e79b328103 | |||
| 1c19d9a86a | |||
| 6043f88b35 | |||
| 2087e6fbcf | |||
| c67086bdba | |||
| 24e6dbcf48 |
+8
-2
@@ -1,12 +1,14 @@
|
||||
# editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{*.patch,syntax_test_*}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{*.c,*.cpp,*.h,*.ino,*.py,Makefile}]
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
|
||||
[{*.c,*.cpp,*.h,*.ino}]
|
||||
@@ -18,6 +20,10 @@ indent_size = 2
|
||||
indent_style = tab
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
# Two spaces at the end of the line means newline in Markdown
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{*.py}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
name: 🪲 Report a bug
|
||||
description: Create a bug report to help improve Marlin Firmware
|
||||
title: "[BUG] (bug summary)"
|
||||
labels: ["Bug: Potential ?"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
@@ -109,8 +110,13 @@ body:
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Add-ons
|
||||
description: Please list any hardware add-ons that could be involved.
|
||||
label: LCD/Controller
|
||||
description: Some Marlin behaviors are determined by the controller. Describe your LCD/Controller model and version.
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Other add-ons
|
||||
description: Please list any other hardware add-ons that could be involved.
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: ✨ Request a feature
|
||||
description: Request a new Marlin Firmware feature
|
||||
title: "[FR] (feature summary)"
|
||||
labels: 'T: Feature Request'
|
||||
labels: ["T: Feature Request"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
||||
@@ -28,15 +28,9 @@ Project maintainers are responsible for clarifying the standards of acceptable b
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [marlinfirmware@github.com](mailto:marlinfirmware@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by following GitHub's [reporting abuse or spam article](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
|
||||
|
||||
## Attribution
|
||||
|
||||
|
||||
@@ -26,11 +26,12 @@ The following is a set of guidelines for contributing to Marlin, hosted by the [
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project and everyone participating in it is governed by the [Marlin Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [marlinfirmware@github.com](mailto:marlinfirmware@github.com).
|
||||
This project and everyone participating in it is governed by the [Marlin Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior by following GitHub's [reporting abuse or spam article](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam).
|
||||
|
||||
## I don't want to read this whole thing I just have a question!!!
|
||||
|
||||
> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below.
|
||||
> [!NOTE]
|
||||
> Please don't file an issue to ask a question. You'll get faster results by using the resources below.
|
||||
|
||||
We have a Message Board and a Facebook group where our knowledgable user community can provide helpful advice if you have questions.
|
||||
|
||||
@@ -55,7 +56,8 @@ This section guides you through submitting a Bug Report for Marlin. Following th
|
||||
|
||||
Before creating a Bug Report, please test the "nightly" development branch, as you might find out that you don't need to create one. When you are creating a Bug Report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE/bug_report.yml), the information it asks for helps us resolve issues faster.
|
||||
|
||||
> **Note:** Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888.
|
||||
> [!NOTE]
|
||||
> Regressions can happen. If you find a **Closed** issue that seems like your issue, go ahead and open a new issue and include a link to the original issue in the body of your new one. All you need to create a link is the issue number, preceded by #. For example, #8888.
|
||||
|
||||
#### How Do I Submit A (Good) Bug Report?
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# auto-label.yml
|
||||
# - Find all open issues without a label and a title containing "[BUG]".
|
||||
# - Apply the label "Bug: Potential ?" to these issues.
|
||||
#
|
||||
|
||||
name: Label Old Bugs
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 8 * * *"
|
||||
|
||||
jobs:
|
||||
autolabel:
|
||||
name: Auto Label
|
||||
if: github.repository == 'MarlinFirmware/Marlin'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Auto Label for [BUG]
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
// Get all open issues in this repository
|
||||
const issueList = await github.rest.issues.listForRepo({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open'
|
||||
});
|
||||
// Filter issues without labels that have a title containing '[BUG]'.
|
||||
const matchingIssues = issueList.data.filter(
|
||||
issue => issue.title.includes('[BUG]') && issue.labels.length === 0
|
||||
);
|
||||
// Process the first 50
|
||||
for (const issue of matchingIssues.slice(0, 50)) {
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue.number,
|
||||
labels: ['Bug: Potential ?']
|
||||
});
|
||||
}
|
||||
@@ -12,7 +12,6 @@ on:
|
||||
- 1.0.x
|
||||
- 1.1.x
|
||||
- 2.0.x
|
||||
- 2.1.x
|
||||
|
||||
jobs:
|
||||
bad_target:
|
||||
|
||||
@@ -23,6 +23,7 @@ jobs:
|
||||
- "S: Please Merge"
|
||||
- "S: Please Test"
|
||||
- "help wanted"
|
||||
- "Bug: Potential ?"
|
||||
- "Needs: Discussion"
|
||||
- "Needs: Documentation"
|
||||
- "Needs: More Data"
|
||||
|
||||
@@ -17,12 +17,24 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
- uses: actions/stale@v8
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.'
|
||||
days-before-stale: 60
|
||||
days-before-close: 10
|
||||
stale-issue-message: |
|
||||
Greetings from the Marlin AutoBot!
|
||||
This issue has had no activity for the last 90 days.
|
||||
Do you still see this issue with the latest `bugfix-2.1.x` code?
|
||||
Please add a reply within 14 days or this issue will be automatically closed.
|
||||
To keep a confirmed issue open we can also add a "Bug: Confirmed" tag.
|
||||
|
||||
Disclaimer: This is an open community project with lots of activity and limited
|
||||
resources. The main project contributors will do a bug sweep ahead of the next
|
||||
release, but any skilled member of the community may jump in at any time to fix
|
||||
this issue. That can take a while depending on our busy lives so please be patient,
|
||||
and take advantage of other resources such as the MarlinFirmware Discord to help
|
||||
solve the issue.
|
||||
days-before-stale: 90
|
||||
days-before-close: 14
|
||||
stale-issue-label: 'stale-closing-soon'
|
||||
exempt-all-assignees: true
|
||||
exempt-issue-labels: 'Bug: Confirmed !,T: Feature Request,Needs: More Data,Needs: Discussion,Needs: Documentation,Needs: Patch,Needs: Work,Needs: Testing,help wanted,no-locking'
|
||||
|
||||
@@ -9,6 +9,7 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- bugfix-2.1.x
|
||||
- 2.1.x
|
||||
paths-ignore:
|
||||
- config/**
|
||||
- data/**
|
||||
@@ -17,6 +18,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- bugfix-2.1.x
|
||||
- 2.1.x
|
||||
paths-ignore:
|
||||
- config/**
|
||||
- data/**
|
||||
@@ -118,6 +120,7 @@ jobs:
|
||||
|
||||
# STM32H7
|
||||
- BTT_SKR_SE_BX
|
||||
- STM32H743VI_btt
|
||||
|
||||
# STM32F1 (Maple)
|
||||
- jgaurora_a5s_a1_maple
|
||||
@@ -133,6 +136,12 @@ jobs:
|
||||
#- STM32F103RC_btt_maple
|
||||
#- STM32F103RE_creality_maple
|
||||
|
||||
# STM32G0
|
||||
- STM32G0B1RE_btt
|
||||
|
||||
# HC32
|
||||
- HC32F460C_aquila_101
|
||||
|
||||
# LPC176x - Lengthy tests
|
||||
- LPC1768
|
||||
- LPC1769
|
||||
@@ -140,7 +149,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Check out the PR
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v3
|
||||
@@ -156,11 +165,11 @@ jobs:
|
||||
path: ~/.platformio
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
||||
|
||||
- name: Select Python 3.7
|
||||
uses: actions/setup-python@v3
|
||||
- name: Select Python 3.9
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.7' # Version range or exact version of a Python version to use, using semvers version range syntax.
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
python-version: '3.9'
|
||||
architecture: 'x64'
|
||||
|
||||
- name: Install PlatformIO
|
||||
run: |
|
||||
|
||||
Vendored
+1
@@ -6,6 +6,7 @@
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode-remote.remote-containers",
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,7 @@ CONTAINER_IMAGE := marlin-dev
|
||||
|
||||
help:
|
||||
@echo "Tasks for local development:"
|
||||
@echo "* format-pins: Reformat all pins files"
|
||||
@echo "* tests-single-ci: Run a single test from inside the CI"
|
||||
@echo "* tests-single-local: Run a single test locally"
|
||||
@echo "* tests-single-local-docker: Run a single test locally, using docker"
|
||||
@@ -57,3 +58,12 @@ tests-all-local-docker:
|
||||
setup-local-docker:
|
||||
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
|
||||
.PHONY: setup-local-docker
|
||||
|
||||
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
|
||||
|
||||
.PHONY: $(PINS)
|
||||
|
||||
$(PINS): %:
|
||||
@echo "Formatting $@" && node buildroot/share/scripts/pinsformat.js $@
|
||||
|
||||
format-pins: $(PINS)
|
||||
|
||||
+662
-1871
File diff suppressed because it is too large
Load Diff
+650
-555
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
Marlin Firmware
|
||||
|
||||
(c) 2011-2020 MarlinFirmware
|
||||
(c) 2011-2023 MarlinFirmware
|
||||
Portions of Marlin are (c) by their respective authors.
|
||||
All code complies with GPLv2 and/or GPLv3
|
||||
|
||||
|
||||
+10
-164
@@ -16,7 +16,7 @@
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
@@ -28,179 +28,25 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
#define SHORT_BUILD_VERSION "DW7.4.9"
|
||||
//#define SHORT_BUILD_VERSION "bugfix-2.1.x"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
* from where the binary was downloaded or the source code was compiled.
|
||||
*/
|
||||
|
||||
#if(ENABLED(MachineMini))
|
||||
#define VerChar1 "M"
|
||||
#elif(ENABLED(MachineEnder2))
|
||||
#define VerChar1 "E2"
|
||||
#elif(ENABLED(MachineEnder2Pro))
|
||||
#define VerChar1 "E2P"
|
||||
#elif(ENABLED(MachineEnder3))
|
||||
#define VerChar1 "E3"
|
||||
#elif ENABLED(MachineEnder3V2)
|
||||
#define VerChar1 "E3V2"
|
||||
#elif ENABLED(MachineEnder3S1)
|
||||
#define VerChar1 "E3S1"
|
||||
#elif ENABLED(MachineEnder3Max)
|
||||
#define VerChar1 "E3M"
|
||||
#elif(ENABLED(MachineEnder4))
|
||||
#define VerChar1 "E4"
|
||||
#elif(ENABLED(MachineEnder5))
|
||||
#define VerChar1 "E5"
|
||||
#elif(ENABLED(MachineEnder6))
|
||||
#define VerChar1 "E6"
|
||||
#elif(ENABLED(MachineEnder7))
|
||||
#define VerChar1 "E7"
|
||||
#elif(ENABLED(MachineSermoonD1))
|
||||
#define VerChar1 "D1"
|
||||
#elif(ENABLED(MachineEnder5Plus))
|
||||
#define VerChar1 "E5P"
|
||||
#elif(ENABLED(MachineCR20))
|
||||
#define VerChar1 "2"
|
||||
#elif(ENABLED(MachineCR10Orig))
|
||||
#define VerChar1 "O"
|
||||
#elif(ENABLED(MachineCR10Std))
|
||||
#define VerChar1 "S"
|
||||
#elif(ENABLED(MachineCRX))
|
||||
#define VerChar1 "X"
|
||||
#elif(ENABLED(MachineCR6))
|
||||
#define VerChar1 "CR6"
|
||||
#elif(ENABLED(MachineCR5))
|
||||
#define VerChar1 "CR5"
|
||||
#elif(ENABLED(MachineCR6Max))
|
||||
#define VerChar1 "CR6M"
|
||||
#elif(ENABLED(MachineS4))
|
||||
#define VerChar1 "4"
|
||||
#elif(ENABLED(MachineS5) || ENABLED(MachineCR10Max))
|
||||
#define VerChar1 "5"
|
||||
#elif ENABLED(MachineCR2020)
|
||||
#define VerChar1 "20"
|
||||
#elif(ENABLED(MachineCR30))
|
||||
#define VerChar1 "CR30"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(HotendStock))
|
||||
#define VerChar2 "S"
|
||||
#elif(ENABLED(HotendE3D))
|
||||
#define VerChar2 "E"
|
||||
#elif ENABLED(HotendMosquito)
|
||||
#define VerChar2 "M"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(HotendAllMetal))
|
||||
#define VerChar3 "M"
|
||||
#else
|
||||
#define VerChar3 "S"
|
||||
#endif
|
||||
|
||||
|
||||
#if(ENABLED(BedAC))
|
||||
#define VerChar4 "A"
|
||||
#elif(ENABLED(BedDC))
|
||||
#define VerChar4 "D"
|
||||
#else
|
||||
#define VerChar4 "N"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(ABL_EZABL))
|
||||
#define VerChar5 "A"
|
||||
#elif(ENABLED(ABL_BLTOUCH))
|
||||
#define VerChar5 "B"
|
||||
#else
|
||||
#define VerChar5 "N"
|
||||
#endif
|
||||
|
||||
#if(ENABLED(ABL_UBL))
|
||||
#define VerChar6 "U"
|
||||
#elif(ENABLED(ABL_BI))
|
||||
#define VerChar6 "B"
|
||||
#else
|
||||
#define VerChar6 "N"
|
||||
#endif
|
||||
|
||||
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " FL " VerChar1 VerChar2 VerChar3 VerChar4 VerChar5 VerChar6
|
||||
//#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION
|
||||
|
||||
/**
|
||||
* The STRING_DISTRIBUTION_DATE represents when the binary file was built,
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2023-08-04"
|
||||
//#define STRING_DISTRIBUTION_DATE "2024-01-09"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
*/
|
||||
#if ENABLED(MACHINE_PRO)
|
||||
#define MACHINEPRO " Pro"
|
||||
#else
|
||||
#define MACHINEPRO ""
|
||||
#endif
|
||||
|
||||
#if(ENABLED(MachineMini))
|
||||
#define CUSTOM_MACHINE_NAME "Mini SuPeR"
|
||||
#elif(ENABLED(MachineCR10Smart))
|
||||
#define CUSTOM_MACHINE_NAME "CR10Smart"
|
||||
#elif(ENABLED(MachineCR10SmartPro))
|
||||
#define CUSTOM_MACHINE_NAME "CR10SmartPro"
|
||||
#elif(ENABLED(MachineEnder2))
|
||||
#define CUSTOM_MACHINE_NAME "Ender2"
|
||||
#elif(ENABLED(MachineEnder2Pro))
|
||||
#define CUSTOM_MACHINE_NAME "Ender2 Pro"
|
||||
#elif(ENABLED(MachineEnder3))
|
||||
#define CUSTOM_MACHINE_NAME "Ender3" MACHINEPRO
|
||||
#elif(ENABLED(MachineEnder3Max))
|
||||
#define CUSTOM_MACHINE_NAME "E3Max"
|
||||
#elif(ENABLED(MachineEnder6))
|
||||
#define CUSTOM_MACHINE_NAME "Ender6"
|
||||
#elif(ENABLED(MachineEnder7))
|
||||
#define CUSTOM_MACHINE_NAME "Ender7"
|
||||
#elif(ENABLED(MachineEnder3V2))
|
||||
#define CUSTOM_MACHINE_NAME "Ender3V2"
|
||||
#elif(ENABLED(MachineEnder3S1))
|
||||
#define CUSTOM_MACHINE_NAME "Ender3S1"
|
||||
#elif(ENABLED(MachineEnder4))
|
||||
#define CUSTOM_MACHINE_NAME "Ender4"
|
||||
#elif(ENABLED(MachineEnder5))
|
||||
#define CUSTOM_MACHINE_NAME "Ender5" MACHINEPRO
|
||||
#elif(ENABLED(MachineEnder5Plus))
|
||||
#define CUSTOM_MACHINE_NAME "E5 Plus"
|
||||
#elif(ENABLED(MachineCR20))
|
||||
#define CUSTOM_MACHINE_NAME "CR-20"
|
||||
#elif(ENABLED(MachineCR10Orig))
|
||||
#define CUSTOM_MACHINE_NAME "CR-10"
|
||||
#elif(ENABLED(MachineCRX))
|
||||
#define CUSTOM_MACHINE_NAME "CR-X"
|
||||
#elif ENABLED(MachineCR10SProV2)
|
||||
#define CUSTOM_MACHINE_NAME "10SProV2"
|
||||
#elif(ENABLED(MachineCR10SPro))
|
||||
#define CUSTOM_MACHINE_NAME "10S Pro"
|
||||
#elif(ENABLED(MachineCR10Max))
|
||||
#define CUSTOM_MACHINE_NAME "CR10Max"
|
||||
#elif(ENABLED(MachineCR10SV3))
|
||||
#define CUSTOM_MACHINE_NAME "CR10V3"
|
||||
#elif(ENABLED(MachineCR10SV2))
|
||||
#define CUSTOM_MACHINE_NAME "CR10V2"
|
||||
#elif(ENABLED(MachineCR10Std))
|
||||
#define CUSTOM_MACHINE_NAME "CR10300"
|
||||
#elif(ENABLED(MachineS4))
|
||||
#define CUSTOM_MACHINE_NAME "CR10400"
|
||||
#elif(ENABLED(MachineS5))
|
||||
#define CUSTOM_MACHINE_NAME "CR10500"
|
||||
#elif ENABLED(MachineCR2020)
|
||||
#define CUSTOM_MACHINE_NAME "CR2020"
|
||||
#elif ENABLED(MachineSermoonD1)
|
||||
#define CUSTOM_MACHINE_NAME "SermoonD1"
|
||||
#elif ENABLED(MachineCR5)
|
||||
#define CUSTOM_MACHINE_NAME "CR5 Pro"
|
||||
#elif ENABLED(MachineCR30)
|
||||
#define CUSTOM_MACHINE_NAME "CR30 Printmill"
|
||||
#endif
|
||||
//#define MACHINE_NAME "3D Printer"
|
||||
|
||||
/**
|
||||
* The SOURCE_CODE_URL is the location where users will find the Marlin Source
|
||||
@@ -208,7 +54,7 @@
|
||||
* has a distinct Github fork— the Source Code URL should just be the main
|
||||
* Marlin repository.
|
||||
*/
|
||||
#define SOURCE_CODE_URL "https://github.com/InsanityAutomation/Marlin/tree/CrealityDwin_2.0"
|
||||
//#define SOURCE_CODE_URL "github.com/MarlinFirmware/Marlin"
|
||||
|
||||
/**
|
||||
* Default generic printer UUID.
|
||||
@@ -219,12 +65,12 @@
|
||||
* The WEBSITE_URL is the location where users can get more information such as
|
||||
* documentation about a specific Marlin release.
|
||||
*/
|
||||
#define WEBSITE_URL "https://www.amazon.com/s?k=F1RST+LAYER"
|
||||
//#define WEBSITE_URL "marlinfw.org"
|
||||
|
||||
/**
|
||||
* Set the vendor info the serial USB interface, if changable
|
||||
* Currently only supported by DUE platform
|
||||
*/
|
||||
//#define USB_DEVICE_VENDOR_ID 0x0000
|
||||
//#define USB_DEVICE_PRODUCT_ID 0x0000
|
||||
//#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
|
||||
//#define USB_DEVICE_VENDOR_ID 0x0000
|
||||
//#define USB_DEVICE_PRODUCT_ID 0x0000
|
||||
//#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
|
||||
|
||||
+68
-58
@@ -29,65 +29,75 @@
|
||||
* - http://www.marlinfw.org/tools/u8glib/converter.html
|
||||
* - http://www.digole.com/tools/PicturetoC_Hex_converter.php
|
||||
*/
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define CUSTOM_BOOTSCREEN_TIMEOUT 2500
|
||||
#define CUSTOM_BOOTSCREEN_BMPWIDTH 128
|
||||
#define CUSTOM_BOOTSCREEN_INVERTED
|
||||
#define CUSTOM_BOOTSCREEN_BMPWIDTH 60
|
||||
#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64
|
||||
|
||||
const unsigned char custom_start_bmp[] PROGMEM = {
|
||||
B11111101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,B11111111,B11111111,B11111111,
|
||||
B11111110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11111111,B11111111,B11111111,
|
||||
B11111100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,
|
||||
B11111100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000101,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11111100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000110,B00000111,B11000000,B00000000,B00000001,B11110000,B00111111,
|
||||
B11111110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000100,B00001010,B00100000,B00000000,B00000010,B00001000,B00011111,
|
||||
B11111100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000110,B00010100,B00010000,B00000000,B00000101,B00000100,B00111111,
|
||||
B11111110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000100,B00101000,B00001000,B00000000,B00001010,B00000010,B00011111,
|
||||
B11111100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000110,B01010100,B00000100,B00000000,B00010101,B00000001,B00111111,
|
||||
B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B01100000,B00000100,B00000000,B00011000,B00000001,B00011111,
|
||||
B11111100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101110,B01010000,B00000100,B00000000,B00010100,B00000001,B00111111,
|
||||
B11111110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010100,B01100000,B00000100,B00000000,B00011000,B00000001,B00011111,
|
||||
B11111100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100110,B01010100,B00000100,B00011100,B00010101,B00000001,B00111111,
|
||||
B11111110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010100,B00101000,B00001000,B00101010,B00001010,B00000010,B00011111,
|
||||
B11111100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101110,B00010100,B00010000,B01010001,B00000101,B00000100,B00111111,
|
||||
B11111110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00001010,B00100000,B01100001,B00000010,B10001000,B00011111,
|
||||
B11111100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000110,B00000111,B11000000,B01010001,B00000001,B11110000,B00111111,
|
||||
B11111110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000100,B00000000,B00000000,B00101010,B00000000,B00000000,B00011111,
|
||||
B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111110,B00000000,B00000000,B00011100,B00000000,B00000000,B00111111,
|
||||
B11111110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010100,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,
|
||||
B11111100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000100,B11111111,B11111111,B11111111,B11111111,B11111111,B10011111,
|
||||
B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000110,B11010101,B01010101,B01010101,B01010101,B01010101,B10111111,
|
||||
B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000110,B11000100,B00010000,B01000001,B00000100,B00010001,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000100,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010110,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111100,B11000100,B00010000,B01000001,B00000100,B00010001,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000110,B10000100,B00010000,B01000001,B00000100,B00010000,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010100,B11010101,B01010101,B01010101,B01010101,B01010101,B10111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111100,B11111111,B11111111,B11111111,B11111111,B11111111,B10011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111101,B01010101,B01010101,B01010101,B01010101,B01010101,B01011111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,
|
||||
B11100000,B00101110,B11111011,B01111101,B11111011,B11111011,B11001111,B11000001,B11011111,B10111011,B00111110,B11000000,B11100001,B11111110,B00111100,B00011111,
|
||||
B11111101,B11101110,B01111011,B00111001,B11111001,B11110011,B11001111,B10011110,B11011111,B10111011,B00111110,B11011111,B11011110,B11111100,B11011101,B11100111,
|
||||
B11111101,B11101110,B00111011,B10111011,B11111001,B11101011,B11010111,B10111111,B01011111,B10111011,B01011110,B11011111,B11011110,B11111101,B11101101,B11110111,
|
||||
B11111101,B11101110,B10111011,B11010011,B11111010,B11101011,B10110111,B00111111,B11011111,B10111011,B01001110,B11011111,B11011111,B11111111,B11001101,B11110011,
|
||||
B11111101,B11101110,B11011011,B11000111,B11111010,B11101011,B10111011,B01111111,B11000000,B00111011,B01101110,B11000000,B11100011,B11111111,B00011101,B11110011,
|
||||
B11111101,B11101110,B11001011,B11101111,B11111010,B11011011,B10111011,B01111111,B11011111,B10111011,B01100110,B11011111,B11111000,B11111111,B11001101,B11110011,
|
||||
B11111101,B11101110,B11101011,B11101111,B11111011,B01011011,B00000011,B00111111,B01011111,B10111011,B01110110,B11011111,B11111110,B01111111,B11101101,B11110011,
|
||||
B11111101,B11101110,B11110011,B11101111,B11111011,B01011011,B01111001,B10111110,B11011111,B10111011,B01111010,B11011111,B11011110,B01111101,B11101101,B11110111,
|
||||
B11111101,B11101110,B11110011,B11101111,B11111011,B10111010,B11111101,B10011110,B11011111,B10111011,B01111100,B11011111,B11011110,B11111101,B11001101,B11100111,
|
||||
B11111101,B11101110,B11111011,B11101111,B11111011,B10111010,B11111101,B11000001,B11011111,B10111011,B01111110,B11000000,B11100000,B11111110,B00011100,B00011111
|
||||
const unsigned char custom_start_bmp[574] PROGMEM = {
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x12, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x23, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x21, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x4c, 0x80, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x5e, 0x80, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x92, 0x40, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0xa1, 0x40, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x1, 0x21, 0x20, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x2, 0x7f, 0x90, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x2, 0x0, 0x10, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x7, 0xff, 0xf8, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x4, 0x0, 0x8, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x8, 0x0, 0x4, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x8, 0x0, 0x6, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x10, 0x0, 0x2, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x30, 0x1e, 0x1, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x20, 0x7f, 0x81, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x41, 0xff, 0xe0, 0x80, 0x0, 0x0,
|
||||
0x0, 0x0, 0x43, 0xfc, 0xf0, 0x80, 0x0, 0x0,
|
||||
0x0, 0x0, 0x87, 0x3b, 0x78, 0x40, 0x0, 0x0,
|
||||
0x0, 0x1, 0x8e, 0xdb, 0xfc, 0x60, 0x0, 0x0,
|
||||
0x0, 0x1, 0xf, 0xeb, 0xcc, 0x20, 0x0, 0x0,
|
||||
0x0, 0x2, 0x1f, 0xed, 0xb6, 0x10, 0x0, 0x0,
|
||||
0x0, 0x2, 0x1f, 0xde, 0xb6, 0x10, 0x0, 0x0,
|
||||
0x0, 0x4, 0x39, 0xcd, 0x7f, 0x8, 0x0, 0x0,
|
||||
0x0, 0x4, 0x36, 0xe0, 0xff, 0x8, 0x0, 0x0,
|
||||
0x0, 0x8, 0x7e, 0xc0, 0xbb, 0x84, 0x0, 0x0,
|
||||
0x0, 0x18, 0x7f, 0x0, 0x5d, 0x86, 0x0, 0x0,
|
||||
0x0, 0x10, 0x7f, 0xc0, 0xed, 0x82, 0x0, 0x0,
|
||||
0x0, 0x20, 0x3c, 0xc0, 0x73, 0x1, 0x0, 0x0,
|
||||
0x0, 0x20, 0x3b, 0x33, 0x7f, 0x1, 0x0, 0x0,
|
||||
0x0, 0x70, 0x1b, 0xe7, 0x7e, 0x3, 0x80, 0x0,
|
||||
0x0, 0xc8, 0x1d, 0xee, 0xde, 0x4, 0xc0, 0x0,
|
||||
0x0, 0x88, 0xf, 0xde, 0xdc, 0x4, 0x40, 0x0,
|
||||
0x1, 0x24, 0xf, 0xdf, 0x3c, 0x9, 0x20, 0x0,
|
||||
0x1, 0x26, 0x7, 0xdb, 0xf8, 0x19, 0x20, 0x0,
|
||||
0x2, 0x72, 0x3, 0xe7, 0xf0, 0x13, 0x90, 0x0,
|
||||
0x2, 0x51, 0x1, 0xff, 0xe0, 0x22, 0x90, 0x0,
|
||||
0x4, 0x89, 0x0, 0x7f, 0x80, 0x24, 0x48, 0x0,
|
||||
0x9, 0x4, 0x80, 0x1e, 0x0, 0x48, 0x24, 0x0,
|
||||
0xb, 0xfe, 0x40, 0x0, 0x0, 0xdf, 0xf4, 0x0,
|
||||
0x10, 0x0, 0x40, 0x0, 0x0, 0x80, 0x2, 0x0,
|
||||
0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x10, 0x22, 0x10, 0x3c, 0x3c, 0xe, 0x1f, 0x0,
|
||||
0x10, 0x22, 0x10, 0x4, 0x22, 0x11, 0x4, 0x0,
|
||||
0x10, 0x22, 0x10, 0x8, 0x22, 0x11, 0x4, 0x0,
|
||||
0x10, 0x22, 0x10, 0x8, 0x3c, 0x11, 0x4, 0x0,
|
||||
0x10, 0x22, 0x10, 0x10, 0x22, 0x11, 0x4, 0x0,
|
||||
0x10, 0x22, 0x10, 0x20, 0x22, 0x11, 0x4, 0x0,
|
||||
0x1e, 0x1c, 0x1e, 0x3c, 0x3c, 0xe, 0x4, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
|
||||
};
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Custom Status Screen bitmap
|
||||
*
|
||||
* Place this file in the root with your configuration files
|
||||
* and enable CUSTOM_STATUS_SCREEN_IMAGE in Configuration.h.
|
||||
*
|
||||
* Use the Marlin Bitmap Converter to make your own:
|
||||
* http://marlinfw.org/tools/u8glib/converter.html
|
||||
*/
|
||||
|
||||
//
|
||||
// Status Screen Logo bitmap
|
||||
//
|
||||
#define STATUS_LOGO_Y 3
|
||||
#define STATUS_LOGO_WIDTH 24
|
||||
|
||||
const unsigned char status_logo_bmp[] PROGMEM = {
|
||||
B11111111,B11111111,B11111111,
|
||||
B10000000,B00000000,B00000001,
|
||||
B10001110,B00000000,B11100001,
|
||||
B10011111,B00000001,B11110001,
|
||||
B10010011,B10000001,B00111001,
|
||||
B10011111,B10000001,B11111001,
|
||||
B10011111,B10000001,B11111001,
|
||||
B10011111,B10111001,B11111001,
|
||||
B10001111,B00101000,B11110001,
|
||||
B10000000,B00111000,B00000001,
|
||||
B10000000,B00000000,B00000001,
|
||||
B10011111,B11111111,B11111001,
|
||||
B10010001,B01110100,B10011001,
|
||||
B10011011,B00000110,B10101001,
|
||||
B10011011,B01010100,B10101001,
|
||||
B10011011,B01010110,B10101001,
|
||||
B10011011,B01010100,B10011001,
|
||||
B10011111,B11111111,B11111001,
|
||||
B11111111,B11111111,B11111111
|
||||
};
|
||||
|
||||
//
|
||||
// Use default bitmaps
|
||||
//
|
||||
#define STATUS_HOTEND_ANIM
|
||||
#define STATUS_BED_ANIM
|
||||
#if HOTENDS < 2
|
||||
#define STATUS_LOGO_X 8
|
||||
#define STATUS_HEATERS_X 40
|
||||
#define STATUS_BED_X 72
|
||||
#else
|
||||
#define STATUS_LOGO_X 0
|
||||
#define STATUS_HEATERS_X 32
|
||||
#define STATUS_BED_X 80
|
||||
#endif
|
||||
@@ -3,10 +3,50 @@
|
||||
# config.ini - Options to apply before the build
|
||||
#
|
||||
[config:base]
|
||||
#
|
||||
# ini_use_config - A comma-separated list of actions to apply to the Configuration files.
|
||||
# The actions will be applied in the listed order.
|
||||
# - none
|
||||
# Ignore this file and don't apply any configuration options
|
||||
#
|
||||
# - base
|
||||
# Just apply the options in config:base to the configuration
|
||||
#
|
||||
# - minimal
|
||||
# Just apply the options in config:minimal to the configuration
|
||||
#
|
||||
# - all
|
||||
# Apply all 'config:*' sections in this file to the configuration
|
||||
#
|
||||
# - another.ini
|
||||
# Load another INI file with a path relative to this config.ini file (i.e., within Marlin/)
|
||||
#
|
||||
# - https://me.myserver.com/path/to/configs
|
||||
# Fetch configurations from any URL.
|
||||
#
|
||||
# - example/Creality/Ender-5 Plus @ bugfix-2.1.x
|
||||
# Fetch example configuration files from the MarlinFirmware/Configurations repository
|
||||
# https://raw.githubusercontent.com/MarlinFirmware/Configurations/bugfix-2.1.x/config/examples/Creality/Ender-5%20Plus/
|
||||
#
|
||||
# - example/default @ release-2.0.9.7
|
||||
# Fetch default configuration files from the MarlinFirmware/Configurations repository
|
||||
# https://raw.githubusercontent.com/MarlinFirmware/Configurations/release-2.0.9.7/config/default/
|
||||
#
|
||||
# - [disable]
|
||||
# Comment out all #defines in both Configuration.h and Configuration_adv.h. This is useful
|
||||
# to start with a clean slate before applying any config: options, so only the options explicitly
|
||||
# set in config.ini will be enabled in the configuration.
|
||||
#
|
||||
# - [flatten] (Not yet implemented)
|
||||
# Produce a flattened set of Configuration.h and Configuration_adv.h files with only the enabled
|
||||
# #defines and no comments. A clean look, but context-free.
|
||||
#
|
||||
ini_use_config = none
|
||||
|
||||
# Load all config: sections in this file
|
||||
;ini_use_config = all
|
||||
# Disable everything and apply subsequent config:base options
|
||||
;ini_use_config = [disable], base
|
||||
# Load config file relative to Marlin/
|
||||
;ini_use_config = another.ini
|
||||
# Download configurations from GitHub
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -139,8 +141,8 @@ typedef Servo hal_servo_t;
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3."
|
||||
#endif
|
||||
#define LCD_SERIAL lcdSerial
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
#define SERIAL_GET_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#if HAS_DGUS_LCD
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.get_tx_buffer_free()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ MSerialT1 customizedSerial1(MSerialT1::HasEmergencyParser);
|
||||
template class MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> >;
|
||||
MSerialLCD lcdSerial(MSerialLCD::HasEmergencyParser);
|
||||
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
#if HAS_DGUS_LCD
|
||||
template<typename Cfg>
|
||||
typename MarlinSerial<Cfg>::ring_buffer_pos_t MarlinSerial<Cfg>::get_tx_buffer_free() {
|
||||
const ring_buffer_pos_t t = tx_buffer.tail, // next byte to send.
|
||||
|
||||
@@ -37,10 +37,6 @@
|
||||
#include "../../core/types.h"
|
||||
#include "../../core/serial_hook.h"
|
||||
|
||||
#ifndef SERIAL_PORT
|
||||
#define SERIAL_PORT 0
|
||||
#endif
|
||||
|
||||
#ifndef USBCON
|
||||
|
||||
// The presence of the UBRRH register is used to detect a UART.
|
||||
@@ -209,7 +205,7 @@
|
||||
static ring_buffer_pos_t available();
|
||||
static void write(const uint8_t c);
|
||||
static void flushTX();
|
||||
#if HAS_DGUS_LCD || ENABLED(DGUS_LCD_UI_CREALITY_TOUCH) || ENABLED(EXTENSIBLE_UI)
|
||||
#if HAS_DGUS_LCD
|
||||
static ring_buffer_pos_t get_tx_buffer_free();
|
||||
#endif
|
||||
|
||||
@@ -280,7 +276,7 @@
|
||||
static constexpr bool DROPPED_RX = false;
|
||||
static constexpr bool RX_FRAMING_ERRORS = false;
|
||||
static constexpr bool MAX_RX_QUEUED = false;
|
||||
static constexpr bool RX_OVERRUNS = (ANY(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS) || ENABLED(DWINOS_4));
|
||||
static constexpr bool RX_OVERRUNS = ALL(HAS_DGUS_LCD, SERIAL_STATS_RX_BUFFER_OVERRUNS);
|
||||
};
|
||||
|
||||
typedef Serial1Class< MarlinSerial< LCDSerialCfg<LCD_SERIAL_PORT> > > MSerialLCD;
|
||||
|
||||
@@ -20,3 +20,7 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef SERIAL_PORT
|
||||
#define SERIAL_PORT 0
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* AVR LCD-specific defines
|
||||
*/
|
||||
|
||||
uint8_t u8g_com_HAL_AVR_sw_sp_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_AVR_sw_sp_fn
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
* Copyright (c) 2016 Victor Perez victor_pv@hotmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* DUE (SAM3X8E) LCD-specific defines
|
||||
*/
|
||||
|
||||
uint8_t u8g_com_HAL_DUE_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_DUE_shared_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_DUE_sw_spi_fn
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_DUE_shared_hw_spi_fn
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_DUE_ST7920_sw_spi_fn
|
||||
@@ -0,0 +1,29 @@
|
||||
# USB Files Source Documentation
|
||||
|
||||
## Source
|
||||
|
||||
We sourced the USB files in Marlin from the Atmel ASF (Advanced Software Framework). The framework provides a variety of examples which were utilized in this project.
|
||||
|
||||
Atmel doesn't provide these files in a source repository but they can be extracted from ASF, which can be downloaded from Atmel.
|
||||
|
||||
[Advanced Software Framework](https://www.microchip.com/en-us/tools-resources/develop/libraries/advanced-software-framework)
|
||||
|
||||
## Modifications
|
||||
|
||||
The files are mostly unmodified except for minor cosmetic changes but some more significant changes were needed.
|
||||
|
||||
The changes that prompted the addition of this README file are listed below. Other changes may have been made prior to this.
|
||||
|
||||
1. Modified `uotghs_device_due.c` to resolve race conditions that could leave interrupts asserted when freezing the peripheral clock, resulting in hangs and watchdog resets due to the ensuing interrupt storm.
|
||||
|
||||
## Version Information
|
||||
|
||||
We don't know the exact version of ASF used as the source. However, the copyright information in the files indicates they are from 2015.
|
||||
|
||||
## Upgrade Considerations
|
||||
|
||||
We looked at the ASF 3.52.0 files released in 2022 but saw no immediate benefits to justify an upgrade. It's important to note that the files in Marlin don't follow the same folder structure as the files in ASF, which complicates the process of comparing and applying updated files.
|
||||
|
||||
When these files are updated it's important to carefully compare them to Marlin's versions so any improvements in the Marlin sources are brought forward.
|
||||
|
||||
It would be best to make Marlin's directory structure align with ASF or at least document the source of each file to ease future updates.
|
||||
@@ -116,6 +116,23 @@
|
||||
//#define dbg_print printf
|
||||
#define dbg_print(...)
|
||||
|
||||
// Marlin modification: Redefine the otg_freeze_clock and otg_unfreeze_clock macros
|
||||
// to add memory barriers to ensure that any accesses to USB registers aren't re-ordered
|
||||
// to occur while the clock is frozen.
|
||||
#undef otg_freeze_clock
|
||||
#undef otg_unfreeze_clock
|
||||
|
||||
#define otg_freeze_clock() do { \
|
||||
__DSB(); \
|
||||
Set_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_FRZCLK); \
|
||||
} while (0)
|
||||
|
||||
#define otg_unfreeze_clock() \
|
||||
do { \
|
||||
Clr_bits(UOTGHS->UOTGHS_CTRL, UOTGHS_CTRL_FRZCLK); \
|
||||
__DSB(); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* \ingroup udd_group
|
||||
* \defgroup udd_udphs_group USB On-The-Go High-Speed Port for device mode (UOTGHS)
|
||||
@@ -611,6 +628,18 @@ ISR(UDD_USB_INT_FUN)
|
||||
// The wakeup interrupt is automatic acked when a suspend occur
|
||||
udd_disable_wake_up_interrupt();
|
||||
udd_enable_suspend_interrupt();
|
||||
|
||||
// Marlin modification: The RESET, SOF, and MSOF interrupts were previously
|
||||
// enabled in udd_attach, which caused a race condition where they could
|
||||
// be raised and unclearable with the clock is frozen. They are now
|
||||
// enabled here, after the clock has been unfrozen in response to the wake
|
||||
// interrupt.
|
||||
udd_enable_reset_interrupt();
|
||||
udd_enable_sof_interrupt();
|
||||
#ifdef USB_DEVICE_HS_SUPPORT
|
||||
udd_enable_msof_interrupt();
|
||||
#endif
|
||||
|
||||
udd_sleep_mode(true); // Enter in IDLE mode
|
||||
#ifdef UDC_RESUME_EVENT
|
||||
UDC_RESUME_EVENT();
|
||||
@@ -776,6 +805,27 @@ void udd_disable(void)
|
||||
cpu_irq_restore(flags);
|
||||
}
|
||||
|
||||
// Marlin modification: The original implementation did not use a memory
|
||||
// barrier between disabling and clearing interrupts. This sometimes
|
||||
// allowed interrupts to remain raised and unclearable after the clock
|
||||
// was frozen. This helper was added to ensure that memory barriers
|
||||
// are used consistently from all places where interrupts are disabled.
|
||||
static void disable_and_ack_sync_interrupts()
|
||||
{
|
||||
// Disable USB line events
|
||||
udd_disable_reset_interrupt();
|
||||
udd_disable_sof_interrupt();
|
||||
#ifdef USB_DEVICE_HS_SUPPORT
|
||||
udd_disable_msof_interrupt();
|
||||
#endif
|
||||
__DSB();
|
||||
udd_ack_reset();
|
||||
udd_ack_sof();
|
||||
#ifdef USB_DEVICE_HS_SUPPORT
|
||||
udd_ack_msof();
|
||||
#endif
|
||||
__DSB();
|
||||
}
|
||||
|
||||
void udd_attach(void)
|
||||
{
|
||||
@@ -796,17 +846,16 @@ void udd_attach(void)
|
||||
udd_attach_device();
|
||||
|
||||
// Enable USB line events
|
||||
udd_enable_reset_interrupt();
|
||||
udd_enable_suspend_interrupt();
|
||||
udd_enable_wake_up_interrupt();
|
||||
udd_enable_sof_interrupt();
|
||||
#ifdef USB_DEVICE_HS_SUPPORT
|
||||
udd_enable_msof_interrupt();
|
||||
#endif
|
||||
// Reset following interrupts flag
|
||||
udd_ack_reset();
|
||||
udd_ack_sof();
|
||||
udd_ack_msof();
|
||||
|
||||
// Marlin modification: The RESET, SOF, and MSOF interrupts were previously
|
||||
// enabled here, which caused a race condition where they could be raised
|
||||
// and unclearable with the clock is frozen. They are now enabled in the
|
||||
// wake interrupt handler, after the clock has been unfrozen. They are now
|
||||
// explicitly disabled here to ensure that they cannot be raised before
|
||||
// the clock is frozen.
|
||||
disable_and_ack_sync_interrupts();
|
||||
|
||||
// The first suspend interrupt must be forced
|
||||
// The first suspend interrupt is not detected else raise it
|
||||
@@ -824,6 +873,12 @@ void udd_detach(void)
|
||||
|
||||
// Detach device from the bus
|
||||
udd_detach_device();
|
||||
|
||||
// Marlin modification: Added the explicit disabling of the RESET, SOF, and
|
||||
// MSOF interrupts here, to ensure that they cannot be raised after the
|
||||
// clock is frozen.
|
||||
disable_and_ack_sync_interrupts();
|
||||
|
||||
otg_freeze_clock();
|
||||
udd_sleep_mode(false);
|
||||
}
|
||||
@@ -2043,6 +2098,12 @@ static bool udd_ep_interrupt(void)
|
||||
dbg_print("I ");
|
||||
udd_disable_in_send_interrupt(ep);
|
||||
// One bank is free then send a ZLP
|
||||
|
||||
// Marlin modification: Add a barrier to ensure in_send is disabled
|
||||
// before it is cleared. This was not an observed problem, but
|
||||
// other interrupts were seen to misbehave without this barrier.
|
||||
__DSB();
|
||||
|
||||
udd_ack_in_send(ep);
|
||||
udd_ack_fifocon(ep);
|
||||
udd_ep_finish_job(ptr_job, false, ep);
|
||||
|
||||
@@ -175,7 +175,7 @@ uint8_t MarlinHAL::get_reset_source() { return rtc_get_reset_reason(1); }
|
||||
|
||||
void MarlinHAL::reboot() { ESP.restart(); }
|
||||
|
||||
void _delay_ms(int delay_ms) { delay(delay_ms); }
|
||||
void _delay_ms(const int ms) { delay(ms); }
|
||||
|
||||
// return free memory between end of heap (or end bss) and whatever is current
|
||||
int MarlinHAL::freeMemory() { return ESP.getFreeHeap(); }
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
* Copyright (c) 2017 Victor Perez
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <freertos/queue.h>
|
||||
#include "../../module/stepper.h"
|
||||
|
||||
#if ENABLED(FT_MOTION)
|
||||
#include "../../module/ft_motion.h"
|
||||
#endif
|
||||
|
||||
#define DMA_BUF_COUNT 8 // number of DMA buffers to store data
|
||||
#define DMA_BUF_LEN 4092 // maximum size in bytes
|
||||
#define I2S_SAMPLE_SIZE 4 // 4 bytes, 32 bits per sample
|
||||
@@ -134,8 +138,8 @@ static void IRAM_ATTR i2s_intr_handler_default(void *arg) {
|
||||
|
||||
if (high_priority_task_awoken == pdTRUE) portYIELD_FROM_ISR();
|
||||
|
||||
// clear interrupt
|
||||
I2S0.int_clr.val = I2S0.int_st.val; //clear pending interrupt
|
||||
// Clear pending interrupt
|
||||
I2S0.int_clr.val = I2S0.int_st.val;
|
||||
}
|
||||
|
||||
void stepperTask(void *parameter) {
|
||||
@@ -148,29 +152,43 @@ void stepperTask(void *parameter) {
|
||||
xQueueReceive(dma.queue, &dma.current, portMAX_DELAY);
|
||||
dma.rw_pos = 0;
|
||||
|
||||
const bool using_ftMotion = TERN0(FT_MOTION, ftMotion.cfg.mode);
|
||||
|
||||
while (dma.rw_pos < DMA_SAMPLE_COUNT) {
|
||||
if (!nextMainISR) {
|
||||
Stepper::pulse_phase_isr();
|
||||
nextMainISR = Stepper::block_phase_isr();
|
||||
}
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
else if (!nextAdvanceISR) {
|
||||
Stepper::advance_isr();
|
||||
nextAdvanceISR = Stepper::la_interval;
|
||||
|
||||
#if ENABLED(FT_MOTION)
|
||||
|
||||
if (using_ftMotion) {
|
||||
if (!nextMainISR) stepper.ftMotion_stepper();
|
||||
nextMainISR = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
else
|
||||
i2s_push_sample();
|
||||
|
||||
nextMainISR--;
|
||||
if (!using_ftMotion) {
|
||||
if (!nextMainISR) {
|
||||
Stepper::pulse_phase_isr();
|
||||
nextMainISR = Stepper::block_phase_isr();
|
||||
}
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
else if (!nextAdvanceISR) {
|
||||
Stepper::advance_isr();
|
||||
nextAdvanceISR = Stepper::la_interval;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
i2s_push_sample();
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (nextAdvanceISR == Stepper::LA_ADV_NEVER)
|
||||
nextAdvanceISR = Stepper::la_interval;
|
||||
nextMainISR--;
|
||||
|
||||
if (nextAdvanceISR && nextAdvanceISR != Stepper::LA_ADV_NEVER)
|
||||
nextAdvanceISR--;
|
||||
#endif
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
if (nextAdvanceISR == Stepper::LA_ADV_NEVER)
|
||||
nextAdvanceISR = Stepper::la_interval;
|
||||
|
||||
if (nextAdvanceISR && nextAdvanceISR != Stepper::LA_ADV_NEVER)
|
||||
nextAdvanceISR--;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,3 +20,7 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if ANY(MKS_MINI_12864, FYSETC_MINI_12864_2_1)
|
||||
#define U8G_HW_SPI_ESP32 1
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* ESP32 LCD-specific defines
|
||||
*/
|
||||
|
||||
uint8_t u8g_esp32_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_esp32_hw_spi_fn
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ANY(MKS_MINI_12864, FYSETC_MINI_12864_2_1)
|
||||
#if U8G_HW_SPI_ESP32
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../shared/HAL_SPI.h"
|
||||
@@ -41,7 +41,6 @@
|
||||
|
||||
static SPISettings spiConfig;
|
||||
|
||||
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#ifdef SD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SD_SPI_SPEED // Assume SPI speed shared with SD
|
||||
@@ -50,7 +49,7 @@ static SPISettings spiConfig;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
uint8_t u8g_esp32_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT
|
||||
|
||||
#if ENABLED(PAUSE_LCD_FOR_BUSY_SD)
|
||||
@@ -101,6 +100,5 @@ uint8_t u8g_eps_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // MKS_MINI_12864 || FYSETC_MINI_12864_2_1
|
||||
|
||||
#endif // U8G_HW_SPI_ESP32
|
||||
#endif // ARDUINO_ARCH_ESP32
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "HAL.h"
|
||||
#include <core_hooks.h>
|
||||
#include <drivers/panic/panic.h>
|
||||
|
||||
//
|
||||
// Emergency Parser
|
||||
//
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
|
||||
extern "C" void core_hook_usart_rx_irq(uint8_t ch, uint8_t usart) {
|
||||
// Only handle receive on host serial ports
|
||||
if (false
|
||||
#ifdef SERIAL_PORT
|
||||
|| usart != SERIAL_PORT
|
||||
#endif
|
||||
#ifdef SERIAL_PORT_2
|
||||
|| usart != SERIAL_PORT_2
|
||||
#endif
|
||||
#ifdef SERIAL_PORT_3
|
||||
|| usart != SERIAL_PORT_3
|
||||
#endif
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Submit character to emergency parser
|
||||
if (MYSERIAL1.emergency_parser_enabled())
|
||||
emergency_parser.update(MYSERIAL1.emergency_state, ch);
|
||||
}
|
||||
|
||||
#endif // EMERGENCY_PARSER
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* HAL for HC32F460 based boards
|
||||
*
|
||||
* Note: MarlinHAL class is in MarlinHAL.h/cpp
|
||||
*/
|
||||
|
||||
#define CPU_32_BIT
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include "../../core/macros.h"
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../shared/math_32bit.h"
|
||||
#include "../shared/HAL_SPI.h"
|
||||
|
||||
#include "fastio.h"
|
||||
#include "timers.h"
|
||||
#include "MarlinSerial.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//
|
||||
// Serial Ports
|
||||
//
|
||||
#define _MSERIAL(X) MSerial##X
|
||||
#define MSERIAL(X) _MSERIAL(X)
|
||||
#define NUM_UARTS 4
|
||||
|
||||
#if SERIAL_PORT == -1
|
||||
#error "USB Serial is not supported on HC32F460"
|
||||
#elif WITHIN(SERIAL_PORT, 1, NUM_UARTS)
|
||||
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
|
||||
#else
|
||||
#define MYSERIAL1 MSERIAL(1) // Dummy port
|
||||
static_assert(false, "SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ".")
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_2
|
||||
#if SERIAL_PORT_2 == -1
|
||||
#error "USB Serial is not supported on HC32F460"
|
||||
#elif WITHIN(SERIAL_PORT_2, 1, NUM_UARTS)
|
||||
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
|
||||
#else
|
||||
#define MYSERIAL2 MSERIAL(1) // Dummy port
|
||||
static_assert(false, "SERIAL_PORT_2 must be from 1 to " STRINGIFY(NUM_UARTS) ".")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_PORT_3
|
||||
#if SERIAL_PORT_3 == -1
|
||||
#error "USB Serial is not supported on HC32F460"
|
||||
#elif WITHIN(SERIAL_PORT_3, 1, NUM_UARTS)
|
||||
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
|
||||
#else
|
||||
#define MYSERIAL3 MSERIAL(1) // Dummy port
|
||||
static_assert(false, "SERIAL_PORT_3 must be from 1 to " STRINGIFY(NUM_UARTS) ".")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LCD_SERIAL_PORT
|
||||
#if LCD_SERIAL_PORT == -1
|
||||
#error "USB Serial is not supported on HC32F460"
|
||||
#elif WITHIN(LCD_SERIAL_PORT, 1, NUM_UARTS)
|
||||
#define LCD_SERIAL MSERIAL(LCD_SERIAL_PORT)
|
||||
#else
|
||||
#define LCD_SERIAL MSERIAL(1) // Dummy port
|
||||
static_assert(false, "LCD_SERIAL_PORT must be from 1 to " STRINGIFY(NUM_UARTS) ".")
|
||||
#endif
|
||||
|
||||
#if HAS_DGUS_LCD
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.availableForWrite()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Emergency Parser
|
||||
//
|
||||
#if ENABLED(EMERGENCY_PARSER)
|
||||
extern "C" void usart_rx_irq_hook(uint8_t ch, uint8_t usart);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Misc. Defines
|
||||
//
|
||||
#define square(x) ((x) * (x))
|
||||
|
||||
#ifndef strncpy_P
|
||||
#define strncpy_P(dest, src, num) strncpy((dest), (src), (num))
|
||||
#endif
|
||||
|
||||
//
|
||||
// Misc. Functions
|
||||
//
|
||||
#ifndef analogInputToDigitalPin
|
||||
#define analogInputToDigitalPin(p) (p)
|
||||
#endif
|
||||
|
||||
#define CRITICAL_SECTION_START \
|
||||
uint32_t primask = __get_PRIMASK(); \
|
||||
(void)__iCliRetVal()
|
||||
|
||||
#define CRITICAL_SECTION_END \
|
||||
if (!primask) \
|
||||
(void)__iSeiRetVal()
|
||||
|
||||
// Disable interrupts
|
||||
#define cli() noInterrupts()
|
||||
|
||||
// Enable interrupts
|
||||
#define sei() interrupts()
|
||||
|
||||
// bss_end alias
|
||||
#define __bss_end __bss_end__
|
||||
|
||||
// Fix bug in pgm_read_ptr
|
||||
#undef pgm_read_ptr
|
||||
#define pgm_read_ptr(addr) (*(addr))
|
||||
|
||||
//
|
||||
// ADC
|
||||
//
|
||||
#define HAL_ADC_VREF_MV 3300
|
||||
#define HAL_ADC_RESOLUTION 10
|
||||
|
||||
#define GET_PIN_MAP_PIN(index) index
|
||||
#define GET_PIN_MAP_INDEX(pin) pin
|
||||
#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
|
||||
|
||||
//
|
||||
// MarlinHAL implementation
|
||||
//
|
||||
#include "MarlinHAL.h"
|
||||
@@ -0,0 +1,278 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* HAL for HC32F460, based heavily on the legacy implementation and STM32F1
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include "HAL.h" // Includes MarlinHAL.h
|
||||
#include <IWatchdog.h>
|
||||
#include <AsyncAnalogRead.h>
|
||||
|
||||
#if TEMP_SENSOR_SOC
|
||||
#include <OnChipTemperature.h>
|
||||
#endif
|
||||
|
||||
extern "C" char *_sbrk(int incr);
|
||||
|
||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||
// From MinSerial.cpp
|
||||
extern void install_min_serial();
|
||||
#endif
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
inline void HAL_clock_frequencies_dump() {
|
||||
// 1. dump all clock frequencies
|
||||
update_system_clock_frequencies();
|
||||
SERIAL_ECHOPGM(
|
||||
"-- clocks dump -- \nSYS=", SYSTEM_CLOCK_FREQUENCIES.system,
|
||||
"\nHCLK=", SYSTEM_CLOCK_FREQUENCIES.hclk,
|
||||
"\nPCLK0=", SYSTEM_CLOCK_FREQUENCIES.pclk0,
|
||||
"\nPCLK1=", SYSTEM_CLOCK_FREQUENCIES.pclk1,
|
||||
"\nPCLK2=", SYSTEM_CLOCK_FREQUENCIES.pclk2,
|
||||
"\nPCLK3=", SYSTEM_CLOCK_FREQUENCIES.pclk3,
|
||||
"\nPCLK4=", SYSTEM_CLOCK_FREQUENCIES.pclk4,
|
||||
"\nEXCLK=", SYSTEM_CLOCK_FREQUENCIES.exclk,
|
||||
"\nF_CPU=", F_CPU
|
||||
);
|
||||
|
||||
// 2. dump current system clock source
|
||||
en_clk_sys_source_t clkSrc = CLK_GetSysClkSource();
|
||||
SERIAL_ECHOPGM("\nSYSCLK=");
|
||||
switch (clkSrc) {
|
||||
case ClkSysSrcHRC: SERIAL_ECHOPGM("HRC"); break;
|
||||
case ClkSysSrcMRC: SERIAL_ECHOPGM("MRC"); break;
|
||||
case ClkSysSrcLRC: SERIAL_ECHOPGM("LRC"); break;
|
||||
case ClkSysSrcXTAL: SERIAL_ECHOPGM("XTAL"); break;
|
||||
case ClkSysSrcXTAL32: SERIAL_ECHOPGM("XTAL32"); break;
|
||||
case CLKSysSrcMPLL: SERIAL_ECHOPGM("MPLL");
|
||||
|
||||
// 3. if MPLL is used, dump MPLL settings:
|
||||
// (derived from CLK_SetPllSource and CLK_MpllConfig)
|
||||
// source
|
||||
switch (M4_SYSREG->CMU_PLLCFGR_f.PLLSRC) {
|
||||
case ClkPllSrcXTAL: SERIAL_ECHOPGM(",XTAL"); break;
|
||||
case ClkPllSrcHRC: SERIAL_ECHOPGM(",HRC"); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// PLL multipliers and dividers
|
||||
SERIAL_ECHOPGM(
|
||||
"\nP=", M4_SYSREG->CMU_PLLCFGR_f.MPLLP + 1UL,
|
||||
"\nQ=", M4_SYSREG->CMU_PLLCFGR_f.MPLLQ + 1UL,
|
||||
"\nR=", M4_SYSREG->CMU_PLLCFGR_f.MPLLR + 1UL,
|
||||
"\nN=", M4_SYSREG->CMU_PLLCFGR_f.MPLLN + 1UL,
|
||||
"\nM=", M4_SYSREG->CMU_PLLCFGR_f.MPLLM + 1UL
|
||||
);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// Done
|
||||
SERIAL_ECHOPGM("\n--\n");
|
||||
}
|
||||
#endif // MARLIN_DEV_MODE
|
||||
|
||||
//
|
||||
// MarlinHAL class implementation
|
||||
//
|
||||
|
||||
pin_t MarlinHAL::last_adc_pin;
|
||||
|
||||
#if TEMP_SENSOR_SOC
|
||||
float MarlinHAL::soc_temp = 0;
|
||||
#endif
|
||||
|
||||
MarlinHAL::MarlinHAL() {}
|
||||
|
||||
void MarlinHAL::watchdog_init() {
|
||||
TERN_(USE_WATCHDOG, WDT.begin(5000)); // Reset on 5 second timeout
|
||||
}
|
||||
|
||||
void MarlinHAL::watchdog_refresh() {
|
||||
TERN_(USE_WATCHDOG, WDT.reload());
|
||||
}
|
||||
|
||||
void MarlinHAL::init() {
|
||||
NVIC_SetPriorityGrouping(0x3);
|
||||
|
||||
// Print clock frequencies to host serial
|
||||
TERN_(MARLIN_DEV_MODE, HAL_clock_frequencies_dump());
|
||||
|
||||
// Register min serial
|
||||
TERN_(POSTMORTEM_DEBUGGING, install_min_serial());
|
||||
}
|
||||
|
||||
void MarlinHAL::init_board() {}
|
||||
|
||||
void MarlinHAL::reboot() {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
bool MarlinHAL::isr_state() {
|
||||
return !__get_PRIMASK();
|
||||
}
|
||||
|
||||
void MarlinHAL::isr_on() {
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
void MarlinHAL::isr_off() {
|
||||
__disable_irq();
|
||||
}
|
||||
|
||||
void MarlinHAL::delay_ms(const int ms) {
|
||||
delay(ms);
|
||||
}
|
||||
|
||||
void MarlinHAL::idletask() {}
|
||||
|
||||
uint8_t MarlinHAL::get_reset_source() {
|
||||
// Query reset cause from RMU
|
||||
stc_rmu_rstcause_t rstCause;
|
||||
RMU_GetResetCause(&rstCause);
|
||||
|
||||
// Map reset cause code to those expected by Marlin
|
||||
// - Reset causes are flags, so multiple can be set
|
||||
TERN_(MARLIN_DEV_MODE, printf("-- Reset Cause -- \n"));
|
||||
uint8_t cause = 0;
|
||||
#define MAP_CAUSE(from, to) \
|
||||
if (rstCause.from == Set) { \
|
||||
TERN_(MARLIN_DEV_MODE, printf(" - " STRINGIFY(from) "\n")); \
|
||||
cause |= to; \
|
||||
}
|
||||
|
||||
// Power on
|
||||
MAP_CAUSE(enPowerOn, RST_POWER_ON) // Power on reset
|
||||
|
||||
// External
|
||||
MAP_CAUSE(enRstPin, RST_EXTERNAL) // Reset pin
|
||||
MAP_CAUSE(enPvd1, RST_EXTERNAL) // Program voltage detection reset
|
||||
MAP_CAUSE(enPvd2, RST_EXTERNAL) // "
|
||||
|
||||
// Brown out
|
||||
MAP_CAUSE(enBrownOut, RST_BROWN_OUT) // Brown out reset
|
||||
|
||||
// Wdt
|
||||
MAP_CAUSE(enWdt, RST_WATCHDOG) // Watchdog reset
|
||||
MAP_CAUSE(enSwdt, RST_WATCHDOG) // Special WDT reset
|
||||
|
||||
// Software
|
||||
MAP_CAUSE(enPowerDown, RST_SOFTWARE) // MCU power down (?)
|
||||
MAP_CAUSE(enSoftware, RST_SOFTWARE) // Software reset (e.g. NVIC_SystemReset())
|
||||
|
||||
// Misc.
|
||||
MAP_CAUSE(enMpuErr, RST_BACKUP) // MPU error
|
||||
MAP_CAUSE(enRamParityErr, RST_BACKUP) // RAM parity error
|
||||
MAP_CAUSE(enRamEcc, RST_BACKUP) // RAM ecc error
|
||||
MAP_CAUSE(enClkFreqErr, RST_BACKUP) // Clock frequency failure
|
||||
MAP_CAUSE(enXtalErr, RST_BACKUP) // XTAL failure
|
||||
|
||||
#undef MAP_CAUSE
|
||||
return cause;
|
||||
}
|
||||
|
||||
void MarlinHAL::clear_reset_source() {
|
||||
RMU_ClrResetFlag();
|
||||
}
|
||||
|
||||
int MarlinHAL::freeMemory() {
|
||||
volatile char top;
|
||||
return &top - _sbrk(0);
|
||||
}
|
||||
|
||||
void MarlinHAL::adc_init() {}
|
||||
|
||||
void MarlinHAL::adc_enable(const pin_t pin) {
|
||||
#if TEMP_SENSOR_SOC
|
||||
if (pin == TEMP_SOC_PIN) {
|
||||
// Start OTS, min. 1s between reads
|
||||
ChipTemperature.begin();
|
||||
ChipTemperature.setMinimumReadDeltaMillis(1000);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Just set pin mode to analog
|
||||
pinMode(pin, INPUT_ANALOG);
|
||||
}
|
||||
|
||||
void MarlinHAL::adc_start(const pin_t pin) {
|
||||
MarlinHAL::last_adc_pin = pin;
|
||||
|
||||
#if TEMP_SENSOR_SOC
|
||||
if (pin == TEMP_SOC_PIN) {
|
||||
// Read OTS
|
||||
float temp;
|
||||
if (ChipTemperature.read(temp))
|
||||
MarlinHAL::soc_temp = temp;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
CORE_ASSERT(IS_GPIO_PIN(pin), "adc_start: invalid pin")
|
||||
|
||||
analogReadAsync(pin);
|
||||
}
|
||||
|
||||
bool MarlinHAL::adc_ready() {
|
||||
#if TEMP_SENSOR_SOC
|
||||
if (MarlinHAL::last_adc_pin == TEMP_SOC_PIN) return true;
|
||||
#endif
|
||||
|
||||
CORE_ASSERT(IS_GPIO_PIN(MarlinHAL::last_adc_pin), "adc_ready: invalid pin")
|
||||
|
||||
return getAnalogReadComplete(MarlinHAL::last_adc_pin);
|
||||
}
|
||||
|
||||
uint16_t MarlinHAL::adc_value() {
|
||||
#if TEMP_SENSOR_SOC
|
||||
if (MarlinHAL::last_adc_pin == TEMP_SOC_PIN)
|
||||
return OTS_FLOAT_TO_ADC_READING(MarlinHAL::soc_temp);
|
||||
#endif
|
||||
|
||||
// Read conversion result
|
||||
CORE_ASSERT(IS_GPIO_PIN(MarlinHAL::last_adc_pin), "adc_value: invalid pin")
|
||||
|
||||
return getAnalogReadValue(MarlinHAL::last_adc_pin);
|
||||
}
|
||||
|
||||
void MarlinHAL::set_pwm_duty(const pin_t pin, const uint16_t value, const uint16_t scale, const bool invert) {
|
||||
// Invert value if requested
|
||||
const uint16_t val = invert ? scale - value : value;
|
||||
|
||||
// AnalogWrite the value, core handles the rest
|
||||
// Pin mode should be set by Marlin by calling SET_PWM() before calling this function
|
||||
analogWriteScaled(pin, val, scale);
|
||||
}
|
||||
|
||||
void MarlinHAL::set_pwm_frequency(const pin_t pin, const uint16_t f_desired) {
|
||||
// TODO set_pwm_frequency is not implemented yet
|
||||
panic("set_pwm_frequency is not implemented yet\n");
|
||||
}
|
||||
|
||||
void flashFirmware(const int16_t) { MarlinHAL::reboot(); }
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <core_types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef gpio_pin_t pin_t;
|
||||
|
||||
#if TEMP_SENSOR_SOC
|
||||
/**
|
||||
* Convert ots measurement float to uint16_t for adc_value()
|
||||
*
|
||||
* @note returns float as integer in degrees C * 10, if T > 0
|
||||
*/
|
||||
#define OTS_FLOAT_TO_ADC_READING(T) ((T) > 0 ? ((uint16_t)((T) * 10.0f)) : 0)
|
||||
|
||||
/**
|
||||
* Convert adc_value() uint16_t to ots measurement float
|
||||
*
|
||||
* @note see OTS_FLOAT_TO_ADC_READING for inverse
|
||||
*
|
||||
* @note RAW is oversampled by OVERSAMPLENR, so we need to divide first
|
||||
*/
|
||||
#define TEMP_SOC_SENSOR(RAW) ((float)(((RAW) / OVERSAMPLENR) / 10))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* HAL class for Marlin on HC32F460
|
||||
*/
|
||||
class MarlinHAL {
|
||||
public:
|
||||
// Earliest possible init, before setup()
|
||||
MarlinHAL();
|
||||
|
||||
// Watchdog
|
||||
static void watchdog_init();
|
||||
static void watchdog_refresh();
|
||||
|
||||
static void init(); // Called early in setup()
|
||||
static void init_board(); // Called less early in setup()
|
||||
static void reboot(); // Restart the firmware from 0x0
|
||||
|
||||
// Interrupts
|
||||
static bool isr_state();
|
||||
static void isr_on();
|
||||
static void isr_off();
|
||||
|
||||
static void delay_ms(const int ms);
|
||||
|
||||
// Tasks, called from idle()
|
||||
static void idletask();
|
||||
|
||||
// Reset
|
||||
static uint8_t get_reset_source();
|
||||
static void clear_reset_source();
|
||||
|
||||
// Free SRAM
|
||||
static int freeMemory();
|
||||
|
||||
//
|
||||
// ADC Methods
|
||||
//
|
||||
|
||||
// Called by Temperature::init once at startup
|
||||
static void adc_init();
|
||||
|
||||
// Called by Temperature::init for each sensor at startup
|
||||
static void adc_enable(const pin_t pin);
|
||||
|
||||
// Begin ADC sampling on the given pin. Called from Temperature::isr!
|
||||
static void adc_start(const pin_t pin);
|
||||
|
||||
// Is the ADC ready for reading?
|
||||
static bool adc_ready();
|
||||
|
||||
// The current value of the ADC register
|
||||
static uint16_t adc_value();
|
||||
|
||||
/**
|
||||
* Set the PWM duty cycle for the pin to the given value.
|
||||
* Optionally invert the duty cycle [default = false]
|
||||
* Optionally change the maximum size of the provided value to enable finer PWM duty control [default = 255]
|
||||
* The timer must be pre-configured with set_pwm_frequency() if the default frequency is not desired.
|
||||
*/
|
||||
static void set_pwm_duty(const pin_t pin, const uint16_t value, const uint16_t scale = 255, const bool invert = false);
|
||||
|
||||
/**
|
||||
* Set the frequency of the timer for the given pin.
|
||||
* All Timer PWM pins run at the same frequency.
|
||||
*/
|
||||
static void set_pwm_frequency(const pin_t pin, const uint16_t f_desired);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Pin number of the last pin that was used with adc_start()
|
||||
*/
|
||||
static pin_t last_adc_pin;
|
||||
|
||||
#if TEMP_SENSOR_SOC
|
||||
/**
|
||||
* On-chip temperature sensor value
|
||||
*/
|
||||
static float soc_temp;
|
||||
#endif
|
||||
};
|
||||
|
||||
// M997: Trigger a firmware update from SD card (after upload).
|
||||
// On HC32F460, a reboot is enough to do this.
|
||||
#ifndef PLATFORM_M997_SUPPORT
|
||||
#define PLATFORM_M997_SUPPORT
|
||||
#endif
|
||||
|
||||
void flashFirmware(const int16_t);
|
||||
@@ -0,0 +1,142 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "MarlinSerial.h"
|
||||
#include <drivers/usart/Usart.h>
|
||||
|
||||
/**
|
||||
* Not every MarlinSerial instance should handle emergency parsing, as
|
||||
* it would not make sense to parse GCode from TMC responses
|
||||
*/
|
||||
constexpr bool serial_handles_emergency(int port) {
|
||||
return false
|
||||
#ifdef SERIAL_PORT
|
||||
|| (SERIAL_PORT) == port
|
||||
#endif
|
||||
#ifdef SERIAL_PORT_2
|
||||
|| (SERIAL_PORT_2) == port
|
||||
#endif
|
||||
#ifdef LCD_SERIAL_PORT
|
||||
|| (LCD_SERIAL_PORT) == port
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
// Define serial ports
|
||||
//
|
||||
#define DEFINE_HWSERIAL_MARLIN(name, n) \
|
||||
MSerialT name(serial_handles_emergency(n), \
|
||||
&USART##n##_config, \
|
||||
BOARD_USART##n##_TX_PIN, \
|
||||
BOARD_USART##n##_RX_PIN);
|
||||
|
||||
DEFINE_HWSERIAL_MARLIN(MSerial1, 1);
|
||||
DEFINE_HWSERIAL_MARLIN(MSerial2, 2);
|
||||
|
||||
//
|
||||
// Serial port assertions
|
||||
//
|
||||
|
||||
// Check the type of each serial port by passing it to a template function.
|
||||
// HardwareSerial is known to sometimes hang the controller when an error occurs,
|
||||
// so this case will fail the static assert. All other classes are assumed to be ok.
|
||||
template <typename T>
|
||||
constexpr bool IsSerialClassAllowed(const T &) { return true; }
|
||||
constexpr bool IsSerialClassAllowed(const HardwareSerial &) { return false; }
|
||||
constexpr bool IsSerialClassAllowed(const Usart &) { return false; }
|
||||
|
||||
// If you encounter this error, replace SerialX with MSerialX, for example MSerial3.
|
||||
#define CHECK_CFG_SERIAL(A) static_assert(IsSerialClassAllowed(A), STRINGIFY(A) " is defined incorrectly");
|
||||
#define CHECK_AXIS_SERIAL(A) static_assert(IsSerialClassAllowed(A##_HARDWARE_SERIAL), STRINGIFY(A) "_HARDWARE_SERIAL must be defined in the form MSerial1, rather than Serial1");
|
||||
|
||||
// Non-TMC ports were already validated in HAL.h, so do not require verbose error messages.
|
||||
#ifdef MYSERIAL1
|
||||
CHECK_CFG_SERIAL(MYSERIAL1);
|
||||
#endif
|
||||
#ifdef MYSERIAL2
|
||||
CHECK_CFG_SERIAL(MYSERIAL2);
|
||||
#endif
|
||||
#ifdef LCD_SERIAL
|
||||
CHECK_CFG_SERIAL(LCD_SERIAL);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(X)
|
||||
CHECK_AXIS_SERIAL(X);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(X2)
|
||||
CHECK_AXIS_SERIAL(X2);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(Y)
|
||||
CHECK_AXIS_SERIAL(Y);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(Y2)
|
||||
CHECK_AXIS_SERIAL(Y2);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(Z)
|
||||
CHECK_AXIS_SERIAL(Z);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(Z2)
|
||||
CHECK_AXIS_SERIAL(Z2);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(Z3)
|
||||
CHECK_AXIS_SERIAL(Z3);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(Z4)
|
||||
CHECK_AXIS_SERIAL(Z4);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(I)
|
||||
CHECK_AXIS_SERIAL(I);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(J)
|
||||
CHECK_AXIS_SERIAL(J);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(K)
|
||||
CHECK_AXIS_SERIAL(K);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E0)
|
||||
CHECK_AXIS_SERIAL(E0);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E1)
|
||||
CHECK_AXIS_SERIAL(E1);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E2)
|
||||
CHECK_AXIS_SERIAL(E2);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E3)
|
||||
CHECK_AXIS_SERIAL(E3);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E4)
|
||||
CHECK_AXIS_SERIAL(E4);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E5)
|
||||
CHECK_AXIS_SERIAL(E5);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E6)
|
||||
CHECK_AXIS_SERIAL(E6);
|
||||
#endif
|
||||
#if AXIS_HAS_HW_SERIAL(E7)
|
||||
CHECK_AXIS_SERIAL(E7);
|
||||
#endif
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../core/serial_hook.h"
|
||||
#include <drivers/usart/Usart.h>
|
||||
|
||||
// Optionally set uart IRQ priority to reduce overflow errors
|
||||
// #define UART_IRQ_PRIO 1
|
||||
|
||||
struct MarlinSerial : public Usart {
|
||||
MarlinSerial(struct usart_config_t *usart_device, gpio_pin_t tx_pin, gpio_pin_t rx_pin) : Usart(usart_device, tx_pin, rx_pin) {}
|
||||
|
||||
#ifdef UART_IRQ_PRIO
|
||||
void setPriority() {
|
||||
NVIC_SetPriority(c_dev()->interrupts.rx_data_available.interrupt_number, UART_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.rx_error.interrupt_number, UART_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.tx_buffer_empty.interrupt_number, UART_IRQ_PRIO);
|
||||
NVIC_SetPriority(c_dev()->interrupts.tx_complete.interrupt_number, UART_IRQ_PRIO);
|
||||
}
|
||||
|
||||
void begin(uint32_t baud) {
|
||||
Usart::begin(baud);
|
||||
setPriority();
|
||||
}
|
||||
|
||||
void begin(uint32_t baud, uint8_t config) {
|
||||
Usart::begin(baud, config);
|
||||
setPriority();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef Serial1Class<MarlinSerial> MSerialT;
|
||||
|
||||
extern MSerialT MSerial1;
|
||||
extern MSerialT MSerial2;
|
||||
@@ -0,0 +1,151 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include <drivers/panic/panic.h>
|
||||
|
||||
#if ANY(POSTMORTEM_DEBUGGING, PANIC_ENABLE)
|
||||
|
||||
#include <drivers/usart/usart_sync.h>
|
||||
|
||||
//
|
||||
// Shared by both panic and PostMortem debugging
|
||||
//
|
||||
static void minserial_begin() {
|
||||
#if !WITHIN(SERIAL_PORT, 1, 3)
|
||||
#warning "MinSerial requires a physical UART port for output."
|
||||
#warning "Disabling MinSerial because the used serial port is not a HW port."
|
||||
#else
|
||||
|
||||
// Prepare usart_sync configuration
|
||||
const stc_usart_uart_init_t usart_config = {
|
||||
.enClkMode = UsartIntClkCkNoOutput,
|
||||
.enClkDiv = UsartClkDiv_1,
|
||||
.enDataLength = UsartDataBits8,
|
||||
.enDirection = UsartDataLsbFirst,
|
||||
.enStopBit = UsartOneStopBit,
|
||||
.enParity = UsartParityNone,
|
||||
.enSampleMode = UsartSampleBit8,
|
||||
.enDetectMode = UsartStartBitFallEdge,
|
||||
.enHwFlow = UsartRtsEnable,
|
||||
};
|
||||
|
||||
// Initializes usart_sync driver
|
||||
#define __USART_SYNC_INIT(port_no, baud, config) \
|
||||
usart_sync_init(M4_USART##port_no, \
|
||||
BOARD_USART##port_no##_TX_PIN, \
|
||||
baud, \
|
||||
config);
|
||||
#define USART_SYNC_INIT(port_no, baud, config) __USART_SYNC_INIT(port_no, baud, config)
|
||||
|
||||
// This will reset the baudrate to what is defined in Configuration.h,
|
||||
// ignoring any changes made with e.g. M575.
|
||||
// keeping the dynamic baudrate would require re-calculating the baudrate
|
||||
// using the register values, which is a pain...
|
||||
|
||||
// TODO: retain dynamic baudrate in MinSerial init
|
||||
// -> see USART_SetBaudrate(), needs to be inverted
|
||||
USART_SYNC_INIT(SERIAL_PORT, BAUDRATE, &usart_config);
|
||||
|
||||
#undef USART_SYNC_INIT
|
||||
#undef __USART_SYNC_INIT
|
||||
#endif
|
||||
}
|
||||
|
||||
static void minserial_putc(char c) {
|
||||
#if WITHIN(SERIAL_PORT, 1, 3)
|
||||
#define __USART_SYNC_PUTC(port_no, ch) usart_sync_putc(M4_USART##port_no, ch);
|
||||
#define USART_SYNC_PUTC(port_no, ch) __USART_SYNC_PUTC(port_no, ch)
|
||||
|
||||
USART_SYNC_PUTC(SERIAL_PORT, c);
|
||||
|
||||
#undef USART_SYNC_PUTC
|
||||
#undef __USART_SYNC_PUTC
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Panic only
|
||||
//
|
||||
#ifdef PANIC_ENABLE
|
||||
|
||||
void panic_begin() {
|
||||
minserial_begin();
|
||||
panic_puts("\n\nPANIC:\n");
|
||||
}
|
||||
|
||||
void panic_puts(const char *str) {
|
||||
while (*str) minserial_putc(*str++);
|
||||
}
|
||||
|
||||
#endif // PANIC_ENABLE
|
||||
|
||||
//
|
||||
// PostMortem debugging only
|
||||
//
|
||||
#if ENABLED(POSTMORTEM_DEBUGGING)
|
||||
|
||||
#include "../shared/MinSerial.h"
|
||||
#include <drivers/panic/fault_handlers.h>
|
||||
|
||||
void fault_handlers_init() {
|
||||
// Enable cpu traps:
|
||||
// - Divide by zero
|
||||
// - Unaligned access
|
||||
SCB->CCR |= SCB_CCR_DIV_0_TRP_Msk; //| SCB_CCR_UNALIGN_TRP_Msk;
|
||||
}
|
||||
|
||||
void install_min_serial() {
|
||||
HAL_min_serial_init = &minserial_begin;
|
||||
HAL_min_serial_out = &minserial_putc;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
__attribute__((naked)) void JumpHandler_ASM() {
|
||||
__asm__ __volatile__(
|
||||
"b CommonHandler_ASM\n");
|
||||
}
|
||||
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) HardFault_Handler();
|
||||
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) BusFault_Handler();
|
||||
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) UsageFault_Handler();
|
||||
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) MemManage_Handler();
|
||||
void __attribute__((naked, alias("JumpHandler_ASM"), nothrow)) NMI_Handler();
|
||||
}
|
||||
|
||||
#endif // POSTMORTEM_DEBUGGING
|
||||
#endif // POSTMORTEM_DEBUGGING || PANIC_ENABLE
|
||||
|
||||
//
|
||||
// Panic_end is always required to print the '!!' to the host
|
||||
//
|
||||
void panic_end() {
|
||||
// Print '!!' to signal error to host
|
||||
// Do it 10x so it's not missed
|
||||
for (uint_fast8_t i = 10; i--;) panic_printf("\n!!\n");
|
||||
|
||||
// Then, reset the board
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,110 @@
|
||||
# HC32F460 HAL
|
||||
|
||||
This document provides notes on the HAL for the HC32F460 MCU.
|
||||
|
||||
## Adding support for a new board
|
||||
|
||||
The HC32F460 HAL is designed to be generic enough for any HC32F460-based board. Adding support for a new HC32F460-based board will require the following steps:
|
||||
|
||||
1. Follow [the usual instructions](https://marlinfw.org/docs/development/boards.html#adding-a-new-board) to add a new board to Marlin. (i.e., Add a pins file, edit `boards.h` and `pins.h`, etc.)
|
||||
2. Determine the flash size your board uses:
|
||||
- Examine the board's main processor. (Refer the naming key in `hc32.ini`.)
|
||||
- Extend the `HC32F460C_common` base env for 256K, or `HC32F460E_common` for 512K.
|
||||
3. Determine your board's application start address (see [below](#finding-the-application-start-address))
|
||||
4. Set `board_build.ld_args.flash_start` to the app start address once you've found it. If your board doesn't use a bootloader, you may be able to use the "ICSP" header or DFU. This document will be updated once we have more information about flashing without a bootloader.
|
||||
|
||||
### Finding the application start address
|
||||
|
||||
If the board contains a bootloader you'll need to find the application address. This is the address the bootloader jumps to after it's done. You can find this address in a few different ways:
|
||||
|
||||
#### 1. Using log messages
|
||||
|
||||
If you're lucky, the bootloader may print the app start address on the serial output during boot. To check for this, use your favorite serial monitor to observe the serial output when you power on the board. Look for a message like "Jumping to 0xC000" or "GotoApp->addr=0xC000". This line would be printed before Marlin's "start" message.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
[...]
|
||||
version 1.2
|
||||
sdio init success!
|
||||
Disk init
|
||||
Tips ------ None Firmware file
|
||||
GotoApp->addr=0xC000
|
||||
|
||||
start
|
||||
[...]
|
||||
```
|
||||
|
||||
#### 2. Using published source code
|
||||
|
||||
If the vendor has published Marlin source code that includes the bootloader, you can search the bootloader source code for the address. Begin your search with the following steps:
|
||||
|
||||
1. Find the code that sets the vector table offset
|
||||
|
||||
The vector table offset is usually set using a line like this:
|
||||
|
||||
```c
|
||||
SCB->VTOR = ((uint32_t) APP_START_ADDRESS & SCB_VTOR_TBLOFF_Msk);
|
||||
```
|
||||
|
||||
Just searching for `SCB->VTOR` should yield some results. From there, you just need to look at the value that's assigned to it. The example uses `APP_START_ADDRESS`.
|
||||
|
||||
> [!NOTE]
|
||||
> Some vendors publish incomplete source code. But they sometimes leave version control related files in the repo, which can contain previous version of files that were removed. Find these by including folders like `.git` or `.svn` in your search.
|
||||
|
||||
> [!NOTE]
|
||||
> The example is based on the [Voxelab-64/Aquila_X2](https://github.com/Voxelab-64/Aquila_X2/blob/d1f23adf96920996b979bc31023d1dce236d05db/firmware/Sources/.svn/pristine/ec/ec82bcb480b511906bc3e6658450e3a803ab9813.svn-base#L96) which actually includes deleted files in its repo.
|
||||
|
||||
2. Using a linker script
|
||||
|
||||
If the repository contains a linker script, look at the memory regions, specifically a region named `FLASH` or similar. The `ORIGIN` of that region will be the application start address.
|
||||
|
||||
**Example:**
|
||||
|
||||
```ld
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx): ORIGIN = 0x0000C000, LENGTH = 512K
|
||||
OTP (rx): ORIGIN = 0x03000C00, LENGTH = 1020
|
||||
RAM (rwx): ORIGIN = 0x1FFF8000, LENGTH = 188K
|
||||
RET_RAM (rwx): ORIGIN = 0x200F0000, LENGTH = 4K
|
||||
}
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> This example is based on [Voxelab-64/Aquila_X2](https://github.com/Voxelab-64/Aquila_X2/blob/d1f23adf96920996b979bc31023d1dce236d05db/firmware/Sources/main/hdsc32core/hc32f46x_flash.ld#L55)
|
||||
|
||||
## Documentation on the HC32F460
|
||||
|
||||
Due to uncertain licensing (w/r/t STMicro), documentation for the HC32F460 is only available upon request. Documentation includes the following:
|
||||
|
||||
- Datasheet, user manual, reference manual
|
||||
- Application notes for the DDL
|
||||
- DDL source code
|
||||
- IDE support packages (Keil, IAR, ...) including .svd files
|
||||
- Programming software
|
||||
- Emulator / debugger drivers
|
||||
- Development board documentation and schematics
|
||||
- Errata documents
|
||||
- (Limited) sales information
|
||||
- Full Voxelab firmware source code
|
||||
- Documents in Chinese or English (machine translated)
|
||||
|
||||
Contact me on Discord (@shadow578) if you need it.
|
||||
|
||||
## Dependencies
|
||||
|
||||
This HAL depends on the following projects:
|
||||
|
||||
- [shadow578/platform-hc32f46x](https://github.com/shadow578/platform-hc32f46x) (PlatformIO platform for HC32F46x)
|
||||
- [shadow578/framework-arduino-hc32f46x](https://github.com/shadow578/framework-arduino-hc32f46x) (Arduino framework for HC32F46x)
|
||||
- [shadow578/framework-hc32f46x-ddl](https://github.com/shadow578/framework-hc32f46x-ddl) (HC32F46x DDL framework)
|
||||
|
||||
## Credits
|
||||
|
||||
This HAL wouldn't be possible without the following projects:
|
||||
|
||||
- [Voxelab-64/Aquila_X2](https://github.com/Voxelab-64/Aquila_X2) (original implementation)
|
||||
- [alexqzd/Marlin-H32](https://github.com/alexqzd/Marlin-H32) (misc. fixes to the original implementation)
|
||||
- [kgoveas/Arduino-Core-Template](https://github.com/kgoveas/Arduino-Core-Template) (template for Arduino headers)
|
||||
- [stm32duino/Arduino_Core_STM32](https://github.com/stm32duino/Arduino_Core_STM32) (misc. Arduino functions)
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_SERVOS
|
||||
|
||||
#include "Servo.h"
|
||||
|
||||
static uint8_t servoCount = 0;
|
||||
static MarlinServo *servos[NUM_SERVOS] = {0};
|
||||
|
||||
constexpr uint32_t servoDelays[] = SERVO_DELAY;
|
||||
static_assert(COUNT(servoDelays) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
|
||||
|
||||
//
|
||||
// MarlinServo impl
|
||||
//
|
||||
MarlinServo::MarlinServo() {
|
||||
this->channel = servoCount++;
|
||||
servos[this->channel] = this;
|
||||
}
|
||||
|
||||
int8_t MarlinServo::attach(const pin_t apin) {
|
||||
// Use last pin if pin not given
|
||||
if (apin >= 0) this->pin = apin;
|
||||
|
||||
// If attached, do nothing but no fail
|
||||
if (this->servo.attached()) return 0;
|
||||
|
||||
// Attach
|
||||
const uint8_t rc = this->servo.attach(this->pin);
|
||||
return rc == INVALID_SERVO ? -1 : rc;
|
||||
}
|
||||
|
||||
void MarlinServo::detach() {
|
||||
this->servo.detach();
|
||||
}
|
||||
|
||||
bool MarlinServo::attached() {
|
||||
return this->servo.attached();
|
||||
}
|
||||
|
||||
void MarlinServo::write(servo_angle_t angle) {
|
||||
this->angle = angle;
|
||||
this->servo.write(angle);
|
||||
}
|
||||
|
||||
void MarlinServo::move(servo_angle_t angle) {
|
||||
// Attach with pin=-1 to use last pin attach() was called with
|
||||
if (attach(-1) < 0) return; // Attach failed
|
||||
|
||||
write(angle);
|
||||
safe_delay(servoDelays[this->channel]);
|
||||
TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
|
||||
}
|
||||
|
||||
servo_angle_t MarlinServo::read() {
|
||||
return TERN(OPTIMISTIC_SERVO_READ, this->angle, this->servo.read());
|
||||
}
|
||||
|
||||
#endif // HAS_SERVOS
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include <Servo.h>
|
||||
|
||||
/**
|
||||
* return last written value in servo.read instead of calculated value
|
||||
*/
|
||||
#define OPTIMISTIC_SERVO_READ
|
||||
|
||||
/**
|
||||
* @brief servo lib wrapper for marlin
|
||||
*/
|
||||
class MarlinServo {
|
||||
public:
|
||||
MarlinServo();
|
||||
|
||||
/**
|
||||
* @brief attach the pin to the servo, set pin mode, return channel number
|
||||
* @param pin pin to attach to
|
||||
* @return channel number, -1 if failed
|
||||
*/
|
||||
int8_t attach(const pin_t apin);
|
||||
|
||||
/**
|
||||
* @brief detach servo
|
||||
*/
|
||||
void detach();
|
||||
|
||||
/**
|
||||
* @brief is servo attached?
|
||||
*/
|
||||
bool attached();
|
||||
|
||||
/**
|
||||
* @brief set servo angle
|
||||
* @param angle new angle
|
||||
*/
|
||||
void write(servo_angle_t angle);
|
||||
|
||||
/**
|
||||
* @brief attach servo, move to angle, delay then detach
|
||||
* @param angle angle to move to
|
||||
*/
|
||||
void move(servo_angle_t angle);
|
||||
|
||||
/**
|
||||
* @brief read current angle
|
||||
* @return current angle betwwne 0 and 180 degrees
|
||||
*/
|
||||
servo_angle_t read();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief internal servo object, provided by arduino core
|
||||
*/
|
||||
Servo servo;
|
||||
|
||||
/**
|
||||
* @brief virtual servo channel
|
||||
*/
|
||||
uint8_t channel;
|
||||
|
||||
/**
|
||||
* @brief pin the servo attached to last
|
||||
*/
|
||||
pin_t pin;
|
||||
|
||||
/**
|
||||
* @brief last known servo angle
|
||||
*/
|
||||
servo_angle_t angle;
|
||||
};
|
||||
|
||||
// Alias for marlin HAL
|
||||
typedef MarlinServo hal_servo_t;
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* PersistentStore for Arduino-style EEPROM interface
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for IIC_BL24CXX_EEPROM."
|
||||
#endif
|
||||
|
||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
eeprom_init();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() { return true; }
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
while (size--) {
|
||||
uint8_t v = *value;
|
||||
uint8_t *const p = (uint8_t *const)pos;
|
||||
|
||||
// EEPROM has only ~100,000 write cycles,
|
||||
// so only write bytes that have changed!
|
||||
if (v != eeprom_read_byte(p)) {
|
||||
eeprom_write_byte(p, v);
|
||||
delay(2);
|
||||
if (eeprom_read_byte(p) != v) {
|
||||
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
crc16(crc, &v, 1);
|
||||
pos++;
|
||||
value++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size,
|
||||
uint16_t *crc, const bool writing /*=true*/) {
|
||||
do {
|
||||
uint8_t *const p = (uint8_t *const)pos;
|
||||
uint8_t c = eeprom_read_byte(p);
|
||||
if (writing)
|
||||
{
|
||||
*value = c;
|
||||
}
|
||||
|
||||
crc16(crc, &c, 1);
|
||||
pos++;
|
||||
value++;
|
||||
} while (--size);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // IIC_BL24CXX_EEPROM
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Platform-independent Arduino functions for I2C EEPROM.
|
||||
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
|
||||
#include "../../libs/BL24CXX.h"
|
||||
#include "../shared/eeprom_if.h"
|
||||
|
||||
void eeprom_init() {
|
||||
BL24CXX::init();
|
||||
}
|
||||
|
||||
void eeprom_write_byte(uint8_t *pos, unsigned char value) {
|
||||
const unsigned eeprom_address = (unsigned)pos;
|
||||
return BL24CXX::writeOneByte(eeprom_address, value);
|
||||
}
|
||||
|
||||
uint8_t eeprom_read_byte(uint8_t *pos) {
|
||||
const unsigned eeprom_address = (unsigned)pos;
|
||||
return BL24CXX::readOneByte(eeprom_address);
|
||||
}
|
||||
|
||||
#endif // IIC_BL24CXX_EEPROM
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implementation of EEPROM settings in SD Card
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION)
|
||||
|
||||
#include "../shared/eeprom_api.h"
|
||||
#include "../../sd/cardreader.h"
|
||||
|
||||
#define EEPROM_FILENAME "eeprom.dat"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
||||
#endif
|
||||
|
||||
size_t PersistentStore::capacity() {
|
||||
return MARLIN_EEPROM_SIZE;
|
||||
}
|
||||
|
||||
#define _ALIGN(x) __attribute__((aligned(x)))
|
||||
static char _ALIGN(4) HAL_eeprom_data[MARLIN_EEPROM_SIZE];
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
if (!card.isMounted()) return false;
|
||||
|
||||
MediaFile file, root = card.getroot();
|
||||
if (!file.open(&root, EEPROM_FILENAME, O_RDONLY))
|
||||
return true; // False aborts the save
|
||||
|
||||
int bytes_read = file.read(HAL_eeprom_data, MARLIN_EEPROM_SIZE);
|
||||
if (bytes_read < 0) return false;
|
||||
|
||||
for (; bytes_read < MARLIN_EEPROM_SIZE; bytes_read++)
|
||||
HAL_eeprom_data[bytes_read] = 0xFF;
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::access_finish() {
|
||||
if (!card.isMounted()) return false;
|
||||
|
||||
MediaFile file, root = card.getroot();
|
||||
int bytes_written = 0;
|
||||
if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
|
||||
bytes_written = file.write(HAL_eeprom_data, MARLIN_EEPROM_SIZE);
|
||||
file.close();
|
||||
}
|
||||
|
||||
return (bytes_written == MARLIN_EEPROM_SIZE);
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
for (size_t i = 0; i < size; i++) HAL_eeprom_data[pos + i] = value[i];
|
||||
|
||||
crc16(crc, value, size);
|
||||
pos += size;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
uint8_t c = HAL_eeprom_data[pos + i];
|
||||
if (writing) value[i] = c;
|
||||
crc16(crc, &c, 1);
|
||||
}
|
||||
|
||||
pos += size;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // SDCARD_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if USE_WIRED_EEPROM
|
||||
|
||||
#warning "SPI / I2C EEPROM has not been tested on HC32F460."
|
||||
|
||||
/**
|
||||
* PersistentStore for Arduino-style EEPROM interface
|
||||
* with simple implementations supplied by Marlin.
|
||||
*/
|
||||
|
||||
#include "../shared/eeprom_if.h"
|
||||
#include "../shared/eeprom_api.h"
|
||||
|
||||
#ifndef MARLIN_EEPROM_SIZE
|
||||
#error "MARLIN_EEPROM_SIZE is required for I2C / SPI EEPROM."
|
||||
#endif
|
||||
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||
|
||||
bool PersistentStore::access_finish() { return true; }
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
eeprom_init();
|
||||
#if ENABLED(SPI_EEPROM)
|
||||
#if SPI_CHAN_EEPROM1 == 1
|
||||
SET_OUTPUT(BOARD_SPI1_SCK_PIN);
|
||||
SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
|
||||
SET_INPUT(BOARD_SPI1_MISO_PIN);
|
||||
SET_OUTPUT(SPI_EEPROM1_CS);
|
||||
#endif
|
||||
|
||||
spiInit(0);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
|
||||
while (size--) {
|
||||
uint8_t *const p = (uint8_t *const)pos;
|
||||
uint8_t v = *value;
|
||||
// EEPROM has only ~100,000 write cycles,
|
||||
// so only write bytes that have changed!
|
||||
if (v != eeprom_read_byte(p)) {
|
||||
eeprom_write_byte(p, v);
|
||||
if (eeprom_read_byte(p) != v) {
|
||||
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
crc16(crc, &v, 1);
|
||||
pos++;
|
||||
value++;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t *crc, const bool writing /*=true*/) {
|
||||
do {
|
||||
uint8_t c = eeprom_read_byte((uint8_t *)pos);
|
||||
if (writing && value) {
|
||||
*value = c;
|
||||
}
|
||||
|
||||
crc16(crc, &c, 1);
|
||||
pos++;
|
||||
value++;
|
||||
} while (--size);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // USE_WIRED_EEPROM
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "endstop_interrupts.h"
|
||||
#include "../../module/endstops.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#define ENDSTOP_IRQ_PRIORITY DDL_IRQ_PRIORITY_06
|
||||
|
||||
//
|
||||
// IRQ handler
|
||||
//
|
||||
void endstopIRQHandler() {
|
||||
bool flag = false;
|
||||
|
||||
// Check all irq flags
|
||||
#define CHECK(name) TERN_(USE_##name, flag |= checkIRQFlag(name##_PIN, /*clear*/ true))
|
||||
|
||||
CHECK(X_MAX);
|
||||
CHECK(X_MIN);
|
||||
|
||||
CHECK(Y_MAX);
|
||||
CHECK(Y_MIN);
|
||||
|
||||
CHECK(Z_MAX);
|
||||
CHECK(Z_MIN);
|
||||
|
||||
CHECK(Z2_MAX);
|
||||
CHECK(Z2_MIN);
|
||||
|
||||
CHECK(Z3_MAX);
|
||||
CHECK(Z3_MIN);
|
||||
|
||||
CHECK(Z_MIN_PROBE);
|
||||
|
||||
// Update endstops
|
||||
if (flag) endstops.update();
|
||||
|
||||
#undef CHECK
|
||||
}
|
||||
|
||||
//
|
||||
// HAL functions
|
||||
//
|
||||
void setup_endstop_interrupts() {
|
||||
#define SETUP(name) TERN_(USE_##name, attachInterrupt(name##_PIN, endstopIRQHandler, CHANGE); setInterruptPriority(name##_PIN, ENDSTOP_IRQ_PRIORITY))
|
||||
|
||||
SETUP(X_MAX);
|
||||
SETUP(X_MIN);
|
||||
|
||||
SETUP(Y_MAX);
|
||||
SETUP(Y_MIN);
|
||||
|
||||
SETUP(Z_MAX);
|
||||
SETUP(Z_MIN);
|
||||
|
||||
SETUP(Z2_MAX);
|
||||
SETUP(Z2_MIN);
|
||||
|
||||
SETUP(Z3_MAX);
|
||||
SETUP(Z3_MIN);
|
||||
|
||||
SETUP(Z_MIN_PROBE);
|
||||
|
||||
#undef SETUP
|
||||
}
|
||||
|
||||
// Ensure 1 - 10 IRQs are registered
|
||||
// Disable some endstops if you encounter this error
|
||||
#define ENDSTOPS_INTERRUPTS_COUNT COUNT_ENABLED(USE_X_MAX, USE_X_MIN, USE_Y_MAX, USE_Y_MIN, USE_Z_MAX, USE_Z_MIN, USE_Z2_MAX, USE_Z2_MIN, USE_Z3_MAX, USE_Z3_MIN, USE_Z_MIN_PROBE)
|
||||
#if ENDSTOPS_INTERRUPTS_COUNT > 10
|
||||
#error "Too many endstop interrupts! HC32F460 only supports 10 endstop interrupts."
|
||||
#elif ENDSTOPS_INTERRUPTS_COUNT == 0
|
||||
#error "No endstop interrupts are enabled! Comment out this line to continue."
|
||||
#endif
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Endstop interrupts for HC32F460 based targets.
|
||||
*
|
||||
* On HC32F460, all pins support external interrupt capability, with some restrictions.
|
||||
* See the documentation of WInterrupts#attachInterrupt() for details.
|
||||
*
|
||||
* TL;DR
|
||||
* any 16 pins can be used, but only one pin per EXTI line (so PA0 and PB0 are no-good).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Endstop Interrupts
|
||||
*
|
||||
* Without endstop interrupts the endstop pins must be polled continually in
|
||||
* the temperature-ISR via endstops.update(), most of the time finding no change.
|
||||
* With this feature endstops.update() is called only when we know that at
|
||||
* least one endstop has changed state, saving valuable CPU cycles.
|
||||
*
|
||||
* This feature only works when all used endstop pins can generate an 'external interrupt'.
|
||||
*
|
||||
* Test whether pins issue interrupts on your board by flashing 'pin_interrupt_test.ino'.
|
||||
* (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
|
||||
*/
|
||||
|
||||
void setup_endstop_interrupts();
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Fast I/O interfaces for HC32F460
|
||||
* These use GPIO functions instead of Direct Port Manipulation.
|
||||
*/
|
||||
#include <wiring_digital.h>
|
||||
#include <wiring_analog.h>
|
||||
#include <drivers/gpio/gpio.h>
|
||||
|
||||
#define READ(IO) (GPIO_GetBit(IO) ? HIGH : LOW)
|
||||
#define WRITE(IO, V) (((V) > 0) ? GPIO_SetBits(IO) : GPIO_ResetBits(IO))
|
||||
#define TOGGLE(IO) (GPIO_Toggle(IO))
|
||||
|
||||
#define _GET_MODE(IO) getPinMode(IO)
|
||||
#define _SET_MODE(IO, M) pinMode(IO, M)
|
||||
#define _SET_OUTPUT(IO) _SET_MODE(IO, OUTPUT)
|
||||
|
||||
#define OUT_WRITE(IO, V) \
|
||||
do { \
|
||||
_SET_OUTPUT(IO); \
|
||||
WRITE(IO, V); \
|
||||
} while (0)
|
||||
|
||||
#define SET_INPUT(IO) _SET_MODE(IO, INPUT_FLOATING)
|
||||
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP)
|
||||
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN)
|
||||
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
|
||||
#define SET_PWM(IO) _SET_MODE(IO, OUTPUT_PWM)
|
||||
|
||||
#define IS_INPUT(IO) ( \
|
||||
_GET_MODE(IO) == INPUT || \
|
||||
_GET_MODE(IO) == INPUT_FLOATING || \
|
||||
_GET_MODE(IO) == INPUT_ANALOG || \
|
||||
_GET_MODE(IO) == INPUT_PULLUP || \
|
||||
_GET_MODE(IO) == INPUT_PULLDOWN)
|
||||
|
||||
#define IS_OUTPUT(IO) ( \
|
||||
_GET_MODE(IO) == OUTPUT || \
|
||||
_GET_MODE(IO) == OUTPUT_PWM || \
|
||||
_GET_MODE(IO) == OUTPUT_OPEN_DRAIN)
|
||||
|
||||
#define PWM_PIN(IO) isAnalogWritePin(IO)
|
||||
|
||||
#define extDigitalRead(IO) digitalRead(IO)
|
||||
#define extDigitalWrite(IO, V) digitalWrite(IO, V)
|
||||
|
||||
#define NO_COMPILE_TIME_PWM // Can't check for PWM at compile time
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if ALL(HAS_MARLINUI_U8GLIB, FORCE_SOFT_SPI)
|
||||
#define U8G_SW_SPI_HC32 1
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef TEMP_SOC_PIN
|
||||
#define TEMP_SOC_PIN 0xFF // Dummy that is not a valid GPIO, HAL checks for this
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
// If no real EEPROM, Flash emulation, or SRAM emulation is available fall back to SD emulation
|
||||
#if USE_FALLBACK_EEPROM
|
||||
#define SDCARD_EEPROM_EMULATION
|
||||
#elif ANY(I2C_EEPROM, SPI_EEPROM)
|
||||
#define USE_SHARED_EEPROM 1
|
||||
#endif
|
||||
|
||||
// Allow SD support to be disabled
|
||||
#if !HAS_MEDIA
|
||||
#undef ONBOARD_SDIO
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef BOARD_XTAL_FREQUENCY
|
||||
#error "BOARD_XTAL_FREQUENCY is required for HC32F460."
|
||||
#endif
|
||||
|
||||
#if ENABLED(FAST_PWM_FAN)
|
||||
#error "FAST_PWM_FAN is not yet implemented for this platform."
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SW_SERIAL) && HAS_TMC_SW_SERIAL
|
||||
#error "Missing SoftwareSerial implementation."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SDCARD_EEPROM_EMULATION) && !HAS_MEDIA
|
||||
#undef SDCARD_EEPROM_EMULATION // Avoid additional error noise
|
||||
#if USE_FALLBACK_EEPROM
|
||||
#warning "EEPROM type not specified. Fallback is SDCARD_EEPROM_EMULATION."
|
||||
#endif
|
||||
|
||||
#error "SDCARD_EEPROM_EMULATION requires SDSUPPORT. Enable SDSUPPORT or choose another EEPROM emulation."
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|
||||
#error "SERIAL_STATS_MAX_RX_QUEUED is not supported on this platform."
|
||||
#elif ENABLED(SERIAL_STATS_DROPPED_RX)
|
||||
#error "SERIAL_STATS_DROPPED_RX is not supported on this platform."
|
||||
#endif
|
||||
|
||||
#if ENABLED(NEOPIXEL_LED) && DISABLED(MKS_MINI_12864_V3)
|
||||
#error "NEOPIXEL_LED (Adafruit NeoPixel) is not supported for HC32F460. Comment out this line to proceed at your own risk!"
|
||||
#endif
|
||||
|
||||
// Emergency Parser needs at least one serial with HardwareSerial.
|
||||
#if ENABLED(EMERGENCY_PARSER) && ((SERIAL_PORT == -1 && !defined(SERIAL_PORT_2)) || (SERIAL_PORT_2 == -1 && !defined(SERIAL_PORT)))
|
||||
#error "EMERGENCY_PARSER is only supported by HardwareSerial on HC32F460."
|
||||
#endif
|
||||
|
||||
#if TEMP_SENSOR_SOC
|
||||
#if !defined(TEMP_SOC_PIN)
|
||||
#error "TEMP_SOC_PIN must be defined to use TEMP_SENSOR_SOC."
|
||||
#endif
|
||||
|
||||
#if defined(TEMP_SOC_PIN) && IS_GPIO_PIN(TEMP_SOC_PIN)
|
||||
#error "TEMP_SOC_PIN must not be a valid GPIO pin to avoid conflicts."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(POSTMORTEM_DEBUGGING) && !defined(CORE_DISABLE_FAULT_HANDLER)
|
||||
#error "POSTMORTEM_DEBUGGING requires CORE_DISABLE_FAULT_HANDLER to be set."
|
||||
#endif
|
||||
|
||||
#if defined(PANIC_ENABLE)
|
||||
#if defined(PANIC_USART1_TX_PIN) || defined(PANIC_USART2_TX_PIN) || defined(PANIC_USART3_TX_PIN) || defined(PANIC_USART3_TX_PIN)
|
||||
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "fastio.h"
|
||||
#include <drivers/timera/timera_pwm.h>
|
||||
|
||||
//
|
||||
// Translation of routines & variables used by pinsDebug.h
|
||||
//
|
||||
#ifndef BOARD_NR_GPIO_PINS
|
||||
#error "Expected BOARD_NR_GPIO_PINS not found."
|
||||
#endif
|
||||
|
||||
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
|
||||
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
|
||||
#define VALID_PIN(pin) IS_GPIO_PIN(pin)
|
||||
|
||||
// Note: pin_array is defined in `Marlin/src/pins/pinsDebug.h`, and since this file is included
|
||||
// after it, it is available in this file as well.
|
||||
#define GET_ARRAY_PIN(p) pin_t(pin_array[p].pin)
|
||||
#define digitalRead_mod(p) extDigitalRead(p)
|
||||
#define PRINT_PIN(p) \
|
||||
do { \
|
||||
sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); \
|
||||
SERIAL_ECHO(buffer); \
|
||||
} while (0)
|
||||
#define PRINT_PIN_ANALOG(p) \
|
||||
do { \
|
||||
sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); \
|
||||
SERIAL_ECHO(buffer); \
|
||||
} while (0)
|
||||
#define PRINT_PORT(p) print_port(p)
|
||||
#define PRINT_ARRAY_NAME(x) \
|
||||
do { \
|
||||
sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); \
|
||||
SERIAL_ECHO(buffer); \
|
||||
} while (0)
|
||||
|
||||
#define MULTI_NAME_PAD 21 // Space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
//
|
||||
// Pins that will cause a hang / reset / disconnect in M43 Toggle and Watch utils
|
||||
//
|
||||
#ifndef M43_NEVER_TOUCH
|
||||
// Don't touch any of the following pins:
|
||||
// - Host serial pins, and
|
||||
// - Pins that could be connected to oscillators (see datasheet, Table 2.1):
|
||||
// - XTAL = PH0, PH1
|
||||
// - XTAL32 = PC14, PC15
|
||||
#define IS_HOST_USART_PIN(Q) (Q == BOARD_USART2_TX_PIN || Q == BOARD_USART2_RX_PIN)
|
||||
#define IS_OSC_PIN(Q) (Q == PH0 || Q == PH1 || Q == PC14 || Q == PC15)
|
||||
|
||||
#define M43_NEVER_TOUCH(Q) (IS_HOST_USART_PIN(Q) || IS_OSC_PIN(Q))
|
||||
#endif
|
||||
|
||||
static pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return -1;
|
||||
const int8_t adc_channel = int8_t(PIN_MAP[pin].adc_info.channel);
|
||||
return pin_t(adc_channel);
|
||||
}
|
||||
|
||||
static bool IS_ANALOG(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return false;
|
||||
|
||||
if (PIN_MAP[pin].adc_info.channel != ADC_PIN_INVALID)
|
||||
return _GET_MODE(pin) == INPUT_ANALOG && !M43_NEVER_TOUCH(pin);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool GET_PINMODE(const pin_t pin) {
|
||||
return VALID_PIN(pin) && !IS_INPUT(pin);
|
||||
}
|
||||
|
||||
static bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
|
||||
const pin_t pin = GET_ARRAY_PIN(array_pin);
|
||||
return (!IS_ANALOG(pin));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief print pin PWM status
|
||||
* @return true if pin is currently a PWM pin, false otherwise
|
||||
*/
|
||||
bool pwm_status(const pin_t pin) {
|
||||
// Get timer assignment for pin
|
||||
timera_config_t *unit;
|
||||
en_timera_channel_t channel;
|
||||
en_port_func_t port_function;
|
||||
if (!timera_get_assignment(pin, unit, channel, port_function) || unit == nullptr) {
|
||||
// No pwm pin or no unit assigned
|
||||
return false;
|
||||
}
|
||||
|
||||
// A pin that is PWM output is:
|
||||
// - Assigned to a timerA unit (tested above)
|
||||
// - Unit is initialized
|
||||
// - Channel is active
|
||||
// - PinMode is OUTPUT_PWM
|
||||
return timera_is_unit_initialized(unit) && timera_is_channel_active(unit, channel) && getPinMode(pin) == OUTPUT_PWM;
|
||||
}
|
||||
|
||||
void pwm_details(const pin_t pin) {
|
||||
// Get timer assignment for pin
|
||||
timera_config_t *unit;
|
||||
en_timera_channel_t channel;
|
||||
en_port_func_t port_function;
|
||||
if (!timera_get_assignment(pin, unit, channel, port_function) || unit == nullptr)
|
||||
return; // No pwm pin or no unit assigned
|
||||
|
||||
// Print timer assignment of pin, eg. "TimerA1Ch2 Func4"
|
||||
SERIAL_ECHOPGM("TimerA", TIMERA_REG_TO_X(unit->peripheral.register_base),
|
||||
"Ch", TIMERA_CHANNEL_TO_X(channel),
|
||||
" Func", int(port_function));
|
||||
SERIAL_ECHO_SP(3); // 3 spaces
|
||||
|
||||
// Print timer unit state, eg. "1/16 PERAR=1234" OR "N/A"
|
||||
if (timera_is_unit_initialized(unit)) {
|
||||
// Unit initialized, print
|
||||
// - Timer clock divider
|
||||
// - Timer period value (PERAR)
|
||||
const uint8_t clock_divider = timera_clk_div_to_n(unit->state.base_init->enClkDiv);
|
||||
const uint16_t period = TIMERA_GetPeriodValue(unit->peripheral.register_base);
|
||||
SERIAL_ECHOPGM("1/", clock_divider, " PERAR=", period);
|
||||
}
|
||||
else {
|
||||
// Unit not initialized
|
||||
SERIAL_ECHOPGM("N/A");
|
||||
return;
|
||||
}
|
||||
|
||||
SERIAL_ECHO_SP(3); // 3 spaces
|
||||
|
||||
// Print timer channel state, e.g. "CMPAR=1234" OR "N/A"
|
||||
if (timera_is_channel_active(unit, channel)) {
|
||||
// Channel active, print
|
||||
// - Channel compare value
|
||||
const uint16_t compare = TIMERA_GetCompareValue(unit->peripheral.register_base, channel);
|
||||
SERIAL_ECHOPGM("CMPAR=", compare);
|
||||
}
|
||||
else {
|
||||
// Channel inactive
|
||||
SERIAL_ECHOPGM("N/A");
|
||||
}
|
||||
}
|
||||
|
||||
void print_port(pin_t pin) {
|
||||
const char port = 'A' + char(pin >> 4); // Pin div 16
|
||||
const int16_t gbit = PIN_MAP[pin].bit_pos;
|
||||
char buffer[8];
|
||||
sprintf_P(buffer, PSTR("P%c%hd "), port, gbit);
|
||||
if (gbit < 10) {
|
||||
SERIAL_CHAR(' ');
|
||||
}
|
||||
|
||||
SERIAL_ECHO(buffer);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
#ifdef REDIRECT_PRINTF_TO_SERIAL
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#error "only GCC is supported"
|
||||
#endif
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
/**
|
||||
* @brief implementation of _write that redirects everything to the host serial(s)
|
||||
* @param file file descriptor. don't care
|
||||
* @param ptr pointer to the data to write
|
||||
* @param len length of the data to write
|
||||
* @return number of bytes written
|
||||
*/
|
||||
extern "C" int _write(int file, char *ptr, int len) {
|
||||
//SERIAL_ECHO_START(); // echo:
|
||||
for (int i = 0; i < len; i++) SERIAL_CHAR(ptr[i]);
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief implementation of _isatty that always returns 1
|
||||
* @param file file descriptor. don't care
|
||||
* @return everything is a tty. there are no files to be had
|
||||
*/
|
||||
extern "C" int _isatty(int file) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // REDIRECT_PRINTF_TO_SERIAL
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "sdio.h"
|
||||
#include <gpio/gpio.h>
|
||||
#include <sd_card.h>
|
||||
|
||||
//
|
||||
// SDIO configuration
|
||||
//
|
||||
|
||||
#define SDIO_PERIPHERAL M4_SDIOC1
|
||||
|
||||
// Use DMA2 channel 0
|
||||
#define SDIO_DMA_PERIPHERAL M4_DMA2
|
||||
#define SDIO_DMA_CHANNEL DmaCh0
|
||||
|
||||
// SDIO read/write operation retries and timeouts
|
||||
#define SDIO_READ_RETRIES 3
|
||||
#define SDIO_READ_TIMEOUT 100 // ms
|
||||
|
||||
#define SDIO_WRITE_RETRIES 1
|
||||
#define SDIO_WRITE_TIMEOUT 100 // ms
|
||||
|
||||
//
|
||||
// HAL functions
|
||||
//
|
||||
|
||||
#define WITH_RETRY(retries, fn) \
|
||||
for (int retry = 0; retry < (retries); retry++) { \
|
||||
MarlinHAL::watchdog_refresh(); \
|
||||
yield(); \
|
||||
fn \
|
||||
}
|
||||
|
||||
stc_sd_handle_t *handle;
|
||||
|
||||
bool SDIO_Init() {
|
||||
// Configure SDIO pins
|
||||
GPIO_SetFunc(BOARD_SDIO_D0, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_D1, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_D2, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_D3, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_CLK, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_CMD, Func_Sdio);
|
||||
GPIO_SetFunc(BOARD_SDIO_DET, Func_Sdio);
|
||||
|
||||
// Create DMA configuration
|
||||
stc_sdcard_dma_init_t *dmaConf = new stc_sdcard_dma_init_t;
|
||||
dmaConf->DMAx = SDIO_DMA_PERIPHERAL;
|
||||
dmaConf->enDmaCh = SDIO_DMA_CHANNEL;
|
||||
|
||||
// Create handle in DMA mode
|
||||
handle = new stc_sd_handle_t;
|
||||
handle->SDIOCx = SDIO_PERIPHERAL;
|
||||
handle->enDevMode = SdCardDmaMode;
|
||||
handle->pstcDmaInitCfg = dmaConf;
|
||||
|
||||
// Create card configuration
|
||||
// This should be a fairly safe configuration for most cards
|
||||
stc_sdcard_init_t cardConf = {
|
||||
.enBusWidth = SdiocBusWidth4Bit,
|
||||
.enClkFreq = SdiocClk400K,
|
||||
.enSpeedMode = SdiocNormalSpeedMode,
|
||||
//.pstcInitCfg = NULL,
|
||||
};
|
||||
|
||||
// Initialize sd card
|
||||
en_result_t rc = SDCARD_Init(handle, &cardConf);
|
||||
if (rc != Ok) printf("SDIO_Init() error (rc=%u)\n", rc);
|
||||
|
||||
return rc == Ok;
|
||||
}
|
||||
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst) {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
CORE_ASSERT(dst != NULL, "SDIO_ReadBlock dst is NULL");
|
||||
|
||||
WITH_RETRY(SDIO_READ_RETRIES, {
|
||||
en_result_t rc = SDCARD_ReadBlocks(handle, block, 1, dst, SDIO_READ_TIMEOUT);
|
||||
if (rc == Ok) return true;
|
||||
printf("SDIO_ReadBlock error (rc=%u; ErrorCode=%lu)\n", rc, handle->u32ErrorCode);
|
||||
})
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src) {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
CORE_ASSERT(src != NULL, "SDIO_WriteBlock src is NULL");
|
||||
|
||||
WITH_RETRY(SDIO_WRITE_RETRIES, {
|
||||
en_result_t rc = SDCARD_WriteBlocks(handle, block, 1, (uint8_t *)src, SDIO_WRITE_TIMEOUT);
|
||||
if (rc == Ok) return true;
|
||||
printf("SDIO_WriteBlock error (rc=%u; ErrorCode=%lu)\n", rc, handle->u32ErrorCode);
|
||||
})
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SDIO_IsReady() {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
return bool(handle->stcCardStatus.READY_FOR_DATA);
|
||||
}
|
||||
|
||||
uint32_t SDIO_GetCardSize() {
|
||||
CORE_ASSERT(handle != NULL, "SDIO not initialized");
|
||||
|
||||
// Multiply number of blocks with block size to get size in bytes
|
||||
const uint64_t cardSizeBytes = uint64_t(handle->stcSdCardInfo.u32LogBlockNbr) * uint64_t(handle->stcSdCardInfo.u32LogBlockSize);
|
||||
|
||||
// If the card is bigger than ~4Gb (maximum a 32bit integer can hold), clamp to the maximum value of a 32 bit integer
|
||||
return _MAX(cardSizeBytes, UINT32_MAX);
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2017 Victor Perez
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
bool SDIO_Init();
|
||||
bool SDIO_ReadBlock(uint32_t block, uint8_t *dst);
|
||||
bool SDIO_WriteBlock(uint32_t block, const uint8_t *src);
|
||||
bool SDIO_IsReady();
|
||||
uint32_t SDIO_GetCardSize();
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* HC32f460 system clock configuration
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
// Get BOARD_XTAL_FREQUENCY from configuration / pins
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#include <core_hooks.h>
|
||||
#include <drivers/sysclock/sysclock_util.h>
|
||||
|
||||
void core_hook_sysclock_init() {
|
||||
// Set wait cycles, as we are about to switch to 200 MHz HCLK
|
||||
sysclock_configure_flash_wait_cycles();
|
||||
sysclock_configure_sram_wait_cycles();
|
||||
|
||||
// Configure MPLLp to 200 MHz output, with different settings depending on XTAL availability
|
||||
#if BOARD_XTAL_FREQUENCY == 8000000 // 8 MHz XTAL
|
||||
// - M = 1 => 8 MHz / 1 = 8 MHz
|
||||
// - N = 50 => 8 MHz * 50 = 400 MHz
|
||||
// - P = 2 => 400 MHz / 2 = 200 MHz (sysclk)
|
||||
// - Q,R = 4 => 400 MHz / 4 = 100 MHz (dont care)
|
||||
stc_clk_mpll_cfg_t pllConf = {
|
||||
.PllpDiv = 2u, // P
|
||||
.PllqDiv = 4u, // Q
|
||||
.PllrDiv = 4u, // R
|
||||
.plln = 50u, // N
|
||||
.pllmDiv = 1u, // M
|
||||
};
|
||||
sysclock_configure_xtal();
|
||||
sysclock_configure_mpll(ClkPllSrcXTAL, &pllConf);
|
||||
|
||||
#elif BOARD_XTAL_FREQUENCY == 16000000 // 16 MHz XTAL
|
||||
// - M = 1 => 16 MHz / 1 = 16 MHz
|
||||
// - N = 50 => 16 MHz * 25 = 400 MHz
|
||||
// - P = 2 => 400 MHz / 2 = 200 MHz (sysclk)
|
||||
// - Q,R = 4 => 400 MHz / 4 = 100 MHz (dont care)
|
||||
stc_clk_mpll_cfg_t pllConf = {
|
||||
.PllpDiv = 2u, // P
|
||||
.PllqDiv = 4u, // Q
|
||||
.PllrDiv = 4u, // R
|
||||
.plln = 50u, // N
|
||||
.pllmDiv = 1u, // M
|
||||
};
|
||||
sysclock_configure_xtal();
|
||||
sysclock_configure_mpll(ClkPllSrcXTAL, &pllConf);
|
||||
|
||||
#warning "HC32F460 with 16 MHz XTAL has not been tested."
|
||||
|
||||
#else // HRC (16 MHz)
|
||||
// - M = 1 => 16 MHz / 1 = 16 MHz
|
||||
// - N = 25 => 16 MHz * 25 = 400 MHz
|
||||
// - P = 2 => 400 MHz / 2 = 200 MHz (sysclk)
|
||||
// - Q,R = 4 => 400 MHz / 4 = 100 MHz (dont care)
|
||||
stc_clk_mpll_cfg_t pllConf = {
|
||||
.PllpDiv = 2u, // P
|
||||
.PllqDiv = 4u, // Q
|
||||
.PllrDiv = 4u, // R
|
||||
.plln = 25u, // N
|
||||
.pllmDiv = 1u, // M
|
||||
};
|
||||
sysclock_configure_hrc();
|
||||
sysclock_configure_mpll(ClkPllSrcHRC, &pllConf);
|
||||
|
||||
// HRC could have been configured by ICG to 20 MHz
|
||||
// TODO: handle gracefully if HRC is not 16 MHz
|
||||
if (1UL != (HRC_FREQ_MON() & 1UL)) {
|
||||
panic("HRC is not 16 MHz");
|
||||
}
|
||||
|
||||
#ifdef BOARD_XTAL_FREQUENCY
|
||||
#warning "No valid XTAL frequency defined, falling back to HRC."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Setup clock divisors for sysclk = 200 MHz:
|
||||
// Note: PCLK1 is used for step+temp timers, and need to be kept at 50 MHz (until there is a better solution)
|
||||
stc_clk_sysclk_cfg_t sysClkConf = {
|
||||
.enHclkDiv = ClkSysclkDiv1, // HCLK = 200 MHz (CPU)
|
||||
.enExclkDiv = ClkSysclkDiv2, // EXCLK = 100 MHz (SDIO)
|
||||
.enPclk0Div = ClkSysclkDiv1, // PCLK0 = 200 MHz (Timer6 (not used))
|
||||
.enPclk1Div = ClkSysclkDiv4, // PCLK1 = 50 MHz (USART, SPI, I2S, Timer0 (step+temp), TimerA (Servo))
|
||||
.enPclk2Div = ClkSysclkDiv4, // PCLK2 = 50 MHz (ADC)
|
||||
.enPclk3Div = ClkSysclkDiv4, // PCLK3 = 50 MHz (I2C, WDT)
|
||||
.enPclk4Div = ClkSysclkDiv2, // PCLK4 = 100 MHz (ADC ctl)
|
||||
};
|
||||
sysclock_set_clock_dividers(&sysClkConf);
|
||||
|
||||
// Set power mode
|
||||
#define POWER_MODE_SYSTEM_CLOCK 200000000 // 200 MHz
|
||||
power_mode_update_pre(POWER_MODE_SYSTEM_CLOCK);
|
||||
|
||||
// Switch to MPLL as sysclk source
|
||||
CLK_SetSysClkSource(CLKSysSrcMPLL);
|
||||
|
||||
// Set power mode
|
||||
power_mode_update_post(POWER_MODE_SYSTEM_CLOCK);
|
||||
#undef POWER_MODE_SYSTEM_CLOCK
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "timers.h"
|
||||
#include <core_debug.h>
|
||||
|
||||
/**
|
||||
* Timer0 Unit 2 Channel A is used for Temperature interrupts
|
||||
*/
|
||||
Timer0 temp_timer(&TIMER02A_config, &Temp_Handler);
|
||||
|
||||
/**
|
||||
* Timer0 Unit 2 Channel B is used for Step interrupts
|
||||
*/
|
||||
Timer0 step_timer(&TIMER02B_config, &Step_Handler);
|
||||
|
||||
void HAL_timer_start(const timer_channel_t timer_num, const uint32_t frequency) {
|
||||
if (timer_num == TEMP_TIMER_NUM) {
|
||||
CORE_DEBUG_PRINTF("HAL_timer_start: temp timer, f=%ld\n", long(frequency));
|
||||
timer_num->start(frequency, TEMP_TIMER_PRESCALE);
|
||||
timer_num->setCallbackPriority(TEMP_TIMER_PRIORITY);
|
||||
}
|
||||
else if (timer_num == STEP_TIMER_NUM) {
|
||||
CORE_DEBUG_PRINTF("HAL_timer_start: step timer, f=%ld\n", long(frequency));
|
||||
timer_num->start(frequency, STEPPER_TIMER_PRESCALE);
|
||||
timer_num->setCallbackPriority(STEP_TIMER_PRIORITY);
|
||||
}
|
||||
else {
|
||||
CORE_ASSERT_FAIL("HAL_timer_start: invalid timer_num")
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2017 Victor Perez
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <Timer0.h>
|
||||
|
||||
//
|
||||
// Timer Types
|
||||
//
|
||||
typedef Timer0 *timer_channel_t;
|
||||
typedef uint16_t hal_timer_t;
|
||||
#define HAL_TIMER_TYPE_MAX 0xFFFF
|
||||
|
||||
//
|
||||
// Timer instances
|
||||
//
|
||||
extern Timer0 temp_timer;
|
||||
extern Timer0 step_timer;
|
||||
|
||||
//
|
||||
// Timer Configurations
|
||||
//
|
||||
|
||||
// TODO: some calculations (step irq min_step_rate) require the timer rate to be known at compile time
|
||||
// this is not possible with the HC32F460, as the timer rate depends on PCLK1
|
||||
// as a workaround, PCLK1 = 50MHz is assumed (check with clock dump in MarlinHAL::init())
|
||||
#define HAL_TIMER_RATE 50000000 // 50MHz
|
||||
// #define HAL_TIMER_RATE TIMER0_BASE_FREQUENCY
|
||||
|
||||
// TODO: CYCLES_PER_MICROSECOND seems to be used by Marlin to calculate the number of cycles per microsecond in the timer ISRs
|
||||
// by default, it uses F_CPU, but since that is not known at compile time for HC32, we overwrite it here
|
||||
#undef CYCLES_PER_MICROSECOND
|
||||
#define CYCLES_PER_MICROSECOND (HAL_TIMER_RATE / 1000000UL)
|
||||
|
||||
// Temperature timer
|
||||
#define TEMP_TIMER_NUM (&temp_timer)
|
||||
#define TEMP_TIMER_PRIORITY DDL_IRQ_PRIORITY_02
|
||||
#define TEMP_TIMER_PRESCALE 16ul
|
||||
#define TEMP_TIMER_RATE 1000 // 1kHz
|
||||
#define TEMP_TIMER_FREQUENCY TEMP_TIMER_RATE // Alias for Marlin
|
||||
|
||||
// Stepper timer
|
||||
#define STEP_TIMER_NUM (&step_timer)
|
||||
#define STEP_TIMER_PRIORITY DDL_IRQ_PRIORITY_01
|
||||
#define STEPPER_TIMER_PRESCALE 16ul
|
||||
|
||||
// TODO: STEPPER_TIMER_RATE seems to work fine like this, but requires further testing...
|
||||
#define STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE) // 50MHz / 16 = 3.125MHz
|
||||
#define STEPPER_TIMER_TICKS_PER_US (STEPPER_TIMER_RATE / 1000000)
|
||||
|
||||
// Pulse timer (== stepper timer)
|
||||
#define PULSE_TIMER_NUM STEP_TIMER_NUM
|
||||
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
|
||||
#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US
|
||||
|
||||
//
|
||||
// Channel aliases
|
||||
//
|
||||
#define MF_TIMER_TEMP TEMP_TIMER_NUM
|
||||
#define MF_TIMER_STEP STEP_TIMER_NUM
|
||||
#define MF_TIMER_PULSE PULSE_TIMER_NUM
|
||||
|
||||
//
|
||||
// HAL functions
|
||||
//
|
||||
void HAL_timer_start(const timer_channel_t timer_num, const uint32_t frequency);
|
||||
|
||||
// Inlined since they are somewhat critical
|
||||
#define MARLIN_HAL_TIMER_INLINE_ATTR __attribute__((always_inline)) inline
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR void HAL_timer_enable_interrupt(const timer_channel_t timer_num) {
|
||||
timer_num->resume();
|
||||
}
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR void HAL_timer_disable_interrupt(const timer_channel_t timer_num) {
|
||||
timer_num->pause();
|
||||
}
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR bool HAL_timer_interrupt_enabled(const timer_channel_t timer_num) {
|
||||
return timer_num->isPaused();
|
||||
}
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR void HAL_timer_set_compare(const timer_channel_t timer_num, const hal_timer_t compare) {
|
||||
timer_num->setCompareValue(compare);
|
||||
}
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR hal_timer_t HAL_timer_get_count(const timer_channel_t timer_num) {
|
||||
return timer_num->getCount();
|
||||
}
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR void HAL_timer_isr_prologue(const timer_channel_t timer_num) {
|
||||
timer_num->clearInterruptFlag();
|
||||
}
|
||||
|
||||
MARLIN_HAL_TIMER_INLINE_ATTR void HAL_timer_isr_epilogue(const timer_channel_t timer_num) {}
|
||||
|
||||
//
|
||||
// HAL function aliases
|
||||
//
|
||||
#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM)
|
||||
#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM)
|
||||
#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
|
||||
|
||||
#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
|
||||
#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM);
|
||||
|
||||
//
|
||||
// HAL ISR callbacks
|
||||
//
|
||||
void Step_Handler();
|
||||
void Temp_Handler();
|
||||
|
||||
#ifndef HAL_STEP_TIMER_ISR
|
||||
#define HAL_STEP_TIMER_ISR() void Step_Handler()
|
||||
#endif
|
||||
#ifndef HAL_TEMP_TIMER_ISR
|
||||
#define HAL_TEMP_TIMER_ISR() void Temp_Handler()
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* HC32 LCD-specific defines
|
||||
*/
|
||||
|
||||
uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_HC32_sw_spi_fn
|
||||
@@ -0,0 +1,163 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef ARDUINO_ARCH_HC32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if U8G_SW_SPI_HC32
|
||||
|
||||
#warning "Software SPI for U8Glib is experimental on HC32F460. Please share your experiences at https://github.com/shadow578/Marlin-H32/issues/35"
|
||||
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/HAL_SPI.h"
|
||||
|
||||
#ifndef LCD_SPI_SPEED
|
||||
#define LCD_SPI_SPEED SPI_FULL_SPEED // Fastest
|
||||
//#define LCD_SPI_SPEED SPI_QUARTER_SPEED // Slower
|
||||
#endif
|
||||
|
||||
static uint8_t SPI_speed = LCD_SPI_SPEED;
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
if (spi_speed == 0) {
|
||||
WRITE(DOGLCD_MOSI, !!(b & 0x80));
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && READ(miso_pin)) b |= 1;
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
}
|
||||
else {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_MOSI, state);
|
||||
for (j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1; ++j)) WRITE(DOGLCD_SCK, HIGH);
|
||||
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && READ(miso_pin)) b |= 1;
|
||||
|
||||
for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_SCK, LOW);
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t miso_pin=-1) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
const uint8_t state = (b & 0x80) ? HIGH : LOW;
|
||||
if (spi_speed == 0) {
|
||||
WRITE(DOGLCD_SCK, LOW);
|
||||
WRITE(DOGLCD_MOSI, state);
|
||||
WRITE(DOGLCD_MOSI, state); // need some setup time
|
||||
WRITE(DOGLCD_SCK, HIGH);
|
||||
}
|
||||
else {
|
||||
for (j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); ++j) WRITE(DOGLCD_SCK, LOW);
|
||||
for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_MOSI, state);
|
||||
for (j = 0; j < spi_speed; ++j) WRITE(DOGLCD_SCK, HIGH);
|
||||
}
|
||||
b <<= 1;
|
||||
if (miso_pin >= 0 && READ(miso_pin)) b |= 1;
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
static void u8g_sw_spi_shift_out(uint8_t val) {
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864)
|
||||
swSpiTransfer_mode_3(val, SPI_speed);
|
||||
#else
|
||||
swSpiTransfer_mode_0(val, SPI_speed);
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint8_t swSpiInit(const uint8_t spi_speed) {
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
SET_OUTPUT(LCD_RESET_PIN);
|
||||
#endif
|
||||
SET_OUTPUT(DOGLCD_A0);
|
||||
OUT_WRITE(DOGLCD_SCK, LOW);
|
||||
OUT_WRITE(DOGLCD_MOSI, LOW);
|
||||
OUT_WRITE(DOGLCD_CS, HIGH);
|
||||
return spi_speed;
|
||||
}
|
||||
|
||||
uint8_t u8g_com_HAL_HC32_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {
|
||||
switch (msg) {
|
||||
case U8G_COM_MSG_INIT:
|
||||
SPI_speed = swSpiInit(LCD_SPI_SPEED);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_STOP:
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_RESET:
|
||||
#if PIN_EXISTS(LCD_RESET)
|
||||
WRITE(LCD_RESET_PIN, arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_CHIP_SELECT:
|
||||
#if ANY(FYSETC_MINI_12864, MKS_MINI_12864) // This LCD SPI is running mode 3 while SD card is running mode 0
|
||||
if (arg_val) { // SCK idle state needs to be set to the proper idle state before
|
||||
// the next chip select goes active
|
||||
WRITE(DOGLCD_SCK, HIGH); // Set SCK to mode 3 idle state before CS goes active
|
||||
WRITE(DOGLCD_CS, LOW);
|
||||
}
|
||||
else {
|
||||
WRITE(DOGLCD_CS, HIGH);
|
||||
WRITE(DOGLCD_SCK, LOW); // Set SCK to mode 0 idle state after CS goes inactive
|
||||
}
|
||||
#else
|
||||
WRITE(DOGLCD_CS, !arg_val);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_BYTE:
|
||||
u8g_sw_spi_shift_out(arg_val);
|
||||
break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
u8g_sw_spi_shift_out(*ptr++);
|
||||
arg_val--;
|
||||
}
|
||||
} break;
|
||||
|
||||
case U8G_COM_MSG_WRITE_SEQ_P: {
|
||||
uint8_t *ptr = (uint8_t *)arg_ptr;
|
||||
while (arg_val > 0) {
|
||||
u8g_sw_spi_shift_out(u8g_pgm_read(ptr));
|
||||
ptr++;
|
||||
arg_val--;
|
||||
}
|
||||
} break;
|
||||
|
||||
case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */
|
||||
WRITE(DOGLCD_A0, arg_val);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // U8G_SW_SPI_HC32
|
||||
#endif // ARDUINO_ARCH_HC32
|
||||
@@ -19,6 +19,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __PLAT_LINUX__
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
@@ -57,4 +58,49 @@ uint16_t MarlinHAL::adc_value() {
|
||||
|
||||
void MarlinHAL::reboot() { /* Reset the application state and GPIO */ }
|
||||
|
||||
// ------------------------
|
||||
// BSD String
|
||||
// ------------------------
|
||||
|
||||
/**
|
||||
* Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef HAS_LIBBSD
|
||||
|
||||
/**
|
||||
* Copy string src to buffer dst of size dsize. At most dsize-1
|
||||
* chars will be copied. Always NUL terminates (unless dsize == 0).
|
||||
* Returns strlen(src); if retval >= dsize, truncation occurred.
|
||||
*/
|
||||
size_t MarlinHAL::_strlcpy(char *dst, const char *src, size_t dsize) {
|
||||
const char *osrc = src;
|
||||
size_t nleft = dsize;
|
||||
|
||||
// Copy as many bytes as will fit.
|
||||
if (nleft != 0) while (--nleft != 0) if ((*dst++ = *src++) == '\0') break;
|
||||
|
||||
// Not enough room in dst, add NUL and traverse rest of src.
|
||||
if (nleft == 0) {
|
||||
if (dsize != 0) *dst = '\0'; // NUL-terminate dst
|
||||
while (*src++) { /* nada */ }
|
||||
}
|
||||
|
||||
return (src - osrc - 1); // count does not include NUL
|
||||
}
|
||||
|
||||
#endif // HAS_LIBBSD
|
||||
|
||||
#endif // __PLAT_LINUX__
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -26,6 +26,11 @@
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef HAS_LIBBSD
|
||||
#include <bsd/string.h>
|
||||
#endif
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
#include <algorithm>
|
||||
@@ -162,4 +167,13 @@ public:
|
||||
}
|
||||
|
||||
static void set_pwm_frequency(const pin_t, int) {}
|
||||
|
||||
#ifndef HAS_LIBBSD
|
||||
/**
|
||||
* Redirect missing strlcpy here
|
||||
*/
|
||||
static size_t _strlcpy(char *dst, const char *src, size_t dsize);
|
||||
#define strlcpy hal._strlcpy
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2023 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Linux LCD-specific defines
|
||||
*/
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
@@ -100,7 +100,7 @@ extern DefaultSerial1 USBSerial;
|
||||
#else
|
||||
#error "LCD_SERIAL_PORT must be from 0 to 3. You can also use -1 if the board supports Native USB."
|
||||
#endif
|
||||
#if HAS_DGUS_LCD || ENABLED(DWINOS_4)
|
||||
#if HAS_DGUS_LCD
|
||||
#define LCD_SERIAL_TX_BUFFER_FREE() LCD_SERIAL.available()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -30,16 +30,6 @@
|
||||
#endif
|
||||
#include "../../core/serial_hook.h"
|
||||
|
||||
#ifndef SERIAL_PORT
|
||||
#define SERIAL_PORT 0
|
||||
#endif
|
||||
#ifndef RX_BUFFER_SIZE
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef TX_BUFFER_SIZE
|
||||
#define TX_BUFFER_SIZE 32
|
||||
#endif
|
||||
|
||||
class MarlinSerial : public HardwareSerial<RX_BUFFER_SIZE, TX_BUFFER_SIZE> {
|
||||
public:
|
||||
MarlinSerial(LPC_UART_TypeDef *UARTx) : HardwareSerial<RX_BUFFER_SIZE, TX_BUFFER_SIZE>(UARTx) { }
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
|
||||
|
||||
@@ -91,7 +91,7 @@ bool PersistentStore::access_finish() {
|
||||
static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) {
|
||||
#if ENABLED(DEBUG_SD_EEPROM_EMULATION)
|
||||
FSTR_P const rw_str = write ? F("write") : F("read");
|
||||
SERIAL_ECHOLN(AS_CHAR(' '), rw_str, F("_data("), pos, AS_CHAR(','), *value, AS_CHAR(','), size, F(", ...)"));
|
||||
SERIAL_ECHOLN(C(' '), rw_str, F("_data("), pos, C(','), *value, C(','), size, F(", ...)"));
|
||||
if (total)
|
||||
SERIAL_ECHOLN(F(" f_"), rw_str, F("()="), s, F("\n size="), size, F("\n bytes_"), write ? F("written=") : F("read="), total);
|
||||
else
|
||||
|
||||
@@ -20,3 +20,7 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef SERIAL_PORT
|
||||
#define SERIAL_PORT 0
|
||||
#endif
|
||||
|
||||
@@ -24,3 +24,10 @@
|
||||
#if DISABLED(NO_SD_HOST_DRIVE)
|
||||
#define HAS_SD_HOST_DRIVE 1
|
||||
#endif
|
||||
|
||||
#ifndef RX_BUFFER_SIZE
|
||||
#define RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef TX_BUFFER_SIZE
|
||||
#define TX_BUFFER_SIZE 32
|
||||
#endif
|
||||
|
||||
@@ -55,11 +55,19 @@ void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
|
||||
WRITE(TFT_CS_PIN, LOW);
|
||||
}
|
||||
|
||||
#ifdef TFT_DEFAULT_DRIVER
|
||||
#include "../../../lcd/tft_io/tft_ids.h"
|
||||
#endif
|
||||
|
||||
uint32_t TFT_SPI::getID() {
|
||||
uint32_t id;
|
||||
id = readID(LCD_READ_ID);
|
||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||
id = readID(LCD_READ_ID4);
|
||||
#ifdef TFT_DEFAULT_DRIVER
|
||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||
id = TFT_DEFAULT_DRIVER;
|
||||
#endif
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +74,8 @@ bool XPT2046::isTouched() {
|
||||
);
|
||||
}
|
||||
|
||||
bool XPT2046::getRawPoint(int16_t *x, int16_t *y) {
|
||||
if (isBusy()) return false;
|
||||
if (!isTouched()) return false;
|
||||
bool XPT2046::getRawPoint(int16_t * const x, int16_t * const y) {
|
||||
if (isBusy() || !isTouched()) return false;
|
||||
*x = getRawData(XPT2046_X);
|
||||
*y = getRawData(XPT2046_Y);
|
||||
return isTouched();
|
||||
|
||||
@@ -79,5 +79,5 @@ public:
|
||||
#endif
|
||||
|
||||
static void init();
|
||||
static bool getRawPoint(int16_t *x, int16_t *y);
|
||||
static bool getRawPoint(int16_t * const x, int16_t * const y);
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
* Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
*
|
||||
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
* Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -25,25 +25,22 @@
|
||||
* LPC1768 LCD-specific defines
|
||||
*/
|
||||
|
||||
// The following are optional depending on the platform.
|
||||
#ifndef U8G_HAL_LINKS
|
||||
|
||||
// definitions of HAL specific com and device drivers.
|
||||
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
#define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn // See U8glib-HAL
|
||||
|
||||
#else
|
||||
|
||||
// connect U8g com generic com names to the desired driver
|
||||
#define U8G_COM_HW_SPI u8g_com_HAL_LPC1768_hw_spi_fn // use LPC1768 specific hardware SPI routine
|
||||
#define U8G_COM_SW_SPI u8g_com_HAL_LPC1768_sw_spi_fn // use LPC1768 specific software SPI routine
|
||||
#define U8G_COM_ST7920_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
|
||||
#define U8G_COM_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
|
||||
#define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
|
||||
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
|
||||
|
||||
// let these default for now
|
||||
#define U8G_COM_PARALLEL u8g_com_null_fn
|
||||
#define U8G_COM_T6963 u8g_com_null_fn
|
||||
#define U8G_COM_FAST_PARALLEL u8g_com_null_fn
|
||||
#define U8G_COM_UC_I2C u8g_com_null_fn
|
||||
#define U8G_COM_HAL_SW_SPI_FN u8g_com_HAL_LPC1768_sw_spi_fn
|
||||
#define U8G_COM_HAL_HW_SPI_FN u8g_com_HAL_LPC1768_hw_spi_fn
|
||||
#define U8G_COM_ST7920_HAL_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
|
||||
#define U8G_COM_ST7920_HAL_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
|
||||
#define U8G_COM_SSD_I2C_HAL u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
|
||||
|
||||
#endif
|
||||
|
||||
@@ -125,5 +125,4 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val,
|
||||
}
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB
|
||||
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
@@ -194,5 +194,4 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v
|
||||
}
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB
|
||||
|
||||
#endif // TARGET_LPC1768
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user