mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-29 21:31:08 +00:00
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:
commit
51d87c6603
@ -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,
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user