Calendar#

Introduction#

The Calendar application manages dates, events, alarms, and reminders within hardware constraints. This section provides a brief overview of building such an application.

Configuration#

The Calendar provides three types of triggers: Second, Millisecond, and Alarm.

To set up a calendar in the si91x, use the sl_calendar_clock_t structure. It is mandatory to call sl_si91x_calendar_calibration_init function before calling RO clock calibration or RC clock calibration function. After defining this structure, the following function will re-initiate and configure the calendar:

For more detailed information on configuring available parameters, see the respective peripheral example README document.

Usage#

Common Calendar functions can be used after the Calendar structures are specified, passing an instance of sl_calendar_datetime_config_t. These functions will initiate and configure the Calendar, following the implementation flow below:

  1. sl_si91x_calendar_set_configuration - Configures the calendar settings.

  2. sl_si91x_calendar_init - Initializes the calendar module.

  3. sl_si91x_calendar_build_datetime_struct - Builds the datetime structure.

  4. sl_si91x_calendar_set_date_time - Sets the date and time.

  5. sl_si91x_calendar_deinit - Deinitializes the calendar module.

Modules#

clock_calibration_config_t

sl_calendar_version_t

Typedefs#

typedef AON_CLK_T

Renaming clock type enum.

typedef RTC_TIME_CONFIG_T

Renaming datetime structure.

typedef RTC_MONTH_T

Renaming month structure.

typedef RTC_DAY_OF_WEEK_T

Renaming days of week structure.

typedef void(*

Typedef for the function pointer of the callback function.

Functions#

TIME_CONVERSION_ENUM(time_conversion_enum)

Enumeration to represent time conversion format.

RC_CLOCK_CALIBRATION_ENUM(rc_clock_calibration_enum)

Enumeration to represent the different RC clock calibration configurations.

RO_CLOCK_CALIBRATION_ENUM(ro_clock_calibration_enum)

Enumeration to represent different RO clock calibration configurations.

sl_status_t
sl_si91x_calendar_set_configuration(sl_calendar_clock_t clock_type)

To configure and initialize Calendar (i.e., the RTC clock).

sl_status_t
sl_si91x_calendar_set_date_time(sl_calendar_datetime_config_t *config)

To configure and initialize Calendar (i.e., the RTC clock).

sl_status_t
sl_si91x_calendar_get_date_time(sl_calendar_datetime_config_t *config)

To fetch the current date and time of an existing Calendar i.e., RTC clock.

sl_status_t
sl_si91x_calendar_rcclk_calibration(clock_calibration_config_t *clock_calibration_config)

To calibrate the RC clock.

sl_status_t
sl_si91x_calendar_roclk_calibration(clock_calibration_config_t *clock_calibration_config)

To calibrate the RO clock.

sl_status_t

To register the callback for a one-millisecond trigger and enable it.

sl_status_t

To register the callback for a one-second trigger and enable it.

sl_status_t

To register the callback for an alarm trigger and enable it.

sl_status_t

To deregister the callback for one millisecond trigger and disable it.

sl_status_t

To deregister the callback for the one-second trigger and disable it.

sl_status_t

To deregister the callback for the alarm trigger and disable it.

sl_status_t
sl_si91x_calendar_set_alarm(sl_calendar_datetime_config_t *alarm)

To set the date and time of a new alarm in RTC.

sl_status_t
sl_si91x_calendar_get_alarm(sl_calendar_datetime_config_t *alarm)

To fetch the date and time of an existing alarm set in RTC.

sl_status_t
sl_si91x_calendar_build_datetime_struct(sl_calendar_datetime_config_t *date, uint8_t Century, uint8_t Year, sl_calendar_month_t Month, sl_calendar_days_of_week_t DayOfWeek, uint8_t Day, uint8_t Hour, uint8_t Minute, uint8_t Second, uint16_t Milliseconds)

To build the structure for date-time configuration.

sl_status_t
sl_si91x_calendar_convert_unix_time_to_ntp_time(uint32_t time, uint32_t *ntp_time)

To convert a Unix timestamp to an NTP timestamp.

sl_status_t
sl_si91x_calendar_convert_ntp_time_to_unix_time(uint32_t ntp_time, uint32_t *time)

To convert NTP timestamp to Unix timestamp.

boolean_t

To return the state of the one millisecond trigger of RTC (enabled or disabled).

boolean_t

To check the state of the one-second trigger of RTC.

boolean_t

To check the state of the alarm trigger of RTC.

__STATIC_INLINE void

To start the Calendar RTC.

__STATIC_INLINE void

To stop the Calendar RTC.

__STATIC_INLINE void

To initialize the calibration for Calendar clocks.

__STATIC_INLINE void

To clear the one millisecond trigger.

__STATIC_INLINE void

To clear the one-second trigger.

__STATIC_INLINE void

To clear the alarm trigger.

__STATIC_INLINE void

To initialize calendar operation.

__STATIC_INLINE void

To de-initialize calendar operation.

To get the calendar version.

Macros#

#define
SLI_ALARM_IRQHandler IRQ028_Handler

Alarm IRQ Handler.

#define

RTC IRQ Handler.

#define
SLI_NVIC_ALARM MCU_CAL_ALARM_IRQn

Alarm NVIQ enable.

#define
SLI_NVIC_MSEC_SEC MCU_CAL_RTC_IRQn

RTC NVIQ enable.

#define

Time Conversion format enum declaration.

#define

Time Conversion format enum declaration.

#define

Time Conversion format enum declaration.

Typedef Documentation#

sl_calendar_clock_t#

typedef AON_CLK_T sl_calendar_clock_t

Renaming clock type enum.


Definition at line 75 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_calendar_datetime_config_t#

typedef RTC_TIME_CONFIG_T sl_calendar_datetime_config_t

Renaming datetime structure.


Definition at line 76 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_calendar_month_t#

typedef RTC_MONTH_T sl_calendar_month_t

Renaming month structure.


Definition at line 77 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_calendar_days_of_week_t#

typedef RTC_DAY_OF_WEEK_T sl_calendar_days_of_week_t

Renaming days of week structure.


Definition at line 78 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

calendar_callback_t#

typedef void(* calendar_callback_t) (void) )(void)

