From feb1f4ac812ec71bc00a964121653e3820c824d2 Mon Sep 17 00:00:00 2001 From: ismail Date: Fri, 14 Feb 2025 15:12:37 +0300 Subject: [PATCH] Update docs for the state_listener_manager API. --- include/relay_chn.h | 7 +++++-- src/relay_chn.c | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/relay_chn.h b/include/relay_chn.h index 3a3573d..9d7dd8f 100644 --- a/include/relay_chn.h +++ b/include/relay_chn.h @@ -63,9 +63,12 @@ typedef enum relay_chn_state_enum relay_chn_state_t; /** * @brief Relay channel state change listener. - * + * * An optional interface to listen to the channel state change events. - * + * The listeners SHOULD be implemented as light functions and SHOULD NOT contain + * any blocking calls. Otherwise the relay_chn module would not function properly + * since it is designed as event driven. + * * @param chn_id The ID of the channel whose state has changed. * @param old_state The old state of the channel. * @param new_state The new state of the channel. diff --git a/src/relay_chn.c b/src/relay_chn.c index 347d04e..5952359 100644 --- a/src/relay_chn.c +++ b/src/relay_chn.c @@ -85,10 +85,12 @@ typedef struct relay_chn_type { esp_timer_handle_t inertia_timer; ///< Timer to handle the opposite direction inertia time. } relay_chn_t; - +/** + * @brief Structure to manage the state change listeners. + */ struct relay_chn_state_listener_manager_type { - uint8_t listener_count; - relay_chn_state_listener_t *listeners; + uint8_t listener_count; ///< The number of registered listeners. + relay_chn_state_listener_t *listeners; ///< The list that holds references to the registered listeners. } relay_chn_state_listener_manager;