Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

feat: More InertialStatus stuff #110

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Before releasing:
- Repurposed the `pros` crate as a metapackage without any code of its own. (**Breaking Change**) (#86)
- Split the pros-rs into several small subcrates. (**Breaking Change**) (#86)
- `pros-async` with the async executor and robot trait.
- `pros-devices` for device bindings.
- `vex-devices` for device bindings.
- `pros-sync` for the sync robot trait.
- `pros-core` with basic abstractions over `pros-sys` needed to compile a program to the brain.
- `pros-math` with commonly used controllers and other mathematical models.
Expand Down
27 changes: 10 additions & 17 deletions packages/pros-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,20 @@ macro_rules! bail_on {
}
use snafu::Snafu;

#[derive(Debug, Snafu)]
/// Generic erros that can take place when using ports on the V5 Brain.
pub enum PortError {
/// No device is plugged into the port.
Disconnected,

/// The incorrect device type is plugged into the port.
IncorrectDevice,
}

/// A trait for converting an errno value into an error type.
pub trait FromErrno {
/// Consume the current `errno` and, if it contains a known error, returns Self.
fn from_errno(num: i32) -> Option<Self>
where
Self: Sized;
}

#[derive(Debug, Snafu)]
/// Generic erros that can take place when using ports on the V5 Brain.
pub enum PortError {
/// The specified port is outside of the allowed range!
PortOutOfRange,
/// The specified port couldn't be configured as the specified type.
PortCannotBeConfigured,
/// The specified port is already being used or is mismatched.
AlreadyInUse,
}

map_errno!(PortError {
ENXIO => Self::PortOutOfRange,
ENODEV => Self::PortCannotBeConfigured,
EADDRINUSE => Self::AlreadyInUse,
});
46 changes: 0 additions & 46 deletions packages/pros-devices/src/battery.rs

This file was deleted.

Loading
Loading