Typedef for the function pointer of the callback function.


Definition at line 83 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

Function Documentation#

TIME_CONVERSION_ENUM#

TIME_CONVERSION_ENUM (time_conversion_enum )

Enumeration to represent time conversion format.

Parameters
N/A

Definition at line 100 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

RC_CLOCK_CALIBRATION_ENUM#

RC_CLOCK_CALIBRATION_ENUM (rc_clock_calibration_enum )

Enumeration to represent the different RC clock calibration configurations.

Parameters
N/A

Definition at line 109 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

RO_CLOCK_CALIBRATION_ENUM#

RO_CLOCK_CALIBRATION_ENUM (ro_clock_calibration_enum )

Enumeration to represent different RO clock calibration configurations.

Parameters
N/A

Definition at line 122 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_set_configuration#

sl_status_t sl_si91x_calendar_set_configuration (sl_calendar_clock_t clock_type)

To configure and initialize Calendar (i.e., the RTC clock).

Parameters
[in]clock_type

(sl_calendar_clock_t) Enum for RTC Clock Type (RO, RC or XTAL).

It takes input of clock type enum sl_calendar_clock_t. The clock type (that is, clock source) can be set to RC or XTAL. It configures the clock type and then initializes the RTC clock accordingly.

  • Pre-conditions:

    • The system clock must be initialized before calling this function.

    • The necessary hardware resources must be available and configured.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success

    • SL_STATUS_FAIL (0x0001) - The function failed.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 162 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_set_date_time#

sl_status_t sl_si91x_calendar_set_date_time (sl_calendar_datetime_config_t * config)

To configure and initialize Calendar (i.e., the RTC clock).

Parameters
[in]config

Pointer to the Date Configuration Structure (sl_calendar_datetime_config_t).

