pub trait Rtcc: DateTimeAccess {
Show 18 methods
// Required methods
fn seconds(&mut self) -> Result<u8, Self::Error>;
fn minutes(&mut self) -> Result<u8, Self::Error>;
fn hours(&mut self) -> Result<Hours, Self::Error>;
fn time(&mut self) -> Result<NaiveTime, Self::Error>;
fn weekday(&mut self) -> Result<u8, Self::Error>;
fn day(&mut self) -> Result<u8, Self::Error>;
fn month(&mut self) -> Result<u8, Self::Error>;
fn year(&mut self) -> Result<u16, Self::Error>;
fn date(&mut self) -> Result<NaiveDate, Self::Error>;
fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>;
fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>;
fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>;
fn set_time(&mut self, time: &NaiveTime) -> Result<(), Self::Error>;
fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>;
fn set_day(&mut self, day: u8) -> Result<(), Self::Error>;
fn set_month(&mut self, month: u8) -> Result<(), Self::Error>;
fn set_year(&mut self, year: u16) -> Result<(), Self::Error>;
fn set_date(&mut self, date: &NaiveDate) -> Result<(), Self::Error>;
}
Expand description
Real-Time Clock / Calendar trait
If you want to combine calls to these methods, prefer to use only
the DateTimeAccess
trait to avoid situations where the passing of time makes the results
of the method calls inconsistent.
For example, this can happen at certain timepoints:
- The time is
01:59:59
- A call to
hours()
returns 1. - The time is increased to
02:00:00
. - A call to
minutes()
returns 0. - A call to
seconds()
returns 0. - Your system thinks it is
01:00:00
.
The same applies to the date, as well as when calling setter methods.
Required Methods§
Sourcefn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>
fn set_seconds(&mut self, seconds: u8) -> Result<(), Self::Error>
Set the seconds [0-59].
Sourcefn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>
fn set_minutes(&mut self, minutes: u8) -> Result<(), Self::Error>
Set the minutes [0-59].
Sourcefn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>
fn set_hours(&mut self, hours: Hours) -> Result<(), Self::Error>
Set the hours.
Changes the operating mode to 12h/24h depending on the parameter.
Sourcefn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>
fn set_weekday(&mut self, weekday: u8) -> Result<(), Self::Error>
Set the day of week [1-7].