fw-rust: Break everything down in multiple files
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
To reduce length of `main.rs` and therefor improve readability create source files for: - Assets (`assets.rs`): Contains all graphical assets such as the splash screen assets, symbols and the symbol table. - LCD (`lcd.rs`): Contains all lower level things regarding the LCD such as the `Lcd` struct and its implementations. - Screen (`screen/mod.rs`): - Splash (`screen/splash.rs`) - Home (`screen/home.rs`) - Setup (`screen/setup.rs`) In the future it would probably make sense to move the LCD module into the screen module.
This commit is contained in:
parent
91e120b258
commit
c2920ea334
7 changed files with 693 additions and 647 deletions
258
firmware/rust/src/assets.rs
Normal file
258
firmware/rust/src/assets.rs
Normal file
|
@ -0,0 +1,258 @@
|
|||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
pub const SACRED_CHAO: [[u8; 40]; 5] = [
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF0, 0xF8, 0xFC, 0xFC, 0xFE, 0xFE, 0xFE,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFC, 0xFC,
|
||||
0xF8, 0xF0, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00,
|
||||
],
|
||||
[
|
||||
0x80, 0xF0, 0xFC, 0xFE, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0xC3,
|
||||
0xE3, 0x73, 0x37, 0x17, 0x07, 0x0F, 0x1E, 0x3C, 0xF0, 0x80,
|
||||
],
|
||||
[
|
||||
0xFF, 0xFF, 0xFF, 0xE7, 0xC3, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xFC, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0x30, 0x00, 0x00, 0xFF,
|
||||
],
|
||||
[
|
||||
0x01, 0x0F, 0x3F, 0x4F, 0x9F, 0x3F, 0x3E, 0x3C, 0x7C, 0x7C, 0x7C, 0x7C, 0x3E, 0x3E, 0x3E,
|
||||
0x1F, 0x1F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x0F,
|
||||
0x0F, 0x0F, 0x07, 0x07, 0x03, 0x81, 0x40, 0x30, 0x0E, 0x01,
|
||||
],
|
||||
[
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x08, 0x08, 0x10, 0x20, 0x20, 0x40, 0x40, 0x40,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20,
|
||||
0x10, 0x08, 0x08, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
pub const ONDERS_ORG: [[u8; 48]; 2] = [
|
||||
[
|
||||
0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xF8, 0x00, 0x00,
|
||||
0xE0, 0xA0, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0xA0, 0xA0, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00, 0xE0, 0x60, 0xE0, 0x00, 0x00,
|
||||
0xE0, 0x60, 0xE0,
|
||||
],
|
||||
[
|
||||
0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03, 0x02, 0x03, 0x00, 0x00,
|
||||
0x03, 0x02, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x03, 0x00, 0x00,
|
||||
0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x02, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0B, 0x0A, 0x0F,
|
||||
],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_0: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x0C, 0xFC, 0xF8],
|
||||
&[0x1F, 0x3F, 0x30, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_1: [&[u8]; 2] = [
|
||||
&[0x30, 0x30, 0xFC, 0xFC, 0x00],
|
||||
&[0x30, 0x30, 0x3F, 0x3F, 0x30],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_2: [&[u8]; 2] = [
|
||||
&[0x18, 0x1C, 0x8C, 0xFC, 0xF8],
|
||||
&[0x38, 0x3E, 0x3F, 0x33, 0x30],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_3: [&[u8]; 2] = [
|
||||
&[0x18, 0x9C, 0x8C, 0xFC, 0x78],
|
||||
&[0x18, 0x39, 0x31, 0x3F, 0x1E],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_4: [&[u8]; 2] = [
|
||||
&[0x80, 0xE0, 0x78, 0xFC, 0xFC],
|
||||
&[0x07, 0x07, 0x06, 0x3F, 0x3F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_5: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x8C, 0x8C, 0x0C],
|
||||
&[0x1C, 0x3D, 0x31, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_6: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x8C, 0xBC, 0x38],
|
||||
&[0x1F, 0x3F, 0x31, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_7: [&[u8]; 2] = [
|
||||
&[0x0C, 0x0C, 0xEC, 0xFC, 0x1C],
|
||||
&[0x00, 0x3E, 0x3F, 0x01, 0x00],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_8: [&[u8]; 2] = [
|
||||
&[0x78, 0xFC, 0x8C, 0xFC, 0x78],
|
||||
&[0x1E, 0x3F, 0x31, 0x3F, 0x1E],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_9: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x8C, 0xFC, 0xF8],
|
||||
&[0x1C, 0x3D, 0x31, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_COLON: [&[u8]; 2] = [&[0x30, 0x30], &[0x0C, 0x0C]];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_A: [&[u8]; 2] = [
|
||||
&[0xC0, 0xF0, 0x3C, 0x3C, 0xF0, 0xC0],
|
||||
&[0x3F, 0x3F, 0x06, 0x06, 0x3F, 0x3F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_B: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0x78],
|
||||
&[0x3F, 0x3F, 0x31, 0x31, 0x3F, 0x1E],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_C: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x0C, 0x1C, 0x18],
|
||||
&[0x1F, 0x3F, 0x30, 0x38, 0x18],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_E: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x8C, 0x8C, 0x0C, 0x0C],
|
||||
&[0x3F, 0x3F, 0x31, 0x31, 0x30, 0x30],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_G: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x0C, 0x0C, 0x3C, 0x38],
|
||||
&[0x1F, 0x3F, 0x30, 0x33, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_H: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x80, 0x80, 0xFC, 0xFC],
|
||||
&[0x3F, 0x3F, 0x01, 0x01, 0x3F, 0x3F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_I: [&[u8]; 2] = [&[0x0C, 0xFC, 0xFC, 0x0C], &[0x30, 0x3F, 0x3F, 0x30]];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_K: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0xC0, 0xF0, 0x7C, 0x1C],
|
||||
&[0x3F, 0x3F, 0x03, 0x0F, 0x3E, 0x38],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_L: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x00, 0x00, 0x00],
|
||||
&[0x3F, 0x3F, 0x30, 0x30, 0x30],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_N: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0xF0, 0xC0, 0x00, 0xFC, 0xFC],
|
||||
&[0x3F, 0x3F, 0x00, 0x03, 0x0F, 0x3F, 0x3F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_O: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x0C, 0x0C, 0xFC, 0xF8],
|
||||
&[0x1F, 0x3F, 0x30, 0x30, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_P: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0xF8],
|
||||
&[0x3F, 0x3F, 0x01, 0x01, 0x01, 0x00],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_R: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x8C, 0x8C, 0xFC, 0xF8],
|
||||
&[0x3F, 0x3F, 0x01, 0x03, 0x3F, 0x3E],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_S: [&[u8]; 2] = [
|
||||
&[0xF8, 0xFC, 0x8C, 0x8C, 0x9C, 0x18],
|
||||
&[0x18, 0x39, 0x31, 0x31, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_T: [&[u8]; 2] = [
|
||||
&[0x0C, 0x0C, 0xFC, 0xFC, 0x0C, 0x0C],
|
||||
&[0x00, 0x00, 0x3F, 0x3F, 0x00, 0x00],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_U: [&[u8]; 2] = [
|
||||
&[0xFC, 0xFC, 0x00, 0x00, 0xFC, 0xFC],
|
||||
&[0x1F, 0x3F, 0x30, 0x30, 0x3F, 0x1F],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
const SYM_INVALID: [&[u8]; 2] = [
|
||||
&[0x80, 0xE0, 0x98, 0xCC, 0x4C, 0x18, 0xE0, 0x80],
|
||||
&[0x01, 0x07, 0x1F, 0x24, 0x25, 0x1F, 0x07, 0x01],
|
||||
];
|
||||
|
||||
// TODO: Use https://github.com/rust-lang/rust/issues/85077 when stabilized
|
||||
pub const SYMBOL_TABLE: [&[&[u8]; 2]; 48] = [
|
||||
&SYM_0, // '0'
|
||||
&SYM_1, // '1'
|
||||
&SYM_2, // '2'
|
||||
&SYM_3, // '3'
|
||||
&SYM_4, // '4'
|
||||
&SYM_5, // '5'
|
||||
&SYM_6, // '6'
|
||||
&SYM_7, // '7'
|
||||
&SYM_8, // '8'
|
||||
&SYM_9, // '9'
|
||||
&SYM_COLON, // ':'
|
||||
&SYM_INVALID, // ';'
|
||||
&SYM_INVALID, // '<'
|
||||
&SYM_INVALID, // '='
|
||||
&SYM_INVALID, // '>'
|
||||
&SYM_INVALID, // '?'
|
||||
&SYM_INVALID, // '@'
|
||||
&SYM_A, // 'A'
|
||||
&SYM_B, // 'B'
|
||||
&SYM_C, // 'C'
|
||||
&SYM_INVALID, // 'D'
|
||||
&SYM_E, // 'E'
|
||||
&SYM_INVALID, // 'F'
|
||||
&SYM_G, // 'G'
|
||||
&SYM_H, // 'H'
|
||||
&SYM_I, // 'I'
|
||||
&SYM_INVALID, // 'J'
|
||||
&SYM_K, // 'K'
|
||||
&SYM_L, // 'L'
|
||||
&SYM_INVALID, // 'M'
|
||||
&SYM_N, // 'N'
|
||||
&SYM_O, // 'O'
|
||||
&SYM_P, // 'P'
|
||||
&SYM_INVALID, // 'Q'
|
||||
&SYM_R, // 'R'
|
||||
&SYM_S, // 'S'
|
||||
&SYM_T, // 'T'
|
||||
&SYM_U, // 'U'
|
||||
&SYM_INVALID, // 'V'
|
||||
&SYM_INVALID, // 'W'
|
||||
&SYM_INVALID, // 'X'
|
||||
&SYM_INVALID, // 'Y'
|
||||
&SYM_INVALID, // 'Z'
|
||||
&SYM_INVALID, // '['
|
||||
&SYM_INVALID, // '\'
|
||||
&SYM_INVALID, // ']'
|
||||
&SYM_INVALID, // '^'
|
||||
&SYM_INVALID, // '_'
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue