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
use embedded_graphics::{
prelude::*,
fonts,
pixelcolor::Rgb565,
primitives::{
Circle,
Rectangle,
},
};
use mynewt::{
result::*,
sys::console,
};
pub fn test_display() -> MynewtResult<()> {
console::print("Rust test display\n"); console::flush();
let background = Rectangle::<Rgb565>
::new( Coord::new( 0, 0 ), Coord::new( 239, 239 ) )
.fill( Some( Rgb565::from(( 0x00, 0x00, 0x00 )) ) );
let circle = Circle::<Rgb565>
::new( Coord::new( 40, 40 ), 40 )
.fill( Some( Rgb565::from(( 0xff, 0x00, 0xff )) ) );
let square = Rectangle::<Rgb565>
::new( Coord::new( 60, 60 ), Coord::new( 150, 150 ) )
.fill( Some( Rgb565::from(( 0x00, 0x00, 0xff )) ) );
let text = fonts::Font12x16::<Rgb565>
::render_str("I AM PINETIME")
.stroke( Some( Rgb565::from(( 0x00, 0x00, 0x00 )) ) )
.fill( Some( Rgb565::from(( 0xff, 0xff, 0x00 )) ) )
.translate( Coord::new( 20, 16 ));
druid::draw_to_display(background);
druid::draw_to_display(circle);
druid::draw_to_display(square);
druid::draw_to_display(text);
Ok(())
}