Sets the date and time of the Calendar RTC. The input parameters include a date-time structure, with the following members:

  • date Pointer to the Date Configuration Structure

  • Century (uint8_t) Century (0-4)

  • Year (uint8_t) Year (1-99) + (Century * 1000)

  • Month (enum) Month from the sl_calendar_month_t enum

  • DayOfWeek (enum) Day of Week from the sl_calendar_days_of_week_t enum

  • Day (uint8_t) Day (1-31)

  • Hour (uint8_t) Hour (0-23)

  • Minute (uint8_t) Minute (0-59)

  • Second (uint8_t) Second (0-59)

  • Milliseconds (uint16_t) Milliseconds (0-999)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 193 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_get_date_time#

sl_status_t sl_si91x_calendar_get_date_time (sl_calendar_datetime_config_t * config)

To fetch the current date and time of an existing Calendar i.e., RTC clock.

Parameters
[in]config

Pointer to the Date Configuration Structure (sl_calendar_datetime_config_t).

The input parameter consists of a date-time structure. The structure is updated with the current date-time parameters. The members of the structure are listed below:

  • date Pointer to the Date Configuration Structure

  • Century (uint8_t) Century (0-4)

  • Year (uint8_t) Year (1-99) + (Century * 1000)

  • Month (enum) Month from the sl_calendar_month_t enum

  • DayOfWeek (enum) Day of Week from the sl_calendar_days_of_week_t enum

  • Day (uint8_t) Day (1-31)

  • Hour (uint8_t) Hour (0-23)

  • Minute (uint8_t) Minute (0-59)

  • Second (uint8_t) Second (0-59)

  • Milliseconds (uint16_t) Milliseconds (0-999)

Returns

  • status Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 225 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_rcclk_calibration#

sl_status_t sl_si91x_calendar_rcclk_calibration (clock_calibration_config_t * clock_calibration_config)

To calibrate the RC clock.

Parameters
[in]clock_calibration_config

Pointer to the clock calibration structure (clock_calibration_config_t).

If the RC clock is selected as the input clock to the calendar, it is recommended to calibrate it after the power sequence. It expects the clock calibration structure clock_calibration_config_t as input. The members are listed below:

  • rc_enable_calibration: true to enable and false to disable RC calibration

  • rc_enable_periodic_calibration: true to enable and false to disable RC periodic calibration

  • rc_trigger_time: The interval at which the RC clock calibration is triggered. Expected values - 5 sec, 10 sec, 15 sec, 30 sec, 1 min, 2 min. RC_CLOCK_CALIBRATION_ENUM

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

Note

  • Only RC parameters are utilized in this function.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 252 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_roclk_calibration#

sl_status_t sl_si91x_calendar_roclk_calibration (clock_calibration_config_t * clock_calibration_config)

To calibrate the RO clock.

Parameters
[in]clock_calibration_config

Pointer to the clock calibration structure (clock_calibration_config_t).

If the RO clock is selected as the input clock to the calendar, it is recommended to calibrate it after the power sequence. This function internally calibrates the RC clock as well. It expects the clock calibration structure clock_calibration_config_t as input. The members are listed below:

  • rc_enable_calibration: true to enable and false to disable RC calibration

  • rc_enable_periodic_calibration: true to enable and false to disable RC periodic calibration

  • rc_trigger_time: Expected values - 5 sec, 10 sec, 15 sec, 30 sec, 1 min, 2 min RC_CLOCK_CALIBRATION_ENUM

  • ro_enable_calibration: true to enable and false to disable RO calibration

  • ro_enable_periodic_calibration: true to enable and false to disable periodic calibration

  • ro_trigger_time: Expected values - 1 sec, 2 sec, 4 sec, 8 sec RO_CLOCK_CALIBRATION_ENUM

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

Note

  • Both RC and RO parameters are utilized in this function, so it is mandatory to update all the parameters.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 283 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_register_msec_trigger_callback#

sl_status_t sl_si91x_calendar_register_msec_trigger_callback (calendar_callback_t callback)

To register the callback for a one-millisecond trigger and enable it.

Parameters
[in]callback

Callback function pointer (calendar_callback_t) to be called when the millisecond interrupt is triggered.

