A personal rust firmware for the Badger 2040 W

updates

+1 -94
Cargo.lock
··· 181 181 ] 182 182 183 183 [[package]] 184 - name = "bt-hci" 185 - version = "0.1.2" 186 - source = "registry+https://github.com/rust-lang/crates.io-index" 187 - checksum = "d69e2db053409c36c45a403da58072b8bf75bdc962746c0a12df9dec0fce92d2" 188 - dependencies = [ 189 - "defmt", 190 - "embassy-sync 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", 191 - "embedded-io", 192 - "embedded-io-async", 193 - "futures-intrusive", 194 - "heapless 0.8.0", 195 - ] 196 - 197 - [[package]] 198 184 name = "buffered-io" 199 185 version = "0.5.4" 200 186 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 206 192 207 193 [[package]] 208 194 name = "byte-slice-cast" 209 - version = "0.3.5" 210 - source = "registry+https://github.com/rust-lang/crates.io-index" 211 - checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3" 212 - 213 - [[package]] 214 - name = "byte-slice-cast" 215 195 version = "1.2.2" 216 196 source = "registry+https://github.com/rust-lang/crates.io-index" 217 197 checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" ··· 364 344 version = "0.2.0" 365 345 source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 366 346 dependencies = [ 367 - "bt-hci", 368 347 "cortex-m", 369 348 "cortex-m-rt", 370 - "defmt", 371 349 "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 372 350 "embassy-net-driver-channel 0.3.0", 373 351 "embassy-sync 0.6.0 (git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6)", 374 352 "embassy-time", 375 353 "embedded-hal 1.0.0", 376 - "embedded-io-async", 377 354 "futures", 378 355 "heapless 0.8.0", 379 356 "num_enum", ··· 524 501 ] 525 502 526 503 [[package]] 527 - name = "display-interface" 528 - version = "0.4.1" 529 - source = "registry+https://github.com/rust-lang/crates.io-index" 530 - checksum = "7517c040926d7b02b111884aa089177db80878533127f7c1b480d852c5fb4112" 531 - 532 - [[package]] 533 - name = "display-interface-spi" 534 - version = "0.4.1" 535 - source = "registry+https://github.com/rust-lang/crates.io-index" 536 - checksum = "489378ad054862146fbd1f09f51d585ccbe4bd1e2feadcda2a13ac33f840e1a5" 537 - dependencies = [ 538 - "byte-slice-cast 0.3.5", 539 - "display-interface", 540 - "embedded-hal 0.2.7", 541 - ] 542 - 543 - [[package]] 544 504 name = "document-features" 545 505 version = "0.2.10" 546 506 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 740 700 [[package]] 741 701 name = "embassy-sync" 742 702 version = "0.6.0" 743 - source = "registry+https://github.com/rust-lang/crates.io-index" 744 - checksum = "b3e0c49ff02ebe324faf3a8653ba91582e2d0a7fdef5bc88f449d5aa1bfcc05c" 745 - dependencies = [ 746 - "cfg-if", 747 - "critical-section", 748 - "embedded-io-async", 749 - "futures-util", 750 - "heapless 0.8.0", 751 - ] 752 - 753 - [[package]] 754 - name = "embassy-sync" 755 - version = "0.6.0" 756 703 source = "git+https://github.com/embassy-rs/embassy.git?rev=f0a86070512ad739641cee7d9fa39d63f5c8a9f6#f0a86070512ad739641cee7d9fa39d63f5c8a9f6" 757 704 dependencies = [ 758 705 "cfg-if", ··· 1157 1104 version = "0.3.30" 1158 1105 source = "registry+https://github.com/rust-lang/crates.io-index" 1159 1106 checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 1160 - 1161 - [[package]] 1162 - name = "futures-intrusive" 1163 - version = "0.5.0" 1164 - source = "registry+https://github.com/rust-lang/crates.io-index" 1165 - checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" 1166 - dependencies = [ 1167 - "futures-core", 1168 - "lock_api", 1169 - ] 1170 1107 1171 1108 [[package]] 1172 1109 name = "futures-io" ··· 1933 1870 ] 1934 1871 1935 1872 [[package]] 1936 - name = "rgb" 1937 - version = "0.8.45" 1938 - source = "registry+https://github.com/rust-lang/crates.io-index" 1939 - checksum = "ade4539f42266ded9e755c605bdddf546242b2c961b03b06a7375260788a0523" 1940 - dependencies = [ 1941 - "bytemuck", 1942 - ] 1943 - 1944 - [[package]] 1945 1873 name = "rp-pac" 1946 1874 version = "6.0.0" 1947 1875 source = "git+https://github.com/embassy-rs/rp-pac.git?rev=a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c#a7f42d25517f7124ad3b4ed492dec8b0f50a0e6c" ··· 1988 1916 version = "0.1.0" 1989 1917 dependencies = [ 1990 1918 "assign-resources", 1991 - "byte-slice-cast 1.2.2", 1919 + "byte-slice-cast", 1992 1920 "cortex-m", 1993 1921 "cortex-m-rt", 1994 1922 "critical-section", ··· 1996 1924 "cyw43-pio", 1997 1925 "defmt", 1998 1926 "defmt-rtt", 1999 - "display-interface-spi", 2000 1927 "embassy-embedded-hal", 2001 1928 "embassy-executor", 2002 1929 "embassy-futures 0.1.1 (git+https://github.com/embassy-rs/embassy.git)", ··· 2029 1956 "serde", 2030 1957 "serde-json-core", 2031 1958 "shtcx", 2032 - "smart-leds", 2033 1959 "static_cell", 2034 1960 "tinybmp", 2035 1961 "uc8151", 2036 - "usbd-hid", 2037 1962 ] 2038 1963 2039 1964 [[package]] ··· 2150 2075 version = "1.13.2" 2151 2076 source = "registry+https://github.com/rust-lang/crates.io-index" 2152 2077 checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 2153 - 2154 - [[package]] 2155 - name = "smart-leds" 2156 - version = "0.3.0" 2157 - source = "registry+https://github.com/rust-lang/crates.io-index" 2158 - checksum = "38dd45fa275f70b4110eac5f5182611ad384f88bb22b68b9a9c3cafd7015290b" 2159 - dependencies = [ 2160 - "smart-leds-trait", 2161 - ] 2162 - 2163 - [[package]] 2164 - name = "smart-leds-trait" 2165 - version = "0.2.1" 2166 - source = "registry+https://github.com/rust-lang/crates.io-index" 2167 - checksum = "ebf6d833fa93f16a1c1874e62c2aebe8567e5bdd436d59bf543ed258b6f7a8e3" 2168 - dependencies = [ 2169 - "rgb", 2170 - ] 2171 2078 2172 2079 [[package]] 2173 2080 name = "smoltcp"
+8 -7
Cargo.toml
··· 13 13 "defmt", 14 14 ] } 15 15 embassy-executor = { git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 16 - "task-arena-size-98304", 16 + "task-arena-size-131072", 17 17 "arch-cortex-m", 18 18 "executor-thread", 19 19 "executor-interrupt", 20 20 "defmt", 21 21 "integrated-timers", 22 + 22 23 ] } 23 24 embassy-time = { version = "0.3.2", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 24 25 "defmt", ··· 49 50 embassy-futures = { version = "0.1.0", git = "https://github.com/embassy-rs/embassy.git" } 50 51 embassy-usb-logger = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git" } 51 52 cyw43 = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 52 - "defmt", 53 - "firmware-logs", 54 - "bluetooth", 53 + # "defmt", 54 + # "firmware-logs", 55 + # "bluetooth", 55 56 ] } 56 57 cyw43-pio = { version = "0.2.0", git = "https://github.com/embassy-rs/embassy.git", rev = "f0a86070512ad739641cee7d9fa39d63f5c8a9f6", features = [ 57 58 "defmt", ··· 75 76 cortex-m-rt = "0.7.0" 76 77 critical-section = "1.1" 77 78 panic-probe = { version = "0.3", features = ["print-defmt"] } 78 - display-interface-spi = "0.4.1" 79 + 79 80 embedded-graphics = "0.8.0" 80 81 byte-slice-cast = { version = "1.2.0", default-features = false } 81 - smart-leds = "0.3.0" 82 + 82 83 heapless = { version = "0.8", features = ["serde"] } 83 - usbd-hid = "0.8.1" 84 + 84 85 85 86 embedded-hal-1 = { package = "embedded-hal", version = "1.0" } 86 87 embedded-hal-async = "1.0"
+4
rust-toolchain-nightly.toml
··· 1 + [toolchain] 2 + channel = "nightly-2024-11-04" 3 + components = ["rust-src", "rustfmt", "llvm-tools", "miri"] 4 + targets = ["thumbv6m-none-eabi"]
+1 -3
src/cyw43_driver.rs
··· 32 32 ) -> (Device<'a>, Control<'a>) { 33 33 let fw = include_bytes!("../cyw43-firmware/43439A0.bin"); 34 34 let clm = include_bytes!("../cyw43-firmware/43439A0_clm.bin"); 35 - // let btfw = include_bytes!("../cyw43-firmware/43439A0_btfw.bin"); 36 35 37 36 // To make flashing faster for development, you may want to flash the firmwares independently 38 37 // at hardcoded addresses, instead of baking them into the program with `include_bytes!`: 39 38 // probe-rs download 43439A0.bin --binary-format bin --chip RP2040 --base-address 0x10100000 40 39 // probe-rs download 43439A0_clm.bin --binary-format bin --chip RP2040 --base-address 0x10140000 41 - // probe-rs download 43439A0_btfw.bin --binary-format bin --chip RP2040 --base-address 0x10141400 40 + 42 41 // let fw = unsafe { core::slice::from_raw_parts(0x10100000 as *const u8, 224190) }; 43 42 // let clm = unsafe { core::slice::from_raw_parts(0x10140000 as *const u8, 4752) }; 44 - // let btfw = unsafe { core::slice::from_raw_parts(0x10141400 as *const u8, 6164) }; 45 43 46 44 let pwr = Output::new(p_23, Level::Low); 47 45 let cs = Output::new(p_25, Level::High);