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
#![no_std]

#[derive(Copy, Clone, PartialEq)]
pub enum AspectRatio {
    Standard, // 4:3
    Wide,     // 16:9
}

impl AspectRatio {
    pub fn diagonal_to_width(&self, diagonal: usize) -> usize {
        match self {
            AspectRatio::Wide => diagonal * 1600 / 1835,
            AspectRatio::Standard => diagonal * 4 / 5,
        }
    }

    pub fn diagonal_to_height(&self, diagonal: usize) -> usize {
        match self {
            AspectRatio::Wide => diagonal * 900 / 1835,
            AspectRatio::Standard => diagonal * 3 / 5,
        }
    }
}

mod altitude;
mod aoa;
mod battery;
mod drawable;
mod flight_mode;
mod g_force;
mod heading_tape;
mod height;
pub mod hud;
mod pitch_ladder;
mod rssi;
mod speed;
pub mod symbol;
mod telemetry;
#[cfg(test)]
mod test_utils;
mod velocity_vector;
mod vertial_speed;
mod waypoint;
mod waypoint_vector;

#[cfg(test)]
#[macro_use]
extern crate std;

#[cfg(test)]
extern crate ascii;