esp_board_manager.h

[English]

Header File

Functions

esp_err_t esp_board_manager_init(void)

Initialize the board manager.

    Initializes all peripherals first, then all devices. If device initialization
    fails, peripherals are deinitialized to maintain consistency. The manager
    can only be initialized once

备注

Device initialization strictly follows the order defined in board_devices.yaml Peripheral initialization strictly follows the order defined in board_peripherals.yaml If a device depends on a peripheral for power-on, it must be initialized after that peripheral For example, the LCD power control device should be listed before the Display LCD device in board_devices.yaml

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_ALREADY_INIT If manager already initialized

  • Others Error codes from peripheral or device initialization

esp_err_t esp_board_manager_get_periph_handle(const char *periph_name, void **periph_handle)

Get peripheral handle by name.

    Retrieves a peripheral handle that has been initialized by the board manager
    The board manager must be initialized before calling this function
参数:
  • periph_name[in] Peripheral name

  • periph_handle[out] Pointer to store the peripheral handle

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If periph_name or periph_handle is NULL

  • ESP_BOARD_ERR_MANAGER_PERIPH_NOT_FOUND If peripheral not found

esp_err_t esp_board_manager_get_device_handle(const char *dev_name, void **device_handle)

Get device handle by name.

    Retrieves a device handle that has been initialized by the board manager
    The board manager must be initialized before calling this function
参数:
  • dev_name[in] Device name

  • device_handle[out] Pointer to store the device handle

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If dev_name or device_handle is NULL

  • ESP_BOARD_ERR_MANAGER_DEVICE_NOT_FOUND If device not found

bool esp_board_manager_check_name(const char *name)

Check whether a device or peripheral name exists.

    This function checks whether the given name is declared as either a
    device or a peripheral in the current board configuration. It does
    not initialize anything and does not emit error logs when the name
    does not exist
参数:

name[in] Device or peripheral name

返回:

  • true If the name exists in the current board configuration

  • false If the name does not exist or name is NULL

esp_err_t esp_board_manager_get_device_config(const char *dev_name, void **config)

Query device configuration.

    Retrieves the configuration data for a specific device. This function
    returns the raw configuration data that was used to initialize the device
参数:
  • dev_name[in] Device name

  • config[out] Pointer to store the device configuration

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If dev_name or config is NULL

  • ESP_BOARD_ERR_MANAGER_DEVICE_NOT_FOUND If device not found

  • ESP_BOARD_ERR_DEVICE_NOT_SUPPORTED If device has no configuration

esp_err_t esp_board_manager_get_periph_config(const char *periph_name, void **config)

Get peripheral configuration by name.

参数:
  • periph_name[in] Peripheral name

  • config[out] Pointer to store the peripheral configuration

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If periph_name or config is NULL

  • ESP_BOARD_ERR_PERIPH_NOT_FOUND If peripheral configuration not found

  • ESP_BOARD_ERR_PERIPH_NOT_SUPPORTED If peripheral has no configuration

esp_err_t esp_board_manager_get_board_info(esp_board_info_t *board_info)

Retrieves the board information.

    This function can be called without initializing the board manager
参数:

board_info[out] Pointer to store the board information

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If board_info is NULL

esp_err_t esp_board_manager_register_device_handle(esp_board_device_handle_t *reg_handle)

Register a user defined device handle The user can initialize the device handle manually and register it with the board manager After that, the application can access it through the board manager APIs.

参数:

reg_handle[in] Pointer to the device handle to register

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If reg_handle is NULL

esp_err_t esp_board_manager_init_device_by_name(const char *dev_name)

Initialize a specific device by name.

    Initializes a single device by name. The device must exist in the board
    configuration. This function is useful for lazy initialization of devices
参数:

dev_name[in] Device name to initialize

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If dev_name is NULL

  • ESP_BOARD_ERR_MANAGER_DEVICE_NOT_FOUND If device not found

  • Others Error codes from device initialization

esp_err_t esp_board_manager_deinit_device_by_name(const char *dev_name)

Deinitialize a specific device by name.

    Deinitializes a single device by name. The device must exist and be
    initialized. This function is useful for selective cleanup
参数:

dev_name[in] Device name to deinitialize

返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_INVALID_ARG If dev_name is NULL

  • Others Error codes from device deinitialization

esp_err_t esp_board_manager_print(void)

Print board manager status information.

    Displays comprehensive status information including all peripherals,
    devices, and their associations. The board manager must be initialized
返回:

  • ESP_OK On success

esp_err_t esp_board_manager_print_board_info(void)

Print board information.

    Displays board metadata including name, chip type, version, description,
    and manufacturer. This function can be called without initializing the
    board manager
返回:

  • ESP_OK On success

esp_err_t esp_board_manager_deinit(void)

Deinitialize the board manager.

    Deinitializes all devices first, then all peripherals. This ensures
    proper cleanup order and prevents resource leaks. The manager state
    is reset to allow re-initialization
返回:

  • ESP_OK On success

  • ESP_BOARD_ERR_MANAGER_NOT_INIT If board manager not initialized

  • Others Error codes from device or peripheral deinitialization

Structures

struct esp_board_info

Board information structure.

Public Members

const char *name

Board name

const char *chip

Chip type

const char *version

Board version

const char *description

Board description

const char *manufacturer

Board manufacturer

Type Definitions

typedef struct esp_board_info esp_board_info_t

Board information structure.


此文档对您有帮助吗?