diff options
| author | Georges Palauqui <[email protected]> | 2025-01-24 11:58:33 +0100 |
|---|---|---|
| committer | Georges Palauqui <[email protected]> | 2025-01-24 11:58:33 +0100 |
| commit | da0f6dbe08bb574c5c2bc448199dc2e4f74692de (patch) | |
| tree | dab46aac37f54ff2ce804a28e3a9d81680238236 /embassy-stm32 | |
| parent | 4e3d066251578b33d3cb0b8e3d2e44875a001ee5 (diff) | |
derive defmt::Format on pub struct/enum of stm32::rtc
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/rtc/datetime.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32/src/rtc/mod.rs | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/embassy-stm32/src/rtc/datetime.rs b/embassy-stm32/src/rtc/datetime.rs index 32732e96e..526b0cfbd 100644 --- a/embassy-stm32/src/rtc/datetime.rs +++ b/embassy-stm32/src/rtc/datetime.rs | |||
| @@ -3,6 +3,7 @@ use chrono::{Datelike, NaiveDate, Timelike, Weekday}; | |||
| 3 | 3 | ||
| 4 | /// Errors regarding the [`DateTime`] struct. | 4 | /// Errors regarding the [`DateTime`] struct. |
| 5 | #[derive(Clone, Debug, PartialEq, Eq)] | 5 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 6 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 6 | pub enum Error { | 7 | pub enum Error { |
| 7 | /// The [DateTime] contains an invalid year value. Must be between `0..=4095`. | 8 | /// The [DateTime] contains an invalid year value. Must be between `0..=4095`. |
| 8 | InvalidYear, | 9 | InvalidYear, |
| @@ -24,6 +25,7 @@ pub enum Error { | |||
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | /// Structure containing date and time information | 27 | /// Structure containing date and time information |
| 28 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 27 | pub struct DateTime { | 29 | pub struct DateTime { |
| 28 | /// 0..4095 | 30 | /// 0..4095 |
| 29 | year: u16, | 31 | year: u16, |
| @@ -141,6 +143,7 @@ impl From<DateTime> for chrono::NaiveDateTime { | |||
| 141 | /// A day of the week | 143 | /// A day of the week |
| 142 | #[repr(u8)] | 144 | #[repr(u8)] |
| 143 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)] | 145 | #[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)] |
| 146 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 144 | #[allow(missing_docs)] | 147 | #[allow(missing_docs)] |
| 145 | pub enum DayOfWeek { | 148 | pub enum DayOfWeek { |
| 146 | Monday = 1, | 149 | Monday = 1, |
diff --git a/embassy-stm32/src/rtc/mod.rs b/embassy-stm32/src/rtc/mod.rs index 1a668cb37..66646de4c 100644 --- a/embassy-stm32/src/rtc/mod.rs +++ b/embassy-stm32/src/rtc/mod.rs | |||
| @@ -36,6 +36,7 @@ use crate::peripherals::RTC; | |||
| 36 | /// Errors that can occur on methods on [RtcClock] | 36 | /// Errors that can occur on methods on [RtcClock] |
| 37 | #[non_exhaustive] | 37 | #[non_exhaustive] |
| 38 | #[derive(Clone, Debug, PartialEq, Eq)] | 38 | #[derive(Clone, Debug, PartialEq, Eq)] |
| 39 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 39 | pub enum RtcError { | 40 | pub enum RtcError { |
| 40 | /// An invalid DateTime was given or stored on the hardware. | 41 | /// An invalid DateTime was given or stored on the hardware. |
| 41 | InvalidDateTime(DateTimeError), | 42 | InvalidDateTime(DateTimeError), |
