Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated static RTC Mutex into SharedResources #5

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions boards/pressure/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use common_arm::*;
use communication::{CanCommandManager, CanDataManager};
use communication::{RadioDevice, RadioManager};
use core::cell::RefCell;

Check warning on line 12 in boards/pressure/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `core::cell::RefCell`
use core::num::{NonZeroU16, NonZeroU8};
use cortex_m::interrupt::Mutex;

Check warning on line 14 in boards/pressure/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `cortex_m::interrupt::Mutex`
use data_manager::DataManager;
use defmt::info;
use fdcan::{
Expand Down Expand Up @@ -43,8 +43,6 @@
cortex_m::asm::udf()
}

static RTC: Mutex<RefCell<Option<rtc::Rtc>>> = Mutex::new(RefCell::new(None));

#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true, dispatchers = [EXTI0, EXTI1, EXTI2, SPI3, SPI2])]
mod app {

Expand All @@ -65,6 +63,7 @@
can_command_manager: CanCommandManager,
can_data_manager: CanDataManager,
sbg_power: PB4<Output<PushPull>>,
rtc: rtc::Rtc,

Check warning on line 66 in boards/pressure/src/main.rs

View workflow job for this annotation

GitHub Actions / All

field `rtc` is never read
}
#[local]
struct LocalResources {
Expand Down Expand Up @@ -294,10 +293,6 @@

rtc.set_date_time(now);

cortex_m::interrupt::free(|cs| {
RTC.borrow(cs).replace(Some(rtc));
});

/* Monotonic clock */
Mono::start(core.SYST, 200_000_000);

Expand All @@ -321,6 +316,7 @@
can_command_manager,
can_data_manager,
sbg_power,
rtc,
},
LocalResources {
led_red,
Expand Down
8 changes: 2 additions & 6 deletions boards/strain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use common_arm::*;
use communication::{CanCommandManager, CanDataManager};
use communication::{RadioDevice, RadioManager};
use core::cell::RefCell;

Check warning on line 12 in boards/strain/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `core::cell::RefCell`
use core::num::{NonZeroU16, NonZeroU8};
use cortex_m::interrupt::Mutex;

Check warning on line 14 in boards/strain/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `cortex_m::interrupt::Mutex`
use data_manager::DataManager;
use defmt::info;
use fdcan::{
Expand Down Expand Up @@ -43,8 +43,6 @@
cortex_m::asm::udf()
}

static RTC: Mutex<RefCell<Option<rtc::Rtc>>> = Mutex::new(RefCell::new(None));

#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true, dispatchers = [EXTI0, EXTI1, EXTI2, SPI3, SPI2])]
mod app {

Expand All @@ -65,6 +63,7 @@
can_command_manager: CanCommandManager,
can_data_manager: CanDataManager,
sbg_power: PB4<Output<PushPull>>,
rtc: rtc::Rtc,

Check warning on line 66 in boards/strain/src/main.rs

View workflow job for this annotation

GitHub Actions / All

field `rtc` is never read
}
#[local]
struct LocalResources {
Expand Down Expand Up @@ -294,10 +293,6 @@

rtc.set_date_time(now);

cortex_m::interrupt::free(|cs| {
RTC.borrow(cs).replace(Some(rtc));
});

/* Monotonic clock */
Mono::start(core.SYST, 200_000_000);

Expand All @@ -321,6 +316,7 @@
can_command_manager,
can_data_manager,
sbg_power,
rtc,
},
LocalResources {
led_red,
Expand Down
8 changes: 2 additions & 6 deletions boards/temperature/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use common_arm::*;
use communication::{CanCommandManager, CanDataManager};
use communication::{RadioDevice, RadioManager};
use core::cell::RefCell;

Check warning on line 12 in boards/temperature/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `core::cell::RefCell`
use core::num::{NonZeroU16, NonZeroU8};
use cortex_m::interrupt::Mutex;
use data_manager::DataManager;
Expand Down Expand Up @@ -43,8 +43,6 @@
cortex_m::asm::udf()
}

static RTC: Mutex<RefCell<Option<rtc::Rtc>>> = Mutex::new(RefCell::new(None));

#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true, dispatchers = [EXTI0, EXTI1, EXTI2, SPI3, SPI2])]
mod app {

Expand All @@ -65,6 +63,7 @@
can_command_manager: CanCommandManager,
can_data_manager: CanDataManager,
sbg_power: PB4<Output<PushPull>>,
rtc: rtc::Rtc,
}
#[local]
struct LocalResources {
Expand Down Expand Up @@ -294,10 +293,6 @@

rtc.set_date_time(now);

cortex_m::interrupt::free(|cs| {
RTC.borrow(cs).replace(Some(rtc));
});

/* Monotonic clock */
Mono::start(core.SYST, 200_000_000);

Expand All @@ -321,6 +316,7 @@
can_command_manager,
can_data_manager,
sbg_power,
rtc,
},
LocalResources {
led_red,
Expand Down
35 changes: 0 additions & 35 deletions crates/common-arm-test/Cargo.toml

This file was deleted.

8 changes: 2 additions & 6 deletions examples/rtic-playground/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use common_arm::*;
use communication::{CanCommandManager, CanDataManager};
use communication::{RadioDevice, RadioManager};
use core::cell::RefCell;

Check warning on line 12 in examples/rtic-playground/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `core::cell::RefCell`
use core::num::{NonZeroU16, NonZeroU8};
use cortex_m::interrupt::Mutex;

Check warning on line 14 in examples/rtic-playground/src/main.rs

View workflow job for this annotation

GitHub Actions / All

unused import: `cortex_m::interrupt::Mutex`
use data_manager::DataManager;
use defmt::info;
use fdcan::{
Expand Down Expand Up @@ -43,8 +43,6 @@
cortex_m::asm::udf()
}

static RTC: Mutex<RefCell<Option<rtc::Rtc>>> = Mutex::new(RefCell::new(None));

#[rtic::app(device = stm32h7xx_hal::stm32, peripherals = true, dispatchers = [EXTI0, EXTI1, EXTI2, SPI3, SPI2])]
mod app {

Expand All @@ -65,6 +63,7 @@
can_command_manager: CanCommandManager,
can_data_manager: CanDataManager,
sbg_power: PB4<Output<PushPull>>,
rtc: rtc::Rtc,

Check warning on line 66 in examples/rtic-playground/src/main.rs

View workflow job for this annotation

GitHub Actions / All

field `rtc` is never read
}
#[local]
struct LocalResources {
Expand Down Expand Up @@ -294,10 +293,6 @@

rtc.set_date_time(now);

cortex_m::interrupt::free(|cs| {
RTC.borrow(cs).replace(Some(rtc));
});

/* Monotonic clock */
Mono::start(core.SYST, 200_000_000);

Expand All @@ -321,6 +316,7 @@
can_command_manager,
can_data_manager,
sbg_power,
rtc,
},
LocalResources {
led_red,
Expand Down
Loading