diff options
author | 2021-11-21 02:20:51 +0100 | |
---|---|---|
committer | 2021-11-21 02:51:02 +0100 | |
commit | 92c15ed56da6331c1f7bc4bb1372b56e3fc93a05 (patch) | |
tree | c1eee27c86b5ca03f465359da3b9fcda07346d0f | |
parent | 5a92298d9c12685214b12266357fe7c104035b59 (diff) | |
download | cortex-m-92c15ed56da6331c1f7bc4bb1372b56e3fc93a05.tar.gz cortex-m-92c15ed56da6331c1f7bc4bb1372b56e3fc93a05.tar.zst cortex-m-92c15ed56da6331c1f7bc4bb1372b56e3fc93a05.zip |
dwt, itm, tpiu: derive common traits for structs/enums
As per Rust API guidelines:
<https://rust-lang.github.io/api-guidelines/interoperability.html#c-common-traits>.
-rw-r--r-- | src/peripheral/dwt.rs | 10 | ||||
-rw-r--r-- | src/peripheral/itm.rs | 8 | ||||
-rw-r--r-- | src/peripheral/tpiu.rs | 3 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/peripheral/dwt.rs b/src/peripheral/dwt.rs index 0769e96..7fc9478 100644 --- a/src/peripheral/dwt.rs +++ b/src/peripheral/dwt.rs @@ -304,7 +304,7 @@ impl DWT { } /// Whether the comparator should match on read, write or read/write operations. -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum AccessType { /// Generate packet only when matched adress is read from. ReadOnly, @@ -315,7 +315,7 @@ pub enum AccessType { } /// The sequence of packet(s) that should be emitted on comparator match. -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum EmitOption { /// Emit only trace data value packet. Data, @@ -332,7 +332,7 @@ pub enum EmitOption { } /// Settings for address matching -#[derive(Debug)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub struct ComparatorAddressSettings { /// The address to match against. pub address: u32, @@ -345,7 +345,7 @@ pub struct ComparatorAddressSettings { } /// The available functions of a DWT comparator. -#[derive(Debug)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] #[non_exhaustive] pub enum ComparatorFunction { /// Compare accessed memory addresses. @@ -353,7 +353,7 @@ pub enum ComparatorFunction { } /// Possible error values returned on [Comparator::configure]. -#[derive(Debug)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] #[non_exhaustive] pub enum DwtError { /// Invalid combination of [AccessType] and [EmitOption]. diff --git a/src/peripheral/itm.rs b/src/peripheral/itm.rs index f5f5935..4d0aa22 100644 --- a/src/peripheral/itm.rs +++ b/src/peripheral/itm.rs @@ -90,7 +90,7 @@ impl Stim { } /// The possible local timestamp options. -#[derive(Debug, PartialEq)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum LocalTimestampOptions { /// Disable local timestamps. Disabled, @@ -108,7 +108,7 @@ pub enum LocalTimestampOptions { } /// The possible global timestamp options. -#[derive(Debug)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum GlobalTimestampOptions { /// Disable global timestamps. Disabled, @@ -121,7 +121,7 @@ pub enum GlobalTimestampOptions { } /// The possible clock sources for timestamp counters. -#[derive(Debug)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum TimestampClkSrc { /// Clock timestamp counters using the system processor clock. SystemClock, @@ -134,7 +134,7 @@ pub enum TimestampClkSrc { } /// Available settings for the ITM peripheral. -#[derive(Debug)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub struct ITMSettings { /// Whether to enable ITM. pub enable: bool, diff --git a/src/peripheral/tpiu.rs b/src/peripheral/tpiu.rs index 582544b..3ff5f55 100644 --- a/src/peripheral/tpiu.rs +++ b/src/peripheral/tpiu.rs @@ -62,6 +62,7 @@ bitfield! { /// The available protocols for the trace output. #[repr(u8)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub enum TraceProtocol { /// Parallel trace port mode Parallel = 0b00, @@ -87,7 +88,7 @@ impl core::convert::TryFrom<u8> for TraceProtocol { } /// The SWO options supported by the TPIU. -#[allow(dead_code)] +#[derive(Debug, Eq, PartialEq, Copy, Clone)] pub struct SWOSupports { /// Whether UART/NRZ encoding is supported for SWO. nrz_encoding: bool, |