Files
relay_chn/private_include/relay_chn_run_info.h
ismail 5afefc4dc0 Use original names for config parameters
The config parameter names defined in the relay_chn_defs.h file
have been changed back to their original names (with the CONFIG_ prefix),
so that they are not confused with application-level defines.

Refs #1085
2025-08-25 10:24:13 +03:00

84 lines
2.3 KiB
C

/*
* SPDX-FileCopyrightText: 2025 Kozmotronik Tech
*
* SPDX-License-Identifier: MIT
*
* This is for managing the run information of relay channels.
*/
#pragma once
#include "relay_chn_priv_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize relay channel run information.
*
* Initializes the run information for all relay channels with default values.
*/
void relay_chn_run_info_init(void);
#if CONFIG_RELAY_CHN_COUNT > 1
/**
* @brief Get run information object for a specific relay channel.
*
* @param[in] chn_id Channel ID to get run information for.
* @return Pointer to run information structure, or NULL if channel ID is invalid.
*/
relay_chn_run_info_t *relay_chn_run_info_get(uint8_t chn_id);
/**
* @brief Get run information objects for all relay channels.
*
* @return Pointer to array of run information structures.
*/
relay_chn_run_info_t *relay_chn_run_info_get_all(void);
#else
/**
* @brief Get run information object for the single relay channel.
*
* @return Pointer to run information structure.
*/
relay_chn_run_info_t *relay_chn_run_info_get(void);
#endif // CONFIG_RELAY_CHN_COUNT > 1
/**
* @brief Get the last run command for a relay channel.
*
* @param[in] run_info Pointer to run information structure.
*
* @return Last command that was executed, or RELAY_CHN_CMD_NONE if invalid.
*/
relay_chn_cmd_t relay_chn_run_info_get_last_run_cmd(relay_chn_run_info_t *run_info);
/**
* @brief Set the last run command for a relay channel.
*
* @param[in] run_info Pointer to run information structure.
* @param[in] cmd Command to set as last run command.
*/
void relay_chn_run_info_set_last_run_cmd(relay_chn_run_info_t *run_info, relay_chn_cmd_t cmd);
/**
* @brief Get the timestamp of the last run command.
*
* @param[in] run_info Pointer to run information structure.
*
* @return Timestamp in milliseconds of last command, or 0 if invalid.
*/
uint32_t relay_chn_run_info_get_last_run_cmd_time_ms(relay_chn_run_info_t *run_info);
/**
* @brief Set the timestamp for the last run command.
*
* @param[in] run_info Pointer to run information structure.
* @param[in] time_ms Timestamp in milliseconds to set.
*/
void relay_chn_run_info_set_last_run_cmd_time_ms(relay_chn_run_info_t *run_info, uint32_t time_ms);
#ifdef __cplusplus
}
#endif