6 releases (3 breaking)

0.4.0 Jul 25, 2021
0.3.2 May 13, 2021
0.3.1 Apr 3, 2021
0.2.0 Sep 10, 2020
0.1.0 Sep 8, 2020

#72 in #embedded-graphics

GPL-3.0-or-later

120KB
669 lines

watchface

A smartwatch watchface implementation in Rust

This crate provides a data structure for watchface data and a simple style for drawing it.


lib.rs:

A smartwatch watchface implementation

This crate provides the Watchface struct which can contain watchface data. Then it provides the SimpleWatchfaceStyle for drawing this data to a embedded_graphics::DrawTarget.

Current state

The current version of this crate is only able to draw the time and the style is ugly.

Examples

use chrono::Local;
use embedded_graphics::Drawable;
use embedded_graphics::mock_display::MockDisplay;
use embedded_graphics::pixelcolor::Rgb888;
use watchface::SimpleWatchfaceStyle;
use watchface::Watchface;

let style = SimpleWatchfaceStyle::default();

let styled_watchface = Watchface::build()
     .with_time(Local::now())
     .into_styled(style);

let mut display = MockDisplay::<Rgb888>::new();
display.set_allow_out_of_bounds_drawing(true); //MockDisplay is too small for SimpleWatchfaceStyle
display.set_allow_overdraw(true);
styled_watchface.draw(&mut display);

Simulator

A simulator is available for testing a watchface on a desktop. Run the example using:

cargo run --example simulator

Dependencies

~6MB
~92K SLoC