At the time of the trigger, the callback function passed as an argument to this function is called. It expects the callback function pointer as an input argument. Before calling this function again, it is mandatory to call sl_si91x_calendar_unregister_msec_trigger_callback, otherwise, it returns the SL_STATUS_BUSY error code.

Returns

  • Status code indicating the results:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_BUSY (0x0004) - The callback is already registered. Deregister the previous callback before registering a new one.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 305 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_register_sec_trigger_callback#

sl_status_t sl_si91x_calendar_register_sec_trigger_callback (calendar_callback_t callback)

To register the callback for a one-second trigger and enable it.

Parameters
[in]callback

Callback function pointer (calendar_callback_t) to be called when the second interrupt is triggered.

At the time of the trigger, the callback function passed as an argument to this function is called. It expects the callback function pointer as an input argument. Before calling this function again, it is mandatory to call sl_si91x_calendar_unregister_sec_trigger_callback, otherwise, it returns the SL_STATUS_BUSY error code.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_BUSY (0x0004) - The callback is already registered. Deregister the previous callback before registering a new one.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 327 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_register_alarm_trigger_callback#

sl_status_t sl_si91x_calendar_register_alarm_trigger_callback (calendar_callback_t callback)

To register the callback for an alarm trigger and enable it.

Parameters
[in]callback

Callback function pointer (calendar_callback_t) to be called when the alarm interrupt is triggered.

At the time of the trigger, the callback function passed as an argument to this function is called. It expects the callback function pointer as an input argument. Before calling this function again, it is mandatory to call sl_si91x_calendar_unregister_alarm_trigger_callback. Otherwise, it returns the SL_STATUS_BUSY error code.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_BUSY (0x0004) - The callback is already registered. Deregister the previous callback before registering a new one.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 349 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_unregister_msec_trigger_callback#

sl_status_t sl_si91x_calendar_unregister_msec_trigger_callback (void )

To deregister the callback for one millisecond trigger and disable it.

Parameters
N/A

Note

  • It is mandatory to call this function before registering the callback again.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - The function failed.

For more information on the status documentation, see SL STATUS DOCUMENTATION.


Definition at line 366 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_unregister_sec_trigger_callback#

sl_status_t sl_si91x_calendar_unregister_sec_trigger_callback (void )

To deregister the callback for the one-second trigger and disable it.

Parameters
N/A

Note

  • It is mandatory to call this function before registering the callback again.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - Function failed.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 383 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_unregister_alarm_trigger_callback#

sl_status_t sl_si91x_calendar_unregister_alarm_trigger_callback (void )

To deregister the callback for the alarm trigger and disable it.

Parameters
N/A

Note

  • It is mandatory to call this function before registering the callback again.

Returns

  • Status code indicating the results:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_FAIL (0x0001) - Function failed.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 400 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_set_alarm#

sl_status_t sl_si91x_calendar_set_alarm (sl_calendar_datetime_config_t * alarm)

To set the date and time of a new alarm in RTC.

Parameters
[in]alarm

Pointer to the Date Configuration Structure (sl_calendar_datetime_config_t).

It is a one-shot alarm; after triggering the alarm, it elapses. The input parameters consist of a date-time structure. The members of the structure are listed below:

  • date Pointer to the Date Configuration Structure

  • Century (uint8_t) Century (0-4)

  • Year (uint8_t) Year (1-99) + (Century * 1000)

  • Month (enum) Month from the sl_calendar_month_t enum

  • DayOfWeek (enum) Day of Week from the sl_calendar_days_of_week_t enum

  • Day (uint8_t) Day (1-31)

  • Hour (uint8_t) Hour (0-23)

  • Minute (uint8_t) Minute (0-59)

  • Second (uint8_t) Second (0-59)

  • Milliseconds (uint16_t) Milliseconds (0-999)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 431 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_get_alarm#

sl_status_t sl_si91x_calendar_get_alarm (sl_calendar_datetime_config_t * alarm)

To fetch the date and time of an existing alarm set in RTC.

Parameters
[in]alarm

Pointer to the Date Configuration Structure (sl_calendar_datetime_config_t).

