rpi_led_matrix/lib.rs
1//! Rust bindings for the C++ library [rpi-rgb-led-matrix](https://github.com/hzeller/rpi-rgb-led-matrix).
2//!
3//! # Example Usage
4//!
5//! ```
6//! use rpi_led_matrix::{LedMatrix, LedColor};
7//! let matrix = LedMatrix::new(None, None).unwrap();
8//! let mut canvas = matrix.offscreen_canvas();
9//! for red in (0..255).step_by(16) {
10//! for green in (0..255).step_by(16) {
11//! for blue in (0..255).step_by(16) {
12//! canvas.fill(&LedColor { red, green, blue });
13//! canvas = matrix.swap(canvas);
14//! }
15//! }
16//! }
17//! ```
18//!
19//! # Features
20//!
21//! ## `embeddedgraphics` (default)
22//!
23//! pulls in the [`embedded-graphics`](embedded_graphics_core) crate and implements
24//! [`DrawTarget`](embedded_graphics_core::draw_target::DrawTarget) so that you can use all of the
25//! [`embedded-graphics`](embedded_graphics_core) abstractions.
26//!
27//! ## `args`
28//!
29//! Pulls in [`clap`], enabling the [`args`](self::args) module which adds LED matrix arguments for
30//! configuration to your [`clap::App`].
31//!
32//! ## `c-stubs`
33//!
34//! Passthrough argument to [`rpi-led-matrix-sys`](rpi_led_matrix_sys). See their documentation for more info.
35//!
36//! ## `stdcpp-static-link`
37//!
38//! Passthrough argument to [`rpi-led-matrix-sys`](rpi_led_matrix_sys). See their documentation for more info.
39extern crate libc;
40
41#[cfg(feature = "args")]
42#[deny(missing_docs)]
43pub mod args;
44#[deny(missing_docs)]
45mod canvas;
46#[deny(missing_docs)]
47mod font;
48#[deny(missing_docs)]
49mod led_color;
50#[deny(missing_docs)]
51mod matrix;
52#[deny(missing_docs)]
53mod options;
54
55// import all of the C FFI functions
56pub(crate) use rpi_led_matrix_sys as ffi;
57
58// re-export objects to the root
59#[doc(inline)]
60pub use canvas::LedCanvas;
61#[doc(inline)]
62pub use font::LedFont;
63#[doc(inline)]
64pub use led_color::LedColor;
65#[doc(inline)]
66pub use matrix::LedMatrix;
67#[doc(inline)]
68pub use options::{LedMatrixOptions, LedRuntimeOptions};