A library for the Raspberry Pi Sense HAT LED Screen
The Raspberry Pi Sense HAT has an 8×8 RGB LED matrix that provides its own driver for the Linux framebuffer.
This library provides a thread-safe, strong-typed, high-level API for the LED matrix, treating it as you would any other screen on a Linux box.
Usage
To use this crate with the default features, add this to your Cargo.toml:
[dependencies]
sensehat-screen = "0.1"
or, to manually specify the features::
[dependencies]
sensehat-screen = { version = "0.1", default-features = false, features = ["fonts"] }
Then you can use it with your crate:
extern crate sensehat_screen
use ;
Example
The following program shows how to:
- Open the framebuffer file-descriptor for the LED matrix screen (
screen) - Define a pixel color (
red_pixel) - Define a vector of each pixel color that makes up the screen (
all_64_pixels) - Turn that vector into a valid screen frame
- Show the frame on the screen
extern crate sensehat_screen;
use ;
Source Code Examples
Features
default
By default, the linux-framebuffer, fonts, offset, rotate, clip, and serde-support features are included.
linux-framebuffer
In default. Use the Linux framebuffer to write to the LED matrix.
fonts
In default. A collection of legacy 8x8 fonts, renderable on the LED matrix.
See this for more information.
offset
In default. Support for offsetting the PixelFrame left/right/up/down.
rotate
In default. Support for rotating PixelFrames by 90-degree steps.
clip
In default. Support for combining, and clipping two PixelFrames onto a single frame.
serde-support
In default. Enables support for serialization/deserialization with serde.
big-endian
Uses big-endian format, suitable for non-AMD64/x86-64 processors. This is used when encoding/decoding 16-bit RGB565 to/from 24-bit RGB.
Feature Wish List
-
linux-framebuffer- Indefault. Use the Linux framebuffer to write to the LED matrix. -
fonts- Indefault. A collection of legacy 8x8 fonts, renderable on the LED matrix. -
offset- Indefault. Support for offsetting thePixelFrameleft/right/up/down. -
rotate- Indefault. Support for rotatingPixelFrames by 90-degree steps. -
clip- Indefault. Support for combining, and clipping twoPixelFrames onto a single frame. -
serde-support- Indefault. Enables support for serialization/deserialization withserde. -
big-endian- Uses big-endian format, suitable for non-AMD64/x86-64 processors. -
images- Load 8x8 images to the LED matrix withimage. -
cgmath- Computer-graphics utilities for manipulating the matrix mathematically.