Skip to content

Commit d87c10e

Browse files
committed
Add defmt::Format to enums behind feature
1 parent 1baef64 commit d87c10e

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
### Added
1616

1717
- Support eMMC peripherals using SDIO module [#458]
18+
- `defmt::Format` derive on enums behind `defmt` feature
1819

1920
[#418]: https://github.com/stm32-rs/stm32f4xx-hal/pull/418
2021
[#458]: https://github.com/stm32-rs/stm32f4xx-hal/pull/458

src/time.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub use fugit::{HertzU32 as Hertz, KilohertzU32 as KiloHertz, MegahertzU32 as Me
22

33
/// Bits per second
44
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
5+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
56
pub struct Bps(pub u32);
67

78
/// Extension trait that adds convenience methods to the `u32` type

src/timer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub struct Timer<TIM> {
3939
}
4040

4141
#[derive(Clone, Copy, PartialEq)]
42+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
4243
#[repr(u8)]
4344
pub enum Channel {
4445
C1 = 0,
@@ -49,6 +50,7 @@ pub enum Channel {
4950

5051
/// Interrupt events
5152
#[derive(Clone, Copy, PartialEq)]
53+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5254
pub enum SysEvent {
5355
/// [Timer] timed out / count down ended
5456
Update,
@@ -65,6 +67,7 @@ bitflags::bitflags! {
6567
}
6668

6769
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
70+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
6871
pub enum Error {
6972
/// Timer is disabled
7073
Disabled,
@@ -196,6 +199,7 @@ impl Timer<SYST> {
196199
}
197200

198201
#[derive(Clone, Copy, Debug, PartialEq)]
202+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
199203
#[repr(u8)]
200204
pub enum Ocm {
201205
Frozen = 0,

0 commit comments

Comments
 (0)