Skip to content

Commit 996f833

Browse files
committed
Set properties after attaching
1 parent 1ccbdf7 commit 996f833

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/flash.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ extern "C" {
4141
feature = "esp32c3",
4242
))]
4343
fn ets_efuse_get_spiconfig() -> u32;
44+
45+
#[cfg(feature = "esp32s3")]
46+
fn ets_efuse_flash_octal_mode() -> bool;
4447
}
4548

4649
pub fn attach() -> i32 {
@@ -57,6 +60,13 @@ pub fn attach() -> i32 {
5760

5861
// TODO: raise CPU frequency
5962

63+
unsafe { esp_rom_spiflash_attach(spiconfig, false) };
64+
65+
#[cfg(feature = "esp32s3")]
66+
if unsafe { ets_efuse_flash_octal_mode() } {
67+
init_ospi_funcs();
68+
}
69+
6070
let config_result = unsafe {
6171
esp_rom_spiflash_config_param(
6272
0,
@@ -69,18 +79,6 @@ pub fn attach() -> i32 {
6979
};
7080

7181
if config_result == 0 {
72-
unsafe { esp_rom_spiflash_attach(spiconfig, false) };
73-
74-
#[cfg(feature = "esp32s3")]
75-
{
76-
extern "C" {
77-
fn ets_efuse_flash_octal_mode() -> bool;
78-
}
79-
if unsafe { ets_efuse_flash_octal_mode() } {
80-
init_ospi_funcs();
81-
}
82-
}
83-
8482
0
8583
} else {
8684
-1

0 commit comments

Comments
 (0)