Crate watchface

Crate watchface 

Source
Expand description

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

Modules§

battery
battery_icon
time

Structs§

SimpleWatchfaceStyle
Simple watchface style
TextualTimeWatchfaceStyle
Watchface
Representation of watchface data
WatchfaceBuilder
Builder for creating watchface data