### Get STM32RTC Instance Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md The STM32RTC library uses a singleton design pattern. Use this to get the single instance of the STM32RTC object. ```APIDOC ## Get STM32RTC Instance ### Description Obtains the singleton instance of the STM32RTC object. This ensures that only one instance of the RTC is managed. ### Method `STM32RTC& getInstance()` ### Endpoint N/A (Class method) ### Parameters None ### Request Example ```c++ STM32RTC& rtc = STM32RTC::getInstance(); ``` ### Response Returns a reference to the single STM32RTC object. ``` -------------------------------- ### Configure Second Alarm (Alarm B) Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md This example demonstrates how to attach an interrupt for Alarm B, set its day, time (including sub-seconds), and enable it with a specific match mode. ```C++ rtc.attachInterrupt(myCallback, &myCallbackdata, STM32RTC::ALARM_B); rtc.setAlarmDay(day, STM32RTC::ALARM_B); rtc.setAlarmTime(hours, minutes, seconds + 5, 567, STM32RTC::ALARM_B); rtc.enableAlarm(rtc.MATCH_DHHMMSS, STM32RTC::ALARM_B); ``` -------------------------------- ### Get STM32RTC Instance Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieve the singleton instance of the STM32RTC object. This ensures only one instance is active. ```C++ /* Get the rtc object */ STM32RTC& rtc = STM32RTC::getInstance(); ``` -------------------------------- ### Get Prescaler Values Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the current asynchronous and synchronous prescaler values for the STM32 RTC. ```APIDOC ## Get Prescaler Values ### Description Retrieves the current asynchronous (`predivA`) and synchronous (`predivS`) prescaler values set for the STM32 RTC. If not explicitly set, it returns the computed values for the current clock source. ### Method `void getPrediv(uint32_t *predivA, uint32_t *predivS)` ### Endpoint N/A (Class method) ### Parameters * **predivA** (uint32_t *) - Output - Pointer to store the asynchronous prescaler value. * **predivS** (uint32_t *) - Output - Pointer to store the synchronous prescaler value. ### Request Example ```c++ uint32_t predivA, predivS; rtc.getPrediv(&predivA, &predivS); // Now predivA and predivS hold the prescaler values ``` ### Response None. The values are written to the provided pointers. ``` -------------------------------- ### Get Date Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the complete date from the RTC, including day of the week, day, month, and year. ```APIDOC ## Get Date ### Description Retrieves the complete current date from the RTC, including the day of the week, day of the month, month, and year. ### Method `void getDate(uint8_t *weekDay, uint8_t *day, uint8_t *month, uint8_t *year)` ### Endpoint N/A (Class method) ### Parameters * **weekDay** (uint8_t *) - Output - Pointer to store the day of the week. * **day** (uint8_t *) - Output - Pointer to store the day of the month. * **month** (uint8_t *) - Output - Pointer to store the month. * **year** (uint8_t *) - Output - Pointer to store the year. ### Request Example ```c++ uint8_t wd, d, mo, y; rtc.getDate(&wd, &d, &mo, &y); ``` ### Response None. The date components are written to the provided pointers. ``` -------------------------------- ### Get Clock Source Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the current clock source used by the STM32 RTC. ```APIDOC ## Get Clock Source ### Description Retrieves the current clock source configured for the STM32 RTC. ### Method `Source_Clock getClockSource(void)` ### Endpoint N/A (Class method) ### Parameters None ### Request Example ```c++ Source_Clock currentSource = rtc.getClockSource(); ``` ### Response Returns the current `Source_Clock` (e.g., `LSI_CLOCK`, `LSE_CLOCK`, `HSE_CLOCK`). ``` -------------------------------- ### Get Week Day Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the current day of the week from the RTC. ```APIDOC ## Get Week Day ### Description Retrieves the current day of the week from the RTC. ### Method `uint8_t getWeekDay(void)` ### Endpoint N/A (Class method) ### Parameters None ### Request Example ```c++ uint8_t dayOfWeek = rtc.getWeekDay(); ``` ### Response Returns the day of the week as a `uint8_t` (typically 1-7). ``` -------------------------------- ### Get SubSeconds Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the sub-second value from the RTC. ```APIDOC ## Get SubSeconds ### Description Retrieves the current sub-second value from the RTC. ### Method `uint32_t getSubSeconds(void)` ### Endpoint N/A (Class method) ### Parameters None ### Request Example ```c++ uint32_t ss = rtc.getSubSeconds(); ``` ### Response Returns the sub-second value as a `uint32_t`. ``` -------------------------------- ### Get Hours (12-hour format) Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the current hour, optionally including AM/PM information. ```APIDOC ## Get Hours (12-hour format) ### Description Retrieves the current hour from the RTC. If the RTC is in 12-hour format, this function can also provide the AM/PM period. ### Method `uint8_t getHours(AM_PM *period = nullptr)` ### Endpoint N/A (Class method) ### Parameters * **period** (AM_PM *) - Optional - A pointer to an `AM_PM` enum to store the period (AM or PM) if the RTC is in 12-hour format. ### Request Example ```c++ AM_PM currentPeriod; uint8_t currentHour = rtc.getHours(¤tPeriod); ``` ### Response Returns the current hour (0-23 for 24-hour format, 1-12 for 12-hour format). ``` -------------------------------- ### Get Time Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the complete time from the RTC, including hours, minutes, seconds, sub-seconds, and optionally AM/PM. ```APIDOC ## Get Time ### Description Retrieves the complete current time from the RTC, including hours, minutes, seconds, sub-seconds, and optionally the AM/PM period. ### Method `void getTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, AM_PM *period = nullptr)` ### Endpoint N/A (Class method) ### Parameters * **hours** (uint8_t *) - Output - Pointer to store the hour value. * **minutes** (uint8_t *) - Output - Pointer to store the minute value. * **seconds** (uint8_t *) - Output - Pointer to store the second value. * **subSeconds** (uint32_t *) - Output - Pointer to store the sub-second value. * **period** (AM_PM *) - Optional - Pointer to store the period (AM or PM) if the RTC is in 12-hour format. ### Request Example ```c++ uint8_t h, m, s; uint32_t ss; AM_PM p; rtc.getTime(&h, &m, &s, &ss, &p); ``` ### Response None. The time components are written to the provided pointers. ``` -------------------------------- ### Get Alarm Hours Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the alarm hour, optionally including AM/PM information. ```APIDOC ## Get Alarm Hours ### Description Retrieves the currently set alarm hour. If the RTC is in 12-hour format, this function can also provide the AM/PM period. ### Method `uint8_t getAlarmHours(AM_PM *period)` ### Endpoint N/A (Class method) ### Parameters * **period** (AM_PM *) - Output - A pointer to an `AM_PM` enum to store the period (AM or PM) if the RTC is in 12-hour format. ### Request Example ```c++ AM_PM alarmPeriod; uint8_t alarmHour = rtc.getAlarmHours(&alarmPeriod); ``` ### Response Returns the alarm hour (0-23 for 24-hour format, 1-12 for 12-hour format). ``` -------------------------------- ### Get Epoch Time Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Retrieves the current time as a Unix epoch timestamp, optionally including sub-seconds. ```APIDOC ## Get Epoch Time ### Description Retrieves the current time from the RTC as a Unix epoch timestamp (seconds since January 1, 1970). It can also optionally return the sub-second component. ### Method `uint32_t getEpoch(uint32_t *subSeconds = nullptr)` ### Endpoint N/A (Class method) ### Parameters * **subSeconds** (uint32_t *) - Optional - A pointer to a `uint32_t` where the sub-second value will be stored if provided. ### Request Example ```c++ uint32_t ts; uint32_t ss; ts = rtc.getEpoch(&ss); ``` ### Response Returns the epoch timestamp as a `uint32_t`. ``` -------------------------------- ### Set Date Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the complete date, including day of the month, month, and year, along with the day of the week. ```APIDOC ## Set Date ### Description Sets the complete date on the RTC, including the day of the week, day of the month, month, and year. ### Method `void setDate(uint8_t weekDay, uint8_t day, uint8_t month, uint8_t year)` ### Endpoint N/A (Class method) ### Parameters * **weekDay** (uint8_t) - Required - The day of the week (typically 1-7). * **day** (uint8_t) - Required - The day of the month (1-31). * **month** (uint8_t) - Required - The month (1-12). * **year** (uint8_t) - Required - The year (typically the last two digits, e.g., 23 for 2023). ### Request Example ```c++ // Set date to Wednesday, October 25, 2023 rtc.setDate(4, 25, 10, 23); ``` ### Response None ``` -------------------------------- ### Set Time Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the complete time, including hours, minutes, seconds, sub-seconds, and optionally AM/PM. ```APIDOC ## Set Time ### Description Sets the complete time on the RTC, including hours, minutes, seconds, sub-seconds, and the AM/PM period if applicable. ### Method `void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds = 1000, AM_PM period = AM)` ### Endpoint N/A (Class method) ### Parameters * **hours** (uint8_t) - Required - The hour value (1-12 for 12-hour format, 0-23 for 24-hour format). * **minutes** (uint8_t) - Required - The minute value (0-59). * **seconds** (uint8_t) - Required - The second value (0-59). * **subSeconds** (uint32_t) - Optional - The sub-second value. Defaults to 1000. * **period** (AM_PM) - Optional - The period (AM or PM), defaults to AM. Only applicable for 12-hour format. ### Request Example ```c++ // Set time to 3:30:15 PM with sub-seconds rtc.setTime(3, 30, 15, 500, PM); ``` ### Response None ``` -------------------------------- ### Initialize RTC with Hour Format Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Initializes the RTC and sets the desired hour format (12 or 24-hour). This function must be called before other configuration functions. ```APIDOC ## Initialize RTC with Hour Format ### Description Initializes the STM32RTC with a specified hour format. This is a prerequisite for many other RTC operations. ### Method `void begin(Hour_Format format)` ### Endpoint N/A (Class method) ### Parameters * **format** (Hour_Format) - Required - Specifies the hour format, either 12-hour or 24-hour. ### Request Example ```c++ // For 24-hour format rtc.begin(FORMAT_24); // For 12-hour format rtc.begin(FORMAT_12); ``` ### Response None ``` -------------------------------- ### Set Prescaler Values Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the asynchronous and synchronous prescaler values for the STM32 RTC. This must be called before `begin()`. ```APIDOC ## Set Prescaler Values ### Description Sets the asynchronous (`predivA`) and synchronous (`predivS`) prescaler values for the STM32 RTC. This function must be called before `begin()`. ### Method `void setPrediv(uint32_t predivA, uint32_t predivS)` ### Endpoint N/A (Class method) ### Parameters * **predivA** (uint32_t) - Required - The asynchronous prescaler value. Use `(PREDIVA_MAX + 1)` to reset to computed values. * **predivS** (uint32_t) - Required - The synchronous prescaler value. Use `(PREDIVS_MAX + 1)` to reset to computed values. ### Conditions The prescaler values must satisfy: `1Hz = RTC CLK source / ((predivA + 1) * (predivS + 1))` ### Request Example ```c++ // Example: Setting prescalers for a specific frequency rtc.setPrediv(127, 255); ``` ### Response None ``` -------------------------------- ### Set Clock Source Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the clock source and prescaler values for the STM32 RTC. This must be called before `begin()`. ```APIDOC ## Set Clock Source ### Description Configures the clock source and prescaler values for the STM32 RTC. This function must be called before `begin()`. ### Method `void setClockSource(Source_Clock source, uint32_t predivA, uint32_t predivS)` ### Endpoint N/A (Class method) ### Parameters * **source** (Source_Clock) - Required - The desired clock source (`LSI_CLOCK`, `LSE_CLOCK`, or `HSE_CLOCK`). * **predivA** (uint32_t) - Required - The asynchronous prescaler value. Use `(PREDIVA_MAX + 1)` to reset to computed values. * **predivS** (uint32_t) - Required - The synchronous prescaler value. Use `(PREDIVS_MAX + 1)` to reset to computed values. ### Conditions The prescaler values must satisfy: `1Hz = RTC CLK source / ((predivA + 1) * (predivS + 1))` ### Request Example ```c++ // Example: Setting LSE clock with specific prescalers rtc.setClockSource(LSE_CLOCK, 127, 255); ``` ### Response None ``` -------------------------------- ### Binary and Mix Modes API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md API for managing the RTC's operational modes (BCD, MIX, BIN). ```APIDOC ## Binary and Mix Modes API ### Description API for managing the RTC's operational modes, allowing the use of a 32-bit free-running counter in addition to or instead of the BCD calendar mode. This is particularly useful for devices like the stm32wl55. ### Functions - **`Binary_Mode getBinaryMode(void)`**: Retrieves the current binary mode of the RTC. - **`void setBinaryMode(Binary_Mode mode)`**: Sets the RTC to the specified binary mode. ### Constants - **`STM32RTC::MODE_BCD`**: Represents the Binary Coded Decimal mode. - **`STM32RTC::MODE_MIX`**: Represents the Mixed mode (BCD and Binary counter). - **`STM32RTC::MODE_BIN`**: Represents the pure Binary counter mode. ### Notes on SubSeconds Parameter - The SubSecond parameter in MIX or BCD mode ranges from [0..999] milliseconds. - In BIN mode, the SubSecond parameter ranges from [0..0xFFFFFFFF]. - When using BIN mode only, `getEpoch` returns the sub-second value [0..0xFFFFFFFF] (time_t is not valid), and `setAlarmEpoch` uses only the sub-second value (time_t is useless). ``` -------------------------------- ### Set Hours (12-hour format) Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the current hour, optionally specifying AM/PM. ```APIDOC ## Set Hours (12-hour format) ### Description Sets the current hour for the RTC. If the RTC is configured for 12-hour format, the AM/PM period can also be specified. ### Method `void setHours(uint8_t hours, AM_PM period = AM)` ### Endpoint N/A (Class method) ### Parameters * **hours** (uint8_t) - Required - The hour value to set (1-12 for 12-hour format, 0-23 for 24-hour format). * **period** (AM_PM) - Optional - The period (AM or PM) to set, defaults to AM. Only applicable for 12-hour format. ### Request Example ```c++ // Set to 3 PM rtc.setHours(3, PM); // Set to 15 (in 24-hour format) rtc.setHours(15); ``` ### Response None ``` -------------------------------- ### Set Alarm Time Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the complete alarm time, including hours, minutes, seconds, and optionally AM/PM. ```APIDOC ## Set Alarm Time ### Description Sets the complete time for an RTC alarm, including hours, minutes, and seconds. The AM/PM period can also be specified. ### Method `void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, AM_PM period)` ### Endpoint N/A (Class method) ### Parameters * **hours** (uint8_t) - Required - The hour value for the alarm (1-12 for 12-hour format, 0-23 for 24-hour format). * **minutes** (uint8_t) - Required - The minute value for the alarm (0-59). * **seconds** (uint8_t) - Required - The second value for the alarm (0-59). * **period** (AM_PM) - Required - The period (AM or PM) for the alarm. Only applicable for 12-hour format. ### Request Example ```c++ // Set alarm for 10:45:30 PM rtc.setAlarmTime(10, 45, 30, PM); ``` ### Response None ``` -------------------------------- ### Set Alarm Epoch Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets an alarm using a Unix epoch timestamp and match criteria, optionally including sub-seconds. ```APIDOC ## Set Alarm Epoch ### Description Sets an RTC alarm using a Unix epoch timestamp and specifies the match criteria. Sub-seconds can also be included. ### Method `void setAlarmEpoch(uint32_t ts, Alarm_Match match = MATCH_DHHMMSS, uint32_t subSeconds = 0)` ### Endpoint N/A (Class method) ### Parameters * **ts** (uint32_t) - Required - The epoch timestamp for the alarm. * **match** (Alarm_Match) - Optional - The alarm match criteria (e.g., `MATCH_DHHMMSS`). Defaults to `MATCH_DHHMMSS`. * **subSeconds** (uint32_t) - Optional - The sub-second value for the alarm. Defaults to 0. ### Request Example ```c++ // Set alarm for a specific epoch time, matching day, hour, minute, second rtc.setAlarmEpoch(1678886400, MATCH_DHHMMSS, 200); ``` ### Response None ``` -------------------------------- ### Set Alarm Time (with SubSeconds) Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the complete alarm time, including hours, minutes, seconds, and sub-seconds. Defaults subSeconds to 0. ```APIDOC ## Set Alarm Time (with SubSeconds) ### Description Sets the complete time for an RTC alarm, including hours, minutes, seconds, and sub-seconds. This is an updated version that supports sub-second precision. ### Method `void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds = 0, AM_PM period = AM)` ### Endpoint N/A (Class method) ### Parameters * **hours** (uint8_t) - Required - The hour value for the alarm (1-12 for 12-hour format, 0-23 for 24-hour format). * **minutes** (uint8_t) - Required - The minute value for the alarm (0-59). * **seconds** (uint8_t) - Required - The second value for the alarm (0-59). * **subSeconds** (uint32_t) - Optional - The sub-second value for the alarm. Defaults to 0. * **period** (AM_PM) - Optional - The period (AM or PM) for the alarm, defaults to AM. Only applicable for 12-hour format. ### Request Example ```c++ // Set alarm for 11:00:00 AM with sub-seconds rtc.setAlarmTime(11, 0, 0, 750, AM); ``` ### Response None ``` -------------------------------- ### Second Alarm (Alarm B) API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md API for configuring and managing the second alarm (Alarm B). ```APIDOC ## Second Alarm (Alarm B) API ### Description API for configuring and managing the second alarm (Alarm B), which is available on some STM32 RTC devices. This allows for more granular alarm settings. ### Functions - **`void attachInterrupt(voidFuncPtr callback, void *data, uint8_t alarmType)`**: Attaches an interrupt callback for a specified alarm type (ALARM_A or ALARM_B). - **`void setAlarmDay(uint8_t day, uint8_t alarmType)`**: Sets the day for a specific alarm type. - **`void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint16_t subSeconds, uint8_t alarmType)`**: Sets the time for a specific alarm type, including sub-second precision. - **`void enableAlarm(uint8_t matchMode, uint8_t alarmType)`**: Enables a specific alarm type with a defined matching mode. ### Constants - **`STM32RTC::ALARM_A`**: Constant for Alarm A. - **`STM32RTC::ALARM_B`**: Constant for Alarm B. ### Example ```C++ rrtc.attachInterrupt(myCallback, &myCallbackdata, STM32RTC::ALARM_B); rrtc.setAlarmDay(day, STM32RTC::ALARM_B); rrtc.setAlarmTime(hours, minutes, seconds + 5, 567, STM32RTC::ALARM_B); rrtc.enableAlarm(rtc.MATCH_DHHMMSS, STM32RTC::ALARM_B); ``` ``` -------------------------------- ### Set Alarm Time with Sub-Seconds Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Set the alarm time including hours, minutes, seconds, and sub-seconds. Note that sub-second support may vary by STM32 series. ```C++ #if defined(STM32_RTC_VERSION) && (STM32_RTC_VERSION >= 0x01010000) rtc.setAlarmTime(alarmHours, alarmMinutes, alarmSeconds, 123); #else rtc.setAlarmTime(alarmHours, alarmMinutes, alarmSeconds); #endif ``` -------------------------------- ### Set Alarm Hours Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the alarm hour, optionally specifying AM/PM. ```APIDOC ## Set Alarm Hours ### Description Sets the hour for an RTC alarm. If the RTC is configured for 12-hour format, the AM/PM period can also be specified. ### Method `void setAlarmHours(uint8_t hours, AM_PM period = AM)` ### Endpoint N/A (Class method) ### Parameters * **hours** (uint8_t) - Required - The hour value to set for the alarm (1-12 for 12-hour format, 0-23 for 24-hour format). * **period** (AM_PM) - Optional - The period (AM or PM) to set, defaults to AM. Only applicable for 12-hour format. ### Request Example ```c++ // Set alarm for 7 AM rtc.setAlarmHours(7, AM); ``` ### Response None ``` -------------------------------- ### Set Epoch Time Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the RTC time using a Unix epoch timestamp, optionally including sub-seconds. ```APIDOC ## Set Epoch Time ### Description Sets the RTC time using a Unix epoch timestamp (seconds since January 1, 1970). It can also optionally set the sub-second component. ### Method `void setEpoch(uint32_t ts, uint32_t subSeconds = 0)` ### Endpoint N/A (Class method) ### Parameters * **ts** (uint32_t) - Required - The epoch timestamp in seconds. * **subSeconds** (uint32_t) - Optional - The sub-second value to set. Defaults to 0. ### Request Example ```c++ // Set time to a specific epoch timestamp with sub-seconds rtc.setEpoch(1678886400, 500); ``` ### Response None ``` -------------------------------- ### SubSeconds Underflow Interrupt API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Functions to attach and detach a callback for SubSeconds register underflow interrupts (STM32WLxx only). ```APIDOC ## SubSeconds Underflow Interrupt API ### Description Functions to manage interrupts triggered when the SubSeconds register underflows. This feature is specific to STM32WLxx devices and is used by STM32LoRaWAN. ### Functions - **`void attachSubSecondsUnderflowInterrupt(voidFuncPtr callback)`**: Attaches a callback function for the SubSeconds underflow interrupt. - **`void detachSubSecondsUnderflowInterrupt(void)`**: Detaches the previously attached SubSeconds underflow interrupt callback. ``` -------------------------------- ### Set SubSeconds Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the sub-second value for the RTC. ```APIDOC ## Set SubSeconds ### Description Sets the sub-second value for the RTC. ### Method `void setSubSeconds(uint32_t subSeconds)` ### Endpoint N/A (Class method) ### Parameters * **subSeconds** (uint32_t) - Required - The sub-second value to set. ### Request Example ```c++ rtc.setSubSeconds(500); ``` ### Response None ``` -------------------------------- ### One-Second Interrupt API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Functions to attach and detach a callback for one-second interrupts. ```APIDOC ## One-Second Interrupt API ### Description Functions to attach and detach a callback for one-second interrupts. ### Functions - **`void attachSecondsInterrupt(voidFuncPtr callback)`**: Attaches a callback function to be executed every second. - **`void detachSecondsInterrupt(void)`**: Detaches the previously attached one-second interrupt callback. ``` -------------------------------- ### IsFormat_24Hour API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Function to check the current hour format setting. ```APIDOC ## IsFormat_24Hour API ### Description Checks if the RTC is currently configured to use the 24-hour format. ### Function - **`bool isFormat24Hour(void)`**: Returns true if the hour format is 24-hour, false if it is 12-hour. ``` -------------------------------- ### Check if Time is Set Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Use this snippet to determine if the RTC time has been previously set. If not, it proceeds to set the time. ```C++ if (!rtc.isTimeSet()) { // Set the time rtc.setHours(hours); rtc.setMinutes(minutes); rtc.setSeconds(seconds); } ``` -------------------------------- ### Set Week Day Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the current day of the week for the RTC. ```APIDOC ## Set Week Day ### Description Sets the current day of the week for the RTC. ### Method `void setWeekDay(uint8_t weekDay)` ### Endpoint N/A (Class method) ### Parameters * **weekDay** (uint8_t) - Required - The day of the week to set (typically 1-7). ### Request Example ```c++ // Set to Wednesday (assuming Wednesday is represented by 4) rtc.setWeekDay(4); ``` ### Response None ``` -------------------------------- ### Reset Time Management API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Functions to manage RTC time setting and check if time has been set. ```APIDOC ## Reset Time Management API ### Description Functions to manage RTC time setting and check if time has been set. By default, time is not reset after a reboot. Using `begin(true)` or `begin(true, HOUR_24)` will reset RTC registers. ### Functions - **`bool isTimeSet(void)`**: Returns true if the time has been set, false otherwise. ### Example ```C++ if (!rtc.isTimeSet()) { // Set the time rtc.setHours(hours); rtc.setMinutes(minutes); rtc.setSeconds(seconds); } ``` ``` -------------------------------- ### RTC Handle API Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Function to retrieve the RTC handle. ```APIDOC ## RTC Handle API ### Description Function to retrieve the underlying RTC hardware handle, which can be useful for advanced configurations or direct register access. ### Function - **`RTC_HandleTypeDef *RTC_GetHandle(void)`**: Returns a pointer to the `RTC_HandleTypeDef` structure. ``` -------------------------------- ### Set Alarm SubSeconds Source: https://github.com/stm32duino/stm32rtc/blob/main/README.md Sets the sub-second value for an RTC alarm. Note: Not supported on STM32F1 and STM32L1xx (ULPM) series. ```APIDOC ## Set Alarm SubSeconds ### Description Sets the sub-second value for an RTC alarm. This feature's availability depends on the STM32 series. ### Important Note - STM32F1 and STM32L1xx (Ultra Low Power Medium density) series do not support sub-second alarms. - The resolution of sub-seconds depends on the synchronous prescaler value. ### Method `void setAlarmSubSeconds(uint32_t subSeconds)` ### Endpoint N/A (Class method) ### Parameters * **subSeconds** (uint32_t) - Required - The sub-second value to set for the alarm. ### Request Example ```c++ // Set alarm to trigger with sub-seconds precision rtc.setAlarmSubSeconds(123); ``` ### Response None ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.