st7735_rs/lib.rs
1//! # ST7735 Display Driver
2//!
3//! A no_std Rust driver library for the ST7735 TFT LCD display controller.
4//!
5//! ## Features
6//!
7//! - **no_std support**: Can be used in embedded systems
8//! - **Type-safe color formats**: Compile-time guarantees for 12-bit, 16-bit, and 18-bit color modes
9//! - **Flexible range specification**: Supports Rust's standard range syntax
10//! - **Zero-cost abstractions**: Type safety without runtime overhead
11//!
12//! ## Usage Example
13//!
14//! ```rust
15//! use st7735_rs::color_format::{Pixel, Pixel16, ColorFormat};
16//! use st7735_rs::command::{Command, Slpout, Dispon, Colmod, Caset, Raset, Ramwr, draw_char};
17//!
18//! // Initialization sequence
19//! let slpout = Slpout;
20//! let colmod = Colmod::new(ColorFormat::Bit16);
21//! let dispon = Dispon;
22//!
23//! // Set drawing area
24//! let caset = Caset::new(0..=127);
25//! let raset = Raset::new(0..=159);
26//!
27//! // Fill rectangle with red color
28//! let ramwr = Ramwr::fill_rect(0..=10, 0..=10, Pixel::<Pixel16>::RED);
29//!
30//! // Or draw with a function for dynamic patterns
31//! let ramwr = Ramwr::draw_rect(0..=10, 0..=10, |x, y| {
32//! let intensity = ((x + y) * 2) as u8;
33//! Pixel::<Pixel16>::new(intensity, intensity, intensity)
34//! });
35//!
36//! // Draw a character from font data
37//! if let Some(ramwr) = draw_char('5', Pixel::<Pixel16>::WHITE, Pixel::<Pixel16>::BLACK) {
38//! // Send the command via SPI
39//! }
40//! ```
41//!
42//! For details on how to send commands via SPI, see the [`command`] module documentation.
43//!
44//! ## Modules
45//!
46//! - [`color_format`]: Color format and pixel definitions
47//! - [`command`]: ST7735 command implementations
48
49use std::env;
50
51pub mod color_format;
52pub mod command;
53
54include!(concat!(env!("OUT_DIR"), "/extracted_font.rs"));