mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
lp-i2c: Added support for LP I2C peripheral to LP core
This commit adds support for the LP I2C peripheral driver to be used by the LP core. An example is also added to demonstrate the usage of the LP I2C peripheral from the LP core.
This commit is contained in:
@@ -110,7 +110,11 @@ static const char *I2C_TAG = "i2c";
|
||||
#if SOC_I2C_NUM >= 2
|
||||
_Static_assert(I2C_NUM_1 == 1, "I2C_NUM_1 must be equal to 1");
|
||||
#endif // SOC_I2C_NUM >= 2
|
||||
#if SOC_LP_I2C_SUPPORTED
|
||||
_Static_assert(I2C_NUM_MAX == (SOC_I2C_NUM + SOC_LP_I2C_NUM), "I2C_NUM_MAX must be equal to SOC_I2C_NUM + SOC_LP_I2C_NUM");
|
||||
#else
|
||||
_Static_assert(I2C_NUM_MAX == SOC_I2C_NUM, "I2C_NUM_MAX must be equal to SOC_I2C_NUM");
|
||||
#endif /* SOC_LP_I2C_SUPPORTED */
|
||||
|
||||
typedef struct {
|
||||
i2c_ll_hw_cmd_t hw_cmd;
|
||||
@@ -259,6 +263,10 @@ esp_err_t i2c_driver_install(i2c_port_t i2c_num, i2c_mode_t mode, size_t slv_rx_
|
||||
int intr_alloc_flags)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE(i2c_num < I2C_NUM_MAX, ESP_ERR_INVALID_ARG, I2C_TAG, I2C_NUM_ERROR_STR);
|
||||
#if SOC_LP_I2C_SUPPORTED
|
||||
// TODO: IDF-5817
|
||||
ESP_RETURN_ON_FALSE(i2c_num != LP_I2C_NUM_0, ESP_ERR_INVALID_ARG, I2C_TAG, "LP_I2C is not supported via i2c_driver_intall()");
|
||||
#endif // SOC_LP_I2C_SUPPORTED
|
||||
#if SOC_I2C_SUPPORT_SLAVE
|
||||
ESP_RETURN_ON_FALSE(mode == I2C_MODE_MASTER || ( slv_rx_buf_len > 100 || slv_tx_buf_len > 100 ),
|
||||
ESP_ERR_INVALID_ARG, I2C_TAG, I2C_SLAVE_BUFFER_LEN_ERR_STR);
|
||||
|
Reference in New Issue
Block a user