跳转至

OLED Display Cache Configuration

OLED display framebuffer dimensions and settings. More...

Defines

Name
CACHED_HEIGHT
Cache height in pixels.
CACHED_WIDTH
Cache width in pixels.
CACHED_HEIGHT
Cache height in pixels.
CACHED_WIDTH
Cache width in pixels.

Detailed Description

OLED display framebuffer dimensions and settings.

Configures the off-screen pixel cache used by OLED drivers. These constants define the resolution that display drivers must support and the memory layout for pixel operations.

Macros Documentation

define CACHED_HEIGHT

#define CACHED_HEIGHT (8)

Cache height in pixels.

Note: Changing this requires updating all driver code that references display height or page counts.

Par: Calculation

Actual vertical pixels = CACHED_HEIGHT × 8

Specifies the vertical dimension of the display cache. In the typical SSD1306 page-based layout, this represents the number of 8-pixel-tall pages. With CACHED_HEIGHT = 8, the actual vertical resolution is 64 pixels (8 pages × 8 pixels per page).

define CACHED_WIDTH

#define CACHED_WIDTH (144)

Cache width in pixels.

Note: Changing this requires updating all driver code that handles horizontal pixel operations, boundaries, and wrapping.

Par:

  • Total Memory

Cache size = (CACHED_HEIGHT × 8 × CACHED_WIDTH) / 8 bytes = (64 × 144) / 8 = 1152 bytes * Example - Buffer Allocation

// Static allocation of OLED cache
static uint8_t oled_cache[CACHED_HEIGHT * CACHED_WIDTH];

// Total memory: 8 * 144 = 1152 bytes

Specifies the horizontal dimension of the display cache in pixels. With CACHED_WIDTH = 144, the display can show 144 characters at 6 pixels wide, or 128 characters at standard 5-pixel-wide fonts, depending on text rendering implementation.

define CACHED_HEIGHT

#define CACHED_HEIGHT (8)

Cache height in pixels.

Note: Changing this requires updating all driver code that references display height or page counts.

Par: Calculation

Actual vertical pixels = CACHED_HEIGHT × 8

Specifies the vertical dimension of the display cache. In the typical SSD1306 page-based layout, this represents the number of 8-pixel-tall pages. With CACHED_HEIGHT = 8, the actual vertical resolution is 64 pixels (8 pages × 8 pixels per page).

define CACHED_WIDTH

#define CACHED_WIDTH (144)

Cache width in pixels.

Note: Changing this requires updating all driver code that handles horizontal pixel operations, boundaries, and wrapping.

Par:

  • Total Memory

Cache size = (CACHED_HEIGHT × 8 × CACHED_WIDTH) / 8 bytes = (64 × 144) / 8 = 1152 bytes * Example - Buffer Allocation

// Static allocation of OLED cache
static uint8_t oled_cache[CACHED_HEIGHT * CACHED_WIDTH];

// Total memory: 8 * 144 = 1152 bytes

Specifies the horizontal dimension of the display cache in pixels. With CACHED_WIDTH = 144, the display can show 144 characters at 6 pixels wide, or 128 characters at standard 5-pixel-wide fonts, depending on text rendering implementation.


Updated on 2026-02-03 at 13:21:55 +0000