The input parameters consist of a dummy date-time structure. The structure is updated with the current date-time parameters. The members of the structure are listed below:

  • date Pointer to the Date Configuration Structure

  • Century (uint8_t) Century (0-4)

  • Year (uint8_t) Year (1-99) + (Century * 1000)

  • Month (enum) Month from the sl_calendar_month_t enum

  • DayOfWeek (enum) Day of Week from the sl_calendar_days_of_week_t enum

  • Day (uint8_t) Day (1-31)

  • Hour (uint8_t) Hour (0-23)

  • Minute (uint8_t) Minute (0-59)

  • Second (uint8_t) Second (0-59)

  • Milliseconds (uint16_t) Milliseconds (0-999)

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 464 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_build_datetime_struct#

sl_status_t sl_si91x_calendar_build_datetime_struct (sl_calendar_datetime_config_t * date, uint8_t Century, uint8_t Year, sl_calendar_month_t Month, sl_calendar_days_of_week_t DayOfWeek, uint8_t Day, uint8_t Hour, uint8_t Minute, uint8_t Second, uint16_t Milliseconds)

To build the structure for date-time configuration.

Parameters
[in]date

Pointer to the Date Configuration Structure (sl_calendar_datetime_config_t)

[in]Century

(uint8_t) Century (0-4)

[in]Year

(uint8_t) Year (1-99) + (Century * 1000)

[in]Month

(enum) Month from the sl_calendar_month_t enum

[in]DayOfWeek

(enum) Day of Week from the sl_calendar_days_of_week_t enum

[in]Day

(uint8_t) Day (1-31)

[in]Hour

(uint8_t) Hour (0-23)

[in]Minute

(uint8_t) Minute (0-59)

[in]Second

(uint8_t) Second (0-59)

[in]Milliseconds

(uint16_t) Milliseconds (0-999)

By providing the following parameters as input, it validates and fills the date-time configuration structure with the respective values.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 491 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_convert_unix_time_to_ntp_time#

sl_status_t sl_si91x_calendar_convert_unix_time_to_ntp_time (uint32_t time, uint32_t * ntp_time)

To convert a Unix timestamp to an NTP timestamp.

Parameters
[in]time

Unix timestamp (uint32_t)

[out]ntp_time

Pointer to a variable to store the NTP timestamp (uint32_t)

This function converts a given Unix timestamp to an NTP timestamp. The Unix timestamp is provided as an input parameter, and the resulting NTP timestamp is stored in the variable pointed to by ntp_time.

Returns

  • Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 520 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_convert_ntp_time_to_unix_time#

sl_status_t sl_si91x_calendar_convert_ntp_time_to_unix_time (uint32_t ntp_time, uint32_t * time)

To convert NTP timestamp to Unix timestamp.

Parameters
[in]ntp_time

NTP timestamp.

[out]time

Variable to store the Unix timestamp.

This function converts a given NTP timestamp to a Unix timestamp.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK (0x0000) - Success.

    • SL_STATUS_INVALID_PARAMETER (0x0021) - Parameters are invalid.

    • SL_STATUS_NULL_POINTER (0x0022) - The parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 539 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_is_msec_trigger_enabled#

boolean_t sl_si91x_calendar_is_msec_trigger_enabled (void )

To return the state of the one millisecond trigger of RTC (enabled or disabled).

Parameters
N/A

If enabled, returns true. If disabled, returns false.

Returns

  • (boolean) true if the trigger is enabled, false otherwise.


Definition at line 552 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_is_sec_trigger_enabled#

boolean_t sl_si91x_calendar_is_sec_trigger_enabled (void )

To check the state of the one-second trigger of RTC.

Parameters
N/A

This function returns the state of the one-second trigger of RTC (enabled or disabled). If enabled, it returns true. If disabled, it returns false.

Returns

  • (boolean) true if the trigger is enabled, false otherwise.


Definition at line 566 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_is_alarm_trigger_enabled#

boolean_t sl_si91x_calendar_is_alarm_trigger_enabled (void )

To check the state of the alarm trigger of RTC.

Parameters
N/A

This function returns the state of the alarm trigger of RTC (enabled or disabled). If enabled, it returns true. If disabled, it returns false.

