Files
esp-st7567/README.md
2026-08-20 07:43:18 +02:00

32 lines
818 B
Markdown

# ST7567 I2C display driver
For esp-idf, same idea as the st7920 driver
This is the I2C version, also see [SPI version](https://git.drath.cc/drath/esp-st7567-spi)
## Usage
```c
i2c_master_bus_config_t bus_cfg = {
.i2c_port = I2C_NUM_0,
.sda_io_num = GPIO_NUM_21,
.scl_io_num = GPIO_NUM_22,
.clk_source = I2C_CLK_SRC_DEFAULT,
.glitch_ignore_cnt = 7,
.flags.enable_internal_pullup = true,
};
i2c_master_bus_handle_t bus;
i2c_new_master_bus(&bus_cfg, &bus);
st7567_config_t cfg = {
.i2c_bus = bus,
.i2c_addr = ST7567_I2C_ADDR_DEFAULT, // 0x3F,
.i2c_clock_speed_hz = 400000,
.contrast = 0x38, // good for generic modules at 3.3v
};
st7567_device_t dev;
st7567_init(&cfg, &dev);
st7567_set_backlight(&dev, true);
st7567_draw_pixel(&dev, 10, 10);
st7567_update_screen(&dev);
```