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
use display_interface::WriteOnlyDataCommand;
use crate::{Builder, ModelOptions, Orientation};
use super::ST7789;
impl<DI> Builder<DI, ST7789>
where
DI: WriteOnlyDataCommand,
{
pub fn st7789(di: DI) -> Self {
Self::with_model(di, ST7789)
}
pub fn st7789_pico1(di: DI) -> Self {
Self::new(
di,
ST7789,
ModelOptions::with_all((135, 240), (135, 240), pico1_offset).with_invert_colors(true),
)
}
}
pub(crate) fn pico1_offset(options: &ModelOptions) -> (u16, u16) {
match options.orientation() {
Orientation::Portrait(false) => (52, 40),
Orientation::Portrait(true) => (53, 40),
Orientation::Landscape(false) => (40, 52),
Orientation::Landscape(true) => (40, 53),
Orientation::PortraitInverted(false) => (53, 40),
Orientation::PortraitInverted(true) => (52, 40),
Orientation::LandscapeInverted(false) => (40, 53),
Orientation::LandscapeInverted(true) => (40, 52),
}
}