Skip to content

Commit

Permalink
chore: upgrade bitflags to v2
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <elpiel93@gmail.com>
  • Loading branch information
elpiel committed Jan 23, 2024
1 parent 77883b7 commit 5fe0d07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ readme = "README.md"
byteorder = { version = "1", default-features = false }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
mint = "^0.5.4"
bitflags = "1"
bitflags = "2"
num-traits = "0.2.15"
num-derive = "0.3.3"

Expand Down
18 changes: 13 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,7 @@ where
}

bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055AxisConfig: u8 {
const AXIS_AS_X = 0b00;
const AXIS_AS_Y = 0b01;
Expand All @@ -671,7 +672,7 @@ impl AxisRemap {
}
}

#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct AxisRemap {
x: BNO055AxisConfig,
y: BNO055AxisConfig,
Expand Down Expand Up @@ -760,6 +761,7 @@ impl AxisRemapBuilder {
}

bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055AxisSign: u8 {
const X_NEGATIVE = 0b100;
const Y_NEGATIVE = 0b010;
Expand All @@ -768,6 +770,7 @@ bitflags! {
}

bitflags! {
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055SystemStatusCode: u8 {
const SYSTEM_IDLE = 0;
const SYSTEM_ERROR = 1;
Expand All @@ -781,6 +784,7 @@ bitflags! {

bitflags! {
/// Possible BNO055 errors.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055SystemErrorCode: u8 {
const NONE = 0;
const PERIPHERAL_INIT = 1;
Expand All @@ -798,6 +802,7 @@ bitflags! {

bitflags! {
/// BNO055 self-test status bit flags.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055SelfTestStatus: u8 {
const ACC_OK = 0b0001;
const MAG_OK = 0b0010;
Expand All @@ -806,14 +811,14 @@ bitflags! {
}
}

#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BNO055SystemStatus {
status: BNO055SystemStatusCode,
selftest: Option<BNO055SelfTestStatus>,
error: BNO055SystemErrorCode,
}

#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055Revision {
pub software: u16,
pub bootloader: u8,
Expand All @@ -822,7 +827,7 @@ pub struct BNO055Revision {
pub gyroscope: u8,
}

#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[repr(C)]
pub struct BNO055Calibration {
Expand Down Expand Up @@ -871,7 +876,7 @@ impl BNO055Calibration {
}
}

#[derive(Debug)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055CalibrationStatus {
pub sys: u8,
pub gyr: u8,
Expand All @@ -881,6 +886,7 @@ pub struct BNO055CalibrationStatus {

bitflags! {
/// Possible BNO055 register map pages.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055RegisterPage: u8 {
const PAGE_0 = 0;
const PAGE_1 = 1;
Expand All @@ -889,6 +895,7 @@ bitflags! {

bitflags! {
/// Possible BNO055 power modes.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055PowerMode: u8 {
const NORMAL = 0b00;
const LOW_POWER = 0b01;
Expand All @@ -898,6 +905,7 @@ bitflags! {

bitflags! {
/// Possible BNO055 operation modes.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct BNO055OperationMode: u8 {
const CONFIG_MODE = 0b0000;
const ACC_ONLY = 0b0001;
Expand Down

0 comments on commit 5fe0d07

Please sign in to comment.