Skip to content

Commit

Permalink
drv/stm32h7-spi-server: convert to task_slot!
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-shift committed Oct 19, 2021
1 parent 1e21045 commit 87528fc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions demo-stm32h7/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ start = true
interrupts = {51 = 1}
stacksize = 1000

[tasks.spi_driver.task-slots]
gpio_driver = "gpio_driver"
rcc_driver = "rcc_driver"

[tasks.user_leds]
path = "../drv/user-leds"
name = "drv-user-leds"
Expand Down
8 changes: 4 additions & 4 deletions drv/stm32h7-spi-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use drv_stm32h7_gpio_api as gpio_api;
use drv_stm32h7_rcc_api as rcc_api;
use drv_stm32h7_spi as spi_core;

declare_task!(RCC, rcc_driver);
declare_task!(GPIO, gpio_driver);
task_slot!(RCC, rcc_driver);
task_slot!(GPIO, gpio_driver);

#[derive(Copy, Clone, PartialEq)]
enum Trace {
Expand All @@ -42,7 +42,7 @@ struct LockState {
fn main() -> ! {
check_server_config();

let rcc_driver = rcc_api::Rcc::from(get_task_id(RCC));
let rcc_driver = rcc_api::Rcc::from(RCC.get_task_id());

let registers = unsafe { &*CONFIG.registers };

Expand All @@ -61,7 +61,7 @@ fn main() -> ! {
device::spi1::cfg2::SSOM_A::ASSERTED,
);

let gpio_driver = gpio_api::Gpio::from(get_task_id(GPIO));
let gpio_driver = gpio_api::Gpio::from(GPIO.get_task_id());

// Configure all devices' CS pins to be deasserted (set).
// We leave them in GPIO output mode from this point forward.
Expand Down
8 changes: 8 additions & 0 deletions gemini-bu/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ start = true
interrupts = {36 = 1}
stacksize = 1000

[tasks.spi2_driver.task-slots]
gpio_driver = "gpio_driver"
rcc_driver = "rcc_driver"

[tasks.spi4_driver]
path = "../drv/stm32h7-spi-server"
name = "drv-stm32h7-spi-server"
Expand All @@ -145,6 +149,10 @@ start = true
interrupts = {84 = 1}
stacksize = 1000

[tasks.spi4_driver.task-slots]
gpio_driver = "gpio_driver"
rcc_driver = "rcc_driver"

[tasks.user_leds]
path = "../drv/user-leds"
name = "drv-user-leds"
Expand Down
8 changes: 8 additions & 0 deletions gimlet/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ start = true
interrupts = {84 = 1}
stacksize = 1000

[tasks.spi4_driver.task-slots]
gpio_driver = "gpio_driver"
rcc_driver = "rcc_driver"

[tasks.spi2_driver]
path = "../drv/stm32h7-spi-server"
name = "drv-stm32h7-spi-server"
Expand All @@ -87,6 +91,10 @@ start = true
interrupts = {36 = 1}
stacksize = 1000

[tasks.spi2_driver.task-slots]
gpio_driver = "gpio_driver"
rcc_driver = "rcc_driver"

[tasks.i2c_driver]
path = "../drv/stm32h7-i2c-server"
name = "drv-stm32h7-i2c-server"
Expand Down
4 changes: 4 additions & 0 deletions gimletlet/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ start = true
interrupts = {84 = 1}
stacksize = 1000

[tasks.spi_driver.task-slots]
gpio_driver = "gpio_driver"
rcc_driver = "rcc_driver"

[tasks.user_leds]
path = "../drv/user-leds"
name = "drv-user-leds"
Expand Down

0 comments on commit 87528fc

Please sign in to comment.