This commit is contained in:
Pascal Engélibert 2023-08-21 23:27:37 +02:00
commit 8dda09689d
6 changed files with 67 additions and 9 deletions

View file

@ -97,6 +97,11 @@ impl Keypad {
.for_each(|key| keys[key as usize] = true);
keys
}
#[cfg(not(feature = "simulator"))]
fn get_keys(&self) -> [bool; NB_KEYS] {
[false; NB_KEYS]
}
}
#[derive(Clone, Copy)]
@ -137,8 +142,28 @@ pub struct KeyEvent {
repeats: u8,
}
/*impl KeyEvent {
pub fn get_char(&self, key_input_mode: KeyInputMode) -> Option<char> {
use Key::*;
match key_input_mode {
KeyInputMode::Digit => match self.key {
D0 =>
}
}
}
}*/
//ncb1 upz2 tdk3
//eow4 lqh5 age6
//sfx7 rmj8 ivy9
pub enum KeyEventType {
Pressed,
Down,
Released,
}
pub enum KeyInputMode {
Digit,
Alpha,
}

View file

@ -14,6 +14,16 @@ mod time;
use energy::EnergyStatus;
use state::*;
cfg_if::cfg_if! {
if #[cfg(not(feature = "simulator"))] {
use maduino_zero_4g as bsp;
use bsp::hal;
use hal::pac::{CorePeripherals, Peripherals};
use hal::prelude::*;
}
}
use arrayvec::ArrayString;
use core::fmt::Write;
use embedded_graphics::{
@ -50,7 +60,7 @@ fn state_mut() -> &'static mut State {
unsafe { &mut STATE }
}
#[cfg_attr(not(feature = "simulator"), cortex_m_rt::entry)]
#[cfg_attr(not(feature = "simulator"), bsp::entry)]
fn main() -> ! {
let mut display = display::Display::new();
let mut keypad = keypad::Keypad::default();

View file

@ -10,6 +10,7 @@ pub fn timestamp() -> u64 {
.as_secs()
}
// TODO
#[cfg(not(feature = "simulator"))]
pub fn timestamp() -> u64 {
1692450980
@ -22,3 +23,9 @@ pub fn millis() -> u64 {
.unwrap()
.as_millis() as u64
}
// TODO
#[cfg(not(feature = "simulator"))]
pub fn millis() -> u64 {
1692450980000
}