Specify dependencies for SD-Card

This commit is contained in:
Frederik Menke 2024-07-04 22:58:27 +02:00
parent d9a0458cd1
commit 07a57d9b1d
3 changed files with 484 additions and 49 deletions

406
Cargo.lock generated
View file

@ -89,6 +89,18 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "byte-slice-cast"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0a5e3906bcbf133e33c1d4d95afc664ad37fbdb9f6568d8043e7ea8c27d93d3"
[[package]]
name = "byte-slice-cast"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c"
[[package]]
name = "bytemuck"
version = "1.16.0"
@ -170,6 +182,38 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "cyw43"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59d6ec798758febb089bd969109385b48dd0fb966193fe97a5f0f8b2d622145e"
dependencies = [
"cortex-m",
"cortex-m-rt",
"defmt",
"embassy-futures",
"embassy-net-driver-channel",
"embassy-sync 0.5.0",
"embassy-time",
"embedded-hal 1.0.0",
"futures",
"num_enum",
]
[[package]]
name = "cyw43-pio"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f429446fe9420ee0a8743fdffb1d08a90f9332116635bbc819f63649264e480c"
dependencies = [
"cyw43",
"defmt",
"embassy-rp",
"fixed",
"pio",
"pio-proc",
]
[[package]]
name = "darling"
version = "0.20.9"
@ -277,6 +321,23 @@ dependencies = [
"winapi",
]
[[package]]
name = "display-interface"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7517c040926d7b02b111884aa089177db80878533127f7c1b480d852c5fb4112"
[[package]]
name = "display-interface-spi"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "489378ad054862146fbd1f09f51d585ccbe4bd1e2feadcda2a13ac33f840e1a5"
dependencies = [
"byte-slice-cast 0.3.5",
"display-interface",
"embedded-hal 0.2.7",
]
[[package]]
name = "document-features"
version = "0.2.8"
@ -298,8 +359,9 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eca4a9380d03e61063067b8239f67d2fa9f108ede7c46b4273804f6b79e59a1d"
dependencies = [
"defmt",
"embassy-futures",
"embassy-sync",
"embassy-sync 0.5.0",
"embassy-time",
"embedded-hal 0.2.7",
"embedded-hal 1.0.0",
@ -354,6 +416,37 @@ dependencies = [
"num-traits",
]
[[package]]
name = "embassy-net-driver"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524eb3c489760508f71360112bca70f6e53173e6fe48fc5f0efd0f5ab217751d"
[[package]]
name = "embassy-net-driver-channel"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "584ab4da7e5612efaa7d55ee76161d9549adf788eab48d49362eddbf322f9933"
dependencies = [
"embassy-futures",
"embassy-net-driver",
"embassy-sync 0.3.0",
]
[[package]]
name = "embassy-net-wiznet"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "114d6894cb781839c50ccc75df5ec41a0059ec4989f34af83bc87bfe3a4274c4"
dependencies = [
"defmt",
"embassy-futures",
"embassy-net-driver-channel",
"embassy-time",
"embedded-hal 1.0.0",
"embedded-hal-async",
]
[[package]]
name = "embassy-rp"
version = "0.1.0"
@ -370,7 +463,7 @@ dependencies = [
"embassy-embedded-hal",
"embassy-futures",
"embassy-hal-internal",
"embassy-sync",
"embassy-sync 0.5.0",
"embassy-time",
"embassy-time-driver",
"embassy-usb-driver",
@ -396,17 +489,57 @@ dependencies = [
name = "embassy-rp-skeleton"
version = "0.1.0"
dependencies = [
"byte-slice-cast 1.2.2",
"cortex-m",
"cortex-m-rt",
"critical-section",
"cyw43",
"cyw43-pio",
"defmt",
"defmt-rtt",
"display-interface",
"display-interface-spi",
"embassy-embedded-hal",
"embassy-executor",
"embassy-futures",
"embassy-net-wiznet",
"embassy-rp",
"embassy-sync 0.6.0",
"embassy-time",
"embassy-usb",
"embassy-usb-logger",
"embedded-graphics",
"embedded-hal 1.0.0",
"embedded-hal-async",
"embedded-hal-bus",
"embedded-io-async",
"embedded-sdmmc",
"embedded-storage",
"fixed",
"fixed-macro",
"heapless 0.8.0",
"log",
"panic-probe",
"pio",
"pio-proc",
"portable-atomic",
"rand",
"smart-leds",
"st7789",
"static_cell",
"usbd-hid",
]
[[package]]
name = "embassy-sync"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0525b466ca3ace30b57f2db868a35215dfaecd038d8668cb2db03feb7c069a0"
dependencies = [
"cfg-if",
"critical-section",
"futures-util",
"heapless 0.7.17",
]
[[package]]
@ -423,10 +556,24 @@ dependencies = [
]
[[package]]
name = "embassy-time"
version = "0.3.0"
name = "embassy-sync"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c844070d9f80dc66ee739299183312baee2e1cdeb6e90b4ea2af44f4676da5"
checksum = "b3e0c49ff02ebe324faf3a8653ba91582e2d0a7fdef5bc88f449d5aa1bfcc05c"
dependencies = [
"cfg-if",
"critical-section",
"defmt",
"embedded-io-async",
"futures-util",
"heapless 0.8.0",
]
[[package]]
name = "embassy-time"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "274c019608a9004aed3cafc871e2a3c87ce9351d537dcaab4cc5db184d4a04b1"
dependencies = [
"cfg-if",
"critical-section",
@ -456,6 +603,22 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1177859559ebf42cd24ae7ba8fe6ee707489b01d0bf471f8827b7b12dcb0bc0"
[[package]]
name = "embassy-usb"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66444f442f4efc155138a996e250821a6d83a0c40e28ce3de8f0d9033617838b"
dependencies = [
"defmt",
"embassy-futures",
"embassy-net-driver-channel",
"embassy-sync 0.5.0",
"embassy-usb-driver",
"heapless 0.8.0",
"ssmarshal",
"usbd-hid",
]
[[package]]
name = "embassy-usb-driver"
version = "0.1.0"
@ -465,6 +628,41 @@ dependencies = [
"defmt",
]
[[package]]
name = "embassy-usb-logger"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffefdf915abf7230f2e44753b552e60895540e4931fc9a743bb9b1c7dca242f7"
dependencies = [
"embassy-futures",
"embassy-sync 0.5.0",
"embassy-usb",
"log",
]
[[package]]
name = "embedded-graphics"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "750082c65094fbcc4baf9ba31583ce9a8bb7f52cadfb96f6164b1bc7f922f32b"
dependencies = [
"az",
"byteorder",
"embedded-graphics-core",
"float-cmp",
"micromath",
]
[[package]]
name = "embedded-graphics-core"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8b1239db5f3eeb7e33e35bd10bd014e7b2537b17e071f726a09351431337cfa"
dependencies = [
"az",
"byteorder",
]
[[package]]
name = "embedded-hal"
version = "0.2.7"
@ -492,14 +690,13 @@ dependencies = [
[[package]]
name = "embedded-hal-bus"
version = "0.2.0"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d3980bf28e8577db59fe2bdb3df868a419469d2cecb363644eea2b6f7797669"
checksum = "57b4e6ede84339ebdb418cd986e6320a34b017cdf99b5cc3efceec6450b06886"
dependencies = [
"critical-section",
"embedded-hal 1.0.0",
"embedded-hal-async",
"portable-atomic",
]
[[package]]
@ -517,6 +714,9 @@ name = "embedded-io"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
dependencies = [
"defmt",
]
[[package]]
name = "embedded-io-async"
@ -524,6 +724,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f"
dependencies = [
"defmt",
"embedded-io",
]
@ -563,6 +764,12 @@ dependencies = [
"log",
]
[[package]]
name = "encode_unicode"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
[[package]]
name = "equivalent"
version = "1.0.1"
@ -581,12 +788,56 @@ dependencies = [
"typenum",
]
[[package]]
name = "fixed-macro"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0c48af8cb14e02868f449f8a2187bd78af7a08da201fdc78d518ecb1675bc"
dependencies = [
"fixed",
"fixed-macro-impl",
"fixed-macro-types",
]
[[package]]
name = "fixed-macro-impl"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c93086f471c0a1b9c5e300ea92f5cd990ac6d3f8edf27616ef624b8fa6402d4b"
dependencies = [
"fixed",
"paste",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.100",
]
[[package]]
name = "fixed-macro-types"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "044a61b034a2264a7f65aa0c3cd112a01b4d4ee58baace51fead3f21b993c7e4"
dependencies = [
"fixed",
"fixed-macro-impl",
]
[[package]]
name = "fixedbitset"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "float-cmp"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1267f4ac4f343772758f7b1bdcbe767c218bbab93bb432acbf5162bbf85a6c4"
dependencies = [
"num-traits",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -851,6 +1102,12 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "micromath"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc4010833aea396656c2f91ee704d51a6f1329ec2ab56ffd00bfd56f7481ea94"
[[package]]
name = "nb"
version = "0.1.3"
@ -1074,6 +1331,15 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
@ -1117,6 +1383,15 @@ version = "0.6.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
[[package]]
name = "rgb"
version = "0.8.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7439be6844e40133eda024efd85bf07f59d0dd2f59b10c00dd6cfb92cc5c741"
dependencies = [
"bytemuck",
]
[[package]]
name = "rp-pac"
version = "6.0.0"
@ -1187,6 +1462,26 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.64",
]
[[package]]
name = "siphasher"
version = "0.3.11"
@ -1199,6 +1494,24 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smart-leds"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38dd45fa275f70b4110eac5f5182611ad384f88bb22b68b9a9c3cafd7015290b"
dependencies = [
"smart-leds-trait",
]
[[package]]
name = "smart-leds-trait"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebf6d833fa93f16a1c1874e62c2aebe8567e5bdd436d59bf543ed258b6f7a8e3"
dependencies = [
"rgb",
]
[[package]]
name = "spin"
version = "0.9.8"
@ -1208,12 +1521,44 @@ dependencies = [
"lock_api",
]
[[package]]
name = "ssmarshal"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850"
dependencies = [
"encode_unicode",
"serde",
]
[[package]]
name = "st7789"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cba7306a9ca07ffcafd13ac1eaac2d5cedc8e9fc0d342ef674e0f0d059c8f8a9"
dependencies = [
"display-interface",
"embedded-graphics-core",
"embedded-hal 0.2.7",
"heapless 0.7.17",
"nb 1.0.0",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "static_cell"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d89b0684884a883431282db1e4343f34afc2ff6996fe1f4a1664519b66e14c1e"
dependencies = [
"portable-atomic",
]
[[package]]
name = "string_cache"
version = "0.8.7"
@ -1328,6 +1673,51 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "usb-device"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
dependencies = [
"heapless 0.8.0",
"portable-atomic",
]
[[package]]
name = "usbd-hid"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41a2d4546ca3e6a5c6a85584e5caf29feabf3ec35d6cd6b772eb35bd3cff7256"
dependencies = [
"serde",
"ssmarshal",
"usb-device",
"usbd-hid-macros",
]
[[package]]
name = "usbd-hid-descriptors"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcbee8c6735e90894fba04770bc41e11fd3c5256018856e15dc4dd1e6c8a3dd1"
dependencies = [
"bitfield",
]
[[package]]
name = "usbd-hid-macros"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "261079a9ada015fa1acac7cc73c98559f3a92585e15f508034beccf6a2ab75a2"
dependencies = [
"byteorder",
"proc-macro2",
"quote",
"serde",
"syn 1.0.100",
"usbd-hid-descriptors",
]
[[package]]
name = "vcell"
version = "0.1.3"

View file

@ -4,45 +4,50 @@ version = "0.1.0"
edition = "2021"
[dependencies]
# embassy-embedded-hal = { version = "0.1.0", features = ["defmt"] }
# embassy-sync = { version = "0.5.0", features = ["defmt"] }
embassy-embedded-hal = { version = "0.1.0", features = ["defmt"] }
embassy-sync = { version = "0.6.0", features = ["defmt"] }
embassy-executor = { version = "0.5.0", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
embassy-time = { version = "0.3.0", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-time = { version = "0.3.1", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-pac", "time-driver", "critical-section-impl"] }
# embassy-usb = { version = "0.1.0", features = ["defmt"] }
# embassy-net = { version = "0.4.0", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
# embassy-net-wiznet = { version = "0.1.0", features = ["defmt"] }
# embassy-futures = { version = "0.1.0" }
# embassy-usb-logger = { version = "0.1.0" }
# cyw43 = { version = "0.1.0", features = ["defmt", "firmware-logs"] }
# cyw43-pio = { version = "0.1.0", features = ["defmt", "overclock"] }
embassy-usb = { version = "0.2.0", features = ["defmt"] }
# embassy-net = { version = "0.4.0", features = ["defmt", "tcp", "udp", "raw", "dhcpv4", "medium-ethernet"] }
embassy-net-wiznet = { version = "0.1.0", features = ["defmt"] }
embassy-futures = { version = "0.1.0"}
embassy-usb-logger = { version = "0.2.0"}
cyw43 = { version = "0.1.0", features = ["defmt", "firmware-logs"] }
cyw43-pio = { version = "0.1.0", features = ["defmt", "overclock"] }
defmt = "0.3"
defmt-rtt = "0.4"
# fixed = "1.23.1"
# fixed-macro = "1.2"
fixed = "1.23.1"
fixed-macro = "1.2"
#cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m = { version = "0.7.6", features = ["inline-asm"] }
cortex-m-rt = "0.7.0"
# critical-section = "1.1"
critical-section = "1.1"
panic-probe = { version = "0.3", features = ["print-defmt"] }
# display-interface-spi = "0.5.0"
# embedded-graphics = "0.8.1"
# display-interface = "0.5.0"
# byte-slice-cast = { version = "1.2.0", default-features = false }
# smart-leds = "0.4.0"
# heapless = "0.8"
# usbd-hid = "0.7.0"
display-interface-spi = "0.4.1"
embedded-graphics = "0.7.1"
st7789 = "0.6.1"
display-interface = "0.4.1"
byte-slice-cast = { version = "1.2.0", default-features = false }
smart-leds = "0.3.0"
heapless = "0.8"
usbd-hid = "0.7.0"
# embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
# embedded-hal-async = "1.0"
embedded-hal-bus = { version = "0.2.0", features = ["async"] }
# embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
# embedded-storage = { version = "0.3" }
# static_cell = "2"
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
embedded-hal-async = "1.0"
embedded-hal-bus = { version = "0.1", features = ["async"] }
embedded-io-async = { version = "0.6.1", features = ["defmt-03"] }
embedded-storage = { version = "0.3" }
static_cell = "2"
portable-atomic = { version = "1.5", features = ["critical-section"] }
# log = "0.4"
# pio-proc = "0.2"
# pio = "0.2.1"
# rand = { version = "0.8.5", default-features = false }
log = "0.4"
pio-proc = "0.2"
pio = "0.2.1"
rand = { version = "0.8.5", default-features = false }
embedded-sdmmc = "0.7.0"
[profile.release]
debug = 2

View file

@ -1,14 +1,16 @@
//! This example test the RP Pico on board LED.
//! This example shows how to use `embedded-sdmmc` with the RP2040 chip, over SPI.
//!
//! It does not work with the RP Pico W board. See wifi_blinky.rs.
//! The example will attempt to read a file `MY_FILE.TXT` from the root directory
//! of the SD card and print its contents.
#![no_std]
#![no_main]
use defmt::*;
use embassy_embedded_hal::SetConfig;
use embassy_executor::Spawner;
use embassy_rp::spi::Spi;
use embassy_rp::{gpio, spi};
use embassy_time::Timer;
use embedded_hal_bus::spi::ExclusiveDevice;
use embedded_sdmmc::sdcard::{DummyCsPin, SdCard};
use gpio::{Level, Output};
@ -31,16 +33,54 @@ impl embedded_sdmmc::TimeSource for DummyTimesource {
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
embassy_rp::pac::SIO.spinlock(31).write_value(1);
let p = embassy_rp::init(Default::default());
let mut led = Output::new(p.PIN_25, Level::Low);
loop {
info!("led on!");
led.set_high();
Timer::after_secs(1).await;
// SPI clock needs to be running at <= 400kHz during initialization
let mut config = spi::Config::default();
config.frequency = 400_000;
let spi = Spi::new_blocking(p.SPI1, p.PIN_10, p.PIN_11, p.PIN_12, config);
// Use a dummy cs pin here, for embedded-hal SpiDevice compatibility reasons
let spi_dev = ExclusiveDevice::new_no_delay(spi, DummyCsPin);
// Real cs pin
let cs = Output::new(p.PIN_16, Level::High);
info!("led off!");
led.set_low();
Timer::after_secs(1).await;
let sdcard = SdCard::new(spi_dev, cs, embassy_time::Delay);
info!("Card size is {} bytes", sdcard.num_bytes().unwrap());
// Now that the card is initialized, the SPI clock can go faster
let mut config = spi::Config::default();
config.frequency = 16_000_000;
sdcard.spi(|dev| dev.bus_mut().set_config(&config)).ok();
info!("here");
// Now let's look for volumes (also known as partitions) on our block device.
// To do this we need a Volume Manager. It will take ownership of the block device.
let mut volume_mgr = embedded_sdmmc::VolumeManager::new(sdcard, DummyTimesource());
info!("here");
// Try and access Volume 0 (i.e. the first partition).
// The volume object holds information about the filesystem on that volume.
let mut volume0 = volume_mgr.open_volume(embedded_sdmmc::VolumeIdx(0)).unwrap();
info!("Volume 0: {:?}", defmt::Debug2Format(&volume0));
// Open the root directory (mutably borrows from the volume).
let mut root_dir = volume0.open_root_dir().unwrap();
// Open a file called "MY_FILE.TXT" in the root directory
// This mutably borrows the directory.
let mut my_file = root_dir
.open_file_in_dir("MY_FILE.TXT", embedded_sdmmc::Mode::ReadOnly)
.unwrap();
// Print the contents of the file
while !my_file.is_eof() {
let mut buf = [0u8; 32];
if let Ok(n) = my_file.read(&mut buf) {
info!("{:a}", buf[..n]);
}
}
loop {}
}