Returns

  • (boolean) true if the trigger is enabled, false otherwise.


Definition at line 580 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_rtc_start#

__STATIC_INLINE void sl_si91x_calendar_rtc_start (void )

To start the Calendar RTC.

Parameters
N/A

This function starts the RTC clock.


Definition at line 592 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_rtc_stop#

__STATIC_INLINE void sl_si91x_calendar_rtc_stop (void )

To stop the Calendar RTC.

Parameters
N/A

This function stops the RTC clock.


Definition at line 608 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_calibration_init#

__STATIC_INLINE void sl_si91x_calendar_calibration_init (void )

To initialize the calibration for Calendar clocks.

Parameters
N/A

This function initiates the calibration for Calendar clocks. It is mandatory to call this function before calling RO clock calibration or RC clock calibration function.


Definition at line 624 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_clear_msec_trigger#

__STATIC_INLINE void sl_si91x_calendar_clear_msec_trigger (void )

To clear the one millisecond trigger.

Parameters
N/A

This function clears the one millisecond trigger. It is generally called in the IRQ handler.

  • Pre-conditions:

    • The one millisecond trigger must be set and the IRQ handler must be configured.


Definition at line 638 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_clear_sec_trigger#

__STATIC_INLINE void sl_si91x_calendar_clear_sec_trigger (void )

To clear the one-second trigger.

Parameters
N/A

This function clears the one-second trigger. It is generally called in the IRQ handler.

  • Pre-conditions:

    • The one-second trigger must be set and the IRQ handler must be configured.


Definition at line 652 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_clear_alarm_trigger#

__STATIC_INLINE void sl_si91x_calendar_clear_alarm_trigger (void )

To clear the alarm trigger.

Parameters
N/A

This function clears the alarm trigger. It is generally called in the IRQ handler.

  • Pre-conditions:

    • The alarm must be set and the IRQ handler must be configured.


Definition at line 666 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_init#

__STATIC_INLINE void sl_si91x_calendar_init (void )

To initialize calendar operation.

Parameters
N/A

This function powers up the RTC domain and starts the calendar clock.


Definition at line 680 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_deinit#

__STATIC_INLINE void sl_si91x_calendar_deinit (void )

To de-initialize calendar operation.

Parameters
N/A

This function powers down the RTC domain and stops the calendar clock.


Definition at line 694 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

sl_si91x_calendar_get_version#

sl_calendar_version_t sl_si91x_calendar_get_version (void )

To get the calendar version.

Parameters
N/A

This function returns the API version of the calendar.

Returns


Definition at line 707 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

Macro Definition Documentation#

SLI_ALARM_IRQHandler#

#define SLI_ALARM_IRQHandler
Value:
IRQ028_Handler

Alarm IRQ Handler.


Definition at line 52 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

SLI_MSEC_SEC_IRQHandler#

#define SLI_MSEC_SEC_IRQHandler
Value:
IRQ029_Handler

RTC IRQ Handler.


Definition at line 53 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

SLI_NVIC_ALARM#

#define SLI_NVIC_ALARM
Value:
MCU_CAL_ALARM_IRQn

Alarm NVIQ enable.


Definition at line 54 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

SLI_NVIC_MSEC_SEC#

#define SLI_NVIC_MSEC_SEC
Value:
MCU_CAL_RTC_IRQn

RTC NVIQ enable.


Definition at line 55 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

TIME_CONVERSION_ENUM#

#define TIME_CONVERSION_ENUM
Value:
typedef uint8_t name; \
enum name##_enum

Time Conversion format enum declaration.


Definition at line 59 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

RC_CLOCK_CALIBRATION_ENUM#

#define RC_CLOCK_CALIBRATION_ENUM
Value:
typedef uint8_t name; \
enum name##_enum

Time Conversion format enum declaration.


Definition at line 62 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h

RO_CLOCK_CALIBRATION_ENUM#

#define RO_CLOCK_CALIBRATION_ENUM
Value:
typedef uint8_t name; \
enum name##_enum

Time Conversion format enum declaration.


Definition at line 65 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_calendar.h