Skip to content

Instantly share code, notes, and snippets.

@manewitz
Last active July 25, 2023 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manewitz/de099bb455eeb36f628c26b5b1e474a6 to your computer and use it in GitHub Desktop.
Save manewitz/de099bb455eeb36f628c26b5b1e474a6 to your computer and use it in GitHub Desktop.
Elixir - Unicorn Hat HD via Circuits.SPI [WIP]
{:ok, spi_ref} = Circuits.SPI.open("spidev0.0", speed_hz: 9_000_000)
off = <<0x72>> <> (<<0::8, 0::8, 0::8>> |> :binary.copy(16 * 16))
red = <<0x72>> <> (<<255::8, 0::8, 0::8>> |> :binary.copy(16 * 16))
green = <<0x72>> <> (<<0::8, 255::8, 0::8>> |> :binary.copy(16 * 16))
blue = <<0x72>> <> (<<0::8, 0::8, 255::8>> |> :binary.copy(16 * 16))
white = <<0x72>> <> (<<255::8, 255::8, 255::8>> |> :binary.copy(16 * 16))
Circuits.SPI.transfer(spi_ref, red)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment