Skip to content

Commit

Permalink
add set
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Nguyen committed Mar 12, 2024
1 parent 7e722ae commit 684b682
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/fake_motor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ impl<const N: usize> RawMotorsIO<N> for FakeMotorsIO<N> {
fn get_board_state(&mut self) -> Result<u8> {
Ok(0)
}
fn set_board_state(&mut self, _state: u8) -> Result<()> {
Ok(())
}
}

#[cfg(test)]
Expand Down
4 changes: 4 additions & 0 deletions src/motors_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ pub trait MotorsController<const N: usize> {
fn get_board_state(&mut self) -> Result<u8> {
self.io().get_board_state()
}
/// Set the current state of the articulation control board (clear error)
fn set_board_state(&mut self, state: u8) -> Result<()> {
self.io().set_board_state(state)
}
}

#[derive(Debug)]
Expand Down
3 changes: 3 additions & 0 deletions src/motors_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ pub trait RawMotorsIO<const N: usize> {

/// Get the Board State byte
fn get_board_state(&mut self) -> Result<u8>;

/// Set the Board State byte
fn set_board_state(&mut self, state: u8) -> Result<()>;
}

0 comments on commit 684b682

Please sign in to comment.