semf
semf::Stm32Rtc Class Reference

Rtc implementation for STM32. More...

#include <stm32rtc.h>

Inheritance diagram for semf::Stm32Rtc:
Inheritance graph
Collaboration diagram for semf::Stm32Rtc:
Collaboration graph

Public Types

enum class  ErrorCode : uint8_t {
  SetMillisecond_HalError = 0 , SetMillisecond_HalBusy , SetMillisecond_HalTimeout , SetSecond_HalError ,
  SetSecond_HalBusy , SetSecond_HalTimeout , SetMinute_HalError , SetMinute_HalBusy ,
  SetMinute_HalTimeout , SetHour_HalError , SetHour_HalBusy , SetHour_HalTimeout ,
  SetDay_HalError , SetDay_HalBusy , SetDay_HalTimeout , SetMonth_HalError ,
  SetMonth_HalBusy , SetMonth_HalTimeout , SetYear_HalError , SetYear_HalBusy ,
  SetYear_HalTimeout , HalTime_HalError , HalTime_HalBusy , HalTime_HalTimeout ,
  HalDate_HalError , HalDate_HalBusy , HalDate_HalTimeout
}
 

Public Member Functions

 Stm32Rtc (RTC_HandleTypeDef &hrtc)
 Constructor. More...
 
 Stm32Rtc (const Stm32Rtc &other)=delete
 
virtual ~Stm32Rtc ()=default
 
uint16_t millisecond () override
 Get the milliseconds from the current time. More...
 
void setMillisecond (uint16_t millisecond) override
 For set a new time. More...
 
uint8_t second () const override
 Get the seconds from the current time. More...
 
void setSecond (uint8_t second) override
 For set a new time. More...
 
uint8_t minute () const override
 Get the minutes from the current time. More...
 
void setMinute (uint8_t minute) override
 For set a new time. More...
 
uint8_t hour () const override
 Get the hours from the current time. More...
 
void setHour (uint8_t hour) override
 For set a new time. More...
 
uint8_t day () const override
 
void setDay (uint8_t day) override
 For set a new date. More...
 
uint8_t month () const override
 Get the current month. More...
 
void setMonth (uint8_t month) override
 For set a new date. More...
 
uint16_t year () const override
 Get the current year. More...
 
void setYear (uint16_t year) override
 For set a new date. More...
 
- Public Member Functions inherited from semf::Rtc
virtual ~Rtc ()=default
 
virtual uint16_t millisecond ()=0
 Get the milliseconds from the current time. More...
 
virtual void setMillisecond (uint16_t millisecond)=0
 For set a new time. More...
 
virtual uint8_t second () const =0
 Get the seconds from the current time. More...
 
virtual void setSecond (uint8_t second)=0
 For set a new time. More...
 
virtual uint8_t minute () const =0
 Get the minutes from the current time. More...
 
virtual void setMinute (uint8_t minute)=0
 For set a new time. More...
 
virtual uint8_t hour () const =0
 Get the hours from the current time. More...
 
virtual void setHour (uint8_t hour)=0
 For set a new time. More...
 
virtual uint8_t day () const =0
 
virtual void setDay (uint8_t day)=0
 For set a new date. More...
 
virtual uint8_t month () const =0
 Get the current month. More...
 
virtual void setMonth (uint8_t month)=0
 For set a new date. More...
 
virtual uint16_t year () const =0
 Get the current year. More...
 
virtual void setYear (uint16_t year)=0
 For set a new date. More...
 

Additional Inherited Members

- Public Attributes inherited from semf::Rtc
Signal< Errorerror
 

Detailed Description

Rtc implementation for STM32.

Definition at line 22 of file stm32rtc.h.

Member Enumeration Documentation

◆ ErrorCode

enum class semf::Stm32Rtc::ErrorCode : uint8_t
strong

Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring).

Enumerator
SetMillisecond_HalError 
SetMillisecond_HalBusy 
SetMillisecond_HalTimeout 
SetSecond_HalError 
SetSecond_HalBusy 
SetSecond_HalTimeout 
SetMinute_HalError 
SetMinute_HalBusy 
SetMinute_HalTimeout 
SetHour_HalError 
SetHour_HalBusy 
SetHour_HalTimeout 
SetDay_HalError 
SetDay_HalBusy 
SetDay_HalTimeout 
SetMonth_HalError 
SetMonth_HalBusy 
SetMonth_HalTimeout 
SetYear_HalError 
SetYear_HalBusy 
SetYear_HalTimeout 
HalTime_HalError 
HalTime_HalBusy 
HalTime_HalTimeout 
HalDate_HalError 
HalDate_HalBusy 
HalDate_HalTimeout 

Definition at line 26 of file stm32rtc.h.

Constructor & Destructor Documentation

◆ Stm32Rtc() [1/2]

semf::Stm32Rtc::Stm32Rtc ( RTC_HandleTypeDef &  hrtc)
explicit

