Skip to content

Commit 51d87c6

Browse files
authored
Merge pull request #3802 from Georges760/stm32-more-defmt
derive `defmt::Format` on pub struct/enum of `embassy-stm32::rtc`
2 parents 4e3d066 + da0f6db commit 51d87c6

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

embassy-stm32/src/rtc/datetime.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use chrono::{Datelike, NaiveDate, Timelike, Weekday};
33

44
/// Errors regarding the [`DateTime`] struct.
55
#[derive(Clone, Debug, PartialEq, Eq)]
6+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
67
pub enum Error {
78
/// The [DateTime] contains an invalid year value. Must be between `0..=4095`.
89
InvalidYear,
@@ -24,6 +25,7 @@ pub enum Error {
2425
}
2526

2627
/// Structure containing date and time information
28+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2729
pub struct DateTime {
2830
/// 0..4095
2931
year: u16,
@@ -141,6 +143,7 @@ impl From<DateTime> for chrono::NaiveDateTime {
141143
/// A day of the week
142144
#[repr(u8)]
143145
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)]
146+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
144147
#[allow(missing_docs)]
145148
pub enum DayOfWeek {
146149
Monday = 1,

embassy-stm32/src/rtc/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use crate::peripherals::RTC;
3636
/// Errors that can occur on methods on [RtcClock]
3737
#[non_exhaustive]
3838
#[derive(Clone, Debug, PartialEq, Eq)]
39+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
3940
pub enum RtcError {
4041
/// An invalid DateTime was given or stored on the hardware.
4142
InvalidDateTime(DateTimeError),

0 commit comments

Comments
 (0)