Skip to content

Commit

Permalink
feat(repo): update conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
Lzw655 committed Dec 9, 2024
1 parent 0066f7c commit 758b33d
Show file tree
Hide file tree
Showing 15 changed files with 294 additions and 294 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## v0.1.1

### Enhancements:

* feat(repo): update config header and Kconfig file s

## v0.1.0

### Enhancements:
Expand Down
55 changes: 27 additions & 28 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,32 @@ menu "ESP Library Utils Configurations"

menu "Check functions"
depends on ESP_UTILS_CONF_FILE_SKIP
config ESP_UTILS_CONF_ENABLE_CHECK
bool "Enable check functions"
default y
help
If enabled, the driver will check the function parameters, return value, etc. Disable them will reduce the code size.
choice ESP_UTILS_CONF_CHECK_HANDLE_METHOD
prompt "Select handle method when check failed"
default ESP_UTILS_CHECK_HANDLE_WITH_ERROR_LOG

config ESP_UTILS_CONF_CHECK_WITH_ERROR_LOG
bool "Print log messages on error"
default y
depends on ESP_UTILS_CONF_ENABLE_CHECK
help
If enabled, the driver will print error message when check failed.
config ESP_UTILS_CHECK_HANDLE_WITH_NONE
bool "Do nothing"

config ESP_UTILS_CONF_CHECK_WITH_ASSERT
bool "Assert on error"
default n
depends on ESP_UTILS_CONF_ENABLE_CHECK
help
If enabled, the driver will assert when check failed.
config ESP_UTILS_CHECK_HANDLE_WITH_ERROR_LOG
bool "Print error message"

config ESP_UTILS_CHECK_HANDLE_WITH_ASSERT
bool "Assert"
endchoice

config ESP_UTILS_CONF_CHECK_HANDLE_METHOD
int
default 0 if ESP_UTILS_CHECK_HANDLE_WITH_NONE
default 1 if ESP_UTILS_CHECK_HANDLE_WITH_ERROR_LOG
default 2 if ESP_UTILS_CHECK_HANDLE_WITH_ASSERT
endmenu

menu "Log functions"
depends on ESP_UTILS_CONF_FILE_SKIP
config ESP_UTILS_CONF_ENABLE_LOG
bool "Enable log functions"
default y
help
If enabled, the driver will output log for debugging.

config ESP_UTILS_CONF_LOG_BUFFER_SIZE
int "Buffer size for formatting messages"
depends on ESP_UTILS_CONF_ENABLE_LOG
default 256

choice ESP_UTILS_CONF_LOG_LEVEL
prompt "Select global log level"
depends on ESP_UTILS_CONF_ENABLE_LOG
default ESP_UTILS_CONF_LOG_LEVEL_INFO

config ESP_UTILS_CONF_LOG_LEVEL_DEBUG
Expand All @@ -63,6 +52,11 @@ menu "ESP Library Utils Configurations"
bool "Error"
help
Critical errors, software module cannot recover on its own

config ESP_UTILS_CONF_LOG_LEVEL_NONE
bool "None"
help
No log output
endchoice

config ESP_UTILS_CONF_LOG_LEVEL
Expand All @@ -71,13 +65,18 @@ menu "ESP Library Utils Configurations"
default 1 if ESP_UTILS_CONF_LOG_LEVEL_INFO
default 2 if ESP_UTILS_CONF_LOG_LEVEL_WARNING
default 3 if ESP_UTILS_CONF_LOG_LEVEL_ERROR
default 4 if ESP_UTILS_CONF_LOG_LEVEL_NONE

config ESP_UTILS_CONF_ENABLE_LOG_TRACE
bool "Enable trace function"
depends on ESP_UTILS_CONF_LOG_LEVEL_DEBUG
default n
help
If enabled, the driver will print trace log messages when enter/exit functions, useful for debugging

config ESP_UTILS_CONF_LOG_BUFFER_SIZE
int "Buffer size for formatting messages"
default 256
endmenu

menu "Memory functions"
Expand Down
38 changes: 17 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,17 @@ Since `esp-lib-utils` configures its functionality through the *esp_utils_conf.h

