Skip to content

Commit

Permalink
Remove redundant function from async nunchuk impl
Browse files Browse the repository at this point in the history
  • Loading branch information
9names committed Apr 15, 2024
1 parent a7f76ef commit 0d4ee55
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions wii-ext/src/async_impl/nunchuk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,15 @@ where
}

/// poll the controller for the latest data
async fn read_classic_report(&mut self) -> Result<NunchukReading, AsyncImplError> {
async fn read_report(&mut self) -> Result<NunchukReading, AsyncImplError> {
let buf = self.interface.read_ext_report().await?;
NunchukReading::from_data(&buf).ok_or(AsyncImplError::InvalidInputData)
}

/// Simple blocking read helper that will start a sample, wait 10ms, then read the value
async fn read_report(&mut self) -> Result<NunchukReading, AsyncImplError> {
self.read_classic_report().await
}

/// Do a read, and report axis values relative to calibration
pub async fn read(&mut self) -> Result<NunchukReadingCalibrated, AsyncImplError> {
Ok(NunchukReadingCalibrated::new(
self.read_classic_report().await?,
self.read_report().await?,
&self.calibration,
))
}
Expand Down

0 comments on commit 0d4ee55

Please sign in to comment.