Skip to content

Commit

Permalink
new design?
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbeechey committed Nov 16, 2024
1 parent e3f0fdd commit 543fa1b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 27 deletions.
52 changes: 26 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion lib/control/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ heapless = "0.8.0"

hyped_core = { path = "../core" }
hyped_io = { path = "../io" }

40 changes: 40 additions & 0 deletions lib/control/src/pneumatics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,43 @@ mod tests {
assert_eq!(gpio_out.blue_2, DigitalSignal::High);
}
}

enum BrakeState {
Engaged,
Disengaged,
}

enum LateralSuspensionState {
Deployed,
Retracted,
}

struct Pneumatics {
brakes: BrakeState,
lateral_suspension: LateralSuspensionState,
}

impl Pneumatics {
fn new() -> Self {
Pneumatics {
brakes: BrakeState::Engaged,
lateral_suspension: LateralSuspensionState::Retracted,
}
}

fn engage_brakes(&mut self) {
self.brakes = BrakeState::Engaged;
}

fn disengage_brakes(&mut self) {
self.brakes = BrakeState::Disengaged;
}

fn deploy_lateral_suspension(&mut self) {
self.lateral_suspension = LateralSuspensionState::Deployed;
}

fn retract_lateral_suspension(&mut self) {
self.lateral_suspension = LateralSuspensionState::Retracted;
}
}

0 comments on commit 543fa1b

Please sign in to comment.