Files
esp-st7567/st7567/st7567-i2c.h
2026-08-20 21:41:27 +02:00

32 lines
926 B
C

#ifndef ST7567_I2C_H
#define ST7567_I2C_H
#include "esp_err.h"
#include "driver/i2c_master.h"
#include "st7567-common.h"
// Display dimensions
#define ST7567_WIDTH 128
#define ST7567_HEIGHT 64
#define ST7567_PAGES (ST7567_HEIGHT / 8)
// Configuration structure
typedef struct {
i2c_master_bus_handle_t i2c_bus; // already-initialized I2C bus
uint16_t i2c_addr; // 7-bit device address, 0 = use ST7567_I2C_ADDR_DEFAULT
uint32_t i2c_clock_speed_hz; // 0 = use 400kHz default
uint8_t contrast; // 0-63, 0 = use a sane default (0x20)
} st7567_i2c_config_t;
/**
* @brief Initialize ST7567 display
*
* @param config Configuration structure
* @param device Pointer to store device state (framebuffer etc, caller-owned)
* @return esp_err_t ESP_OK on success
*/
esp_err_t st7567_init(const st7567_i2c_config_t *config, st7567_device_t *device);
#endif // ST7567_I2C_H