diff --git a/components/esp_hw_support/include/esp_private/esp_ldo.h b/components/esp_hw_support/include/esp_private/esp_ldo.h index 9cbe9cd4e9..efde4d84aa 100644 --- a/components/esp_hw_support/include/esp_private/esp_ldo.h +++ b/components/esp_hw_support/include/esp_private/esp_ldo.h @@ -9,16 +9,12 @@ #include #include #include "esp_err.h" +#include "hal/ldo_types.h" #ifdef __cplusplus extern "C" { #endif -#define ESP_LDO_ID_1 0 ///< See datasheet `VFB/VO1` -#define ESP_LDO_ID_2 1 ///< See datasheet `VFB/VO2` -#define ESP_LDO_ID_3 2 ///< See datasheet `VFB/VO3` -#define ESP_LDO_ID_4 3 ///< See datasheet `VFB/VO4` - /** * @brief Type of LDO unit handle */ diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ldo.c b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ldo.c index 47c806bcb3..fe0e693c7d 100644 --- a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ldo.c +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ldo.c @@ -15,7 +15,7 @@ TEST_CASE("LDO unit early / normal allocation", "[LDO]") { esp_ldo_unit_init_cfg_t init_early_unit_cfg = { - .unit_id = ESP_LDO_ID_3, + .unit_id = LDO_UNIT_3, .cfg = { .voltage_mv = 1800, }, @@ -27,7 +27,7 @@ TEST_CASE("LDO unit early / normal allocation", "[LDO]") esp_ldo_unit_handle_t unit = NULL; esp_ldo_unit_init_cfg_t init_unit_cfg = { - .unit_id = ESP_LDO_ID_4, + .unit_id = LDO_UNIT_4, .cfg = { .voltage_mv = 2500, }, @@ -48,7 +48,7 @@ TEST_CASE("LDO unit early / normal allocation", "[LDO]") TEST_CASE("LDO unit output", "[LDO][mannual][ignore]") { esp_ldo_unit_init_cfg_t early_unit_cfg = { - .unit_id = ESP_LDO_ID_2, + .unit_id = LDO_UNIT_2, .cfg = { .voltage_mv = 2500, }, @@ -57,12 +57,12 @@ TEST_CASE("LDO unit output", "[LDO][mannual][ignore]") esp_ldo_unit_handle_t early_unit2 = esp_ldo_init_unit_early(&early_unit_cfg); assert(early_unit2); - early_unit_cfg.unit_id = ESP_LDO_ID_3; + early_unit_cfg.unit_id = LDO_UNIT_3; early_unit_cfg.cfg.voltage_mv = 3300; esp_ldo_unit_handle_t early_unit3 = esp_ldo_init_unit_early(&early_unit_cfg); assert(early_unit3); - early_unit_cfg.unit_id = ESP_LDO_ID_4; + early_unit_cfg.unit_id = LDO_UNIT_4; early_unit_cfg.cfg.voltage_mv = 1100; esp_ldo_unit_handle_t early_unit4 = esp_ldo_init_unit_early(&early_unit_cfg); assert(early_unit4); diff --git a/components/hal/include/hal/ldo_types.h b/components/hal/include/hal/ldo_types.h new file mode 100644 index 0000000000..f4b8c47d69 --- /dev/null +++ b/components/hal/include/hal/ldo_types.h @@ -0,0 +1,28 @@ +/* + * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief LDO Unit + * + * @note See datasheet to know LDO, alias includes but not least to `VFB/VOn` + */ +typedef enum { + LDO_UNIT_1, ///< LDO 1 + LDO_UNIT_2, ///< LDO 2 + LDO_UNIT_3, ///< LDO 3 + LDO_UNIT_4, ///< LDO 4 +} ldo_unit_t; + +#ifdef __cplusplus +} +#endif