Compare commits

..

No commits in common. "wip-belpomme" and "main" have entirely different histories.

7 changed files with 17 additions and 75 deletions

23
Cargo.lock generated
View file

@ -340,27 +340,6 @@ dependencies = [
"void", "void",
] ]
[[package]]
name = "embedded-layout"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7adbc16ba694006a121bce08a8935186d16cb008a4c9e20c5e346517ad1e0ac8"
dependencies = [
"embedded-graphics",
"embedded-layout-macros",
]
[[package]]
name = "embedded-layout-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "352186cee85e4cf9104c42b4dfd0295a22901c5d2bf0c26efd47265adcf1c52d"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "embedded-sdmmc" name = "embedded-sdmmc"
version = "0.3.0" version = "0.3.0"
@ -842,13 +821,11 @@ dependencies = [
"cfg-if", "cfg-if",
"embedded-graphics", "embedded-graphics",
"embedded-graphics-simulator", "embedded-graphics-simulator",
"embedded-layout",
"embedded-sdmmc", "embedded-sdmmc",
"embedded-text", "embedded-text",
"epd-waveshare", "epd-waveshare",
"maduino_zero_4g", "maduino_zero_4g",
"panic-halt", "panic-halt",
"static_assertions",
"tz-rs", "tz-rs",
"tzdb", "tzdb",
] ]

View file

@ -11,13 +11,11 @@ arrayvec = { version = "0.7.4", default_features = false }
atsamd-hal = { version = "0.15.1", default_features = false, features = ["samd21g", "samd21g-rt", "usb"] } atsamd-hal = { version = "0.15.1", default_features = false, features = ["samd21g", "samd21g-rt", "usb"] }
cfg-if = "1.0.0" cfg-if = "1.0.0"
embedded-graphics = "0.7.1" embedded-graphics = "0.7.1"
embedded-layout = "0.2.0"
embedded-text = "0.5.0" embedded-text = "0.5.0"
embedded-sdmmc = { version = "0.3.0", default_features = false } embedded-sdmmc = { version = "0.3.0", default_features = false }
epd-waveshare = "0.5.0" epd-waveshare = "0.5.0"
maduino_zero_4g = { git = "https://github.com/ZettaScript/atsamd", branch = "maduino-zero-4g", features = ["usb"] } maduino_zero_4g = { git = "https://github.com/ZettaScript/atsamd", branch = "maduino-zero-4g", features = ["usb"] }
panic-halt = "0.2.0" panic-halt = "0.2.0"
static_assertions = "1.1.0"
tz-rs = { version = "0.6.14", default_features = false, features = ["const"] } tz-rs = { version = "0.6.14", default_features = false, features = ["const"] }
tzdb = { version = "0.5.7", optional = true } tzdb = { version = "0.5.7", optional = true }

View file

@ -22,11 +22,7 @@ GSM will be shutting down in France in a few years so if you have an old cellpho
## Install tools ## Install tools
```bash ```bash
# Choose one line depending on your distro
sudo pacman -S arm-none-eabi-gcc sudo pacman -S arm-none-eabi-gcc
sudo apt install gcc-arm-none-eabi
# Install Rust target
rustup target add thumbv6m-none-eabi rustup target add thumbv6m-none-eabi
``` ```

View file

@ -69,7 +69,6 @@ impl App for Dial {
} }
Key::OptionRight => { Key::OptionRight => {
if mode_state.line.pop().is_some() { if mode_state.line.pop().is_some() {
// TODO redraw background over the erased character
mode_state.line_changed = true; mode_state.line_changed = true;
} else { } else {
return Some(ModeState::Clock(Default::default())); return Some(ModeState::Clock(Default::default()));

View file

@ -69,7 +69,8 @@ impl Keypad {
#[cfg(feature = "simulator")] #[cfg(feature = "simulator")]
fn get_keys(&self) -> [bool; NB_KEYS] { fn get_keys(&self) -> [bool; NB_KEYS] {
use embedded_graphics_simulator::{sdl2::Keycode, SimulatorEvent}; use embedded_graphics_simulator::sdl2::Keycode;
use embedded_graphics_simulator::SimulatorEvent;
let mut keys = [false; NB_KEYS]; let mut keys = [false; NB_KEYS];
crate::display::window_mut() crate::display::window_mut()
@ -87,7 +88,7 @@ impl Keypad {
Keycode::Num8 | Keycode::Kp8 => Some(Key::D8), Keycode::Num8 | Keycode::Kp8 => Some(Key::D8),
Keycode::Num9 | Keycode::Kp9 => Some(Key::D9), Keycode::Num9 | Keycode::Kp9 => Some(Key::D9),
Keycode::KpEnter | Keycode::Return => Some(Key::Enter), Keycode::KpEnter | Keycode::Return => Some(Key::Enter),
Keycode::Asterisk | Keycode::KpMultiply => Some(Key::Asterisk), Keycode::Asterisk => Some(Key::Asterisk),
Keycode::Hash | Keycode::KpHash => Some(Key::Hash), Keycode::Hash | Keycode::KpHash => Some(Key::Hash),
// TODO more // TODO more
_ => None, _ => None,
@ -147,22 +148,19 @@ impl KeyEvent {
pub fn get_char(&self, key_input_mode: KeyInputMode) -> Option<char> { pub fn get_char(&self, key_input_mode: KeyInputMode) -> Option<char> {
use Key::*; use Key::*;
match key_input_mode { match key_input_mode {
KeyInputMode::Digit => match (self.key, self.repeats) { KeyInputMode::Digit => match self.key {
(D0, _) => Some('0'), D0 => Some('0'),
(D1, _) => Some('1'), D1 => Some('1'),
(D2, _) => Some('2'), D2 => Some('2'),
(D3, _) => Some('3'), D3 => Some('3'),
(D4, _) => Some('4'), D4 => Some('4'),
(D5, _) => Some('5'), D5 => Some('5'),
(D6, _) => Some('6'), D6 => Some('6'),
(D7, _) => Some('7'), D7 => Some('7'),
(D8, _) => Some('8'), D8 => Some('8'),
(D9, _) => Some('9'), D9 => Some('9'),
(Asterisk, 1) => Some('*'), Asterisk => Some('*'),
(Asterisk, 2) => Some('+'), Hash => Some('#'),
(Asterisk, 3) => Some('p'),
(Asterisk, 4) => Some('W'),
(Hash, _) => Some('#'),
_ => None, _ => None,
}, },
_ => { _ => {

View file

@ -10,7 +10,6 @@ mod gui;
mod keypad; mod keypad;
mod state; mod state;
mod strf; mod strf;
mod text_input;
mod time; mod time;
use apps::App; use apps::App;
@ -22,10 +21,7 @@ use state::*;
use arrayvec::ArrayString; use arrayvec::ArrayString;
use core::fmt::Write; use core::fmt::Write;
use embedded_graphics::{ use embedded_graphics::{
mono_font::{ mono_font::{ascii::FONT_10X20, ascii::FONT_6X10, ascii::FONT_9X15, MonoTextStyleBuilder},
ascii::{FONT_10X20, FONT_6X10, FONT_9X15},
MonoTextStyleBuilder,
},
pixelcolor::BinaryColor, pixelcolor::BinaryColor,
prelude::*, prelude::*,
primitives::{Line, PrimitiveStyle, PrimitiveStyleBuilder, Rectangle, StrokeAlignment}, primitives::{Line, PrimitiveStyle, PrimitiveStyleBuilder, Rectangle, StrokeAlignment},
@ -45,22 +41,6 @@ use maduino_zero_4g::{
use panic_halt as _; use panic_halt as _;
use tz::DateTime; use tz::DateTime;
// Check that stack overflow is unlikely
#[cfg(not(feature = "simulator"))]
static_assertions::const_assert!(
core::mem::size_of::<(
State,
ModeState,
Peripherals,
maduino_zero_4g::Pins,
CorePeripherals,
keypad::Keypad,
Display,
Context,
fs::Fs,
)>() < 16 * 1024
);
#[cfg_attr(not(feature = "simulator"), bsp::entry)] #[cfg_attr(not(feature = "simulator"), bsp::entry)]
fn main() -> ! { fn main() -> ! {
cfg_if::cfg_if! { cfg_if::cfg_if! {

View file

@ -1,6 +0,0 @@
use arrayvec::ArrayString;
pub struct TextInput<const N: usize> {
cursor: usize,
value: ArrayString<N>,
}