Merge pull request #3802 from Georges760/stm32-more-defmt

derive `defmt::Format` on pub struct/enum of `embassy-stm32::rtc`
This commit is contained in:
Dario Nieuwenhuis 2025-01-24 11:35:22 +00:00 committed by GitHub
commit 51d87c6603
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -3,6 +3,7 @@ use chrono::{Datelike, NaiveDate, Timelike, Weekday};
/// Errors regarding the [`DateTime`] struct. /// Errors regarding the [`DateTime`] struct.
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error { pub enum Error {
/// The [DateTime] contains an invalid year value. Must be between `0..=4095`. /// The [DateTime] contains an invalid year value. Must be between `0..=4095`.
InvalidYear, InvalidYear,
@ -24,6 +25,7 @@ pub enum Error {
} }
/// Structure containing date and time information /// Structure containing date and time information
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct DateTime { pub struct DateTime {
/// 0..4095 /// 0..4095
year: u16, year: u16,
@ -141,6 +143,7 @@ impl From<DateTime> for chrono::NaiveDateTime {
/// A day of the week /// A day of the week
#[repr(u8)] #[repr(u8)]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum DayOfWeek { pub enum DayOfWeek {
Monday = 1, Monday = 1,

View File

@ -36,6 +36,7 @@ use crate::peripherals::RTC;
/// Errors that can occur on methods on [RtcClock] /// Errors that can occur on methods on [RtcClock]
#[non_exhaustive] #[non_exhaustive]
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum RtcError { pub enum RtcError {
/// An invalid DateTime was given or stored on the hardware. /// An invalid DateTime was given or stored on the hardware.
InvalidDateTime(DateTimeError), InvalidDateTime(DateTimeError),