Configurable Timer (CT) API Reference#

This section describes the Configurable Timer (CT) Application Programming Interface (API) for SiWx917 devices.

Use these APIs to configure timers, register callback, and handle events efficiently in an event-driven system design.

Public APIs Overview#

The CT module exposes a set of public APIs for:

  • Timer configuration and initialization

  • Counter control and synchronization

  • PWM and Input Capture management

  • Interrupt and callback handling

  • DMA integration for advanced timing updates

These APIs simplify the integration of timing features into your application with minimal effort.

For the complete CT API documentation, refer to the Configurable Timer Public API Reference.

Callback and Notification APIs#

In addition to core configuration functions, the CT driver supports asynchronous event handling through callback registration. Callbacks allow your application to respond to timer events—such as counter matches, overflows, and errors—without the need for polling. This improves system responsiveness and power efficiency.

  • The callback and notification APIs enable you to link custom handler functions to timer events.

  • Once registered, your callback executes automatically when the configured interrupt conditions occur, allowing real-time event processing.

Callback Function#

sl_status_t sl_si91x_config_timer_register_callback (sl_config_timer_callback_t on_config_timer_callback, void * callback_flag, sl_config_timer_interrupt_flags_t * interrupt_flags)

Description

Use this API to register a user-defined callback function for Configurable Timer (CT) interrupt events on SiWx917 devices. The callback mechanism allows your application to respond asynchronously to timer events—such as counter matches, overflows, or errors—without the need for polling.

This enables an event-driven architecture for efficient and low-latency timer management.

Parameters

Parameter

Description

on_config_timer_callback

Pointer to the user-defined interrupt handler. The driver automatically invokes this function when the configured CT event occurs.

callback_flag

Pointer to a user-defined variable that provides context information to the callback (for example, which interrupt flag or event was triggered).

interrupt_flags

Pointer to a structure that specifies which CT events (for example, match, overflow, capture) should trigger the callback.

Usage#

Register the callback function sl_si91x_config_timer_register_callback during timer initialization or configuration.

Once registered, the driver automatically invokes your callback whenever a configured CT event occurs, allowing your application to handle matches, overflows, or errors without polling.

Example#

void my_timer_event_handler(void *callback_flag) {
    uint32_t flag = *((uint32_t *)callback_flag);
    if (flag == SL_CONFIG_TIMER_EVENT_MATCH) {
        // Handle timer match event
    } else if (flag == SL_CONFIG_TIMER_EVENT_OVERFLOW) {
        // Handle overflow event
    } else {
        // Handle other timer events or errors
    }
}

Integration#

To use a callback, register it during timer initialization or configuration:

sl_status_t status = sl_si91x_config_timer_register_callback(
    my_timer_event_handler,
    &callback_flag,
    &interrupt_flags
);