Skip to content

Commit 467d11e

Browse files
committed
1 parent e274104 commit 467d11e

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

src/lib.rs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ where
104104
/// The initial state of the motors will be set to [stopped](DriveCommand::Stop).
105105
/// The initial state of standby will be *disabled*.
106106
///
107-
/// Usage example:
107+
/// # Errors
108+
/// If any of the underlying pin interactions fail these errors will be propagated up.
109+
/// The errors are specific to your HAL.
110+
///
111+
/// # Usage example
108112
/// ```
109113
/// # use embedded_hal_mock::eh1::digital::Mock as PinMock;
110114
/// # use embedded_hal_mock::eh1::pwm::Mock as PwmMock;
@@ -189,18 +193,30 @@ where
189193
///
190194
/// Note that this does not change any commands on the motors, i.e. the PWM signal will continue
191195
/// and once [`Tb6612fng::disable_standby`] is called the motor will pick up where it left off (unless the command was changed in-between).
196+
///
197+
/// # Errors
198+
/// If the underlying pin interaction fails this error will be propagated up.
199+
/// The error is specific to your HAL.
192200
pub fn enable_standby(&mut self) -> Result<(), STBY::Error> {
193201
self.standby.set_low()
194202
}
195203

196204
/// Disable standby. Note that the last active commands on the motors will resume.
205+
///
206+
/// # Errors
207+
/// If the underlying pin interaction fails this error will be propagated up.
208+
/// The error is specific to your HAL.
197209
pub fn disable_standby(&mut self) -> Result<(), STBY::Error> {
198210
self.standby.set_high()
199211
}
200212

201213
/// Returns whether the standby mode is enabled.
202214
///
203215
/// *NOTE* this does *not* read the electrical state of the pin, see [`StatefulOutputPin`]
216+
///
217+
/// # Errors
218+
/// If the underlying pin interaction fails this error will be propagated up.
219+
/// The error is specific to your HAL.
204220
pub fn current_standby(&mut self) -> Result<bool, STBY::Error>
205221
where
206222
STBY: StatefulOutputPin,
@@ -231,7 +247,11 @@ where
231247
/// This also automatically enables the PWM pin.
232248
/// The initial state of the motor will be set to [stopped](DriveCommand::Stop).
233249
///
234-
/// Usage example:
250+
/// # Errors
251+
/// If any of the underlying pin interactions fail these errors will be propagated up.
252+
/// The errors are specific to your HAL.
253+
///
254+
/// # Usage example
235255
/// ```
236256
/// # use embedded_hal_mock::eh1::digital::Mock as PinMock;
237257
/// # use embedded_hal_mock::eh1::pwm::Mock as PwmMock;
@@ -275,6 +295,13 @@ where
275295
}
276296

277297
/// Drive with the defined speed (or brake or stop the motor).
298+
///
299+
/// # Errors
300+
/// If the underlying pin interaction fails this error will be propagated up.
301+
/// The error is specific to your HAL.
302+
///
303+
/// The specified speed must be between 0 and 100 (inclusive), otherwise you will get a
304+
/// [`MotorError::InvalidSpeed`] error.
278305
#[allow(clippy::type_complexity)]
279306
pub fn drive(
280307
&mut self,
@@ -330,7 +357,7 @@ where
330357
/// Return the current speed of the motor (in percentage). Note that driving forward returns a positive number
331358
/// while driving backward returns a negative number and both [`DriveCommand::Brake`] and [`DriveCommand::Stop`] return 0.
332359
///
333-
/// If you need to know in more details what the current status is consider calling [`Motor::current_drive_command`] instead.
360+
/// If you need to know in more details what the current status is, consider calling [`Motor::current_drive_command`] instead.
334361
pub fn current_speed(&self) -> i8 {
335362
match self.current_drive_command() {
336363
DriveCommand::Forward(s) => *s as i8,

0 commit comments

Comments
 (0)