change(ldo): added ldo_types.h

This commit is contained in:
Armando
2023-12-29 15:54:50 +08:00
parent 5ae29bc4e5
commit 2a5343b2e0
3 changed files with 34 additions and 10 deletions

View File

@@ -9,16 +9,12 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "esp_err.h" #include "esp_err.h"
#include "hal/ldo_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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 * @brief Type of LDO unit handle
*/ */

View File

@@ -15,7 +15,7 @@
TEST_CASE("LDO unit early / normal allocation", "[LDO]") TEST_CASE("LDO unit early / normal allocation", "[LDO]")
{ {
esp_ldo_unit_init_cfg_t init_early_unit_cfg = { esp_ldo_unit_init_cfg_t init_early_unit_cfg = {
.unit_id = ESP_LDO_ID_3, .unit_id = LDO_UNIT_3,
.cfg = { .cfg = {
.voltage_mv = 1800, .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_handle_t unit = NULL;
esp_ldo_unit_init_cfg_t init_unit_cfg = { esp_ldo_unit_init_cfg_t init_unit_cfg = {
.unit_id = ESP_LDO_ID_4, .unit_id = LDO_UNIT_4,
.cfg = { .cfg = {
.voltage_mv = 2500, .voltage_mv = 2500,
}, },
@@ -48,7 +48,7 @@ TEST_CASE("LDO unit early / normal allocation", "[LDO]")
TEST_CASE("LDO unit output", "[LDO][mannual][ignore]") TEST_CASE("LDO unit output", "[LDO][mannual][ignore]")
{ {
esp_ldo_unit_init_cfg_t early_unit_cfg = { esp_ldo_unit_init_cfg_t early_unit_cfg = {
.unit_id = ESP_LDO_ID_2, .unit_id = LDO_UNIT_2,
.cfg = { .cfg = {
.voltage_mv = 2500, .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); esp_ldo_unit_handle_t early_unit2 = esp_ldo_init_unit_early(&early_unit_cfg);
assert(early_unit2); 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; early_unit_cfg.cfg.voltage_mv = 3300;
esp_ldo_unit_handle_t early_unit3 = esp_ldo_init_unit_early(&early_unit_cfg); esp_ldo_unit_handle_t early_unit3 = esp_ldo_init_unit_early(&early_unit_cfg);
assert(early_unit3); 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; early_unit_cfg.cfg.voltage_mv = 1100;
esp_ldo_unit_handle_t early_unit4 = esp_ldo_init_unit_early(&early_unit_cfg); esp_ldo_unit_handle_t early_unit4 = esp_ldo_init_unit_early(&early_unit_cfg);
assert(early_unit4); assert(early_unit4);

View File

@@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#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