Rewrite firmware: use postcard over USB MIDI (SysEx)
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
/target
|
||||
target/
|
||||
|
||||
Generated
+310
-130
@@ -4,9 +4,9 @@ version = 4
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.11"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@@ -16,9 +16,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "aligned"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "377e4c0ba83e4431b10df45c1d4666f178ea9c552cac93e60c3a88bf32785923"
|
||||
checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
|
||||
dependencies = [
|
||||
"as-slice",
|
||||
]
|
||||
@@ -33,10 +33,19 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
name = "atomic-polyfill"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
||||
|
||||
[[package]]
|
||||
name = "az"
|
||||
@@ -50,7 +59,7 @@ version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
|
||||
dependencies = [
|
||||
"rustc_version",
|
||||
"rustc_version 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -61,9 +70,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||
|
||||
[[package]]
|
||||
name = "bit_field"
|
||||
version = "0.10.2"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61"
|
||||
checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
|
||||
|
||||
[[package]]
|
||||
name = "bitfield"
|
||||
@@ -85,9 +94,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.9.0"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
|
||||
checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
||||
|
||||
[[package]]
|
||||
name = "block-device-driver"
|
||||
@@ -106,9 +115,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
||||
|
||||
[[package]]
|
||||
name = "cobs"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cortex-m"
|
||||
@@ -140,7 +158,7 @@ checksum = "e37549a379a9e0e6e576fd208ee60394ccb8be963889eebba3ffe0980364f472"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -151,9 +169,9 @@ checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.10"
|
||||
version = "0.20.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
|
||||
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
@@ -161,27 +179,27 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.10"
|
||||
version = "0.20.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
|
||||
checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.10"
|
||||
version = "0.20.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -213,7 +231,7 @@ dependencies = [
|
||||
"proc-macro-error2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -227,9 +245,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "defmt-rtt"
|
||||
version = "1.0.0"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2cac3b8a5644a9e02b75085ebad3b6deafdbdbdec04bb25086523828aa4dfd1"
|
||||
checksum = "93d5a25c99d89c40f5676bec8cefe0614f17f0f40e916f98e345dae941807f9e"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
"defmt 1.0.1",
|
||||
@@ -237,21 +255,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "document-features"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
|
||||
checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"
|
||||
dependencies = [
|
||||
"litrs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-embedded-hal"
|
||||
version = "0.3.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41fea5ef5bed4d3468dfd44f5c9fa4cda8f54c86d4fb4ae683eacf9d39e2ea12"
|
||||
checksum = "554e3e840696f54b4c9afcf28a0f24da431c927f4151040020416e7393d6d0d8"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"embassy-futures",
|
||||
"embassy-hal-internal 0.3.0",
|
||||
"embassy-sync",
|
||||
"embassy-time",
|
||||
"embedded-hal 0.2.7",
|
||||
@@ -264,47 +283,63 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-executor"
|
||||
version = "0.7.0"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90327bcc66333a507f89ecc4e2d911b265c45f5c9bc241f98eee076752d35ac6"
|
||||
checksum = "06070468370195e0e86f241c8e5004356d696590a678d47d6676795b2e439c6b"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"document-features",
|
||||
"embassy-executor-macros",
|
||||
"embassy-executor-timer-queue",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-executor-macros"
|
||||
version = "0.6.2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3577b1e9446f61381179a330fc5324b01d511624c55f25e3c66c9e3c626dbecf"
|
||||
checksum = "dfdddc3a04226828316bf31393b6903ee162238576b1584ee2669af215d55472"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-futures"
|
||||
version = "0.1.1"
|
||||
name = "embassy-executor-timer-queue"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f878075b9794c1e4ac788c95b728f26aa6366d32eeb10c7051389f898f7d067"
|
||||
checksum = "2fc328bf943af66b80b98755db9106bf7e7471b0cf47dc8559cd9a6be504cc9c"
|
||||
|
||||
[[package]]
|
||||
name = "embassy-futures"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-hal-internal"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ef3bac31ec146321248a169e9c7b5799f1e0b3829c7a9b324cb4600a7438f59"
|
||||
checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-hal-internal"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f10ce10a4dfdf6402d8e9bd63128986b96a736b1a0a6680547ed2ac55d55dba"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
@@ -319,9 +354,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-net-driver-channel"
|
||||
version = "0.3.0"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4818c32afec43e3cae234f324bad9a976c9aa7501022d26ff60a4017a1a006b7"
|
||||
checksum = "b7b2739fbcf6cd206ae08779c7d709087b16577d255f2ea4a45bc4bbbf305b3f"
|
||||
dependencies = [
|
||||
"embassy-futures",
|
||||
"embassy-net-driver",
|
||||
@@ -330,23 +365,23 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "embassy-stm32"
|
||||
version = "0.2.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1e0bb733acdddbc7097765a47ce80bde2385647cf1d8427331931e06cff9a87"
|
||||
checksum = "088d65743a48f2cc9b3ae274ed85d6e8b68bd3ee92eb6b87b15dca2f81f7a101"
|
||||
dependencies = [
|
||||
"aligned",
|
||||
"bit_field",
|
||||
"bitflags 2.9.0",
|
||||
"bitflags 2.10.0",
|
||||
"block-device-driver",
|
||||
"cfg-if",
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"document-features",
|
||||
"embassy-embedded-hal",
|
||||
"embassy-futures",
|
||||
"embassy-hal-internal",
|
||||
"embassy-hal-internal 0.4.0",
|
||||
"embassy-net-driver",
|
||||
"embassy-sync",
|
||||
"embassy-time",
|
||||
@@ -359,107 +394,112 @@ dependencies = [
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"embedded-hal-nb",
|
||||
"embedded-io",
|
||||
"embedded-io-async",
|
||||
"embedded-io 0.7.1",
|
||||
"embedded-io-async 0.7.0",
|
||||
"embedded-storage",
|
||||
"embedded-storage-async",
|
||||
"futures-util",
|
||||
"heapless 0.9.2",
|
||||
"nb 1.1.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rand_core",
|
||||
"rand_core 0.6.4",
|
||||
"rand_core 0.9.3",
|
||||
"sdio-host",
|
||||
"static_assertions",
|
||||
"stm32-fmc",
|
||||
"stm32-metapac",
|
||||
"trait-set",
|
||||
"vcell",
|
||||
"volatile-register",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-sync"
|
||||
version = "0.6.2"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049"
|
||||
checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"embedded-io-async",
|
||||
"defmt 1.0.1",
|
||||
"embedded-io-async 0.6.1",
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"heapless",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8"
|
||||
checksum = "f4fa65b9284d974dad7a23bb72835c4ec85c0b540d86af7fc4098c88cff51d65"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"document-features",
|
||||
"embassy-time-driver",
|
||||
"embedded-hal 0.2.7",
|
||||
"embedded-hal 1.0.0",
|
||||
"embedded-hal-async",
|
||||
"futures-util",
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time-driver"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d45f5d833b6d98bd2aab0c2de70b18bfaa10faf661a1578fd8e5dfb15eb7eba"
|
||||
checksum = "a0a244c7dc22c8d0289379c8d8830cae06bb93d8f990194d0de5efb3b5ae7ba6"
|
||||
dependencies = [
|
||||
"document-features",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-time-queue-utils"
|
||||
version = "0.1.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc55c748d16908a65b166d09ce976575fb8852cf60ccd06174092b41064d8f83"
|
||||
checksum = "80e2ee86063bd028a420a5fb5898c18c87a8898026da1d4c852af2c443d0a454"
|
||||
dependencies = [
|
||||
"embassy-executor",
|
||||
"heapless",
|
||||
"embassy-executor-timer-queue",
|
||||
"heapless 0.8.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-usb"
|
||||
version = "0.4.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e651b9b7b47b514e6e6d1940a6e2e300891a2c33641917130643602a0cb6386"
|
||||
checksum = "dc4462e48b19a4f401a11901bdd981aab80c6a826608016a0bdc73cbbab31954"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"embassy-futures",
|
||||
"embassy-net-driver-channel",
|
||||
"embassy-sync",
|
||||
"embassy-usb-driver",
|
||||
"heapless",
|
||||
"embedded-io-async 0.6.1",
|
||||
"heapless 0.8.0",
|
||||
"ssmarshal",
|
||||
"usbd-hid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-usb-driver"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fc247028eae04174b6635104a35b1ed336aabef4654f5e87a8f32327d231970"
|
||||
checksum = "17119855ccc2d1f7470a39756b12068454ae27a3eabb037d940b5c03d9c77b7a"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"embedded-io-async 0.6.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embassy-usb-synopsys-otg"
|
||||
version = "0.2.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7"
|
||||
checksum = "288751f8eaa44a5cf2613f13cee0ca8e06e6638cb96e897e6834702c79084b23"
|
||||
dependencies = [
|
||||
"critical-section",
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
"embassy-sync",
|
||||
"embassy-usb-driver",
|
||||
]
|
||||
@@ -481,6 +521,7 @@ checksum = "0649998afacf6d575d126d83e68b78c0ab0e00ca2ac7e9b3db11b4cbe8274ef0"
|
||||
dependencies = [
|
||||
"az",
|
||||
"byteorder",
|
||||
"defmt 0.3.100",
|
||||
"embedded-graphics-core",
|
||||
"float-cmp",
|
||||
"micromath",
|
||||
@@ -494,6 +535,7 @@ checksum = "ba9ecd261f991856250d2207f6d8376946cd9f412a2165d3b75bc87a0bc7a044"
|
||||
dependencies = [
|
||||
"az",
|
||||
"byteorder",
|
||||
"defmt 0.3.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -547,8 +589,14 @@ name = "embedded-io"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
|
||||
|
||||
[[package]]
|
||||
name = "embedded-io"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9eb1aa714776b75c7e67e1da744b81a129b3ff919c8712b5e1b32252c1f07cc7"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"defmt 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -557,8 +605,17 @@ version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
|
||||
dependencies = [
|
||||
"defmt 0.3.100",
|
||||
"embedded-io",
|
||||
"embedded-io 0.6.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "embedded-io-async"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2564b9f813c544241430e147d8bc454815ef9ac998878d30cc3055449f7fd4c0"
|
||||
dependencies = [
|
||||
"defmt 1.0.1",
|
||||
"embedded-io 0.7.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -638,6 +695,15 @@ dependencies = [
|
||||
"pin-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hash32"
|
||||
version = "0.3.1"
|
||||
@@ -656,13 +722,37 @@ dependencies = [
|
||||
"ahash",
|
||||
]
|
||||
|
||||
[[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",
|
||||
"serde",
|
||||
"spin",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||
dependencies = [
|
||||
"hash32",
|
||||
"hash32 0.3.1",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heapless"
|
||||
version = "0.9.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed"
|
||||
dependencies = [
|
||||
"hash32 0.3.1",
|
||||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
@@ -692,20 +782,31 @@ dependencies = [
|
||||
"embedded-hal-bus",
|
||||
"epd-waveshare",
|
||||
"panic-probe",
|
||||
"usbd-hid",
|
||||
"postcard",
|
||||
"serde",
|
||||
"static_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
version = "0.4.1"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||
checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.26"
|
||||
version = "0.4.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
||||
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
||||
|
||||
[[package]]
|
||||
name = "micromath"
|
||||
@@ -739,9 +840,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.20.3"
|
||||
version = "1.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
|
||||
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
||||
|
||||
[[package]]
|
||||
name = "panic-probe"
|
||||
@@ -767,9 +868,21 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "portable-atomic"
|
||||
version = "1.11.0"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
||||
checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
|
||||
|
||||
[[package]]
|
||||
name = "postcard"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24"
|
||||
dependencies = [
|
||||
"cobs",
|
||||
"defmt 1.0.1",
|
||||
"heapless 0.7.17",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr2"
|
||||
@@ -790,23 +903,23 @@ dependencies = [
|
||||
"proc-macro-error-attr2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.93"
|
||||
version = "1.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
|
||||
checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.38"
|
||||
version = "1.0.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
||||
checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@@ -817,20 +930,41 @@ version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
dependencies = [
|
||||
"semver",
|
||||
"semver 0.9.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sdio-host"
|
||||
version = "0.5.0"
|
||||
name = "rustc_version"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93c025f9cfe4c388c328ece47d11a54a823da3b5ad0370b22d95ad47137f85a"
|
||||
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
||||
dependencies = [
|
||||
"semver 1.0.27",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "sdio-host"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b328e2cb950eeccd55b7f55c3a963691455dcd044cfb5354f0c5e68d2c2d6ee2"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
@@ -841,6 +975,12 @@ dependencies = [
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
@@ -849,22 +989,41 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.218"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.218"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -879,9 +1038,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
@@ -890,22 +1049,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||
|
||||
[[package]]
|
||||
name = "stm32-fmc"
|
||||
version = "0.3.2"
|
||||
name = "static_cell"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7f0639399e2307c2446c54d91d4f1596343a1e1d5cab605b9cce11d0ab3858c"
|
||||
checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23"
|
||||
dependencies = [
|
||||
"embedded-hal 0.2.7",
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stm32-fmc"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72692594faa67f052e5e06dd34460951c21e83bc55de4feb8d2666e2f15480a2"
|
||||
dependencies = [
|
||||
"embedded-hal 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stm32-metapac"
|
||||
version = "16.0.0"
|
||||
version = "19.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc520f60f6653a32479a95b9180b33908f0cbbdf106609465ee7dea98f4f5b37"
|
||||
checksum = "a411079520dbccc613af73172f944b7cf97ba84e3bd7381a0352b6ec7bfef03b"
|
||||
dependencies = [
|
||||
"cortex-m",
|
||||
"cortex-m-rt",
|
||||
"defmt 0.3.100",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -927,9 +1096,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.98"
|
||||
version = "2.0.112"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
|
||||
checksum = "21f182278bf2d2bcb3c88b1b08a37df029d71ce3d3ae26168e3c653b213b99d4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -938,29 +1107,40 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "2.0.12"
|
||||
version = "2.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
||||
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "2.0.12"
|
||||
version = "2.0.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
||||
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trait-set"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b79e2e9c9ab44c6d7c20d5976961b47e8f49ac199154daa514b77cd1ab536625"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.17"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
|
||||
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
|
||||
|
||||
[[package]]
|
||||
name = "usb-device"
|
||||
@@ -968,7 +1148,7 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
|
||||
dependencies = [
|
||||
"heapless",
|
||||
"heapless 0.8.0",
|
||||
"portable-atomic",
|
||||
]
|
||||
|
||||
@@ -1038,20 +1218,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.35"
|
||||
version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.35"
|
||||
version = "0.8.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
"syn 2.0.112",
|
||||
]
|
||||
|
||||
+31
-29
@@ -4,45 +4,47 @@ version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
embassy-stm32 = { version = "0.2", features = [
|
||||
"defmt",
|
||||
"stm32f411ce",
|
||||
"memory-x",
|
||||
"time-driver-any",
|
||||
"exti",
|
||||
base64 = { version = "0.22.1", default-features = false }
|
||||
cortex-m = { version = "0.7.7", features = [
|
||||
"inline-asm",
|
||||
"critical-section-single-core",
|
||||
] }
|
||||
embassy-sync = { version = "0.6", features = ["defmt"] }
|
||||
embassy-executor = { version = "0.7", features = [
|
||||
"nightly",
|
||||
cortex-m-rt = "0.7.5"
|
||||
critical-section = "1.2.0"
|
||||
defmt = "1.0.1"
|
||||
defmt-rtt = "1.1.0"
|
||||
embassy-executor = { version = "0.9.1", features = [
|
||||
"arch-cortex-m",
|
||||
"executor-thread",
|
||||
"executor-interrupt",
|
||||
"defmt",
|
||||
] }
|
||||
embassy-time = { version = "0.4", features = [
|
||||
embassy-futures = { version = "0.1.2", features = ["defmt"] }
|
||||
embassy-stm32 = { version = "0.5.0", features = [
|
||||
"stm32f411ce",
|
||||
"defmt",
|
||||
"memory-x",
|
||||
"unstable-pac",
|
||||
"time-driver-any",
|
||||
"exti",
|
||||
] }
|
||||
embassy-sync = { version = "0.7.2", features = ["defmt"] }
|
||||
embassy-time = { version = "0.5.0", features = [
|
||||
"defmt",
|
||||
"defmt-timestamp-uptime",
|
||||
"tick-hz-32_768",
|
||||
] }
|
||||
embassy-usb = { version = "0.4", features = ["defmt"] }
|
||||
embassy-futures = { version = "0.1", features = ["defmt"] }
|
||||
embassy-usb = { version = "0.5.1", features = ["defmt"] }
|
||||
embedded-graphics = { version = "0.8.1", features = ["defmt"] }
|
||||
embedded-hal-bus = { version = "0.3.0", features = ["async"] }
|
||||
epd-waveshare = "0.6.0"
|
||||
panic-probe = { version = "1.0.0", features = ["print-defmt"] }
|
||||
postcard = { version = "1.1.3", features = ["defmt"] }
|
||||
serde = { version = "1.0.228", default-features = false, features = ["derive"] }
|
||||
static_cell = "2.1.1"
|
||||
|
||||
defmt = "1.0"
|
||||
defmt-rtt = "1.0"
|
||||
|
||||
cortex-m = { version = "0.7", features = [
|
||||
"inline-asm",
|
||||
"critical-section-single-core",
|
||||
] }
|
||||
cortex-m-rt = "0.7"
|
||||
embedded-hal-bus = { version = "0.3", features = ["async"] }
|
||||
panic-probe = { version = "1.0", features = ["print-defmt"] }
|
||||
critical-section = "1.1"
|
||||
|
||||
epd-waveshare = "0.6"
|
||||
embedded-graphics = "0.8"
|
||||
usbd-hid = "0.8"
|
||||
base64 = { version = "0.22", default-features = false }
|
||||
[profile.dev]
|
||||
opt-level = "s"
|
||||
|
||||
[profile.release]
|
||||
opt-level = "z"
|
||||
opt-level = "s"
|
||||
|
||||
@@ -1,674 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,5 +1,7 @@
|
||||
# Inkclip Firmware
|
||||
|
||||
> WARNING! Contents below are outdated; we are currently using a USB MIDI-based firmware for better cross-platform compatibility.
|
||||
|
||||
This is the firmware implementation for Inkclip. It implements a USB 2.0 HID device with the following reports:
|
||||
|
||||
- **Write Pattern:** Report ID = 0x01, Direction = Output (host to device), Size = 5,000 bytes.
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
use core::cmp::Ordering;
|
||||
|
||||
use crate::{
|
||||
epd::Epd,
|
||||
midi::UsbMidi,
|
||||
pack::{decode_7in8, encode_7in8},
|
||||
sysex::{SysExEncoder, SysExParser},
|
||||
uid::uid_base64,
|
||||
};
|
||||
use defmt::{error, info, warn};
|
||||
use embassy_executor::task;
|
||||
use embassy_usb::driver::EndpointError;
|
||||
use embedded_graphics::prelude::*;
|
||||
use epd_waveshare::{epd1in54::Display1in54, prelude::*};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize)]
|
||||
enum DeviceType {
|
||||
BWRev1, // Black-and-white, API Rev. 1
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
enum Chroma {
|
||||
Black,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
enum Request<'a> {
|
||||
GetIdentification,
|
||||
UpdateDisplay,
|
||||
SetPattern {
|
||||
from: u32,
|
||||
to: u32,
|
||||
chroma: Chroma,
|
||||
pattern: &'a [u8],
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
enum Response<'a> {
|
||||
GetIdentification { serial: &'a str, model: DeviceType },
|
||||
UpdateDisplay,
|
||||
SetPattern,
|
||||
}
|
||||
|
||||
const PATTERN_SIZE: usize = 5000;
|
||||
const MAGIC_NUMBER_LEN: usize = 1;
|
||||
const MAGIC_NUMBER: [u8; MAGIC_NUMBER_LEN] = [0x7d]; // Generic educational/R&D
|
||||
|
||||
#[task]
|
||||
pub async fn app_task(epd: Epd, midi: UsbMidi) {
|
||||
App {
|
||||
epd,
|
||||
midi,
|
||||
pattern: [0; PATTERN_SIZE],
|
||||
}
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
|
||||
struct App {
|
||||
epd: Epd,
|
||||
midi: UsbMidi,
|
||||
pattern: [u8; PATTERN_SIZE],
|
||||
}
|
||||
|
||||
impl App {
|
||||
async fn handle_request<'a>(&mut self, req: Request<'a>) {
|
||||
match req {
|
||||
Request::SetPattern {
|
||||
from,
|
||||
to,
|
||||
chroma,
|
||||
pattern,
|
||||
} => self.handle_set_pattern(from, to, chroma, pattern).await,
|
||||
Request::UpdateDisplay => self.handle_update_display().await,
|
||||
Request::GetIdentification => self.handle_get_identification().await,
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_set_pattern(&mut self, from: u32, to: u32, _chroma: Chroma, pattern: &[u8]) {
|
||||
let from = from as usize;
|
||||
let to = to as usize;
|
||||
if from >= PATTERN_SIZE || to > PATTERN_SIZE || from > to {
|
||||
warn!(
|
||||
"SetPattern: 'from' and/or 'to' out of range (from = {}, to = {}, PATTERN_SIZE = {})",
|
||||
from, to, PATTERN_SIZE
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let buf_size = match pattern.len().cmp(&(to - from)) {
|
||||
Ordering::Less => {
|
||||
warn!(
|
||||
"SetPattern buffer too short (buf_size = {}, range_size = {})",
|
||||
pattern.len(),
|
||||
to - from,
|
||||
);
|
||||
pattern.len()
|
||||
}
|
||||
Ordering::Equal => pattern.len(),
|
||||
Ordering::Greater => {
|
||||
warn!(
|
||||
"SetPattern buffer too long; truncating (buf_size = {}, range_size = {})",
|
||||
pattern.len(),
|
||||
to - from,
|
||||
);
|
||||
to - from
|
||||
}
|
||||
};
|
||||
|
||||
for (stride, &byte) in pattern[..buf_size].iter().enumerate() {
|
||||
self.pattern[from + stride] = byte;
|
||||
}
|
||||
|
||||
self.write_response(Response::SetPattern).await;
|
||||
}
|
||||
|
||||
async fn handle_update_display(&mut self) {
|
||||
let mut display = Display1in54::default();
|
||||
display.set_rotation(DisplayRotation::Rotate180);
|
||||
let width = display.size().width as i32;
|
||||
|
||||
for (stride, &byte) in self.pattern.iter().enumerate() {
|
||||
for stroll in 0..8 {
|
||||
let ix = stride as i32 * 8 + stroll;
|
||||
let x = ix % width;
|
||||
let y = ix / width;
|
||||
display.set_pixel(Pixel(Point { x, y }, color_at(byte, stroll)));
|
||||
}
|
||||
}
|
||||
|
||||
self.epd.update_display(&display);
|
||||
self.write_response(Response::UpdateDisplay).await;
|
||||
}
|
||||
|
||||
async fn handle_get_identification(&mut self) {
|
||||
self.write_response(Response::GetIdentification {
|
||||
serial: uid_base64(),
|
||||
model: DeviceType::BWRev1,
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn write_response<'a>(&mut self, resp: Response<'a>) -> bool {
|
||||
const RESP_N: usize = 1024;
|
||||
|
||||
let mut resp_buffer = [0u8; RESP_N];
|
||||
let Ok(payload_slice) = postcard::to_slice(&resp, &mut resp_buffer) else {
|
||||
error!("write_response: postcard encoding overflows the buffer");
|
||||
return false;
|
||||
};
|
||||
|
||||
let mut encode_buffer = [0u8; RESP_N];
|
||||
encode_buffer[..MAGIC_NUMBER_LEN].copy_from_slice(&MAGIC_NUMBER);
|
||||
let Some(encoded_len) = encode_7in8(payload_slice, &mut encode_buffer[MAGIC_NUMBER_LEN..])
|
||||
else {
|
||||
error!("write_response: 7-in-8 encoding overflows the buffer");
|
||||
return false;
|
||||
};
|
||||
|
||||
let mut sysex_encoder = SysExEncoder::<1024>::new();
|
||||
let Some(encoded) = sysex_encoder.encode(&encode_buffer[..MAGIC_NUMBER_LEN + encoded_len])
|
||||
else {
|
||||
error!("write_response: USB MIDI encoding overflows the buffer");
|
||||
return false;
|
||||
};
|
||||
|
||||
for chunk in encoded.chunks(64) {
|
||||
let Ok(_) = self.midi.write_packet(chunk).await else {
|
||||
error!("write_response: failed to write response");
|
||||
return false;
|
||||
};
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub async fn run(&mut self) {
|
||||
let mut sysex_parser = SysExParser::<8192>::new();
|
||||
|
||||
'_connection: loop {
|
||||
self.midi.wait_connection().await;
|
||||
|
||||
'packet: loop {
|
||||
let mut packet_in_buf = [0u8; 64];
|
||||
|
||||
match self.midi.read_packet(&mut packet_in_buf).await {
|
||||
Err(EndpointError::BufferOverflow) => {
|
||||
error!(
|
||||
"App: read more than 64 bytes at once from EP. This should not be happening!"
|
||||
)
|
||||
}
|
||||
Err(EndpointError::Disabled) => {
|
||||
info!("App: EP has been disabled; waiting to be enabled again.");
|
||||
break 'packet;
|
||||
}
|
||||
Ok(nread) => {
|
||||
for midi_packet in packet_in_buf[..nread].chunks_exact(4) {
|
||||
let Some(midi_msg) = sysex_parser.feed(midi_packet) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let midi_msg_len = midi_msg.len();
|
||||
if midi_msg_len < 2
|
||||
|| midi_msg[0] != 0xf0
|
||||
|| midi_msg[midi_msg_len - 1] != 0xf7
|
||||
{
|
||||
warn!("App: MIDI event not SysEx; dropping.");
|
||||
continue;
|
||||
}
|
||||
|
||||
let sysex = &mut midi_msg[1..midi_msg_len - 1];
|
||||
if sysex.len() < MAGIC_NUMBER_LEN
|
||||
|| sysex[..MAGIC_NUMBER_LEN] != MAGIC_NUMBER
|
||||
{
|
||||
warn!(
|
||||
"App: SysEx does not start with magic number; first {} bytes = {}. dropping.",
|
||||
MAGIC_NUMBER,
|
||||
sysex[..MAGIC_NUMBER_LEN]
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
let Ok(parsed) = postcard::from_bytes::<Request>(decode_7in8(
|
||||
&mut sysex[MAGIC_NUMBER_LEN..],
|
||||
)) else {
|
||||
warn!("App: cannot parse payload. dropping.");
|
||||
continue;
|
||||
};
|
||||
self.handle_request(parsed).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn color_at(byte: u8, ix: i32) -> Color {
|
||||
debug_assert!(0 <= ix && ix < 8);
|
||||
|
||||
if byte & (1u8 << ix) == 0 {
|
||||
Color::White
|
||||
} else {
|
||||
Color::Black
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
use usbd_hid::descriptor::generator_prelude::*;
|
||||
|
||||
// Watch out the terminology!
|
||||
// - An "output" report is a report from the host to the device (as the device is the one doing the output);
|
||||
// - An "input" report is a report from the device to the host (as it is presumably triggered by user input).
|
||||
#[gen_hid_descriptor(
|
||||
(usage_page = VENDOR_DEFINED_END, usage = 0x01, collection = APPLICATION) = {
|
||||
(report_id = 0x01, usage = 0x02) = {
|
||||
write_pattern = output;
|
||||
};
|
||||
(report_id = 0x02, usage = 0x03) = {
|
||||
serial_number_request = output;
|
||||
};
|
||||
(report_id = 0x02, usage = 0x03) = {
|
||||
serial_number_response = input;
|
||||
};
|
||||
}
|
||||
)]
|
||||
pub struct HIDReports {
|
||||
write_pattern: [u8; 5000],
|
||||
serial_number_request: u8,
|
||||
serial_number_response: [u8; 16],
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
use defmt::*;
|
||||
|
||||
use embedded_graphics::prelude::*;
|
||||
use epd_waveshare::epd1in54_v2::Display1in54;
|
||||
use epd_waveshare::prelude::*;
|
||||
|
||||
use crate::device::epd::Epd;
|
||||
use crate::device::usb_hid::Hid;
|
||||
use crate::util::{uid_base64, uid_base64_bytes};
|
||||
|
||||
pub mod descriptor;
|
||||
|
||||
pub const USB_READ_BUFFER_SIZE: usize = 8192;
|
||||
pub const USB_WRITE_BUFFER_SIZE: usize = 32;
|
||||
|
||||
const WRITE_PATTERN_REPORT_ID: u8 = 0x01;
|
||||
const SERIAL_NUMBER_REPORT_ID: u8 = 0x02;
|
||||
|
||||
fn color_at(byte: u8, ix: i32) -> Color {
|
||||
defmt::debug_assert!(0 <= ix && ix < 8);
|
||||
|
||||
if byte & (1u8 << ix) == 0 {
|
||||
Color::White
|
||||
} else {
|
||||
Color::Black
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MainLoop<'a> {
|
||||
pub hid: Hid<'a, USB_READ_BUFFER_SIZE, USB_WRITE_BUFFER_SIZE>,
|
||||
pub epd: Epd,
|
||||
}
|
||||
|
||||
impl<'a> MainLoop<'a> {
|
||||
fn draw_pattern(&mut self, buf: &[u8]) {
|
||||
debug!("Updating display");
|
||||
|
||||
let mut buf_size = buf.len();
|
||||
|
||||
if buf_size < 5000 {
|
||||
warn!("WRITE_PATTERN buffer too short (buf_size = {})", buf_size);
|
||||
} else if buf_size > 5000 {
|
||||
warn!(
|
||||
"WRITE_PATTERN buffer too long; truncating (buf_size = {})",
|
||||
buf_size
|
||||
);
|
||||
buf_size = 5000;
|
||||
}
|
||||
|
||||
let mut display = Display1in54::default();
|
||||
display.set_rotation(DisplayRotation::Rotate180);
|
||||
let width = display.size().width as i32;
|
||||
|
||||
for (stride, &byte) in buf[..buf_size].iter().enumerate() {
|
||||
for stroll in 0..8 {
|
||||
let ix = stride as i32 * 8 + stroll;
|
||||
let x = ix % width;
|
||||
let y = ix / width;
|
||||
display.set_pixel(Pixel(Point { x, y }, color_at(byte, stroll)));
|
||||
}
|
||||
}
|
||||
|
||||
self.epd.update_display(&display);
|
||||
}
|
||||
|
||||
async fn send_serial_number(&mut self) {
|
||||
debug!("Sending serial number {}", uid_base64());
|
||||
|
||||
self.hid
|
||||
.write(SERIAL_NUMBER_REPORT_ID, uid_base64_bytes())
|
||||
.await;
|
||||
}
|
||||
|
||||
pub async fn run(&mut self) -> ! {
|
||||
let mut read_buf = [0u8; USB_READ_BUFFER_SIZE];
|
||||
|
||||
loop {
|
||||
let (id, buf) = self.hid.read(&mut read_buf).await;
|
||||
match id {
|
||||
WRITE_PATTERN_REPORT_ID => self.draw_pattern(buf),
|
||||
SERIAL_NUMBER_REPORT_ID => self.send_serial_number().await,
|
||||
_ => warn!("Unknown report ID: {}", buf[0]),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod epd;
|
||||
pub mod usb_hid;
|
||||
@@ -1,120 +0,0 @@
|
||||
use defmt::*;
|
||||
|
||||
use embassy_stm32::peripherals::USB_OTG_FS;
|
||||
use embassy_stm32::usb::{self, DmPin, DpPin};
|
||||
use embassy_usb::class::hid::{self, HidReader, HidReaderWriter, HidWriter};
|
||||
use embassy_usb::driver::EndpointError;
|
||||
|
||||
use crate::init::Irqs;
|
||||
|
||||
pub type UsbBuilder<'d> = embassy_usb::Builder<'d, usb::Driver<'d, USB_OTG_FS>>;
|
||||
|
||||
pub fn get_usb_builder<'d>(
|
||||
usb_peri: USB_OTG_FS,
|
||||
dp: impl DpPin<USB_OTG_FS>,
|
||||
dm: impl DmPin<USB_OTG_FS>,
|
||||
ep_out_buffer: &'d mut [u8],
|
||||
driver_config: usb::Config,
|
||||
builder_config: embassy_usb::Config<'d>,
|
||||
config_descriptor: &'d mut [u8],
|
||||
bos_descriptor: &'d mut [u8],
|
||||
msos_descriptor: &'d mut [u8],
|
||||
control_buf: &'d mut [u8],
|
||||
) -> UsbBuilder<'d> {
|
||||
let driver = usb::Driver::new_fs(usb_peri, Irqs, dp, dm, ep_out_buffer, driver_config);
|
||||
|
||||
return embassy_usb::Builder::new(
|
||||
driver,
|
||||
builder_config,
|
||||
config_descriptor,
|
||||
bos_descriptor,
|
||||
msos_descriptor,
|
||||
control_buf,
|
||||
);
|
||||
}
|
||||
|
||||
pub struct Hid<'d, const READ_N: usize, const WRITE_N: usize> {
|
||||
reader: HidReader<'d, usb::Driver<'d, USB_OTG_FS>, READ_N>,
|
||||
writer: HidWriter<'d, usb::Driver<'d, USB_OTG_FS>, WRITE_N>,
|
||||
}
|
||||
|
||||
impl<'d, const READ_N: usize, const WRITE_N: usize> Hid<'d, READ_N, WRITE_N> {
|
||||
pub fn new(
|
||||
usb_builder: &mut UsbBuilder<'d>,
|
||||
report_descriptor: &'d [u8],
|
||||
state: &'d mut hid::State<'d>,
|
||||
) -> Hid<'d, READ_N, WRITE_N> {
|
||||
let hid_config = hid::Config {
|
||||
report_descriptor,
|
||||
request_handler: None,
|
||||
poll_ms: 10,
|
||||
max_packet_size: 64,
|
||||
};
|
||||
|
||||
let (reader, writer) = HidReaderWriter::new(usb_builder, state, hid_config).split();
|
||||
return Hid { reader, writer };
|
||||
}
|
||||
|
||||
async fn internal_read<'a, const USE_ID: bool>(
|
||||
&mut self,
|
||||
buf: &'a mut [u8; READ_N],
|
||||
) -> (u8, &'a [u8]) {
|
||||
loop {
|
||||
match self.reader.read(buf).await {
|
||||
Ok(len) => {
|
||||
if USE_ID {
|
||||
if len < 1 {
|
||||
warn!("Received no report ID")
|
||||
} else {
|
||||
return (buf[0], &buf[1..len]);
|
||||
}
|
||||
} else {
|
||||
return (0, &buf[..len]);
|
||||
}
|
||||
}
|
||||
Err(hid::ReadError::BufferOverflow) => {
|
||||
warn!("Buffer overflow when reading from host")
|
||||
}
|
||||
Err(hid::ReadError::Disabled) => {
|
||||
info!("Endpoint disabled");
|
||||
self.reader.ready().await
|
||||
}
|
||||
Err(hid::ReadError::Sync(_)) => defmt::unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn read<'a>(&mut self, buf: &'a mut [u8; READ_N]) -> (u8, &'a [u8]) {
|
||||
self.internal_read::<true>(buf).await
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub async fn read_no_id<'a>(&mut self, buf: &'a mut [u8; READ_N]) -> &'a [u8] {
|
||||
self.internal_read::<false>(buf).await.1
|
||||
}
|
||||
|
||||
pub async fn write(&mut self, id: u8, report: &[u8]) {
|
||||
let payload_size = report.len() + 1;
|
||||
|
||||
if payload_size > WRITE_N {
|
||||
error!(
|
||||
"Buffer overflow when writing to host (report_size = {})",
|
||||
payload_size
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let mut payload = [id; WRITE_N];
|
||||
payload[1..payload_size].copy_from_slice(report);
|
||||
|
||||
self.writer
|
||||
.write(&payload[..payload_size])
|
||||
.await
|
||||
.unwrap_or_else(|err| match err {
|
||||
EndpointError::BufferOverflow => error!("Buffer overflow when writing to host"),
|
||||
EndpointError::Disabled => warn!("Endpoint disabled"),
|
||||
});
|
||||
|
||||
info!("Written report #{}: {}", id, report);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
use embassy_stm32::Peri;
|
||||
use embassy_stm32::gpio::{self, Level, Pull, Speed};
|
||||
use embassy_stm32::spi::{self, MosiPin, SckPin, Spi};
|
||||
use embassy_stm32::time::Hertz;
|
||||
@@ -8,8 +9,11 @@ use epd_waveshare::epd1in54::Display1in54;
|
||||
use epd_waveshare::epd1in54_v2::Epd1in54;
|
||||
use epd_waveshare::prelude::*;
|
||||
|
||||
type EpdSpiDevice =
|
||||
ExclusiveDevice<Spi<'static, embassy_stm32::mode::Blocking>, gpio::Output<'static>, Delay>;
|
||||
type EpdSpiDevice = ExclusiveDevice<
|
||||
Spi<'static, embassy_stm32::mode::Blocking, spi::mode::Master>,
|
||||
gpio::Output<'static>,
|
||||
Delay,
|
||||
>;
|
||||
|
||||
pub struct Epd {
|
||||
spi_device: EpdSpiDevice,
|
||||
@@ -24,13 +28,13 @@ pub struct Epd {
|
||||
|
||||
impl Epd {
|
||||
pub fn new<SPI: spi::Instance>(
|
||||
spi: SPI,
|
||||
cs: impl gpio::Pin,
|
||||
sck: impl SckPin<SPI>,
|
||||
mosi: impl MosiPin<SPI>,
|
||||
busy: impl gpio::Pin,
|
||||
dc: impl gpio::Pin,
|
||||
rst: impl gpio::Pin,
|
||||
spi: Peri<'static, SPI>,
|
||||
cs: Peri<'static, impl gpio::Pin>,
|
||||
sck: Peri<'static, impl SckPin<SPI>>,
|
||||
mosi: Peri<'static, impl MosiPin<SPI>>,
|
||||
busy: Peri<'static, impl gpio::Pin>,
|
||||
dc: Peri<'static, impl gpio::Pin>,
|
||||
rst: Peri<'static, impl gpio::Pin>,
|
||||
) -> Epd {
|
||||
let cs_pin = gpio::Output::new(cs, Level::High, Speed::VeryHigh);
|
||||
let busy_pin = gpio::Input::new(busy, Pull::Down);
|
||||
@@ -1,35 +0,0 @@
|
||||
use embassy_stm32::bind_interrupts;
|
||||
use embassy_stm32::peripherals::USB_OTG_FS;
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::usb;
|
||||
use embassy_stm32::{Config, Peripherals};
|
||||
|
||||
bind_interrupts!(pub struct Irqs {
|
||||
OTG_FS => usb::InterruptHandler<USB_OTG_FS>;
|
||||
});
|
||||
|
||||
pub fn init_peripherals() -> Peripherals {
|
||||
let mut config = Config::default();
|
||||
{
|
||||
use embassy_stm32::rcc::*;
|
||||
config.rcc.hse = Some(Hse {
|
||||
freq: Hertz(12_000_000),
|
||||
mode: HseMode::Oscillator,
|
||||
});
|
||||
config.rcc.pll_src = PllSource::HSE;
|
||||
config.rcc.pll = Some(Pll {
|
||||
prediv: PllPreDiv::DIV12, // 12 / 12 = 1 MHz
|
||||
mul: PllMul::MUL192, // 1 * 192 = 192 MHz
|
||||
divp: Some(PllPDiv::DIV2), // 192 / 2 = 96 MHz <= 100 MHz max freq
|
||||
divq: Some(PllQDiv::DIV4), // 192 / 4 = 48 MHz necessary for USB
|
||||
divr: None,
|
||||
});
|
||||
config.rcc.ahb_pre = AHBPrescaler::DIV1;
|
||||
config.rcc.apb1_pre = APBPrescaler::DIV2;
|
||||
config.rcc.apb2_pre = APBPrescaler::DIV4;
|
||||
config.rcc.sys = Sysclk::PLL1_P;
|
||||
config.rcc.mux.clk48sel = mux::Clk48sel::PLL1_Q;
|
||||
}
|
||||
|
||||
return embassy_stm32::init(config);
|
||||
}
|
||||
+62
-65
@@ -1,79 +1,76 @@
|
||||
#![no_main]
|
||||
#![no_std]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_futures::join::join;
|
||||
use crate::{
|
||||
app::app_task,
|
||||
epd::Epd,
|
||||
midi::{make_midi_class, make_usb_builder, usb_task},
|
||||
};
|
||||
use defmt_rtt as _;
|
||||
use embassy_executor::{Spawner, main};
|
||||
use embassy_stm32::{
|
||||
Peripherals, bind_interrupts,
|
||||
peripherals::USB_OTG_FS,
|
||||
time::Hertz,
|
||||
usb::{self},
|
||||
};
|
||||
use panic_probe as _;
|
||||
|
||||
use device::epd::Epd;
|
||||
use device::usb_hid::Hid;
|
||||
use device::usb_hid::get_usb_builder;
|
||||
use embassy_stm32::usb;
|
||||
use embassy_usb::UsbVersion;
|
||||
use embassy_usb::class::hid;
|
||||
use usbd_hid::descriptor::generator_prelude::*;
|
||||
|
||||
use init::init_peripherals;
|
||||
use util::uid_base64;
|
||||
|
||||
use app::MainLoop;
|
||||
use app::descriptor::HIDReports;
|
||||
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
macro_rules! static_ref {
|
||||
($ty:ty = $expr:expr) => {{
|
||||
static CELL: static_cell::StaticCell<$ty> = StaticCell::new();
|
||||
CELL.init($expr)
|
||||
}};
|
||||
}
|
||||
|
||||
mod app;
|
||||
mod device;
|
||||
mod init;
|
||||
mod util;
|
||||
mod epd;
|
||||
mod midi;
|
||||
mod pack;
|
||||
mod sysex;
|
||||
mod uid;
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
bind_interrupts!(pub struct Irqs {
|
||||
OTG_FS => usb::InterruptHandler<USB_OTG_FS>;
|
||||
});
|
||||
|
||||
fn init_peripherals() -> Peripherals {
|
||||
embassy_stm32::init({
|
||||
use embassy_stm32::rcc::*;
|
||||
let mut config = embassy_stm32::Config::default();
|
||||
|
||||
config.rcc.hse = Some(Hse {
|
||||
freq: Hertz(12_000_000),
|
||||
mode: HseMode::Oscillator,
|
||||
});
|
||||
config.rcc.pll_src = PllSource::HSE;
|
||||
config.rcc.pll = Some(Pll {
|
||||
prediv: PllPreDiv::DIV12, // 12 / 12 = 1 MHz
|
||||
mul: PllMul::MUL192, // 1 * 192 = 192 MHz
|
||||
divp: Some(PllPDiv::DIV2), // 192 / 2 = 96 MHz <= 100 MHz max freq
|
||||
divq: Some(PllQDiv::DIV4), // 192 / 4 = 48 MHz necessary for USB
|
||||
divr: None,
|
||||
});
|
||||
config.rcc.ahb_pre = AHBPrescaler::DIV1;
|
||||
config.rcc.apb1_pre = APBPrescaler::DIV2;
|
||||
config.rcc.apb2_pre = APBPrescaler::DIV4;
|
||||
config.rcc.sys = Sysclk::PLL1_P;
|
||||
config.rcc.mux.clk48sel = mux::Clk48sel::PLL1_Q;
|
||||
|
||||
config
|
||||
})
|
||||
}
|
||||
|
||||
#[main]
|
||||
async fn main(spawner: Spawner) {
|
||||
let peri = init_peripherals();
|
||||
|
||||
info!("Initialized peripherals");
|
||||
|
||||
let epd = Epd::new(
|
||||
peri.SPI1, peri.PA4, peri.PA5, peri.PA7, peri.PB10, peri.PB0, peri.PB1,
|
||||
);
|
||||
|
||||
info!("Established SPI link to e-paper display");
|
||||
let mut usb_builder = make_usb_builder(peri.USB_OTG_FS, peri.PA12, peri.PA11);
|
||||
let midi = make_midi_class(&mut usb_builder);
|
||||
|
||||
let mut ep_out_buffer = [0u8; 256];
|
||||
let mut config_descriptor = [0; 256];
|
||||
let mut control_buf = [0; 256];
|
||||
let mut state = hid::State::new();
|
||||
|
||||
let mut builder_config = embassy_usb::Config::new(0x1209, 0xc9c9);
|
||||
builder_config.manufacturer = Some("daylily");
|
||||
builder_config.product = Some("“Inkclip” 1.54″ ePaper Accessory");
|
||||
builder_config.serial_number = Some(uid_base64());
|
||||
|
||||
// Caution: past USB 2.0 (including USB 2.1 aka 2.0 LPM), BOS descriptors become necessary
|
||||
builder_config.bcd_usb = UsbVersion::Two;
|
||||
|
||||
let mut builder = get_usb_builder(
|
||||
peri.USB_OTG_FS,
|
||||
peri.PA12,
|
||||
peri.PA11,
|
||||
&mut ep_out_buffer,
|
||||
usb::Config::default(),
|
||||
builder_config,
|
||||
&mut config_descriptor,
|
||||
&mut [], // USB 2.0 does not require BOS descriptors
|
||||
&mut [], // Non vendor-specific devices/interfaces do not require MS OS descriptors
|
||||
&mut control_buf,
|
||||
);
|
||||
|
||||
let usb_hid = Hid::new(&mut builder, HIDReports::desc(), &mut state);
|
||||
|
||||
let mut main_loop = MainLoop { epd, hid: usb_hid };
|
||||
let main_fut = main_loop.run();
|
||||
|
||||
let mut usb_device = builder.build();
|
||||
let usb_fut = usb_device.run();
|
||||
|
||||
info!("Initialized USB HID device");
|
||||
|
||||
join(main_fut, usb_fut).await;
|
||||
spawner.must_spawn(usb_task(usb_builder));
|
||||
spawner.must_spawn(app_task(epd, midi));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
use defmt_rtt as _;
|
||||
use embassy_executor::task;
|
||||
use embassy_stm32::{
|
||||
Peri,
|
||||
peripherals::USB_OTG_FS,
|
||||
usb::{self, DmPin, DpPin},
|
||||
};
|
||||
use embassy_usb::{UsbVersion, class::midi::MidiClass};
|
||||
use panic_probe as _;
|
||||
use static_cell::StaticCell;
|
||||
|
||||
use crate::{Irqs, uid};
|
||||
|
||||
pub type UsbDriver = usb::Driver<'static, USB_OTG_FS>;
|
||||
pub type UsbBuilder = embassy_usb::Builder<'static, UsbDriver>;
|
||||
pub type UsbMidi = MidiClass<'static, UsbDriver>;
|
||||
|
||||
pub fn make_usb_builder(
|
||||
peri: Peri<'static, USB_OTG_FS>,
|
||||
dp: Peri<'static, impl DpPin<USB_OTG_FS>>,
|
||||
dm: Peri<'static, impl DmPin<USB_OTG_FS>>,
|
||||
) -> UsbBuilder {
|
||||
let ep_out_buffer = static_ref!([u8; 4096] = [0; 4096]);
|
||||
let config_descriptor = static_ref!([u8; 256] = [0; 256]);
|
||||
let control_buf = static_ref!([u8; 256] = [0; 256]);
|
||||
|
||||
let mut config = embassy_usb::Config::new(0x1209, 0xc9c9);
|
||||
config.manufacturer = Some("Project Daylily");
|
||||
config.product = Some("Inkclip BW");
|
||||
config.serial_number = Some(uid::uid_base64());
|
||||
config.bcd_usb = UsbVersion::Two;
|
||||
|
||||
let usb_driver = usb::Driver::new_fs(peri, Irqs, dp, dm, ep_out_buffer, usb::Config::default());
|
||||
embassy_usb::Builder::new(
|
||||
usb_driver,
|
||||
config,
|
||||
config_descriptor,
|
||||
&mut [],
|
||||
&mut [],
|
||||
control_buf,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn make_midi_class(builder: &mut UsbBuilder) -> UsbMidi {
|
||||
UsbMidi::new(builder, 1, 1, 64)
|
||||
}
|
||||
|
||||
#[task]
|
||||
pub async fn usb_task(builder: UsbBuilder) -> ! {
|
||||
let mut device = builder.build();
|
||||
device.run().await;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// 7-in-8 encoding. Each 7 bytes can be encoded into 8 bytes with all-0 MSB's. This is useful
|
||||
// for sending data over exotic protocols like MIDI SysEx.
|
||||
|
||||
// Decode in-place, returning the decoded slice.
|
||||
pub fn decode_7in8(payload: &mut [u8]) -> &mut [u8] {
|
||||
let mut decoded_len = 0;
|
||||
for stride in 0..payload.len().div_ceil(8) {
|
||||
// Most significant bits of a 7-in-8 group
|
||||
let msbs = payload[8 * stride];
|
||||
|
||||
for stroll in 1..8 {
|
||||
let in_ix = 8 * stride + stroll;
|
||||
if in_ix >= payload.len() {
|
||||
break;
|
||||
}
|
||||
|
||||
payload[decoded_len] =
|
||||
(payload[in_ix] & 0b01111111) | ((msbs << (8 - stroll)) & 0b10000000);
|
||||
decoded_len += 1;
|
||||
}
|
||||
}
|
||||
&mut payload[..decoded_len]
|
||||
}
|
||||
|
||||
// Encode into provided output buffer, returning the length of the output, or None if the buffer is too small.
|
||||
pub fn encode_7in8<'a>(payload: &[u8], output: &'a mut [u8]) -> Option<usize> {
|
||||
let mut encoded_len = 0;
|
||||
for stride in 0..payload.len().div_ceil(7) {
|
||||
let msbs_ix = encoded_len;
|
||||
if encoded_len >= output.len() {
|
||||
return None;
|
||||
}
|
||||
output[msbs_ix] = 0;
|
||||
encoded_len += 1;
|
||||
|
||||
for stroll in 1..8 {
|
||||
let in_ix = 7 * stride + stroll - 1;
|
||||
if in_ix >= payload.len() {
|
||||
break;
|
||||
}
|
||||
|
||||
if encoded_len >= output.len() {
|
||||
return None;
|
||||
}
|
||||
output[msbs_ix] |= (payload[in_ix] & 0b10000000) >> (8 - stroll);
|
||||
output[encoded_len] = payload[in_ix] & 0b01111111;
|
||||
encoded_len += 1;
|
||||
}
|
||||
}
|
||||
Some(encoded_len)
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
use defmt::{error, warn};
|
||||
|
||||
pub struct SysExParser<const N: usize> {
|
||||
buf: [u8; N],
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<const N: usize> SysExParser<N> {
|
||||
pub fn new() -> Self {
|
||||
SysExParser {
|
||||
buf: [0u8; N],
|
||||
len: 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn feed(&mut self, packet: &[u8]) -> Option<&mut [u8]> {
|
||||
if packet.len() != 4 {
|
||||
error!(
|
||||
"Got a UDB MIDI packet of length {} != 4; dropping",
|
||||
packet.len()
|
||||
);
|
||||
return None;
|
||||
}
|
||||
match packet[0] & 0x0f {
|
||||
0x04 => self.extend_buf(&packet[1..]),
|
||||
0x05 => self.extend_buf_fin(&packet[1..2]),
|
||||
0x06 => self.extend_buf_fin(&packet[1..3]),
|
||||
0x07 => self.extend_buf_fin(&packet[1..4]),
|
||||
_ => self.reset(),
|
||||
}
|
||||
}
|
||||
|
||||
fn extend_buf(&mut self, data: &[u8]) -> Option<&mut [u8]> {
|
||||
let new_len = self.len + data.len();
|
||||
if new_len > N {
|
||||
warn!("USB MIDI parsing overflowed buffer! Discarding partially parsed payload.");
|
||||
self.len = 0;
|
||||
return None;
|
||||
}
|
||||
|
||||
self.buf[self.len..new_len].copy_from_slice(data);
|
||||
self.len = new_len;
|
||||
None
|
||||
}
|
||||
|
||||
fn extend_buf_fin(&mut self, data: &[u8]) -> Option<&mut [u8]> {
|
||||
let new_len = self.len + data.len();
|
||||
if new_len > N {
|
||||
warn!("USB MIDI parsing overflowed buffer! Discarding partially parsed payload.");
|
||||
self.len = 0;
|
||||
return None;
|
||||
}
|
||||
|
||||
self.buf[self.len..new_len].copy_from_slice(data);
|
||||
self.len = new_len;
|
||||
let result = &mut self.buf[..self.len];
|
||||
self.len = 0;
|
||||
Some(result)
|
||||
}
|
||||
|
||||
fn reset(&mut self) -> Option<&mut [u8]> {
|
||||
self.len = 0;
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SysExEncoder<const N: usize> {
|
||||
buf: [u8; N],
|
||||
len: usize,
|
||||
}
|
||||
|
||||
impl<const N: usize> SysExEncoder<N> {
|
||||
pub fn new() -> Self {
|
||||
SysExEncoder {
|
||||
buf: [0u8; N],
|
||||
len: 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn clear(&mut self) {
|
||||
self.len = 0;
|
||||
}
|
||||
|
||||
fn feed(&mut self, data: &[u8; 3]) -> bool {
|
||||
if self.len + 4 > N {
|
||||
error!("Encoding more would overflow the buffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
self.buf[self.len] = 0x04;
|
||||
self.buf[self.len + 1] = data[0];
|
||||
self.buf[self.len + 2] = data[1];
|
||||
self.buf[self.len + 3] = data[2];
|
||||
self.len += 4;
|
||||
true
|
||||
}
|
||||
|
||||
fn feed_fin(&mut self, n: u8, data: &[u8; 3]) -> Option<&[u8]> {
|
||||
if n == 0 || n > 3 {
|
||||
error!("Inconsistent number of bytes");
|
||||
return None;
|
||||
}
|
||||
if self.len + 4 > N {
|
||||
error!("Encoding more would overflow the buffer");
|
||||
return None;
|
||||
}
|
||||
|
||||
self.buf[self.len] = 0x04 + n;
|
||||
self.buf[self.len + 1] = data[0];
|
||||
self.buf[self.len + 2] = data[1];
|
||||
self.buf[self.len + 3] = data[2];
|
||||
self.len += 4;
|
||||
Some(&self.buf[..self.len])
|
||||
}
|
||||
|
||||
pub fn encode(&mut self, data: &[u8]) -> Option<&[u8]> {
|
||||
self.clear();
|
||||
|
||||
if data.len() == 0 {
|
||||
return self.feed_fin(2, &[0xf0, 0xf7, 0x00]);
|
||||
}
|
||||
if data.len() == 1 {
|
||||
return self.feed_fin(3, &[0xf0, data[0], 0xf7]);
|
||||
}
|
||||
|
||||
self.feed(&[0xf0, data[0], data[1]]);
|
||||
for chunk in data[2..].chunks(3) {
|
||||
match chunk.len() {
|
||||
3 => {
|
||||
if !self.feed(&[chunk[0], chunk[1], chunk[2]]) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
2 => return self.feed_fin(3, &[chunk[0], chunk[1], 0xf7]),
|
||||
1 => return self.feed_fin(2, &[chunk[0], 0xf7, 0x00]),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
self.feed_fin(1, &[0xf7, 0x00, 0x00])
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ pub fn uid_base64() -> &'static str {
|
||||
}
|
||||
|
||||
#[allow(static_mut_refs)]
|
||||
pub fn uid_base64_bytes() -> &'static [u8] {
|
||||
pub fn uid_base64_bytes() -> &'static [u8; 16] {
|
||||
static mut UID_BASE64: [u8; 16] = [0; 16];
|
||||
static mut LOADED: bool = false;
|
||||
critical_section::with(|_| unsafe {
|
||||
Reference in New Issue
Block a user