```c
...
/* Set to 1 if use `ESP_UTILS_LOG*()` macros */
#define ESP_UTILS_CONF_ENABLE_LOG (1) // 0/1
#if ESP_UTILS_CONF_ENABLE_LOG
/**
* Global log level, logs with a level lower than this will not be compiled. Choose one of the following:
* - ESP_UTILS_LOG_LEVEL_DEBUG: Extra information which is not necessary for normal use (values, pointers, sizes, etc)
* (lowest level)
* - ESP_UTILS_LOG_LEVEL_INFO: Information messages which describe the normal flow of events
* - ESP_UTILS_LOG_LEVEL_WARNING: Error conditions from which recovery measures have been taken
* - ESP_UTILS_LOG_LEVEL_ERROR: Critical errors, software module cannot recover on its own (highest level)
*
*/
#define ESP_UTILS_CONF_LOG_LEVEL (ESP_UTILS_LOG_LEVEL_DEBUG)
...
#endif // ESP_UTILS_CONF_ENABLE_LOG
/**
* Global log level, logs with a level lower than this will not be compiled. Choose one of the following:
* - ESP_UTILS_LOG_LEVEL_DEBUG: Extra information which is not necessary for normal use (values, pointers, sizes, etc)
* (lowest level)
* - ESP_UTILS_LOG_LEVEL_INFO: Information messages which describe the normal flow of events
* - ESP_UTILS_LOG_LEVEL_WARNING: Error conditions from which recovery measures have been taken
* - ESP_UTILS_LOG_LEVEL_ERROR: Critical errors, software module cannot recover on its own
* - ESP_UTILS_LOG_LEVEL_NONE: No log output (highest level) (Minimum code size)
*
*/
#define ESP_UTILS_CONF_LOG_LEVEL (ESP_UTILS_LOG_LEVEL_DEBUG)
...
```

Expand Down Expand Up @@ -166,10 +162,10 @@ bool test_check_false_goto(void)
ESP_UTILS_CHECK_FALSE_GOTO(true, err, "Check false goto failed");
ESP_UTILS_CHECK_FALSE_GOTO(false, end, "Check false goto success");
ESP_UTILS_CHECK_TAG(err)
err:
return false;
ESP_UTILS_CHECK_TAG(end)
end:
return true;
}
Expand All @@ -191,10 +187,10 @@ bool test_check_error_goto(void)
ESP_UTILS_CHECK_ERROR_GOTO(ESP_OK, err, "Check error goto failed");
ESP_UTILS_CHECK_ERROR_GOTO(ESP_FAIL, end, "Check error goto success");
ESP_UTILS_CHECK_TAG(err)
err:
return false;
ESP_UTILS_CHECK_TAG(end)
end:
return true;
}
Expand All @@ -216,10 +212,10 @@ static bool test_check_null_goto(void)
ESP_UTILS_CHECK_NULL_GOTO((void *)1, err, "Check null goto failed");
ESP_UTILS_CHECK_NULL_GOTO(NULL, end, "Check null goto success");
ESP_UTILS_CHECK_TAG(err)
err:
return false;
ESP_UTILS_CHECK_TAG(end)
end:
return true;
}
Expand Down
54 changes: 21 additions & 33 deletions esp_utils_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,37 @@
///////////////////////////////////////////////// Check Configurations /////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* These functions are used to check the function parameters, return value, etc. Disable them will reduce the code size.
* Check handle method, choose one of the following:
* - ESP_UTILS_CHECK_HANDLE_WITH_NONE: Do nothing when check failed (Minimum code size)
* - ESP_UTILS_CHECK_HANDLE_WITH_ERROR_LOG: Print error message when check failed (Recommended)
* - ESP_UTILS_CHECK_HANDLE_WITH_ASSERT: Assert when check failed
*
*/
/* Set to 1 if use `ESP_UTILS_CHECK_*()` macros */
#define ESP_UTILS_CONF_ENABLE_CHECK (1) // 0/1
#if ESP_UTILS_CONF_ENABLE_CHECK
/* Set to 1 if print message when check failed */
#define ESP_UTILS_CONF_CHECK_WITH_ERROR_LOG (1) // 0/1

