-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i2c_master): Add an api for retrieveing handle via port,
Closes #13968
- Loading branch information
1 parent
c77ea73
commit 992d8bc
Showing
6 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
components/esp_driver_i2c/include/esp_private/i2c_platform.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
#include "esp_err.h" | ||
#include "driver/i2c_types.h" | ||
#include "hal/gpio_types.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Retrieves the I2C master bus handle for a specified I2C port number. | ||
* | ||
* This function retrieves the I2C master bus handle for the | ||
* given I2C port number. Please make sure the handle has already been initialized, and this | ||
* function would simply returns the existing handle. Note that the returned handle still can't be used concurrently | ||
* | ||
* @param port_num I2C port number for which the handle is to be retrieved. | ||
* @param ret_handle Pointer to a variable where the retrieved handle will be stored. | ||
* @return | ||
* - ESP_OK: Success. The handle is retrieved successfully. | ||
* - ESP_ERR_INVALID_ARG: Invalid argument, such as invalid port number | ||
* - ESP_ERR_INVALID_STATE: Invalid state, such as the I2C port is not initialized. | ||
*/ | ||
esp_err_t i2c_master_get_bus_handle(i2c_port_num_t port_num, i2c_master_bus_handle_t *ret_handle); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters