Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
fmckeogh committed Oct 26, 2023
1 parent 2141dac commit 6a9d148
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
4 changes: 1 addition & 3 deletions usb-pd/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![no_std]

use core::ops::Not;

pub mod header;
pub mod message;
pub mod pdo;
Expand All @@ -18,7 +16,7 @@ pub enum CcPin {
CC2,
}

impl Not for CcPin {
impl core::ops::Not for CcPin {
type Output = CcPin;

fn not(self) -> Self::Output {
Expand Down
9 changes: 4 additions & 5 deletions usb-pd/src/message.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use defmt::trace;

use {
crate::{
header::{ControlMessageType, DataMessageType, Header, MessageType},
Expand All @@ -11,7 +9,7 @@ use {
},
},
byteorder::{ByteOrder, LittleEndian},
defmt::{warn, Format},
defmt::{trace, warn, Format},
heapless::Vec,
};

Expand Down Expand Up @@ -74,8 +72,9 @@ impl Message {
};

trace!("VDM RX: {:?}", header);
// trace!("HEADER: VDM:: TYPE: {:?}, VERS: {:?}", header.vdm_type(), header.vdm_version());
// trace!("HEADER: CMD:: TYPE: {:?}, CMD: {:?}", header.command_type(), header.command());
// trace!("HEADER: VDM:: TYPE: {:?}, VERS: {:?}", header.vdm_type(),
// header.vdm_version()); trace!("HEADER: CMD:: TYPE: {:?}, CMD:
// {:?}", header.command_type(), header.command());

// Keep for now...
// let pkt = payload
Expand Down
3 changes: 2 additions & 1 deletion usb-pd/src/pdo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ impl From<u8> for VDMCommandType {
1 => VDMCommandType::ResponderACK,
2 => VDMCommandType::ResponderNAK,
3 => VDMCommandType::ResponderBSY,
_ => panic!("Cannot convert {:} to VDMCommandType", value), // Illegal values shall panic.
_ => panic!("Cannot convert {:} to VDMCommandType", value), /* Illegal values shall
* panic. */
}
}
}
Expand Down
16 changes: 9 additions & 7 deletions usb-pd/src/sink.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use crate::{
header::{DataMessageType, Header, SpecificationRevision},
message::Message,
pdo::FixedVariableRequestDataObject,
Instant, PowerRole,
use {
crate::{
header::{DataMessageType, Header, SpecificationRevision},
message::Message,
pdo::{FixedVariableRequestDataObject, PowerDataObject},
Instant, PowerRole,
},
defmt::{warn, Format},
heapless::Vec,
};
use defmt::warn;
use {crate::pdo::PowerDataObject, defmt::Format, heapless::Vec};

pub trait Driver {
fn init(&mut self);
Expand Down
3 changes: 1 addition & 2 deletions zy12pdn/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ type PdSink = Sink<Fusb302b<I2cBB<PA10<Output<PushPull>>, PA9<Output<OpenDrain>>

#[app(device = stm32f0xx_hal::pac, peripherals = true, dispatchers = [SPI1])]
mod app {
use crate::handle_event;

use {
crate::{
handle_event,
rgb::{Color, Rgb},
Led, PdSink,
},
Expand Down

0 comments on commit 6a9d148

Please sign in to comment.