@@ -104,7 +104,11 @@ where
104
104
/// The initial state of the motors will be set to [stopped](DriveCommand::Stop).
105
105
/// The initial state of standby will be *disabled*.
106
106
///
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
108
112
/// ```
109
113
/// # use embedded_hal_mock::eh1::digital::Mock as PinMock;
110
114
/// # use embedded_hal_mock::eh1::pwm::Mock as PwmMock;
@@ -189,18 +193,30 @@ where
189
193
///
190
194
/// Note that this does not change any commands on the motors, i.e. the PWM signal will continue
191
195
/// 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.
192
200
pub fn enable_standby ( & mut self ) -> Result < ( ) , STBY :: Error > {
193
201
self . standby . set_low ( )
194
202
}
195
203
196
204
/// 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.
197
209
pub fn disable_standby ( & mut self ) -> Result < ( ) , STBY :: Error > {
198
210
self . standby . set_high ( )
199
211
}
200
212
201
213
/// Returns whether the standby mode is enabled.
202
214
///
203
215
/// *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.
204
220
pub fn current_standby ( & mut self ) -> Result < bool , STBY :: Error >
205
221
where
206
222
STBY : StatefulOutputPin ,
@@ -231,7 +247,11 @@ where
231
247
/// This also automatically enables the PWM pin.
232
248
/// The initial state of the motor will be set to [stopped](DriveCommand::Stop).
233
249
///
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
235
255
/// ```
236
256
/// # use embedded_hal_mock::eh1::digital::Mock as PinMock;
237
257
/// # use embedded_hal_mock::eh1::pwm::Mock as PwmMock;
@@ -275,6 +295,13 @@ where
275
295
}
276
296
277
297
/// 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.
278
305
#[ allow( clippy:: type_complexity) ]
279
306
pub fn drive (
280
307
& mut self ,
@@ -330,7 +357,7 @@ where
330
357
/// Return the current speed of the motor (in percentage). Note that driving forward returns a positive number
331
358
/// while driving backward returns a negative number and both [`DriveCommand::Brake`] and [`DriveCommand::Stop`] return 0.
332
359
///
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.
334
361
pub fn current_speed ( & self ) -> i8 {
335
362
match self . current_drive_command ( ) {
336
363
DriveCommand :: Forward ( s) => * s as i8 ,
0 commit comments