diff --git a/Cargo.toml b/Cargo.toml index e7f244f..2341436 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,8 @@ proptest-derive = { version = "0.3.0", optional = true } messages-proc-macros-lib = { path = "messages-proc-macros-lib" } chrono = { git = "https://github.com/uorocketry/chrono", features = ["serde"], default-features = false } ublox = { git = "https://github.com/uorocketry/ublox", features = ["serde"], default-features = false } +# The actual version imported does not matter as reset reason is not behind or affected by any feature flags. +stm32h7xx-hal = { git = "https://github.com/uorocketry/stm32h7xx-hal", features = ["defmt", "stm32h735"] } [dev-dependencies] proptest = "1.2.0" @@ -28,4 +30,4 @@ postcard = { version = "1.0.4", features = ["alloc"] } [features] default = ["mavlink/embedded-hal-02", "mavlink/uorocketry"] -std = ["chrono/std", "chrono/arbitrary", "mavlink/std", "mavlink/tcp", "mavlink/udp", "mavlink/direct-serial", "mavlink/serde", "dep:proptest", "dep:proptest-derive"] \ No newline at end of file +std = ["stm32h7xx-hal/arbitrary", "chrono/std", "chrono/arbitrary", "mavlink/std", "mavlink/tcp", "mavlink/udp", "mavlink/direct-serial", "mavlink/serde", "dep:proptest", "dep:proptest-derive"] \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index fe76d83..7012418 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,7 +69,7 @@ pub struct CanMessage { #[common_derives] #[derive(From)] pub enum Common { - ResetReason(sensor::ResetReason), + ResetReason(stm32h7xx_hal::rcc::ResetReason), Command(command::Command), Log(Log), } diff --git a/src/sensor.rs b/src/sensor.rs index 3b7d38a..e48bfb6 100644 --- a/src/sensor.rs +++ b/src/sensor.rs @@ -131,39 +131,6 @@ pub enum SbgData { GpsPos(GpsPos), } -/* Replace with new health monitor */ - -#[common_derives] -pub enum ResetReason { - /// The mcu went from not having power to having power and resetting - PowerOnReset, - /// The reset pin was asserted - PinReset, - /// The brownout detector triggered - BrownoutReset, - /// The software did a soft reset through the SCB peripheral - SystemReset, - /// The software did a soft reset through the RCC periperal - CpuReset, - /// The window watchdog triggered - WindowWatchdogReset, - /// The independent watchdog triggered - IndependentWatchdogReset, - /// Either of the two watchdogs triggered (but we don't know which one) - GenericWatchdogReset, - /// The DStandby mode was exited - D1ExitsDStandbyMode, - /// The DStandby mode was exited - D2ExitsDStandbyMode, - /// A state has been entered erroneously - D1EntersDStandbyErroneouslyOrCpuEntersCStopErroneously, - /// The reason could not be determined - Unknown { - /// The raw register value - rcc_rsr: u32, - }, -} - #[common_derives] pub struct GpsPos { #[doc = "< Latitude in degrees, positive north."] diff --git a/src/state.rs b/src/state.rs index 3c44a04..5f66fac 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,12 +1,12 @@ use messages_proc_macros_lib::common_derives; -#[common_derives] -pub struct State { - pub data: StateData, -} +// #[common_derives] +// pub struct State { +// pub data: StateData, +// } #[common_derives] -pub enum StateData { +pub enum State { Initializing, WaitForTakeoff, Ascent, @@ -16,8 +16,8 @@ pub enum StateData { Abort, } -impl State { - pub fn new(data: impl Into) -> Self { - State { data: data.into() } - } -} +// impl State { +// pub fn new(data: impl Into) -> Self { +// State { data: data.into() } +// } +// }