1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
//! Core types for describing communication with Luminator flip-dot and LED signs. //! //! For the basic task of sign communication, you likely want to use the high-level API //! in the [`flipdot`] crate instead. //! //! However, `flipdot_core` is useful for crates that want to interact with the sign protocol //! at a lower level than the `flipdot` crate, or who want to provide their own [`SignBus`] //! implementations for use by `flipdot`. //! //! Tested with a MAX3000 90 × 7 side sign. Should work with any flip-dot or LED sign that uses the 7-pin circular //! connector, but no guarantees. //! //! Intended only for hobbyist and educational purposes. Not affiliated with Luminator in any way. //! //! # Examples //! //! ```no_run //! use flipdot_core::{Address, Message, Operation, SignBus, SignType, State}; //! # use flipdot_testing::{VirtualSign, VirtualSignBus}; //! //! # fn get_bus() -> Box<dyn SignBus> { Box::new(VirtualSignBus::new(vec![VirtualSign::new(Address(3))])) } //! # fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> { //! # //! // Assume we have a helper function to obtain a SignBus. //! let mut bus: Box<dyn SignBus> = get_bus(); //! //! // Discover the sign and verify that is has not yet been configured. //! let message = Message::Hello(Address(3)); //! let response = bus.process_message(message)?; //! assert_eq!(Some(Message::ReportState(Address(3), State::Unconfigured)), response); //! //! // Request that the sign receive the configuration data and verify that it acknowledges. //! let message = Message::RequestOperation(Address(3), Operation::ReceiveConfig); //! let response = bus.process_message(message)?; //! assert_eq!(Some(Message::AckOperation(Address(3), Operation::ReceiveConfig)), response); //! //! # //! # Ok(()) } //! ``` //! //! [`flipdot`]: https://docs.rs/flipdot #![doc(html_root_url = "https://docs.rs/flipdot-core/0.6.0")] #![deny( missing_copy_implementations, missing_debug_implementations, trivial_casts, trivial_numeric_casts, unsafe_code )] #![warn( missing_docs, unused_extern_crates, unused_import_braces, unused_qualifications, unused_results )] mod frame; mod message; mod page; mod sign_bus; mod sign_type; pub use self::frame::{Address, Data, Frame, FrameError, MsgType}; pub use self::message::{ChunkCount, Message, Offset, Operation, State}; pub use self::page::{Page, PageError, PageId}; pub use self::sign_bus::SignBus; pub use self::sign_type::{SignType, SignTypeError};