mirror of
https://github.com/LegitCamper/picocalc-os-rs.git
synced 2025-12-27 15:55:25 +00:00
Compare commits
14 Commits
double-buf
...
macros
| Author | SHA1 | Date | |
|---|---|---|---|
| 97639138a1 | |||
| dd26e3528b | |||
| 74ec86da8f | |||
| cc463a34be | |||
| 355be5cde3 | |||
| 1bbb892fcc | |||
| 7fcc5291e6 | |||
| 9afec60033 | |||
| 382e2e73ef | |||
| 1d7ab3fb42 | |||
| 2226541813 | |||
| 05198c716d | |||
| ba426f5baa | |||
| 7bc6aeb998 |
136
Cargo.lock
generated
136
Cargo.lock
generated
@@ -19,6 +19,7 @@ dependencies = [
|
|||||||
"abi_sys",
|
"abi_sys",
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"embedded-sdmmc",
|
"embedded-sdmmc",
|
||||||
|
"main_proc_macro",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.3",
|
||||||
]
|
]
|
||||||
@@ -124,7 +125,7 @@ version = "0.2.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
|
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc_version 0.2.3",
|
"rustc_version",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -225,7 +226,7 @@ dependencies = [
|
|||||||
"embedded-io",
|
"embedded-io",
|
||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"futures-intrusive",
|
"futures-intrusive",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -350,7 +351,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -409,7 +410,7 @@ dependencies = [
|
|||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"futures",
|
"futures",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"num_enum 0.5.11",
|
"num_enum 0.5.11",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -447,7 +448,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim 0.11.1",
|
"strsim 0.11.1",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -458,7 +459,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core",
|
"darling_core",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -496,7 +497,7 @@ dependencies = [
|
|||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -645,7 +646,7 @@ dependencies = [
|
|||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -788,7 +789,7 @@ dependencies = [
|
|||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -803,7 +804,7 @@ dependencies = [
|
|||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -856,7 +857,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454"
|
checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embassy-executor-timer-queue",
|
"embassy-executor-timer-queue",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -870,7 +871,7 @@ dependencies = [
|
|||||||
"embassy-sync 0.7.2",
|
"embassy-sync 0.7.2",
|
||||||
"embassy-usb-driver 0.2.0",
|
"embassy-usb-driver 0.2.0",
|
||||||
"embedded-io-async",
|
"embedded-io-async",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"ssmarshal",
|
"ssmarshal",
|
||||||
"usbd-hid",
|
"usbd-hid",
|
||||||
]
|
]
|
||||||
@@ -1019,7 +1020,7 @@ checksum = "4f6e621fe4c7e05b695274b722dc0a60bacd1c8696b58191baa0154713d52400"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1032,7 +1033,7 @@ dependencies = [
|
|||||||
"defmt 0.3.100",
|
"defmt 0.3.100",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
"embedded-io",
|
"embedded-io",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1212,7 +1213,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1312,15 +1313,6 @@ dependencies = [
|
|||||||
"crunchy",
|
"crunchy",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hash32"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hash32"
|
name = "hash32"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
@@ -1351,26 +1343,13 @@ version = "0.15.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "heapless"
|
|
||||||
version = "0.7.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f"
|
|
||||||
dependencies = [
|
|
||||||
"atomic-polyfill",
|
|
||||||
"hash32 0.2.1",
|
|
||||||
"rustc_version 0.4.1",
|
|
||||||
"spin 0.9.8",
|
|
||||||
"stable_deref_trait",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heapless"
|
name = "heapless"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hash32 0.3.1",
|
"hash32",
|
||||||
"serde",
|
"serde",
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
@@ -1524,14 +1503,14 @@ dependencies = [
|
|||||||
"embedded-sdmmc",
|
"embedded-sdmmc",
|
||||||
"embedded-text",
|
"embedded-text",
|
||||||
"goblin",
|
"goblin",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"kolibri-embedded-gui",
|
"kolibri-embedded-gui",
|
||||||
"num_enum 0.7.4",
|
"num_enum 0.7.4",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"panic-probe",
|
"panic-probe",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
"rand",
|
"rand",
|
||||||
"spin 0.10.0",
|
"spin",
|
||||||
"st7365p-lcd",
|
"st7365p-lcd",
|
||||||
"static_cell",
|
"static_cell",
|
||||||
"strum",
|
"strum",
|
||||||
@@ -1548,7 +1527,7 @@ dependencies = [
|
|||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"embedded-iconoir",
|
"embedded-iconoir",
|
||||||
"foldhash",
|
"foldhash",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1670,6 +1649,14 @@ version = "0.4.27"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "main_proc_macro"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.108",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.7.5"
|
version = "2.7.5"
|
||||||
@@ -1750,7 +1737,7 @@ checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1942,7 +1929,7 @@ dependencies = [
|
|||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2009,7 +1996,7 @@ dependencies = [
|
|||||||
"proc-macro-error-attr2",
|
"proc-macro-error-attr2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2023,9 +2010,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.40"
|
version = "1.0.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@@ -2164,16 +2151,7 @@ version = "0.2.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver 0.9.0",
|
"semver",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
|
||||||
dependencies = [
|
|
||||||
"semver 1.0.27",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2231,12 +2209,6 @@ dependencies = [
|
|||||||
"semver-parser",
|
"semver-parser",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "1.0.27"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver-parser"
|
name = "semver-parser"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -2270,7 +2242,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2342,15 +2314,6 @@ dependencies = [
|
|||||||
"rand",
|
"rand",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spin"
|
|
||||||
version = "0.9.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
|
||||||
dependencies = [
|
|
||||||
"lock_api",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spin"
|
name = "spin"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
@@ -2379,7 +2342,7 @@ dependencies = [
|
|||||||
"embedded-graphics-core",
|
"embedded-graphics-core",
|
||||||
"embedded-hal 1.0.0",
|
"embedded-hal 1.0.0",
|
||||||
"embedded-hal-async",
|
"embedded-hal-async",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"nb 1.1.0",
|
"nb 1.1.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2446,7 +2409,7 @@ dependencies = [
|
|||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2475,9 +2438,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.104"
|
version = "2.0.108"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -2574,7 +2537,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2585,7 +2548,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2609,11 +2572,10 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "tinygif"
|
name = "tinygif"
|
||||||
version = "0.0.4"
|
version = "0.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/LegitCamper/tinygif#083c0efbdbeb21835de30425e234247340f6e370"
|
||||||
checksum = "09f1406b710986188de8d393c810213d4bbf940e327d90d52cff9930d007a248"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"heapless 0.7.17",
|
"heapless",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2637,7 +2599,7 @@ dependencies = [
|
|||||||
"embassy-time 0.4.0",
|
"embassy-time 0.4.0",
|
||||||
"embedded-io",
|
"embedded-io",
|
||||||
"futures",
|
"futures",
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"rand_core 0.6.4",
|
"rand_core 0.6.4",
|
||||||
"static_cell",
|
"static_cell",
|
||||||
"trouble-host-macros",
|
"trouble-host-macros",
|
||||||
@@ -2654,7 +2616,7 @@ dependencies = [
|
|||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2688,7 +2650,7 @@ version = "0.3.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
|
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heapless 0.8.0",
|
"heapless",
|
||||||
"portable-atomic",
|
"portable-atomic",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2813,7 +2775,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -2835,7 +2797,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@@ -2985,5 +2947,5 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.104",
|
"syn 2.0.108",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ members = [
|
|||||||
"user-apps/snake",
|
"user-apps/snake",
|
||||||
"user-apps/gallery",
|
"user-apps/gallery",
|
||||||
"user-apps/gif",
|
"user-apps/gif",
|
||||||
|
"main_proc_macro",
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ version = "0.1.0"
|
|||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embedded-sdmmc = { version = "0.9.0", default-features = false }
|
|
||||||
embedded-graphics = "0.8.1"
|
|
||||||
abi_sys = { path = "../abi_sys" }
|
abi_sys = { path = "../abi_sys" }
|
||||||
|
main_proc_macro = { path = "../main_proc_macro" }
|
||||||
|
embedded-sdmmc = { version = "0.9", default-features = false }
|
||||||
|
embedded-graphics = "0.8.1"
|
||||||
once_cell = { version = "1", default-features = false }
|
once_cell = { version = "1", default-features = false }
|
||||||
rand_core = "0.9.3"
|
rand_core = "0.9.3"
|
||||||
|
|||||||
@@ -5,10 +5,20 @@ extern crate alloc;
|
|||||||
|
|
||||||
pub use abi_sys::{self, keyboard};
|
pub use abi_sys::{self, keyboard};
|
||||||
use abi_sys::{RngRequest, alloc, dealloc, keyboard::KeyEvent};
|
use abi_sys::{RngRequest, alloc, dealloc, keyboard::KeyEvent};
|
||||||
pub use alloc::format;
|
use alloc::format;
|
||||||
use core::alloc::{GlobalAlloc, Layout};
|
use core::{
|
||||||
|
alloc::{GlobalAlloc, Layout},
|
||||||
|
panic::PanicInfo,
|
||||||
|
};
|
||||||
|
pub use main_proc_macro::main;
|
||||||
use rand_core::RngCore;
|
use rand_core::RngCore;
|
||||||
|
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
|
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOC: Alloc = Alloc;
|
static ALLOC: Alloc = Alloc;
|
||||||
|
|
||||||
@@ -27,7 +37,7 @@ unsafe impl GlobalAlloc for Alloc {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! print {
|
macro_rules! print {
|
||||||
($($arg:tt)*) => {{
|
($($arg:tt)*) => {{
|
||||||
let s = $crate::format!($($arg)*);
|
let s = format!($($arg)*);
|
||||||
$crate::abi_sys::print(s.as_ptr(), s.len());
|
$crate::abi_sys::print(s.as_ptr(), s.len());
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
@@ -46,7 +56,6 @@ pub fn get_key() -> KeyEvent {
|
|||||||
|
|
||||||
pub mod display {
|
pub mod display {
|
||||||
use abi_sys::CPixel;
|
use abi_sys::CPixel;
|
||||||
// use alloc::{vec, vec::Vec};
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Pixel,
|
Pixel,
|
||||||
geometry::{Dimensions, Point},
|
geometry::{Dimensions, Point},
|
||||||
@@ -54,7 +63,6 @@ pub mod display {
|
|||||||
prelude::{DrawTarget, Size},
|
prelude::{DrawTarget, Size},
|
||||||
primitives::Rectangle,
|
primitives::Rectangle,
|
||||||
};
|
};
|
||||||
// use once_cell::unsync::Lazy;
|
|
||||||
|
|
||||||
pub const SCREEN_WIDTH: usize = 320;
|
pub const SCREEN_WIDTH: usize = 320;
|
||||||
pub const SCREEN_HEIGHT: usize = 320;
|
pub const SCREEN_HEIGHT: usize = 320;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pub struct CLayout {
|
|||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
impl Into<Layout> for CLayout {
|
impl Into<Layout> for CLayout {
|
||||||
fn into(self) -> Layout {
|
fn into(self) -> Layout {
|
||||||
Layout::from_size_align(self.size, self.alignment).unwrap()
|
unsafe { Layout::from_size_align_unchecked(self.size, self.alignment) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ doctest = false
|
|||||||
bench = false
|
bench = false
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rp235x", "defmt", "pimoroni2w"]
|
default = ["rp235x", "defmt"]
|
||||||
pimoroni2w = ["rp235x"]
|
pimoroni2w = ["rp235x"]
|
||||||
rp2040 = ["embassy-rp/rp2040"]
|
rp2040 = ["embassy-rp/rp2040"]
|
||||||
rp235x = ["embassy-rp/rp235xb"]
|
rp235x = ["embassy-rp/rp235xb"]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use abi_sys::{
|
|||||||
PrintAbi, ReadFile, RngRequest, SleepMsAbi, keyboard::*,
|
PrintAbi, ReadFile, RngRequest, SleepMsAbi, keyboard::*,
|
||||||
};
|
};
|
||||||
use alloc::{string::ToString, vec::Vec};
|
use alloc::{string::ToString, vec::Vec};
|
||||||
use core::{alloc::GlobalAlloc, ops::DerefMut, sync::atomic::Ordering};
|
use core::{alloc::GlobalAlloc, sync::atomic::Ordering};
|
||||||
use embassy_rp::clocks::{RoscRng, clk_sys_freq};
|
use embassy_rp::clocks::{RoscRng, clk_sys_freq};
|
||||||
use embassy_time::Instant;
|
use embassy_time::Instant;
|
||||||
use embedded_graphics::draw_target::DrawTarget;
|
use embedded_graphics::draw_target::DrawTarget;
|
||||||
@@ -11,7 +11,8 @@ use embedded_sdmmc::{DirEntry, LfnBuffer};
|
|||||||
use heapless::spsc::Queue;
|
use heapless::spsc::Queue;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
display::{FRAMEBUFFER, FRAMEBUFFER2, WRITE_FRAMEBUFFER2},
|
display::FRAMEBUFFER,
|
||||||
|
framebuffer::FB_PAUSED,
|
||||||
storage::{Dir, File, SDCARD},
|
storage::{Dir, File, SDCARD},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -79,19 +80,9 @@ pub extern "C" fn draw_iter(cpixels: *const CPixel, len: usize) {
|
|||||||
|
|
||||||
let iter = cpixels.iter().copied().map(|c: CPixel| c.into());
|
let iter = cpixels.iter().copied().map(|c: CPixel| c.into());
|
||||||
|
|
||||||
let fb = if cfg!(feature = "pimoroni2w") {
|
FB_PAUSED.store(true, Ordering::Release);
|
||||||
if WRITE_FRAMEBUFFER2.load(Ordering::Acquire) {
|
unsafe { FRAMEBUFFER.as_mut().unwrap().draw_iter(iter).unwrap() }
|
||||||
unsafe { FRAMEBUFFER2.deref_mut() }
|
FB_PAUSED.store(false, Ordering::Release);
|
||||||
} else {
|
|
||||||
unsafe { &mut FRAMEBUFFER }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unsafe { &mut FRAMEBUFFER }
|
|
||||||
};
|
|
||||||
|
|
||||||
fb.draw_iter(iter).unwrap();
|
|
||||||
|
|
||||||
WRITE_FRAMEBUFFER2.fetch_not(Ordering::AcqRel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static mut KEY_CACHE: Queue<KeyEvent, 32> = Queue::new();
|
pub static mut KEY_CACHE: Queue<KeyEvent, 32> = Queue::new();
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
use crate::framebuffer::{self, AtomicFrameBuffer};
|
use crate::framebuffer::{self, AtomicFrameBuffer, FB_PAUSED};
|
||||||
use alloc::vec;
|
use core::alloc::{GlobalAlloc, Layout};
|
||||||
use core::alloc::GlobalAlloc;
|
|
||||||
use core::alloc::Layout;
|
|
||||||
#[cfg(feature = "pimoroni2w")]
|
|
||||||
use core::sync::atomic::AtomicBool;
|
|
||||||
use core::sync::atomic::Ordering;
|
use core::sync::atomic::Ordering;
|
||||||
use embassy_rp::{
|
use embassy_rp::{
|
||||||
Peri,
|
Peri,
|
||||||
@@ -12,8 +8,11 @@ use embassy_rp::{
|
|||||||
spi::{Async, Spi},
|
spi::{Async, Spi},
|
||||||
};
|
};
|
||||||
use embassy_time::{Delay, Timer};
|
use embassy_time::{Delay, Timer};
|
||||||
|
use embedded_graphics::{
|
||||||
|
pixelcolor::Rgb565,
|
||||||
|
prelude::{DrawTarget, RgbColor},
|
||||||
|
};
|
||||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||||
use once_cell::unsync::Lazy;
|
|
||||||
use st7365p_lcd::ST7365P;
|
use st7365p_lcd::ST7365P;
|
||||||
|
|
||||||
type DISPLAY = ST7365P<
|
type DISPLAY = ST7365P<
|
||||||
@@ -26,33 +25,24 @@ type DISPLAY = ST7365P<
|
|||||||
pub const SCREEN_WIDTH: usize = 320;
|
pub const SCREEN_WIDTH: usize = 320;
|
||||||
pub const SCREEN_HEIGHT: usize = 320;
|
pub const SCREEN_HEIGHT: usize = 320;
|
||||||
|
|
||||||
// used to switch which fb is being used for read/write
|
pub static mut FRAMEBUFFER: Option<AtomicFrameBuffer> = None;
|
||||||
#[cfg(feature = "pimoroni2w")]
|
|
||||||
pub static WRITE_FRAMEBUFFER2: AtomicBool = AtomicBool::new(false);
|
|
||||||
|
|
||||||
// the default screen buffer - the only one on boards without extra ram or psram
|
fn init_fb() {
|
||||||
pub static mut FRAMEBUFFER: Lazy<AtomicFrameBuffer> = Lazy::new(|| {
|
unsafe {
|
||||||
static mut BUF: [u16; framebuffer::SIZE] = [0; framebuffer::SIZE];
|
FRAMEBUFFER = Some(if cfg!(not(feature = "pimoroni2w")) {
|
||||||
AtomicFrameBuffer::new(unsafe { &mut BUF })
|
static mut BUF: [u16; framebuffer::SIZE] = [0; framebuffer::SIZE];
|
||||||
});
|
AtomicFrameBuffer::new(&mut BUF)
|
||||||
|
} else {
|
||||||
|
let slab = crate::heap::HEAP.alloc(Layout::array::<u16>(framebuffer::SIZE).unwrap())
|
||||||
|
as *mut u16;
|
||||||
|
let buf = core::slice::from_raw_parts_mut(slab, framebuffer::SIZE);
|
||||||
|
|
||||||
#[cfg(feature = "pimoroni2w")]
|
let mut fb = AtomicFrameBuffer::new(buf);
|
||||||
pub static mut FRAMEBUFFER2: Lazy<AtomicFrameBuffer> = Lazy::new(|| {
|
fb.clear(Rgb565::BLACK).unwrap();
|
||||||
use embedded_graphics::{
|
fb
|
||||||
pixelcolor::Rgb565,
|
});
|
||||||
prelude::{DrawTarget, RgbColor},
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
let buf = unsafe {
|
|
||||||
let slab =
|
|
||||||
crate::heap::HEAP.alloc(Layout::array::<u16>(framebuffer::SIZE).unwrap()) as *mut u16;
|
|
||||||
core::slice::from_raw_parts_mut(slab, framebuffer::SIZE)
|
|
||||||
};
|
|
||||||
let mut fb = AtomicFrameBuffer::new(buf);
|
|
||||||
fb.set_all_tiles(false);
|
|
||||||
fb.clear(Rgb565::BLACK).unwrap();
|
|
||||||
fb
|
|
||||||
});
|
|
||||||
|
|
||||||
pub async fn init_display(
|
pub async fn init_display(
|
||||||
spi: Spi<'static, SPI1, Async>,
|
spi: Spi<'static, SPI1, Async>,
|
||||||
@@ -60,6 +50,8 @@ pub async fn init_display(
|
|||||||
data: Peri<'static, PIN_14>,
|
data: Peri<'static, PIN_14>,
|
||||||
reset: Peri<'static, PIN_15>,
|
reset: Peri<'static, PIN_15>,
|
||||||
) -> DISPLAY {
|
) -> DISPLAY {
|
||||||
|
init_fb();
|
||||||
|
|
||||||
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
|
let spi_device = ExclusiveDevice::new(spi, Output::new(cs, Level::Low), Delay).unwrap();
|
||||||
let mut display = ST7365P::new(
|
let mut display = ST7365P::new(
|
||||||
spi_device,
|
spi_device,
|
||||||
@@ -71,7 +63,14 @@ pub async fn init_display(
|
|||||||
);
|
);
|
||||||
display.init().await.unwrap();
|
display.init().await.unwrap();
|
||||||
display.set_custom_orientation(0x40).await.unwrap();
|
display.set_custom_orientation(0x40).await.unwrap();
|
||||||
unsafe { FRAMEBUFFER.draw(&mut display).await.unwrap() }
|
unsafe {
|
||||||
|
FRAMEBUFFER
|
||||||
|
.as_mut()
|
||||||
|
.unwrap()
|
||||||
|
.draw(&mut display)
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
display.set_on().await.unwrap();
|
display.set_on().await.unwrap();
|
||||||
|
|
||||||
display
|
display
|
||||||
@@ -80,18 +79,18 @@ pub async fn init_display(
|
|||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
pub async fn display_handler(mut display: DISPLAY) {
|
pub async fn display_handler(mut display: DISPLAY) {
|
||||||
loop {
|
loop {
|
||||||
let fb = if cfg!(feature = "pimoroni2w") {
|
if !FB_PAUSED.load(Ordering::Acquire) {
|
||||||
if WRITE_FRAMEBUFFER2.load(Ordering::Acquire) {
|
unsafe {
|
||||||
unsafe { &mut FRAMEBUFFER }
|
FRAMEBUFFER
|
||||||
} else {
|
.as_mut()
|
||||||
unsafe { &mut FRAMEBUFFER2 }
|
.unwrap()
|
||||||
}
|
.partial_draw(&mut display)
|
||||||
} else {
|
.await
|
||||||
unsafe { &mut FRAMEBUFFER }
|
.unwrap()
|
||||||
};
|
};
|
||||||
fb.safe_draw(&mut display).await.unwrap();
|
}
|
||||||
|
|
||||||
// small yield to allow other tasks to run
|
// small yield to allow other tasks to run
|
||||||
Timer::after_nanos(100).await;
|
Timer::after_nanos(500).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use crate::display::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
use crate::display::{SCREEN_HEIGHT, SCREEN_WIDTH};
|
||||||
use core::sync::atomic::{AtomicBool, Ordering};
|
use core::sync::atomic::{AtomicBool, Ordering};
|
||||||
use embassy_sync::lazy_lock::LazyLock;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
draw_target::DrawTarget,
|
draw_target::DrawTarget,
|
||||||
pixelcolor::{
|
pixelcolor::{
|
||||||
@@ -14,37 +13,32 @@ use embedded_hal_2::digital::OutputPin;
|
|||||||
use embedded_hal_async::{delay::DelayNs, spi::SpiDevice};
|
use embedded_hal_async::{delay::DelayNs, spi::SpiDevice};
|
||||||
use st7365p_lcd::ST7365P;
|
use st7365p_lcd::ST7365P;
|
||||||
|
|
||||||
pub const TILE_SIZE: usize = 16; // 16x16 tile
|
const TILE_SIZE: usize = 16; // 16x16 tile
|
||||||
pub const TILE_COUNT: usize = (SCREEN_WIDTH / TILE_SIZE) * (SCREEN_HEIGHT / TILE_SIZE); // 400 tiles
|
const TILE_COUNT: usize = (SCREEN_WIDTH / TILE_SIZE) * (SCREEN_HEIGHT / TILE_SIZE); // 400 tiles
|
||||||
|
const NUM_TILE_ROWS: usize = SCREEN_WIDTH / TILE_SIZE;
|
||||||
|
const NUM_TILE_COLS: usize = SCREEN_WIDTH / TILE_SIZE;
|
||||||
|
|
||||||
// Group of tiles for batching
|
const MAX_BATCH_TILES: usize = (SCREEN_WIDTH / TILE_SIZE) * 2;
|
||||||
pub const MAX_META_TILES: usize = (SCREEN_WIDTH / TILE_SIZE) * 2; // max number of meta tiles in buffer
|
type BatchTileBuf = [u16; MAX_BATCH_TILES * TILE_SIZE * TILE_SIZE];
|
||||||
type MetaTileVec = heapless::Vec<Rectangle, { TILE_COUNT / MAX_META_TILES }>;
|
|
||||||
|
|
||||||
pub const SIZE: usize = SCREEN_HEIGHT * SCREEN_WIDTH;
|
pub const SIZE: usize = SCREEN_HEIGHT * SCREEN_WIDTH;
|
||||||
|
|
||||||
|
pub static FB_PAUSED: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct AtomicFrameBuffer<'a> {
|
pub struct AtomicFrameBuffer<'a> {
|
||||||
fb: &'a mut [u16],
|
fb: &'a mut [u16],
|
||||||
dirty_tiles: heapless::Vec<AtomicBool, TILE_COUNT>,
|
dirty_tiles: [AtomicBool; TILE_COUNT],
|
||||||
|
batch_tile_buf: BatchTileBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> AtomicFrameBuffer<'a> {
|
impl<'a> AtomicFrameBuffer<'a> {
|
||||||
pub fn new(buffer: &'a mut [u16]) -> Self {
|
pub fn new(buffer: &'a mut [u16]) -> Self {
|
||||||
assert!(buffer.len() == SIZE);
|
assert!(buffer.len() == SIZE);
|
||||||
let mut dirty_tiles = heapless::Vec::new();
|
|
||||||
for _ in 0..TILE_COUNT {
|
|
||||||
dirty_tiles.push(AtomicBool::new(true)).unwrap()
|
|
||||||
}
|
|
||||||
Self {
|
Self {
|
||||||
fb: buffer,
|
fb: buffer,
|
||||||
dirty_tiles,
|
dirty_tiles: core::array::from_fn(|_| AtomicBool::new(true)),
|
||||||
}
|
batch_tile_buf: [0; MAX_BATCH_TILES * TILE_SIZE * TILE_SIZE],
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_all_tiles(&mut self, set: bool) {
|
|
||||||
for t in self.dirty_tiles.iter_mut() {
|
|
||||||
t.store(set, Ordering::Release);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,59 +93,17 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// walk the dirty tiles and mark groups of tiles(meta-tiles) for batched updates
|
// Checks if a full draw would be faster than individual tile batches
|
||||||
fn find_meta_tiles(&mut self, tiles_x: usize, tiles_y: usize) -> MetaTileVec {
|
fn should_full_draw(&self) -> bool {
|
||||||
let mut meta_tiles: MetaTileVec = heapless::Vec::new();
|
let threshold_pixels = SIZE * 80 / 100;
|
||||||
|
let mut dirty_pixels = 0;
|
||||||
|
|
||||||
for ty in 0..tiles_y {
|
self.dirty_tiles.iter().any(|tile| {
|
||||||
let mut tx = 0;
|
if tile.load(Ordering::Acquire) {
|
||||||
while tx < tiles_x {
|
dirty_pixels += TILE_SIZE * TILE_SIZE;
|
||||||
let idx = ty * tiles_x + tx;
|
|
||||||
if !self.dirty_tiles[idx].load(Ordering::Acquire) {
|
|
||||||
tx += 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start meta-tile at this tile
|
|
||||||
let mut width_tiles = 1;
|
|
||||||
let height_tiles = 1;
|
|
||||||
|
|
||||||
// Grow horizontally, but keep under MAX_TILES_PER_METATILE
|
|
||||||
while tx + width_tiles < tiles_x
|
|
||||||
&& unsafe {
|
|
||||||
self.dirty_tiles[ty * tiles_x + tx + width_tiles].load(Ordering::Acquire)
|
|
||||||
}
|
|
||||||
&& (width_tiles + height_tiles) <= MAX_META_TILES
|
|
||||||
{
|
|
||||||
width_tiles += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: for simplicity, skipped vertical growth
|
|
||||||
|
|
||||||
for x_off in 0..width_tiles {
|
|
||||||
unsafe {
|
|
||||||
self.dirty_tiles[ty * tiles_x + tx + x_off].store(false, Ordering::Release);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// new meta-tile pos
|
|
||||||
let rect = Rectangle::new(
|
|
||||||
Point::new((tx * TILE_SIZE) as i32, (ty * TILE_SIZE) as i32),
|
|
||||||
Size::new(
|
|
||||||
(width_tiles * TILE_SIZE) as u32,
|
|
||||||
(height_tiles * TILE_SIZE) as u32,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if meta_tiles.push(rect).is_err() {
|
|
||||||
return meta_tiles;
|
|
||||||
};
|
|
||||||
|
|
||||||
tx += width_tiles;
|
|
||||||
}
|
}
|
||||||
}
|
dirty_pixels >= threshold_pixels
|
||||||
|
})
|
||||||
meta_tiles
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends the entire framebuffer to the display
|
/// Sends the entire framebuffer to the display
|
||||||
@@ -174,68 +126,36 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
unsafe {
|
for tile in self.dirty_tiles.iter() {
|
||||||
for tile in self.dirty_tiles.iter() {
|
tile.store(false, Ordering::Release);
|
||||||
tile.store(false, Ordering::Release);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn safe_draw<SPI, DC, RST, DELAY>(
|
|
||||||
&mut self,
|
|
||||||
display: &mut ST7365P<SPI, DC, RST, DELAY>,
|
|
||||||
) -> Result<(), ()>
|
|
||||||
where
|
|
||||||
SPI: SpiDevice,
|
|
||||||
DC: OutputPin,
|
|
||||||
RST: OutputPin,
|
|
||||||
DELAY: DelayNs,
|
|
||||||
{
|
|
||||||
let tiles_x = SCREEN_WIDTH / TILE_SIZE;
|
|
||||||
let _tiles_y = SCREEN_HEIGHT / TILE_SIZE;
|
|
||||||
|
|
||||||
let mut pixel_buffer: heapless::Vec<u16, { TILE_SIZE * TILE_SIZE }> = heapless::Vec::new();
|
|
||||||
|
|
||||||
for tile_idx in 0..TILE_COUNT {
|
|
||||||
if self.dirty_tiles[tile_idx].swap(false, Ordering::AcqRel) {
|
|
||||||
let tx = tile_idx % tiles_x;
|
|
||||||
let ty = tile_idx / tiles_x;
|
|
||||||
|
|
||||||
let x_start = tx * TILE_SIZE;
|
|
||||||
let y_start = ty * TILE_SIZE;
|
|
||||||
|
|
||||||
let x_end = (x_start + TILE_SIZE).min(SCREEN_WIDTH);
|
|
||||||
let y_end = (y_start + TILE_SIZE).min(SCREEN_HEIGHT);
|
|
||||||
|
|
||||||
pixel_buffer.clear();
|
|
||||||
|
|
||||||
for y in y_start..y_end {
|
|
||||||
let start = y * SCREEN_WIDTH + x_start;
|
|
||||||
let end = y * SCREEN_WIDTH + x_end;
|
|
||||||
pixel_buffer
|
|
||||||
.extend_from_slice(&self.fb[start..end])
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
display
|
|
||||||
.set_pixels_buffered(
|
|
||||||
x_start as u16,
|
|
||||||
y_start as u16,
|
|
||||||
(x_end - 1) as u16,
|
|
||||||
(y_end - 1) as u16,
|
|
||||||
&pixel_buffer,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends only dirty tiles (16x16px) in batches to the display
|
// copy N tiles horizontally to the right into batch tile buf
|
||||||
|
fn append_tiles_to_batch(
|
||||||
|
&mut self,
|
||||||
|
tile_x: u16,
|
||||||
|
tile_y: u16,
|
||||||
|
total_tiles: u16, // number of tiles being written to buf
|
||||||
|
) {
|
||||||
|
debug_assert!(total_tiles as usize <= NUM_TILE_COLS);
|
||||||
|
for batch_row_num in 0..TILE_SIZE {
|
||||||
|
let batch_row_offset = batch_row_num * total_tiles as usize * TILE_SIZE;
|
||||||
|
let batch_row = &mut self.batch_tile_buf
|
||||||
|
[batch_row_offset..batch_row_offset + (total_tiles as usize * TILE_SIZE)];
|
||||||
|
|
||||||
|
let fb_row_offset = (tile_y as usize * TILE_SIZE + batch_row_num) * SCREEN_WIDTH
|
||||||
|
+ tile_x as usize * TILE_SIZE;
|
||||||
|
let fb_row =
|
||||||
|
&self.fb[fb_row_offset..fb_row_offset + (total_tiles as usize * TILE_SIZE)];
|
||||||
|
|
||||||
|
batch_row.copy_from_slice(fb_row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pushes tiles to the display in batches to avoid full frame pushes (unless needed)
|
||||||
pub async fn partial_draw<SPI, DC, RST, DELAY>(
|
pub async fn partial_draw<SPI, DC, RST, DELAY>(
|
||||||
&mut self,
|
&mut self,
|
||||||
display: &mut ST7365P<SPI, DC, RST, DELAY>,
|
display: &mut ST7365P<SPI, DC, RST, DELAY>,
|
||||||
@@ -246,57 +166,53 @@ impl<'a> AtomicFrameBuffer<'a> {
|
|||||||
RST: OutputPin,
|
RST: OutputPin,
|
||||||
DELAY: DelayNs,
|
DELAY: DelayNs,
|
||||||
{
|
{
|
||||||
if unsafe { self.dirty_tiles.iter().any(|p| p.load(Ordering::Acquire)) } {
|
if self.should_full_draw() {
|
||||||
let tiles_x = (SCREEN_WIDTH + TILE_SIZE - 1) / TILE_SIZE;
|
return self.draw(display).await;
|
||||||
let tiles_y = (SCREEN_HEIGHT + TILE_SIZE - 1) / TILE_SIZE;
|
}
|
||||||
|
|
||||||
let meta_tiles = self.find_meta_tiles(tiles_x, tiles_y);
|
for tile_row in 0..NUM_TILE_ROWS {
|
||||||
|
let row_start_idx = tile_row * NUM_TILE_COLS;
|
||||||
|
let mut col = 0;
|
||||||
|
|
||||||
// buffer for copying meta tiles before sending to display
|
while col < NUM_TILE_COLS {
|
||||||
let mut pixel_buffer: heapless::Vec<u16, { MAX_META_TILES * TILE_SIZE * TILE_SIZE }> =
|
// Check for dirty tile
|
||||||
heapless::Vec::new();
|
if self.dirty_tiles[row_start_idx + col].swap(false, Ordering::Acquire) {
|
||||||
|
let run_start = col;
|
||||||
|
let mut run_len = 1;
|
||||||
|
|
||||||
for rect in meta_tiles {
|
// Extend run while contiguous dirty tiles and within MAX_BATCH_TILES
|
||||||
let rect_width = rect.size.width as usize;
|
while col + 1 < NUM_TILE_COLS
|
||||||
let rect_height = rect.size.height as usize;
|
&& self.dirty_tiles[row_start_idx + col + 1].load(Ordering::Acquire)
|
||||||
let rect_x = rect.top_left.x as usize;
|
&& run_len < MAX_BATCH_TILES
|
||||||
let rect_y = rect.top_left.y as usize;
|
{
|
||||||
|
col += 1;
|
||||||
pixel_buffer.clear();
|
run_len += 1;
|
||||||
|
|
||||||
for row in 0..rect_height {
|
|
||||||
let y = rect_y + row;
|
|
||||||
let start = y * SCREEN_WIDTH + rect_x;
|
|
||||||
let end = start + rect_width;
|
|
||||||
|
|
||||||
// Safe: we guarantee buffer will not exceed MAX_META_TILE_PIXELS
|
|
||||||
pixel_buffer
|
|
||||||
.extend_from_slice(&self.fb[start..end])
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
display
|
|
||||||
.set_pixels_buffered(
|
|
||||||
rect_x as u16,
|
|
||||||
rect_y as u16,
|
|
||||||
(rect_x + rect_width - 1) as u16,
|
|
||||||
(rect_y + rect_height - 1) as u16,
|
|
||||||
&pixel_buffer,
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
// walk the meta-tile and set as clean
|
|
||||||
let start_tx = rect_x / TILE_SIZE;
|
|
||||||
let start_ty = rect_y / TILE_SIZE;
|
|
||||||
let end_tx = (rect_x + rect_width - 1) / TILE_SIZE;
|
|
||||||
let end_ty = (rect_y + rect_height - 1) / TILE_SIZE;
|
|
||||||
|
|
||||||
for ty in start_ty..=end_ty {
|
|
||||||
for tx in start_tx..=end_tx {
|
|
||||||
let tile_idx = ty * tiles_x + tx;
|
|
||||||
self.dirty_tiles[tile_idx].store(false, Ordering::Release);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy the whole horizontal run into the batch buffer in one call
|
||||||
|
let tile_x = run_start;
|
||||||
|
let tile_y = tile_row;
|
||||||
|
self.append_tiles_to_batch(tile_x as u16, tile_y as u16, run_len as u16);
|
||||||
|
|
||||||
|
// Compute coordinates for display write
|
||||||
|
let start_x = tile_x * TILE_SIZE;
|
||||||
|
let end_x = start_x + run_len * TILE_SIZE - 1;
|
||||||
|
let start_y = tile_y * TILE_SIZE;
|
||||||
|
let end_y = start_y + TILE_SIZE - 1;
|
||||||
|
|
||||||
|
// Send batch to display
|
||||||
|
display
|
||||||
|
.set_pixels_buffered(
|
||||||
|
start_x as u16,
|
||||||
|
start_y as u16,
|
||||||
|
end_x as u16,
|
||||||
|
end_y as u16,
|
||||||
|
&self.batch_tile_buf[..run_len * TILE_SIZE * TILE_SIZE],
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
col += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +233,8 @@ impl<'a> DrawTarget for AtomicFrameBuffer<'a> {
|
|||||||
|
|
||||||
for Pixel(coord, color) in pixels {
|
for Pixel(coord, color) in pixels {
|
||||||
if coord.x >= 0 && coord.y >= 0 {
|
if coord.x >= 0 && coord.y >= 0 {
|
||||||
let x = coord.x as i32;
|
let x = coord.x;
|
||||||
let y = coord.y as i32;
|
let y = coord.y;
|
||||||
|
|
||||||
if (x as usize) < SCREEN_WIDTH && (y as usize) < SCREEN_HEIGHT {
|
if (x as usize) < SCREEN_WIDTH && (y as usize) < SCREEN_HEIGHT {
|
||||||
let idx = (y as usize) * SCREEN_WIDTH + (x as usize);
|
let idx = (y as usize) * SCREEN_WIDTH + (x as usize);
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ mod abi;
|
|||||||
mod display;
|
mod display;
|
||||||
mod elf;
|
mod elf;
|
||||||
mod framebuffer;
|
mod framebuffer;
|
||||||
|
#[allow(unused)]
|
||||||
mod heap;
|
mod heap;
|
||||||
mod peripherals;
|
mod peripherals;
|
||||||
|
#[allow(unused)]
|
||||||
mod psram;
|
mod psram;
|
||||||
mod scsi;
|
mod scsi;
|
||||||
mod storage;
|
mod storage;
|
||||||
@@ -80,7 +82,10 @@ static mut CORE1_STACK: Stack<16384> = Stack::new();
|
|||||||
static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
|
static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
|
||||||
static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
|
static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
|
||||||
|
|
||||||
|
#[cfg(not(feature = "pimoroni2w"))]
|
||||||
static mut ARENA: [u8; 250 * 1024] = [0; 250 * 1024];
|
static mut ARENA: [u8; 250 * 1024] = [0; 250 * 1024];
|
||||||
|
#[cfg(feature = "pimoroni2w")]
|
||||||
|
static mut ARENA: [u8; 400 * 1024] = [0; 400 * 1024];
|
||||||
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static ALLOCATOR: Talck<spin::Mutex<()>, ClaimOnOom> =
|
static ALLOCATOR: Talck<spin::Mutex<()>, ClaimOnOom> =
|
||||||
@@ -90,11 +95,12 @@ static ALLOCATOR: Talck<spin::Mutex<()>, ClaimOnOom> =
|
|||||||
#[embassy_executor::task]
|
#[embassy_executor::task]
|
||||||
async fn watchdog_task(mut watchdog: Watchdog) {
|
async fn watchdog_task(mut watchdog: Watchdog) {
|
||||||
if let Some(reason) = watchdog.reset_reason() {
|
if let Some(reason) = watchdog.reset_reason() {
|
||||||
let reason = match reason {
|
let _reason = match reason {
|
||||||
ResetReason::Forced => "forced",
|
ResetReason::Forced => "forced",
|
||||||
ResetReason::TimedOut => "timed out",
|
ResetReason::TimedOut => "timed out",
|
||||||
};
|
};
|
||||||
defmt::error!("Watchdog reset reason: {}", reason);
|
#[cfg(feature = "debug")]
|
||||||
|
defmt::error!("Watchdog reset reason: {}", _reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
watchdog.start(Duration::from_secs(3));
|
watchdog.start(Duration::from_secs(3));
|
||||||
@@ -194,7 +200,7 @@ async fn userland_task() {
|
|||||||
{
|
{
|
||||||
ENABLE_UI.store(true, Ordering::Release);
|
ENABLE_UI.store(true, Ordering::Release);
|
||||||
UI_CHANGE.signal(());
|
UI_CHANGE.signal(());
|
||||||
unsafe { FRAMEBUFFER.clear(Rgb565::BLACK).unwrap() };
|
unsafe { FRAMEBUFFER.as_mut().unwrap().clear(Rgb565::BLACK).unwrap() };
|
||||||
|
|
||||||
let mut selections = SELECTIONS.lock().await;
|
let mut selections = SELECTIONS.lock().await;
|
||||||
selections.set_changed(true);
|
selections.set_changed(true);
|
||||||
@@ -221,6 +227,7 @@ struct Sd {
|
|||||||
cs: Peri<'static, PIN_17>,
|
cs: Peri<'static, PIN_17>,
|
||||||
det: Peri<'static, PIN_22>,
|
det: Peri<'static, PIN_22>,
|
||||||
}
|
}
|
||||||
|
#[allow(dead_code)]
|
||||||
struct Psram {
|
struct Psram {
|
||||||
pio: Peri<'static, PIO0>,
|
pio: Peri<'static, PIO0>,
|
||||||
sclk: Peri<'static, PIN_21>,
|
sclk: Peri<'static, PIN_21>,
|
||||||
@@ -246,7 +253,7 @@ async fn setup_mcu(mcu: Mcu) {
|
|||||||
|
|
||||||
async fn setup_display(display: Display, spawner: Spawner) {
|
async fn setup_display(display: Display, spawner: Spawner) {
|
||||||
let mut config = spi::Config::default();
|
let mut config = spi::Config::default();
|
||||||
config.frequency = 16_000_000;
|
config.frequency = 64_000_000;
|
||||||
let spi = Spi::new(
|
let spi = Spi::new(
|
||||||
display.spi,
|
display.spi,
|
||||||
display.clk,
|
display.clk,
|
||||||
@@ -279,20 +286,18 @@ async fn setup_psram(psram: Psram) {
|
|||||||
|
|
||||||
#[cfg(feature = "pimoroni2w")]
|
#[cfg(feature = "pimoroni2w")]
|
||||||
async fn setup_qmi_psram() {
|
async fn setup_qmi_psram() {
|
||||||
let mut tries = 5;
|
|
||||||
Timer::after_millis(250).await;
|
Timer::after_millis(250).await;
|
||||||
while tries > 1 {
|
let psram_qmi_size = init_psram_qmi(&embassy_rp::pac::QMI, &embassy_rp::pac::XIP_CTRL);
|
||||||
let psram_qmi_size = init_psram_qmi(&embassy_rp::pac::QMI, &embassy_rp::pac::XIP_CTRL);
|
#[cfg(feature = "debug")]
|
||||||
defmt::info!("size: {}", psram_qmi_size);
|
defmt::info!("size: {}", psram_qmi_size);
|
||||||
Timer::after_millis(100).await;
|
Timer::after_millis(100).await;
|
||||||
if psram_qmi_size > 0 {
|
|
||||||
init_qmi_psram_heap(psram_qmi_size);
|
if psram_qmi_size > 0 {
|
||||||
return;
|
init_qmi_psram_heap(psram_qmi_size);
|
||||||
}
|
return;
|
||||||
defmt::info!("failed to init qmi psram... trying again");
|
} else {
|
||||||
tries -= 1;
|
panic!("qmi psram not initialized");
|
||||||
}
|
}
|
||||||
panic!("qmi psram not initialized");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn setup_sd(sd: Sd) {
|
async fn setup_sd(sd: Sd) {
|
||||||
@@ -316,7 +321,7 @@ async fn kernel_task(
|
|||||||
watchdog: Peri<'static, WATCHDOG>,
|
watchdog: Peri<'static, WATCHDOG>,
|
||||||
display: Display,
|
display: Display,
|
||||||
sd: Sd,
|
sd: Sd,
|
||||||
psram: Psram,
|
_psram: Psram,
|
||||||
mcu: Mcu,
|
mcu: Mcu,
|
||||||
usb: Peri<'static, USB>,
|
usb: Peri<'static, USB>,
|
||||||
) {
|
) {
|
||||||
@@ -324,11 +329,16 @@ async fn kernel_task(
|
|||||||
.spawn(watchdog_task(Watchdog::new(watchdog)))
|
.spawn(watchdog_task(Watchdog::new(watchdog)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
setup_mcu(mcu).await;
|
||||||
|
|
||||||
|
defmt::info!("setting up psram");
|
||||||
|
Timer::after_millis(100).await;
|
||||||
|
|
||||||
// setup_psram(psram).await;
|
// setup_psram(psram).await;
|
||||||
#[cfg(feature = "pimoroni2w")]
|
#[cfg(feature = "pimoroni2w")]
|
||||||
setup_qmi_psram().await;
|
setup_qmi_psram().await;
|
||||||
|
|
||||||
setup_mcu(mcu).await;
|
Timer::after_millis(100).await;
|
||||||
setup_display(display, spawner).await;
|
setup_display(display, spawner).await;
|
||||||
setup_sd(sd).await;
|
setup_sd(sd).await;
|
||||||
|
|
||||||
|
|||||||
@@ -526,6 +526,7 @@ pub fn init_psram_qmi(
|
|||||||
let psram_size = detect_psram_qmi(qmi);
|
let psram_size = detect_psram_qmi(qmi);
|
||||||
|
|
||||||
if psram_size == 0 {
|
if psram_size == 0 {
|
||||||
|
#[cfg(feature = "debug")]
|
||||||
defmt::error!("qmi psram size 0");
|
defmt::error!("qmi psram size 0");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -548,13 +549,13 @@ pub fn init_psram_qmi(
|
|||||||
let min_deselect: u32 = ((18 * 1_000_000 + (clock_period_fs - 1)) / clock_period_fs
|
let min_deselect: u32 = ((18 * 1_000_000 + (clock_period_fs - 1)) / clock_period_fs
|
||||||
- u64::from(divisor + 1) / 2) as u32;
|
- u64::from(divisor + 1) / 2) as u32;
|
||||||
|
|
||||||
#[cfg(feature = "defmt")]
|
// #[cfg(feature = "defmt")]
|
||||||
defmt::info!(
|
// defmt::info!(
|
||||||
"clock_period_fs={} max_select={} min_deselect={}",
|
// "clock_period_fs={} max_select={} min_deselect={}",
|
||||||
clock_period_fs,
|
// clock_period_fs,
|
||||||
max_select,
|
// max_select,
|
||||||
min_deselect
|
// min_deselect
|
||||||
);
|
// );
|
||||||
|
|
||||||
qmi.direct_csr().write(|w| {
|
qmi.direct_csr().write(|w| {
|
||||||
w.set_clkdiv(10);
|
w.set_clkdiv(10);
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
BINARY_CH,
|
BINARY_CH, display::FRAMEBUFFER, elf::load_binary, framebuffer::FB_PAUSED,
|
||||||
display::{FRAMEBUFFER, FRAMEBUFFER2, WRITE_FRAMEBUFFER2},
|
peripherals::keyboard, storage::FileName,
|
||||||
elf::load_binary,
|
|
||||||
peripherals::keyboard,
|
|
||||||
storage::FileName,
|
|
||||||
};
|
};
|
||||||
use abi_sys::keyboard::{KeyCode, KeyState};
|
use abi_sys::keyboard::{KeyCode, KeyState};
|
||||||
use alloc::{str::FromStr, string::String, vec::Vec};
|
use alloc::{str::FromStr, string::String, vec::Vec};
|
||||||
use core::{ops::DerefMut, sync::atomic::Ordering};
|
use core::sync::atomic::Ordering;
|
||||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex};
|
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, mutex::Mutex};
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Drawable,
|
Drawable,
|
||||||
@@ -71,7 +68,7 @@ pub async fn clear_selection() {
|
|||||||
if let Some(area) = sel.last_bounds {
|
if let Some(area) = sel.last_bounds {
|
||||||
Rectangle::new(area.top_left, area.size)
|
Rectangle::new(area.top_left, area.size)
|
||||||
.into_styled(PrimitiveStyle::with_fill(Rgb565::BLACK))
|
.into_styled(PrimitiveStyle::with_fill(Rgb565::BLACK))
|
||||||
.draw(unsafe { &mut *FRAMEBUFFER })
|
.draw(unsafe { &mut *FRAMEBUFFER.as_mut().unwrap() })
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,20 +78,12 @@ async fn draw_selection() {
|
|||||||
let file_names = &guard.selections.clone();
|
let file_names = &guard.selections.clone();
|
||||||
|
|
||||||
let text_style = MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE);
|
let text_style = MonoTextStyle::new(&FONT_10X20, Rgb565::WHITE);
|
||||||
let display_area = unsafe { FRAMEBUFFER.bounding_box() };
|
let display_area = unsafe { FRAMEBUFFER.as_mut().unwrap().bounding_box() };
|
||||||
|
|
||||||
const NO_BINS: &str = "No Programs found on SD Card. Ensure programs end with '.bin', and are located in the root directory";
|
const NO_BINS: &str = "No Programs found on SD Card. Ensure programs end with '.bin', and are located in the root directory";
|
||||||
let no_bins = String::from_str(NO_BINS).unwrap();
|
let no_bins = String::from_str(NO_BINS).unwrap();
|
||||||
|
|
||||||
let mut fb = if cfg!(feature = "pimoroni2w") {
|
FB_PAUSED.store(true, Ordering::Release); // ensure all elements show up at once
|
||||||
if WRITE_FRAMEBUFFER2.load(Ordering::Acquire) {
|
|
||||||
unsafe { FRAMEBUFFER2.deref_mut() }
|
|
||||||
} else {
|
|
||||||
unsafe { &mut FRAMEBUFFER }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unsafe { &mut FRAMEBUFFER }
|
|
||||||
};
|
|
||||||
|
|
||||||
if file_names.is_empty() {
|
if file_names.is_empty() {
|
||||||
TextBox::new(
|
TextBox::new(
|
||||||
@@ -105,7 +94,7 @@ async fn draw_selection() {
|
|||||||
),
|
),
|
||||||
text_style,
|
text_style,
|
||||||
)
|
)
|
||||||
.draw(fb.deref_mut())
|
.draw(unsafe { &mut *FRAMEBUFFER.as_mut().unwrap() })
|
||||||
.unwrap();
|
.unwrap();
|
||||||
} else {
|
} else {
|
||||||
let mut views: alloc::vec::Vec<Text<MonoTextStyle<Rgb565>>> = Vec::new();
|
let mut views: alloc::vec::Vec<Text<MonoTextStyle<Rgb565>>> = Vec::new();
|
||||||
@@ -130,17 +119,18 @@ async fn draw_selection() {
|
|||||||
.bounding_box();
|
.bounding_box();
|
||||||
Rectangle::new(selected_bounds.top_left, selected_bounds.size)
|
Rectangle::new(selected_bounds.top_left, selected_bounds.size)
|
||||||
.into_styled(PrimitiveStyle::with_stroke(Rgb565::WHITE, 1))
|
.into_styled(PrimitiveStyle::with_stroke(Rgb565::WHITE, 1))
|
||||||
.draw(fb.deref_mut())
|
.draw(unsafe { &mut *FRAMEBUFFER.as_mut().unwrap() })
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
guard.last_bounds = Some(layout.bounds());
|
guard.last_bounds = Some(layout.bounds());
|
||||||
|
|
||||||
layout.draw(fb.deref_mut()).unwrap();
|
layout
|
||||||
|
.draw(unsafe { &mut *FRAMEBUFFER.as_mut().unwrap() })
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
guard.changed = false;
|
guard.changed = false;
|
||||||
|
FB_PAUSED.store(false, Ordering::Release); // ensure all elements show up at once
|
||||||
WRITE_FRAMEBUFFER2.fetch_not(Ordering::AcqRel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
11
main_proc_macro/Cargo.toml
Normal file
11
main_proc_macro/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[package]
|
||||||
|
name = "main_proc_macro"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
proc-macro = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
quote = "1.0.41"
|
||||||
|
syn = "2.0.108"
|
||||||
21
main_proc_macro/src/lib.rs
Normal file
21
main_proc_macro/src/lib.rs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
use proc_macro::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
|
use syn::{ItemFn, parse_macro_input};
|
||||||
|
|
||||||
|
#[proc_macro_attribute]
|
||||||
|
pub fn main(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||||
|
let input = parse_macro_input!(item as ItemFn);
|
||||||
|
let name = &input.sig.ident;
|
||||||
|
|
||||||
|
// ensure we emit _start in the same module as the fn
|
||||||
|
let expanded = quote! {
|
||||||
|
#input
|
||||||
|
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
|
pub extern "Rust" fn _start() {
|
||||||
|
#name();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
expanded.into()
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ use abi::{
|
|||||||
print,
|
print,
|
||||||
};
|
};
|
||||||
use alloc::{format, string::String, vec, vec::Vec};
|
use alloc::{format, string::String, vec, vec::Vec};
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Drawable,
|
Drawable,
|
||||||
geometry::{Dimensions, Point},
|
geometry::{Dimensions, Point},
|
||||||
@@ -26,12 +25,6 @@ use embedded_layout::{
|
|||||||
prelude::Chain,
|
prelude::Chain,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "Rust" fn _start() {
|
pub extern "Rust" fn _start() {
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -8,27 +8,16 @@ use abi::{
|
|||||||
fs::{list_dir, read_file},
|
fs::{list_dir, read_file},
|
||||||
get_key,
|
get_key,
|
||||||
keyboard::{KeyCode, KeyState},
|
keyboard::{KeyCode, KeyState},
|
||||||
print,
|
main, print,
|
||||||
};
|
};
|
||||||
use alloc::{format, string::ToString, vec};
|
use alloc::{format, string::ToString, vec};
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
Drawable, image::Image, mono_font::MonoTextStyle, mono_font::ascii::FONT_6X10,
|
Drawable, image::Image, mono_font::MonoTextStyle, mono_font::ascii::FONT_6X10,
|
||||||
pixelcolor::Rgb565, prelude::*, text::Text,
|
pixelcolor::Rgb565, prelude::*, text::Text,
|
||||||
};
|
};
|
||||||
use tinybmp::Bmp;
|
use tinybmp::Bmp;
|
||||||
|
|
||||||
#[panic_handler]
|
#[main]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location());
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "Rust" fn _start() {
|
|
||||||
main()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
print!("Starting Gallery app");
|
print!("Starting Gallery app");
|
||||||
let mut bmp_buf = vec![0_u8; 100_000];
|
let mut bmp_buf = vec![0_u8; 100_000];
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ edition = "2024"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
abi = { path = "../../abi" }
|
abi = { path = "../../abi" }
|
||||||
embedded-graphics = "0.8.1"
|
embedded-graphics = "0.8.1"
|
||||||
tinygif = "0.0.4"
|
tinygif = { git = "https://github.com/LegitCamper/tinygif" }
|
||||||
|
|||||||
@@ -7,24 +7,15 @@ use abi::{
|
|||||||
fs::{file_len, read_file},
|
fs::{file_len, read_file},
|
||||||
get_key, get_ms,
|
get_key, get_ms,
|
||||||
keyboard::{KeyCode, KeyState},
|
keyboard::{KeyCode, KeyState},
|
||||||
print, sleep,
|
main, print, sleep,
|
||||||
|
};
|
||||||
|
use alloc::{format, vec};
|
||||||
|
use embedded_graphics::{
|
||||||
|
image::ImageDrawable, pixelcolor::Rgb565, prelude::Point, transform::Transform,
|
||||||
};
|
};
|
||||||
use alloc::vec;
|
|
||||||
use core::panic::PanicInfo;
|
|
||||||
use embedded_graphics::{image::ImageDrawable, pixelcolor::Rgb565};
|
|
||||||
use tinygif::Gif;
|
use tinygif::Gif;
|
||||||
|
|
||||||
#[panic_handler]
|
#[main]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
|
||||||
pub extern "Rust" fn _start() {
|
|
||||||
main()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
print!("Starting Gif app");
|
print!("Starting Gif app");
|
||||||
let mut display = Display;
|
let mut display = Display;
|
||||||
@@ -36,20 +27,27 @@ pub fn main() {
|
|||||||
assert!(read == size);
|
assert!(read == size);
|
||||||
|
|
||||||
let gif = Gif::<Rgb565>::from_slice(&buf).unwrap();
|
let gif = Gif::<Rgb565>::from_slice(&buf).unwrap();
|
||||||
|
let height = gif.height();
|
||||||
|
|
||||||
let mut frame_num = 0;
|
let mut frame_num = 0;
|
||||||
loop {
|
loop {
|
||||||
for frame in gif.frames() {
|
for mut frame in gif.frames() {
|
||||||
let start = get_ms();
|
let start = get_ms();
|
||||||
|
|
||||||
frame.draw(&mut display).unwrap();
|
frame
|
||||||
|
.translate_mut(Point::new(0, (320 - height as i32) / 2))
|
||||||
|
.draw(&mut display)
|
||||||
|
.unwrap();
|
||||||
frame_num += 1;
|
frame_num += 1;
|
||||||
|
|
||||||
if frame_num % 100 == 0 {
|
if frame_num % 5 == 0 {
|
||||||
let event = get_key();
|
let event = get_key();
|
||||||
if event.state != KeyState::Idle {
|
if event.state != KeyState::Idle {
|
||||||
match event.key {
|
match event.key {
|
||||||
KeyCode::Esc => return,
|
KeyCode::Esc => {
|
||||||
|
drop(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,16 +9,10 @@ use abi::{
|
|||||||
keyboard::{KeyCode, KeyState},
|
keyboard::{KeyCode, KeyState},
|
||||||
print, sleep,
|
print, sleep,
|
||||||
};
|
};
|
||||||
use core::panic::PanicInfo;
|
use alloc::format;
|
||||||
use embedded_graphics::{pixelcolor::Rgb565, prelude::RgbColor};
|
use embedded_graphics::{pixelcolor::Rgb565, prelude::RgbColor};
|
||||||
use embedded_snake::{Direction, SnakeGame};
|
use embedded_snake::{Direction, SnakeGame};
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
|
||||||
print!("user panic: {} @ {:?}", info.message(), info.location(),);
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub extern "Rust" fn _start() {
|
pub extern "Rust" fn _start() {
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user