mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-10-02 14:44:32 +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.
|
/// 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,
|
||||||
|
@ -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),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user