/** * @file oled.h * @brief SSD1315 OLED 128x64 I2C driver */ #pragma once #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif /* Screen dimensions */ #define OLED_WIDTH 128 #define OLED_HEIGHT 64 #define OLED_PAGES 8 /* OLED colors */ #define OLED_COLOR_BLACK 0 #define OLED_COLOR_WHITE 1 #define OLED_COLOR_YELLOW 2 /* Top 16px */ #define OLED_COLOR_BLUE 3 /* Bottom 48px */ /* Initialize OLED */ esp_err_t oled_init(int sda, int scl); /* Clear entire display */ void oled_clear(void); /* Clear specific area */ void oled_clear_area(uint8_t x, uint8_t y, uint8_t w, uint8_t h); /* Set pixel at (x, y) */ void oled_draw_pixel(uint8_t x, uint8_t y, uint8_t color); /* Draw character at (x, y) using 8x16 font */ void oled_draw_char(uint8_t x, uint8_t y, char c, uint8_t color); /* Draw string at (x, y) */ void oled_draw_string(uint8_t x, uint8_t y, const char *str, uint8_t color); /* Draw string in top yellow area (16px high) */ void oled_draw_top_string(const char *str, uint8_t color); /* Draw horizontal line */ void oled_draw_hline(uint8_t x, uint8_t y, uint8_t w, uint8_t color); /* Draw vertical line */ void oled_draw_vline(uint8_t x, uint8_t y, uint8_t h, uint8_t color); /* Fill rectangle */ void oled_fill_rect(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t color); /* Update display (flush buffer to OLED) */ void oled_update(void); /* Turn display on/off */ void oled_display_on(void); void oled_display_off(void); /* Set contrast */ void oled_set_contrast(uint8_t value); #ifdef __cplusplus } #endif