Skip to content

Commit

Permalink
PeripheralRef/spi (#299)
Browse files Browse the repository at this point in the history
* Add missing UART instances

* Add SPI to list of peripherals to be created

* Refactor SPI driver to use PeripheralRef
  • Loading branch information
MabezDev authored Dec 13, 2022
1 parent 2632421 commit cfe8382
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 88 deletions.
2 changes: 1 addition & 1 deletion esp-hal-common/src/cpu_control/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl CpuControl {
}

fn enable_cache(&mut self, core: Cpu) {
let spi0 = unsafe { &(*crate::pac::SPI0::ptr()) };
let spi0 = unsafe { &(*crate::peripherals::SPI0::ptr()) };

let dport_control = crate::pac::DPORT::PTR;
let dport_control = unsafe { &*dport_control };
Expand Down
5 changes: 5 additions & 0 deletions esp-hal-common/src/peripherals/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,10 @@ mod peripherals {
crate::create_peripherals! {
UART0,
UART1,
UART2,
SPI0,
SPI1,
SPI2,
SPI3,
}
}
3 changes: 3 additions & 0 deletions esp-hal-common/src/peripherals/esp32c2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ mod peripherals {
crate::create_peripherals! {
UART0,
UART1,
SPI0,
SPI1,
SPI2,
}
}
3 changes: 3 additions & 0 deletions esp-hal-common/src/peripherals/esp32c3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ mod peripherals {
crate::create_peripherals! {
UART0,
UART1,
SPI0,
SPI1,
SPI2,
}
}
5 changes: 5 additions & 0 deletions esp-hal-common/src/peripherals/esp32s2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@ mod peripherals {
crate::create_peripherals! {
UART0,
UART1,
SPI0,
SPI1,
SPI2,
SPI3,
SPI4,
}
}
5 changes: 5 additions & 0 deletions esp-hal-common/src/peripherals/esp32s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,10 @@ mod peripherals {
crate::create_peripherals! {
UART0,
UART1,
UART2,
SPI0,
SPI1,
SPI2,
SPI3,
}
}
Loading

0 comments on commit cfe8382

Please sign in to comment.