diff --git a/usb-pd/src/lib.rs b/usb-pd/src/lib.rs index 9654ec4..753a01a 100644 --- a/usb-pd/src/lib.rs +++ b/usb-pd/src/lib.rs @@ -1,7 +1,5 @@ #![no_std] -use core::ops::Not; - pub mod header; pub mod message; pub mod pdo; @@ -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 { diff --git a/usb-pd/src/message.rs b/usb-pd/src/message.rs index 981b0ec..2a7fb06 100644 --- a/usb-pd/src/message.rs +++ b/usb-pd/src/message.rs @@ -1,5 +1,3 @@ -use defmt::trace; - use { crate::{ header::{ControlMessageType, DataMessageType, Header, MessageType}, @@ -11,7 +9,7 @@ use { }, }, byteorder::{ByteOrder, LittleEndian}, - defmt::{warn, Format}, + defmt::{trace, warn, Format}, heapless::Vec, }; @@ -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 diff --git a/usb-pd/src/pdo.rs b/usb-pd/src/pdo.rs index 1d6b844..2578907 100644 --- a/usb-pd/src/pdo.rs +++ b/usb-pd/src/pdo.rs @@ -173,7 +173,8 @@ impl From 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. */ } } } diff --git a/usb-pd/src/sink.rs b/usb-pd/src/sink.rs index c681b9e..8ad52db 100644 --- a/usb-pd/src/sink.rs +++ b/usb-pd/src/sink.rs @@ -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); diff --git a/zy12pdn/src/main.rs b/zy12pdn/src/main.rs index c512cc2..87de333 100644 --- a/zy12pdn/src/main.rs +++ b/zy12pdn/src/main.rs @@ -30,10 +30,9 @@ type PdSink = Sink>, PA9> #[app(device = stm32f0xx_hal::pac, peripherals = true, dispatchers = [SPI1])] mod app { - use crate::handle_event; - use { crate::{ + handle_event, rgb::{Color, Rgb}, Led, PdSink, },