Add single channel mode feature.

The addition of a single-channel mode implied further modularisation of the component. This commit has broken the component down into the following modules to avoid a huge single source file and to make unit testing easier.

The modules:

- Separation of public and private code
- *types and *defs
- public relay_chn API
- *adapter
- *output
- *run_info
- *core
- *ctl (control)
- *tilt

Closes #957.
This commit is contained in:
2025-08-13 17:53:27 +03:00
parent 22668b6759
commit 61f8ed440e
17 changed files with 2453 additions and 1472 deletions

View File

@@ -0,0 +1,58 @@
/*
* SPDX-FileCopyrightText: 2025 Kozmotronik Tech
*
* SPDX-License-Identifier: MIT
*/
#pragma once
#include "relay_chn_priv_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize relay channel tilt controls.
*
* Sets up tilt functionality for relay channels including timers and event handlers.
* Must be called before using any other tilt functions.
*
* @param[in] chn_ctls Array of relay channel control structures.
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_tilt_init(relay_chn_ctl_t *chn_ctls);
/**
* @brief Deinitialize relay channel tilt controls.
*
* Cleans up tilt resources including timers and event handlers.
* Should be called when tilt functionality is no longer needed.
*/
void relay_chn_tilt_deinit(void);
/**
* @brief Dispatch a tilt command to a relay channel.
*
* Queues a tilt command for execution on the specified channel.
*
* @param[in] tilt_ctl Pointer to tilt control structure.
* @param[in] cmd Tilt command to execute.
*
* @return ESP_OK on success, error code otherwise.
*/
esp_err_t relay_chn_tilt_dispatch_cmd(relay_chn_tilt_ctl_t *tilt_ctl, relay_chn_tilt_cmd_t cmd);
/**
* @brief Reset tilt counters for a relay channel.
*
* Resets both forward and reverse tilt counters to zero.
*
* @param[in] tilt_ctl Pointer to tilt control structure.
*/
void relay_chn_tilt_reset_count(relay_chn_tilt_ctl_t *tilt_ctl);
#ifdef __cplusplus
}
#endif