Rdzleo dbdd304905 代码初始化:
本项目为触摸版项目代码复制而来,基于此版本进行按键功能的适配!
2026-03-23 11:14:56 +08:00
..
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00
2026-03-23 11:14:56 +08:00

ESP-Brookesia Library Utils

Overview

brookesia_lib_utils is the core utility library of the ESP-Brookesia framework, providing a comprehensive set of practical tools including task scheduler, thread configuration, performance profilers, logging system, state machine, plugin system, and various helper utilities.

Table of Contents

Features

  • Task Scheduler: An asynchronous task scheduling system based on Boost.Asio, supporting multi-threaded task management, including immediate, delayed, and periodic tasks.
  • Thread Configuration: RAII-style thread configuration management, supporting thread naming, priority setting, stack size and location configuration, CPU core binding, and more.
  • Profilers:
    • Memory Profiler: Monitors and analyzes memory usage, supporting automatic threshold detection and signal sending.
    • Thread Profiler: Monitors thread status and performance, supporting automatic threshold detection and signal sending.
    • Time Profiler: Measures code execution time and performance bottlenecks
  • Logging System: Supports both ESP_LOG and standard printf output, and allows output formatting with boost::format.
  • State Machine: Provides base classes and implementations for state machines, making it easy to manage complex state transitions.
  • Plugin System: Enables a modular development plugin mechanism.
  • Helpers:
    • Check Macros: Provides macros for checking false, nullptr, exceptions, and value ranges, as well as supporting custom error handling code blocks.
    • Function Guard: Provides RAII-style function call guards to help manage function call order and resource releasing.
    • Object Description Tools: Uses static reflection to provide object description, supporting serialization and deserialization of enums, structs, JSON, and certain standard types (string, integer, float, boolean, pointer, array, containers, etc.).

How to Use

Development Environment Requirements

Before using this library, please ensure the following SDK development environment is installed:

Note

Adding to Project

brookesia_lib_utils has been uploaded to the Espressif Component Registry. You can add it to your project in the following ways:

  1. Using Command Line

    Run the following command in your project directory:

    idf.py add-dependency "espressif/brookesia_lib_utils"
    
  2. Modifying Configuration File

    Create or modify the idf_component.yml file in your project directory:

    dependencies:
      espressif/brookesia_lib_utils: "*"
    

For detailed information, please refer to Espressif Documentation - IDF Component Manager.

Overview of Utility Classes

Header File Description Test Cases
check.hpp Provides assertion and condition checking test_apps/check
describe_helpers.hpp Provides object description and debugging info test_apps/describe_helpers
function_guard.hpp Provides RAII-style function guard test_apps/function_guard
log.hpp Provides logging system test_apps/log
memory_profiler.hpp Provides memory profiling test_apps/memory_profiler
plugin.hpp Provides plugin system test_apps/plugin
state_base.hpp, state_machine.hpp Provides state base class and state machine test_apps/state_base, test_apps/state_machine
task_scheduler.hpp Provides task scheduler test_apps/task_scheduler
thread_config.hpp Provides thread configuration test_apps/thread_config
thread_profiler.hpp Provides thread profiling test_apps/thread_profiler
time_profiler.hpp Provides time profiling test_apps/time_profiler