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

View File

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