Constructor.

Parameters
hrtcHardware handle.

Definition at line 16 of file stm32rtc.cpp.

◆ Stm32Rtc() [2/2]

semf::Stm32Rtc::Stm32Rtc ( const Stm32Rtc other)
explicitdelete

◆ ~Stm32Rtc()

virtual semf::Stm32Rtc::~Stm32Rtc ( )
virtualdefault

Member Function Documentation

◆ day()

uint8_t semf::Stm32Rtc::day ( ) const
overridevirtual

Get the current day.

Returns
The current day.

Implements semf::Rtc.

Definition at line 173 of file stm32rtc.cpp.

Here is the caller graph for this function:

◆ hour()

uint8_t semf::Stm32Rtc::hour ( ) const
overridevirtual

Get the hours from the current time.

Returns
The hours from the current time.

Implements semf::Rtc.

Definition at line 137 of file stm32rtc.cpp.

Here is the caller graph for this function:

◆ millisecond()

uint16_t semf::Stm32Rtc::millisecond ( )
overridevirtual

Get the milliseconds from the current time.

Returns
The milliseconds from the current time.

Implements semf::Rtc.

Definition at line 21 of file stm32rtc.cpp.

Here is the caller graph for this function:

◆ minute()

uint8_t semf::Stm32Rtc::minute ( ) const
overridevirtual

Get the minutes from the current time.

Returns
The minutes from the current time.

Implements semf::Rtc.

Definition at line 101 of file stm32rtc.cpp.

Here is the caller graph for this function:

◆ month()

uint8_t semf::Stm32Rtc::month ( ) const
overridevirtual

Get the current month.

Returns
The current month.

Implements semf::Rtc.

Definition at line 205 of file stm32rtc.cpp.

Here is the caller graph for this function:

◆ second()

uint8_t semf::Stm32Rtc::second ( ) const
overridevirtual

Get the seconds from the current time.

Returns
The seconds from the current time.

Implements semf::Rtc.

Definition at line 65 of file stm32rtc.cpp.

Here is the caller graph for this function:

◆ setDay()

void semf::Stm32Rtc::setDay ( uint8_t  day)
overridevirtual

For set a new date.

Parameters
dayThe new day.
Exceptions
SetDay_HalErrorIf the ST-HAL returns a hal error.
SetDay_HalBusyIf the ST-HAL returns a hal busy.
SetDay_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 178 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ setHour()

void semf::Stm32Rtc::setHour ( uint8_t  hour)
overridevirtual

For set a new time.

Parameters
hourThe hours for the new time.
Exceptions
SetHour_HalErrorIf the ST-HAL returns a hal error.
SetHour_HalBusyIf the ST-HAL returns a hal busy.
SetHour_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 142 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ setMillisecond()

void semf::Stm32Rtc::setMillisecond ( uint16_t  millisecond)
overridevirtual

For set a new time.

Parameters
millisecondThe milliseconds for the new time.
Exceptions
SetMillisecond_HalErrorIf the ST-HAL returns a hal error.
SetMillisecond_HalBusyIf the ST-HAL returns a hal busy.
SetMillisecond_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 31 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ setMinute()

void semf::Stm32Rtc::setMinute ( uint8_t  minute)
overridevirtual

For set a new time.

Parameters
minuteThe minutes for the new time.
Exceptions
SetMinute_HalErrorIf the ST-HAL returns a hal error.
SetMinute_HalBusyIf the ST-HAL returns a hal busy.
SetMinute_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 106 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ setMonth()

void semf::Stm32Rtc::setMonth ( uint8_t  month)
overridevirtual

For set a new date.

Parameters
monthThe new month.
Exceptions
SetDay_HalErrorIf the ST-HAL returns a hal error.
SetDay_HalBusyIf the ST-HAL returns a hal busy.
SetDay_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 210 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ setSecond()

void semf::Stm32Rtc::setSecond ( uint8_t  second)
overridevirtual

For set a new time.

Parameters
secondThe second for the new time.
Exceptions
SetSecond_HalErrorIf the ST-HAL returns a hal error.
SetSecond_HalBusyIf the ST-HAL returns a hal busy.
SetSecond_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 70 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ setYear()

void semf::Stm32Rtc::setYear ( uint16_t  year)
overridevirtual

For set a new date.

Parameters
yearThe new year.
Exceptions
SetYear_HalErrorIf the ST-HAL returns a hal error.
SetYear_HalBusyIf the ST-HAL returns a hal busy.
SetYear_HalTimeoutIf the ST-HAL returns a hal timeout.

Implements semf::Rtc.

Definition at line 242 of file stm32rtc.cpp.

Here is the call graph for this function:

◆ year()

uint16_t semf::Stm32Rtc::year ( ) const
overridevirtual

Get the current year.

Returns
The current year.

Implements semf::Rtc.

Definition at line 237 of file stm32rtc.cpp.

Here is the caller graph for this function: