Skip to content

Commit 8ab2ed0

Browse files
committed
sprinkled some more debug and partial eq derives on public items
1 parent 8d0a123 commit 8ab2ed0

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

src/datetime.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
//! Date and timer units & helper functions
22
33
/// Seconds
4-
#[derive(Clone, Copy, Debug)]
4+
#[derive(Clone, Copy, Debug, PartialEq)]
55
pub struct Second(pub u32);
66

77
/// Minutes
8-
#[derive(Clone, Copy, Debug)]
8+
#[derive(Clone, Copy, Debug, PartialEq)]
99
pub struct Minute(pub u32);
1010

1111
/// Hours
12-
#[derive(Clone, Copy, Debug)]
12+
#[derive(Clone, Copy, Debug, PartialEq)]
1313
pub struct Hour(pub u32);
1414

1515
/// Day (1-7)
16-
#[derive(Clone, Copy, Debug)]
16+
#[derive(Clone, Copy, Debug, PartialEq)]
1717
pub struct Day(pub u32);
1818

1919
/// Date (1-31)
20-
#[derive(Clone, Copy, Debug)]
20+
#[derive(Clone, Copy, Debug, PartialEq)]
2121
pub struct DateInMonth(pub u32);
2222

2323
/// Week (1-52)
24-
#[derive(Clone, Copy, Debug)]
24+
#[derive(Clone, Copy, Debug, PartialEq)]
2525
pub struct Week(pub u32);
2626

2727
/// Month (1-12)
28-
#[derive(Clone, Copy, Debug)]
28+
#[derive(Clone, Copy, Debug, PartialEq)]
2929
pub struct Month(pub u32);
3030

3131
/// Year
32-
#[derive(Clone, Copy, Debug)]
32+
#[derive(Clone, Copy, Debug, PartialEq)]
3333
pub struct Year(pub u32);
3434

3535
/// Extension trait that adds convenience methods to the `u32` type
@@ -80,7 +80,7 @@ impl U32Ext for u32 {
8080
}
8181
}
8282

83-
#[derive(Clone,Copy,Debug)]
83+
#[derive(Clone, Copy, Debug, PartialEq)]
8484
pub struct Time {
8585
pub hours: u32,
8686
pub minutes: u32,
@@ -99,7 +99,7 @@ impl Time {
9999
}
100100
}
101101

102-
#[derive(Clone,Copy, Debug)]
102+
#[derive(Clone, Copy, Debug, PartialEq)]
103103
pub struct Date {
104104
pub day: u32,
105105
pub date: u32,

src/delay.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::hal::blocking::delay::{DelayMs, DelayUs};
88
use crate::rcc::Clocks;
99

1010
/// System timer (SysTick) as a delay provider
11+
#[derive(Debug)]
1112
pub struct Delay {
1213
clocks: Clocks,
1314
syst: SYST,

src/gpio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! General Purpose Input / Output
22
3-
// Based on (ripped)
3+
// Based on
44
// https://github.com/japaric/stm32f30x-hal/blob/master/src/gpio.rs
55

66
use core::marker::PhantomData;

src/tsc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ use crate::stm32::{TSC};
1212
use crate::gpio::gpiob::{PB4, PB5, PB6, PB7};
1313
use crate::gpio::{AF9, Alternate, Output, OpenDrain, PushPull};
1414

15-
#[derive(Debug, Copy, Clone)]
15+
#[derive(Clone, Copy, Debug, PartialEq)]
1616
pub enum Event {
1717
/// Max count error
1818
MaxCountError,
1919
/// End of acquisition
2020
EndOfAcquisition
2121
}
2222

23-
#[derive(Debug, Copy, Clone)]
23+
#[derive(Clone, Copy, Debug, PartialEq)]
2424
pub enum Error {
2525
/// Max count error
2626
MaxCountError,
@@ -70,21 +70,21 @@ impl ChannelPin<TSC> for PB7<Alternate<AF9, Output<PushPull>>> {
7070
const OFFSET: u32 = 3;
7171
}
7272

73-
73+
#[derive(Debug)]
7474
pub struct Tsc<SPIN> {
7575
sample_pin: SPIN,
7676
tsc: TSC
7777
}
7878

79-
#[derive(Debug, Copy, Clone)]
79+
#[derive(Clone, Copy, Debug, PartialEq)]
8080
pub struct Config {
8181
pub clock_prescale: Option<ClockPrescaler>,
8282
pub max_count_error: Option<MaxCountError>,
8383
pub charge_transfer_high: Option<ChargeDischargeTime>,
8484
pub charge_transfer_low: Option<ChargeDischargeTime>,
8585
}
8686

87-
#[derive(Debug, Copy, Clone)]
87+
#[derive(Clone, Copy, Debug, PartialEq)]
8888
pub enum ClockPrescaler {
8989
Hclk = 0b000,
9090
HclkDiv2 = 0b001,
@@ -96,7 +96,7 @@ pub enum ClockPrescaler {
9696
HclkDiv128 = 0b111,
9797
}
9898

99-
#[derive(Debug, Copy, Clone)]
99+
#[derive(Clone, Copy, Debug, PartialEq)]
100100
pub enum MaxCountError {
101101
/// 000: 255
102102
U255 = 000,
@@ -114,7 +114,7 @@ pub enum MaxCountError {
114114
U16383 = 110
115115
}
116116

117-
#[derive(Debug, Copy, Clone)]
117+
#[derive(Clone, Copy, Debug, PartialEq)]
118118
/// How many tsc cycles are spent charging / discharging
119119
pub enum ChargeDischargeTime {
120120
C1 = 0b0000,

0 commit comments

Comments
 (0)