|
29 | 29 | #include "driver/i2c_master.h" |
30 | 30 | #include "esp32-hal-periman.h" |
31 | 31 |
|
32 | | - |
33 | 32 | typedef volatile struct { |
34 | 33 | bool initialized; |
35 | 34 | uint32_t frequency; |
@@ -114,17 +113,17 @@ esp_err_t i2cInit(uint8_t i2c_num, int8_t sda, int8_t scl, uint32_t frequency) { |
114 | 113 | #if SOC_LP_I2C_SUPPORTED |
115 | 114 | if (i2c_num >= SOC_HP_I2C_NUM) { |
116 | 115 | bus_config.lp_source_clk = LP_I2C_SCLK_DEFAULT; |
117 | | - } else |
| 116 | + } else |
118 | 117 | #endif |
119 | 118 | { |
120 | 119 | bus_config.clk_source = I2C_CLK_SRC_DEFAULT; |
121 | 120 | } |
122 | 121 | bus_config.glitch_ignore_cnt = 7; |
123 | | - bus_config.intr_priority = 0; // auto |
124 | | - bus_config.trans_queue_depth = 0; // only valid in asynchronous transaction, which Arduino does not use |
| 122 | + bus_config.intr_priority = 0; // auto |
| 123 | + bus_config.trans_queue_depth = 0; // only valid in asynchronous transaction, which Arduino does not use |
125 | 124 | bus_config.flags.enable_internal_pullup = 1; |
126 | 125 | #if SOC_I2C_SUPPORT_SLEEP_RETENTION |
127 | | - bus_config.flags.allow_pd = 1; // backup/restore the I2C registers before/after entering/exist sleep mode |
| 126 | + bus_config.flags.allow_pd = 1; // backup/restore the I2C registers before/after entering/exist sleep mode |
128 | 127 | #endif |
129 | 128 |
|
130 | 129 | ret = i2c_new_master_bus(&bus_config, &bus_handle); |
@@ -208,7 +207,7 @@ static esp_err_t i2cAddDeviceIfNeeded(uint8_t i2c_num, uint16_t address) { |
208 | 207 | i2c_master_dev_handle_t dev_handle = NULL; |
209 | 208 | i2c_device_config_t dev_config; |
210 | 209 | memset(&dev_config, 0, sizeof(i2c_device_config_t)); |
211 | | - dev_config.dev_addr_length = I2C_ADDR_BIT_LEN_7; // Arduino supports only 7bit addresses |
| 210 | + dev_config.dev_addr_length = I2C_ADDR_BIT_LEN_7; // Arduino supports only 7bit addresses |
212 | 211 | dev_config.device_address = address; |
213 | 212 | dev_config.scl_speed_hz = bus[i2c_num].frequency; |
214 | 213 | dev_config.scl_wait_us = 0; |
|
0 commit comments