flipdot_graphics/lib.rs
1//! An implementation of the [`embedded-graphics::DrawTarget`] trait using the [`flipdot`] crate
2//! to provide an easy way to send text and graphics to Luminator flip-dot and LED signs over RS-485.
3//!
4//! Tested with a MAX3000 90 × 7 side sign. Should work with any flip-dot or LED sign that uses the 7-pin circular
5//! connector, but no guarantees.
6//!
7//! Intended only for hobbyist and educational purposes. Not affiliated with Luminator in any way.
8//!
9//! # Examples
10//!
11//! ```no_run
12//! use flipdot_graphics::{Address, FlipdotDisplay, SignBusType, SignType};
13//!
14//! use embedded_graphics::{
15//! mono_font::{ascii::FONT_5X7, MonoTextStyle},
16//! pixelcolor::BinaryColor,
17//! prelude::*,
18//! primitives::{Circle, PrimitiveStyle, Triangle},
19//! text::{Baseline, Text},
20//! };
21//!
22//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! #
24//! // Create a display for a sign connected over serial.
25//! let mut display = FlipdotDisplay::try_new(
26//! SignBusType::Serial("/dev/ttyUSB0"),
27//! Address(3),
28//! SignType::Max3000Side90x7
29//! )?;
30//!
31//! // Draw a circle and a triangle.
32//! Circle::new(Point::new(2, 0), 6)
33//! .into_styled(PrimitiveStyle::with_stroke(BinaryColor::On, 1))
34//! .draw(&mut display)?;
35//!
36//! Triangle::new(Point::new(11, 1), Point::new(15, 5), Point::new(19, 1))
37//! .into_styled(PrimitiveStyle::with_fill(BinaryColor::On))
38//! .draw(&mut display)?;
39//!
40//! // Send the page to the sign.
41//! display.flush()?;
42//!
43//! // Keep editing the same page, adding some text.
44//! let style = MonoTextStyle::new(&FONT_5X7, BinaryColor::On);
45//! Text::with_baseline("Hello, world!", Point::new(24, 0), style, Baseline::Top)
46//! .draw(&mut display)?;
47//!
48//! // Send the updated page to the sign.
49//! display.flush()?;
50//!
51//! // Turn all pixels on.
52//! display.clear(BinaryColor::On)?;
53//! display.flush()?;
54//!
55//! // Turn all pixels off.
56//! display.clear(BinaryColor::Off)?;
57//! display.flush()?;
58//! #
59//! # Ok(()) }
60//! ```
61//!
62//! [`embedded-graphics::DrawTarget`]: https://docs.rs/embedded-graphics-core/latest/embedded_graphics_core/draw_target/trait.DrawTarget.html
63//! [`flipdot`]: https://docs.rs/flipdot
64#![doc(html_root_url = "https://docs.rs/flipdot-graphics/0.1.0")]
65#![deny(
66 missing_copy_implementations,
67 missing_debug_implementations,
68 trivial_casts,
69 trivial_numeric_casts,
70 unsafe_code
71)]
72#![warn(
73 missing_docs,
74 unused_extern_crates,
75 unused_import_braces,
76 unused_qualifications,
77 unused_results
78)]
79
80mod flipdot_display;
81
82pub use self::flipdot_display::{FlipdotDisplay, SignBusType};
83
84pub use flipdot::{Address, SignType};