Skip to content

Commit 0484387

Browse files
committed
Things noted by @tore-espressif
See #70 (review)
1 parent e521123 commit 0484387

File tree

3 files changed

+6
-41
lines changed

3 files changed

+6
-41
lines changed

i2c_manager/Kconfig

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,8 @@ menu "I2C Port Settings"
99
if I2C_MANAGER_0_ENABLED
1010
config I2C_MANAGER_0_SDA
1111
int "SDA (GPIO pin)"
12-
range 0 39 if IDF_TARGET_ESP32
13-
range 0 46 if IDF_TARGET_ESP32S2
14-
range 0 21 if IDF_TARGET_ESP32C3
1512
config I2C_MANAGER_0_SCL
1613
int "SCL (GPIO pin)"
17-
range 0 39 if IDF_TARGET_ESP32
18-
range 0 46 if IDF_TARGET_ESP32S2
19-
range 0 21 if IDF_TARGET_ESP32C3
2014
config I2C_MANAGER_0_FREQ_HZ
2115
int "Frequency (Hz)"
2216
default 400000
@@ -64,16 +58,8 @@ menu "I2C Port Settings"
6458
if I2C_MANAGER_1_ENABLED
6559
config I2C_MANAGER_1_SDA
6660
int "SDA (GPIO pin)"
67-
default 32
68-
range 0 39 if IDF_TARGET_ESP32
69-
range 0 46 if IDF_TARGET_ESP32S2
70-
range 0 21 if IDF_TARGET_ESP32C3
7161
config I2C_MANAGER_1_SCL
7262
int "SCL (GPIO pin)"
73-
default 33
74-
range 0 39 if IDF_TARGET_ESP32
75-
range 0 46 if IDF_TARGET_ESP32S2
76-
range 0 21 if IDF_TARGET_ESP32C3
7763
config I2C_MANAGER_1_FREQ_HZ
7864
int "Frequency (Hz)"
7965
default 1000000

i2c_manager/i2c_manager.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ static const uint8_t ACK_CHECK_EN = 1;
6666
#define I2C_MANAGER_0_PULLUPS false
6767
#endif
6868

69-
#define I2C_MANAGER_0_TIMEOUT CONFIG_I2C_MANAGER_0_TIMEOUT / portTICK_RATE_MS
70-
#define I2C_MANAGER_0_LOCK_TIMEOUT CONFIG_I2C_MANAGER_0_LOCK_TIMEOUT / portTICK_RATE_MS
69+
#define I2C_MANAGER_0_TIMEOUT ( CONFIG_I2C_MANAGER_0_TIMEOUT / portTICK_RATE_MS )
70+
#define I2C_MANAGER_0_LOCK_TIMEOUT ( CONFIG_I2C_MANAGER_0_LOCK_TIMEOUT / portTICK_RATE_MS )
7171
#endif
7272

7373

@@ -79,8 +79,8 @@ static const uint8_t ACK_CHECK_EN = 1;
7979
#define I2C_MANAGER_1_PULLUPS false
8080
#endif
8181

82-
#define I2C_MANAGER_1_TIMEOUT CONFIG_I2C_MANAGER_1_TIMEOUT / portTICK_RATE_MS
83-
#define I2C_MANAGER_1_LOCK_TIMEOUT CONFIG_I2C_MANAGER_1_LOCK_TIMEOUT / portTICK_RATE_MS
82+
#define I2C_MANAGER_1_TIMEOUT ( CONFIG_I2C_MANAGER_1_TIMEOUT / portTICK_RATE_MS )
83+
#define I2C_MANAGER_1_LOCK_TIMEOUT ( CONFIG_I2C_MANAGER_1_LOCK_TIMEOUT / portTICK_RATE_MS )
8484
#endif
8585

8686
#define ERROR_PORT(port, fail) { \

lvgl_tft/ssd1306.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -211,36 +211,15 @@ void ssd1306_sleep_out(void)
211211
static uint8_t send_data(lv_disp_drv_t *disp_drv, void *bytes, size_t bytes_len)
212212
{
213213
(void) disp_drv;
214-
esp_err_t err;
215214

216215
uint8_t *data = (uint8_t *) bytes;
217216

218-
err = lvgl_i2c_write(OLED_I2C_PORT, OLED_I2C_ADDRESS, data[0], data + 1, bytes_len - 1 );
219-
220-
// i2c_cmd_handle_t cmd = i2c_cmd_link_create();
221-
//
222-
// i2c_master_start(cmd);
223-
// i2c_master_write_byte(cmd, (OLED_I2C_ADDRESS << 1) | I2C_MASTER_WRITE, true);
224-
//
225-
// for (size_t idx = 0; idx < bytes_len; idx++) {
226-
// i2c_master_write_byte(cmd, data[idx], true);
227-
// }
228-
//
229-
// i2c_master_stop(cmd);
230-
//
231-
// /* Send queued commands */
232-
// err = i2c_master_cmd_begin(DISP_I2C_PORT, cmd, 10 / portTICK_PERIOD_MS);
233-
// i2c_cmd_link_delete(cmd);
234-
235-
return ESP_OK == err ? 0 : 1;
217+
return lvgl_i2c_write(OLED_I2C_PORT, OLED_I2C_ADDRESS, data[0], data + 1, bytes_len - 1 );
236218
}
237219

238220
static uint8_t send_pixels(lv_disp_drv_t *disp_drv, void *color_buffer, size_t buffer_len)
239221
{
240222
(void) disp_drv;
241-
esp_err_t err;
242223

243-
err = lvgl_i2c_write(OLED_I2C_PORT, OLED_I2C_ADDRESS, OLED_CONTROL_BYTE_DATA_STREAM, color_buffer, buffer_len);
244-
245-
return ESP_OK == err ? 0 : 1;
224+
return lvgl_i2c_write(OLED_I2C_PORT, OLED_I2C_ADDRESS, OLED_CONTROL_BYTE_DATA_STREAM, color_buffer, buffer_len);
246225
}

0 commit comments

Comments
 (0)