/* Set to 1 if assert when check failed */
#define ESP_UTILS_CONF_CHECK_WITH_ASSERT (0) // 0/1
#endif // ESP_UTILS_CONF_ENABLE_CHECK
#define ESP_UTILS_CONF_CHECK_HANDLE_METHOD (ESP_UTILS_CHECK_HANDLE_WITH_ERROR_LOG)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// Log Configurations //////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* These functions are used to print log messages. Disable them will reduce the code size.
* Global log level, logs with a level lower than this will not be compiled. Choose one of the following:
* - ESP_UTILS_LOG_LEVEL_DEBUG: Extra information which is not necessary for normal use (values, pointers, sizes, etc)
* (lowest level)
* - ESP_UTILS_LOG_LEVEL_INFO: Information messages which describe the normal flow of events
* - ESP_UTILS_LOG_LEVEL_WARNING: Error conditions from which recovery measures have been taken
* - ESP_UTILS_LOG_LEVEL_ERROR: Critical errors, software module cannot recover on its own
* - ESP_UTILS_LOG_LEVEL_NONE: No log output (highest level) (Minimum code size)
*
*/
/* Set to 1 if use `ESP_UTILS_LOG*()` macros */
#define ESP_UTILS_CONF_ENABLE_LOG (1) // 0/1
#if ESP_UTILS_CONF_ENABLE_LOG
/**
* Global log level, logs with a level lower than this will not be compiled. Choose one of the following:
* - ESP_UTILS_LOG_LEVEL_DEBUG: Extra information which is not necessary for normal use (values, pointers, sizes, etc)
* (lowest level)
* - ESP_UTILS_LOG_LEVEL_INFO: Information messages which describe the normal flow of events
* - ESP_UTILS_LOG_LEVEL_WARNING: Error conditions from which recovery measures have been taken
* - ESP_UTILS_LOG_LEVEL_ERROR: Critical errors, software module cannot recover on its own (highest level)
*
*/
#define ESP_UTILS_CONF_LOG_LEVEL (ESP_UTILS_LOG_LEVEL_INFO)
#if ESP_UTILS_CONF_LOG_LEVEL == ESP_UTILS_LOG_LEVEL_DEBUG
#define ESP_UTILS_CONF_LOG_LEVEL (ESP_UTILS_LOG_LEVEL_INFO)
#if ESP_UTILS_CONF_LOG_LEVEL == ESP_UTILS_LOG_LEVEL_DEBUG

/* Set to 1 if print trace log messages when enter/exit functions, useful for debugging */
#define ESP_UTILS_CONF_ENABLE_LOG_TRACE (0)
/* Set to 1 if print trace log messages when enter/exit functions, useful for debugging */
#define ESP_UTILS_CONF_ENABLE_LOG_TRACE (0)

#endif // ESP_UTILS_CONF_LOG_LEVEL
#endif // ESP_UTILS_CONF_LOG_LEVEL

/* Log format buffer size */
#define ESP_UTILS_CONF_LOG_BUFFER_SIZE (256)
#endif // ESP_UTILS_CONF_ENABLE_LOG
/* Log format buffer size */
#define ESP_UTILS_CONF_LOG_BUFFER_SIZE (256)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////// Memory Configurations /////////////////////////////////////////////////
Expand Down Expand Up @@ -96,8 +84,8 @@
* 3. Even if the patch version is not consistent, it will not affect normal functionality.
*
*/
#define ESP_UTILS_CONF_FILE_VERSION_MAJOR 0
#define ESP_UTILS_CONF_FILE_VERSION_MINOR 1
#define ESP_UTILS_CONF_FILE_VERSION_MAJOR 1
#define ESP_UTILS_CONF_FILE_VERSION_MINOR 0
#define ESP_UTILS_CONF_FILE_VERSION_PATCH 0

// *INDENT-OFF*
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "0.1.0"
version: "0.1.1"
description: esp-lib-utils is a library designed for ESP SoCs to provide utility functions, including logging, checking, and memory.
url: https://github.com/esp-arduino-libs/esp-lib-utils
repository: https://github.com/esp-arduino-libs/esp-lib-utils.git
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=esp-lib-utils
version=0.1.0
version=0.1.1
author=espressif
maintainer=espressif
sentence=esp-lib-utils is a library designed for ESP SoCs to provide utility functions, including logging, checking, and memory.
Expand Down
Loading

0 comments on commit 758b33d

Please sign in to comment.