3 Commits

Author SHA1 Message Date
bb0a99ac2b Updated zh_vector 2024-05-30 08:44:36 +03:00
e2078e46b1 Updated zh_espnow 2024-05-30 08:43:41 +03:00
4433e03320 Updated zh_config 2024-05-30 08:41:47 +03:00
8 changed files with 38 additions and 41 deletions

View File

@@ -6,7 +6,7 @@ In an existing project, run the following command to install the component:
```text ```text
cd ../your_project/components cd ../your_project/components
git clone http://git.zh.com.ru/alexey.zholtikov/zh_config.git git clone https://github.com/aZholtikov/zh_config.git
``` ```
In the application, add the component: In the application, add the component:

View File

@@ -44,9 +44,7 @@ extern "C"
* *
* @note Before initialize ESP-NOW interface recommend initialize zh_espnow_init_config_t structure with default values. * @note Before initialize ESP-NOW interface recommend initialize zh_espnow_init_config_t structure with default values.
* *
* @code * @code zh_espnow_init_config_t config = ZH_ESPNOW_INIT_CONFIG_DEFAULT() @endcode
* zh_espnow_init_config_t config = ZH_ESPNOW_INIT_CONFIG_DEFAULT()
* @endcode
*/ */
typedef struct typedef struct
{ {
@@ -85,7 +83,6 @@ extern "C"
* @brief Structure for sending data to the event handler when an ESP-NOW message was sent. * @brief Structure for sending data to the event handler when an ESP-NOW message was sent.
* *
* @note Should be used with ZH_ESPNOW event base and ZH_ESPNOW_ON_SEND_EVENT event. * @note Should be used with ZH_ESPNOW event base and ZH_ESPNOW_ON_SEND_EVENT event.
*
*/ */
typedef struct typedef struct
{ {
@@ -106,15 +103,13 @@ extern "C"
} zh_espnow_event_on_recv_t; } zh_espnow_event_on_recv_t;
/** /**
* @brief Initialize ESP-NOW interface. * @brief Initialize ESP-NOW interface.
* *
* @note Before initialize ESP-NOW interface recommend initialize zh_espnow_init_config_t structure with default values. * @note Before initialize ESP-NOW interface recommend initialize zh_espnow_init_config_t structure with default values.
* *
* @code * @code zh_espnow_init_config_t config = ZH_ESPNOW_INIT_CONFIG_DEFAULT() @endcode
* zh_espnow_init_config_t config = ZH_ESPNOW_INIT_CONFIG_DEFAULT()
* @endcode
* *
* @param[in] config Pointer to ESP-NOW initialized configuration structure. Can point to a temporary variable. * @param[in] config Pointer to ESP-NOW initialized configuration structure. Can point to a temporary variable.
* *
* @return * @return
* - ESP_OK if initialization was success * - ESP_OK if initialization was success
@@ -125,7 +120,7 @@ extern "C"
esp_err_t zh_espnow_init(const zh_espnow_init_config_t *config); esp_err_t zh_espnow_init(const zh_espnow_init_config_t *config);
/** /**
* @brief Deinitialize ESP-NOW interface. * @brief Deinitialize ESP-NOW interface.
* *
* @return * @return
* - ESP_OK if deinitialization was success * - ESP_OK if deinitialization was success
@@ -134,11 +129,11 @@ extern "C"
esp_err_t zh_espnow_deinit(void); esp_err_t zh_espnow_deinit(void);
/** /**
* @brief Send ESP-NOW data. * @brief Send ESP-NOW data.
* *
* @param[in] target Pointer to a buffer containing an eight-byte target MAC. Can be NULL for broadcast. * @param[in] target Pointer to a buffer containing an eight-byte target MAC. Can be NULL for broadcast.
* @param[in] data Pointer to a buffer containing the data for send. * @param[in] data Pointer to a buffer containing the data for send.
* @param[in] data_len Sending data length. * @param[in] data_len Sending data length.
* *
* @note The function will return an ESP_ERR_INVALID_STATE error if less than 10% of the size set at initialization remains in the message queue. * @note The function will return an ESP_ERR_INVALID_STATE error if less than 10% of the size set at initialization remains in the message queue.
* *

View File

@@ -1 +1 @@
1.2.6 1.0.0

View File

@@ -1,6 +1,7 @@
/** /**
* @file * @file
* The main code of the zh_espnow component. * The main code of the zh_espnow component.
*
*/ */
#include "zh_espnow.h" #include "zh_espnow.h"

View File

@@ -46,7 +46,7 @@ char example[10] = {0};
void app_main(void) void app_main(void)
{ {
// esp_log_level_set("zh_vector", ESP_LOG_NONE); esp_log_level_set("zh_vector", ESP_LOG_NONE);
zh_vector_init(&vector, sizeof(example), false); zh_vector_init(&vector, sizeof(example), false);
printf("Initial vector size is: %d\n", zh_vector_get_size(&vector)); printf("Initial vector size is: %d\n", zh_vector_get_size(&vector));
strcpy(example, "Item 1"); strcpy(example, "Item 1");

View File

@@ -32,15 +32,15 @@ extern "C"
} zh_vector_t; } zh_vector_t;
/** /**
* @brief Initialize vector. * @brief Initialize vector.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* @param[in] unit Size of vector item. * @param[in] unit Size of vector item.
* @param[in] spiram SPI RAM using (true - vector will be placed in SPI RAM, false - vector will be placed in RAM). * @param[in] spiram SPI RAM using (true - vector will be placed in SPI RAM, false - vector will be placed in RAM).
* *
* @attention For using SPI RAM select “Make RAM allocatable using heap_caps_malloc(…, MALLOC_CAP_SPIRAM)” from CONFIG_SPIRAM_USE. For ESP32 with external, SPI-connected RAM only. * @attention For using SPI RAM select “Make RAM allocatable using heap_caps_malloc(…, MALLOC_CAP_SPIRAM)” from CONFIG_SPIRAM_USE. For ESP32 with external, SPI-connected RAM only.
* *
* @note If SPI RAM is not supported or not initialised via menuconfig vector will be placed in RAM regardless of the set spiram value. * @note If SPI RAM is not supported or not initialised via menuconfig vector will be placed in RAM regardless of the set spiram value.
* *
* @return * @return
* - ESP_OK if initialization was success * - ESP_OK if initialization was success
@@ -50,9 +50,9 @@ extern "C"
esp_err_t zh_vector_init(zh_vector_t *vector, uint16_t unit, bool spiram); esp_err_t zh_vector_init(zh_vector_t *vector, uint16_t unit, bool spiram);
/** /**
* @brief Deinitialize vector. Free all allocated memory. * @brief Deinitialize vector. Free all allocated memory.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* *
* @return * @return
* - ESP_OK if deinitialization was success * - ESP_OK if deinitialization was success
@@ -62,9 +62,9 @@ extern "C"
esp_err_t zh_vector_free(zh_vector_t *vector); esp_err_t zh_vector_free(zh_vector_t *vector);
/** /**
* @brief Get current vector size. * @brief Get current vector size.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* *
* @return * @return
* - Vector size * - Vector size
@@ -73,10 +73,10 @@ extern "C"
esp_err_t zh_vector_get_size(zh_vector_t *vector); esp_err_t zh_vector_get_size(zh_vector_t *vector);
/** /**
* @brief Add item at end of vector. * @brief Add item at end of vector.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* @param[in] item Pointer to item for add. * @param[in] item Pointer to item for add.
* *
* @return * @return
* - ESP_OK if add was success * - ESP_OK if add was success
@@ -87,11 +87,11 @@ extern "C"
esp_err_t zh_vector_push_back(zh_vector_t *vector, void *item); esp_err_t zh_vector_push_back(zh_vector_t *vector, void *item);
/** /**
* @brief Change item by index. * @brief Change item by index.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* @param[in] index Index of item for change. * @param[in] index Index of item for change.
* @param[in] item Pointer to new data of item. * @param[in] item Pointer to new data of item.
* *
* @return * @return
* - ESP_OK if change was success * - ESP_OK if change was success
@@ -102,10 +102,10 @@ extern "C"
esp_err_t zh_vector_change_item(zh_vector_t *vector, uint16_t index, void *item); esp_err_t zh_vector_change_item(zh_vector_t *vector, uint16_t index, void *item);
/** /**
* @brief Get item by index. * @brief Get item by index.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* @param[in] index Index of item for get. * @param[in] index Index of item for get.
* *
* @return * @return
* - Pointer to item * - Pointer to item
@@ -114,10 +114,10 @@ extern "C"
void *zh_vector_get_item(zh_vector_t *vector, uint16_t index); void *zh_vector_get_item(zh_vector_t *vector, uint16_t index);
/** /**
* @brief Delete item by index and shifts all elements in vector. * @brief Delete item by index and shifts all elements in vector.
* *
* @param[in] vector Pointer to main structure of vector data. * @param[in] vector Pointer to main structure of vector data.
* @param[in] index Index of item for delete. * @param[in] index Index of item for delete.
* *
* @return * @return
* - ESP_OK if delete was success * - ESP_OK if delete was success

View File

@@ -1 +1 @@
1.4.6 1.0.0

View File

@@ -1,6 +1,7 @@
/** /**
* @file * @file
* The main code of the zh_vector component. * The main code of the zh_vector component.
*
*/ */
#include "zh_vector.h" #include "zh_vector.h"