mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-08 22:01:42 +00:00
change(ldo): make ldo driver unit_id same as datasheet
Prior to this commit, we expect passing ldo_unit_t to esp_ldo driver `ldo_unit` field. And ldo_unit_t will alias the LDO unit to values starting from 0, e.g. LDO_UNIT_1 is actually value 0. With this commit, esp_ldo driver `ldo_unit` field will start with 1, which is aligned with the datasheet. So LDO_UNIT_1 is in value 1, meanwhile setting 1 to `ldo_unit` will work as well.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -54,6 +54,17 @@ extern "C" {
|
||||
*/
|
||||
#define LDO_ID2UNIT(ldo_id) ((ldo_id) - 1)
|
||||
|
||||
/**
|
||||
* @brief Check if a LDO ID is valid
|
||||
*
|
||||
* @return True for valid
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline bool ldo_ll_is_valid_ldo_id(int ldo_id)
|
||||
{
|
||||
return ((ldo_id > 0) && (ldo_id <= LDO_LL_UNIT_NUM));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable a LDO
|
||||
*
|
||||
|
Reference in New Issue
Block a user