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

11
Cargo.lock generated
View file

@ -524,6 +524,15 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "maduino_zero_4g"
version = "0.10.0"
dependencies = [
"atsamd-hal",
"cortex-m-rt",
"usb-device",
]
[[package]]
name = "memchr"
version = "2.3.4"
@ -816,12 +825,12 @@ dependencies = [
"arrayvec",
"atsamd-hal",
"cfg-if",
"cortex-m-rt",
"embedded-graphics",
"embedded-graphics-simulator",
"embedded-sdmmc",
"embedded-text",
"epd-waveshare",
"maduino_zero_4g",
"panic-halt",
"tinybmp",
"tinytga",

View file

@ -10,12 +10,11 @@ edition = "2021"
arrayvec = { version = "0.7.4", default_features = false }
atsamd-hal = { version = "0.15.1", default_features = false, features = ["samd21g", "samd21g-rt", "usb"] }
cfg-if = "1.0.0"
cortex-m-rt = "0.7.1"
embedded-graphics = "0.7.1"
embedded-text = "0.5.0"
embedded-sdmmc = { version = "0.5.0", default_features = false }
epd-waveshare = "0.5.0"
#maduino_zero_4g = { git = "https://github.com/ZettaScript/atsamd", branch = "maduino-zero-4g" }
maduino_zero_4g = { git = "https://github.com/ZettaScript/atsamd", branch = "maduino-zero-4g", features = ["usb"] }
panic-halt = "0.2.0"
tinybmp = "0.4.0"
tinytga = "0.4.1"
@ -26,12 +25,12 @@ tzdb = { version = "0.5.7", optional = true }
embedded-graphics-simulator = { version = "0.4.1", optional = true }
[features]
default = ["simulator"]
#default = ["simulator"]
simulator = ["embedded-graphics-simulator", "tzdb"]
[profile.release]
lto = "fat"
#[patch."https://github.com/ZettaScript/atsamd"]
#maduino_zero_4g = { path = "../atsamd" }
[patch."https://github.com/ZettaScript/atsamd"]
maduino_zero_4g = { path = "../atsamd/boards/maduino_zero_4g" }

View file

@ -20,7 +20,7 @@ cargo run
## Build
```bash
cargo build --release --target thumbv6m-none-eabi --no-default-features
cargo build --release --target thumbv6m-none-eabi
```
## Pins
@ -46,12 +46,20 @@ cargo build --release --target thumbv6m-none-eabi --no-default-features
* SDA: I2C
* SCL: I2C
3 pins for the display SPI, 3 pins for the 74HC565 (keypad), 3 pins for the 74HC165 (keypad)
Used pins:
* display SPI: 3 pins
* keypad: 6 pins (74HC565+75HC165), maybe 5 if the same clock is used
* display LED: 1 pin
* torch LED: 1 pin
* ESP UART: 2 pins (I2C still possible if not enough pins)
Note: at most 5 outputs of the 74HC565 may be used as GPO.
## components
https://www.makerfabs.com/maduino-zero-4g-lte-sim7600.html
https://www.waveshare.com/1.54inch-e-Paper-Module.htm1
https://bulkmemorycards.com/shop/microsd-cards/microsd-32gb/sd-32gb-class-10/32gb-microsd-ultra-sandisk-memory-card-2/
Maybe an ESP for WIFI and Bluetooth.
## crates
bitmap-font ?

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
}