Last active
July 25, 2023 22:04
-
-
Save manewitz/de099bb455eeb36f628c26b5b1e474a6 to your computer and use it in GitHub Desktop.
Elixir - Unicorn Hat HD via Circuits.SPI [WIP]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{: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