atomvm_gleam/display

Types

Backlight active level (low / high), matching AtomGL port options.

pub type ActiveLevel {
  Low
  High
}

Constructors

  • Low
  • High

Options passed to the AtomGL display port.

Built into the Erlang proplist expected by erlang:open_port/2 with {spawn, <<"display">>}.

clock_speed_hz is optional; omit it (None) to keep AtomGL’s panel default.

pub type Config {
  Config(
    compatible: String,
    init_seq_type: String,
    enable_tft_invon: Bool,
    width: Int,
    height: Int,
    rotation: Int,
    reset: Int,
    dc: Int,
    cs: Int,
    backlight: Int,
    backlight_active: ActiveLevel,
    backlight_enabled: Bool,
    clock_speed_hz: option.Option(Int),
    spi_host: spi.Spi,
  )
}

Constructors

  • Config(
      compatible: String,
      init_seq_type: String,
      enable_tft_invon: Bool,
      width: Int,
      height: Int,
      rotation: Int,
      reset: Int,
      dc: Int,
      cs: Int,
      backlight: Int,
      backlight_active: ActiveLevel,
      backlight_enabled: Bool,
      clock_speed_hz: option.Option(Int),
      spi_host: spi.Spi,
    )

Opaque handle for an AtomGL display port, opened via erlang:open_port({spawn, <<"display">>}, Opts).

See erlang:open_port/2.

pub type Display

Values

pub fn deregister_font(display: Display, name: String) -> Nil

Release a previously registered font.

See port:call/2.

pub fn open(config: Config) -> Display

Open the AtomGL display port with the given options. Pin and panel values stay in the application so each workshop exercise shows the wiring.

See erlang:open_port/2.

pub fn register_font(
  display: Display,
  name: String,
  bytes: BitArray,
) -> Nil

Register a font binary under name for later {text, …} items.

name is turned into an Erlang atom (for example "dogica" → dogica).

See port:call/2.

pub fn update(display: Display, items: List(a)) -> Nil

Push a display list to the panel. Item types are scene-specific and pass through as Erlang terms AtomGL already understands ({update, Items}). Common shapes include text, rect, image (rgba8888), and scaled_cropped_image.

See port:call/2.

✨ Search Document