ESP32 - IDF - I2C

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
kurtwerbrouck
 
Posts: 2
Joined: Sat Jan 23, 2021 11:35 am

ESP32 - IDF - I2C

Post by kurtwerbrouck »

hello

i trying to transform a part of the ssd1306 lib created by adafruit to and ESP32 IDF version.
Clearing - displaying - Horizontal scroll is working ok so for

example Horizontal scrolling - 2 lines :
esp_err_t espRc;

i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);

i2c_master_write_byte(cmd, (OLED_I2C_ADDRESS << 1) | I2C_MASTER_WRITE, true);
i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_CMD_STREAM, true);

i2c_master_write_byte(cmd, 0x26, true); // vertical and horizontal scroll (p29)
i2c_master_write_byte(cmd, 0x00, true); // dummy
i2c_master_write_byte(cmd, 0x02, true); // start page
i2c_master_write_byte(cmd, 0x06, true); // interval
i2c_master_write_byte(cmd, 0x03, true); // end page
i2c_master_write_byte(cmd, 0x00, true); // dummy 00
i2c_master_write_byte(cmd, 0xFF, true); // dummy ff
i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_CMD_SINGLE, true);
//i2c_master_write_byte(cmd, 0x00, true );
i2c_master_write_byte(cmd, 0x2F, true); // start scroll

i2c_master_stop(cmd);
espRc = i2c_master_cmd_begin(I2C_NUM_0, cmd, 10/portTICK_PERIOD_MS);
if (espRc == ESP_OK) {
ESP_LOGI(tag, "Scroll command HOR L R succeeded");
} else {
ESP_LOGE(tag, "Scroll command HOR L R failed. code: 0x%.2X", espRc);
}

i2c_cmd_link_delete(cmd);

However , i cant get the Diagonal scrolling working

esp_err_t espRc;

i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);

i2c_master_write_byte(cmd, (OLED_I2C_ADDRESS << 1) | I2C_MASTER_WRITE, true);

i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_CMD_STREAM, true);
i2c_master_write_byte(cmd, 0xA3, true); // set vertical scroll area (p30)
i2c_master_write_byte(cmd, 0x00, true); // amount of fix lines top
i2c_master_write_byte(cmd, 0x3F, true); // scrolling amount of line

//i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_CMD_SINGLE, true);
i2c_master_write_byte(cmd, 0x2F, true); // activate scroll (p29)

//i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_CMD_STREAM, true);
i2c_master_write_byte(cmd, 0x2A, true); // vertical and horizontal scroll (p29)
i2c_master_write_byte(cmd, 0x00, true); // dummy
i2c_master_write_byte(cmd, 0x00, true); // start page
i2c_master_write_byte(cmd, 0x00, true); // interval
i2c_master_write_byte(cmd, 0x07, true); // end page
i2c_master_write_byte(cmd, 0x01, true); // vertikale offset

//i2c_master_write_byte(cmd, OLED_CONTROL_BYTE_CMD_SINGLE, true);
i2c_master_write_byte(cmd, 0x2F, true); // activate scroll (p29)

i2c_master_stop(cmd);
espRc = i2c_master_cmd_begin(I2C_NUM_0, cmd, 10/portTICK_PERIOD_MS);
if (espRc == ESP_OK) {
ESP_LOGI(tag, "Scroll command ver T B succeeded");
} else {
ESP_LOGE(tag, "Scroll command ver T B failed. code: 0x%.2X", espRc);
}

i2c_cmd_link_delete(cmd);

I verified the needed command and data in the i2C stream against the commands and data in the ss1306 lib.

Any suggestion what i am missing?

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”