fix(bsp)
This commit is contained in:
parent
726632a35a
commit
8dda09689d
6 changed files with 67 additions and 9 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -524,6 +524,15 @@ version = "0.4.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maduino_zero_4g"
|
||||||
|
version = "0.10.0"
|
||||||
|
dependencies = [
|
||||||
|
"atsamd-hal",
|
||||||
|
"cortex-m-rt",
|
||||||
|
"usb-device",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.3.4"
|
version = "2.3.4"
|
||||||
|
@ -816,12 +825,12 @@ dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"atsamd-hal",
|
"atsamd-hal",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cortex-m-rt",
|
|
||||||
"embedded-graphics",
|
"embedded-graphics",
|
||||||
"embedded-graphics-simulator",
|
"embedded-graphics-simulator",
|
||||||
"embedded-sdmmc",
|
"embedded-sdmmc",
|
||||||
"embedded-text",
|
"embedded-text",
|
||||||
"epd-waveshare",
|
"epd-waveshare",
|
||||||
|
"maduino_zero_4g",
|
||||||
"panic-halt",
|
"panic-halt",
|
||||||
"tinybmp",
|
"tinybmp",
|
||||||
"tinytga",
|
"tinytga",
|
||||||
|
|
|
@ -10,12 +10,11 @@ edition = "2021"
|
||||||
arrayvec = { version = "0.7.4", default_features = false }
|
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"
|
||||||
cortex-m-rt = "0.7.1"
|
|
||||||
embedded-graphics = "0.7.1"
|
embedded-graphics = "0.7.1"
|
||||||
embedded-text = "0.5.0"
|
embedded-text = "0.5.0"
|
||||||
embedded-sdmmc = { version = "0.5.0", default_features = false }
|
embedded-sdmmc = { version = "0.5.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" }
|
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"
|
||||||
tinybmp = "0.4.0"
|
tinybmp = "0.4.0"
|
||||||
tinytga = "0.4.1"
|
tinytga = "0.4.1"
|
||||||
|
@ -26,12 +25,12 @@ tzdb = { version = "0.5.7", optional = true }
|
||||||
embedded-graphics-simulator = { version = "0.4.1", optional = true }
|
embedded-graphics-simulator = { version = "0.4.1", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["simulator"]
|
#default = ["simulator"]
|
||||||
|
|
||||||
simulator = ["embedded-graphics-simulator", "tzdb"]
|
simulator = ["embedded-graphics-simulator", "tzdb"]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "fat"
|
lto = "fat"
|
||||||
|
|
||||||
#[patch."https://github.com/ZettaScript/atsamd"]
|
[patch."https://github.com/ZettaScript/atsamd"]
|
||||||
#maduino_zero_4g = { path = "../atsamd" }
|
maduino_zero_4g = { path = "../atsamd/boards/maduino_zero_4g" }
|
||||||
|
|
12
README.md
12
README.md
|
@ -20,7 +20,7 @@ cargo run
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo build --release --target thumbv6m-none-eabi --no-default-features
|
cargo build --release --target thumbv6m-none-eabi
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pins
|
## Pins
|
||||||
|
@ -46,12 +46,20 @@ cargo build --release --target thumbv6m-none-eabi --no-default-features
|
||||||
* SDA: I2C
|
* SDA: I2C
|
||||||
* SCL: 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
|
## components
|
||||||
https://www.makerfabs.com/maduino-zero-4g-lte-sim7600.html
|
https://www.makerfabs.com/maduino-zero-4g-lte-sim7600.html
|
||||||
https://www.waveshare.com/1.54inch-e-Paper-Module.htm1
|
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/
|
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
|
## crates
|
||||||
bitmap-font ?
|
bitmap-font ?
|
||||||
|
|
|
@ -97,6 +97,11 @@ impl Keypad {
|
||||||
.for_each(|key| keys[key as usize] = true);
|
.for_each(|key| keys[key as usize] = true);
|
||||||
keys
|
keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "simulator"))]
|
||||||
|
fn get_keys(&self) -> [bool; NB_KEYS] {
|
||||||
|
[false; NB_KEYS]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
|
@ -137,8 +142,28 @@ pub struct KeyEvent {
|
||||||
repeats: u8,
|
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 {
|
pub enum KeyEventType {
|
||||||
Pressed,
|
Pressed,
|
||||||
Down,
|
Down,
|
||||||
Released,
|
Released,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub enum KeyInputMode {
|
||||||
|
Digit,
|
||||||
|
Alpha,
|
||||||
|
}
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -14,6 +14,16 @@ mod time;
|
||||||
use energy::EnergyStatus;
|
use energy::EnergyStatus;
|
||||||
use state::*;
|
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 arrayvec::ArrayString;
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
use embedded_graphics::{
|
use embedded_graphics::{
|
||||||
|
@ -50,7 +60,7 @@ fn state_mut() -> &'static mut State {
|
||||||
unsafe { &mut STATE }
|
unsafe { &mut STATE }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "simulator"), cortex_m_rt::entry)]
|
#[cfg_attr(not(feature = "simulator"), bsp::entry)]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
let mut display = display::Display::new();
|
let mut display = display::Display::new();
|
||||||
let mut keypad = keypad::Keypad::default();
|
let mut keypad = keypad::Keypad::default();
|
||||||
|
|
|
@ -10,6 +10,7 @@ pub fn timestamp() -> u64 {
|
||||||
.as_secs()
|
.as_secs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
#[cfg(not(feature = "simulator"))]
|
#[cfg(not(feature = "simulator"))]
|
||||||
pub fn timestamp() -> u64 {
|
pub fn timestamp() -> u64 {
|
||||||
1692450980
|
1692450980
|
||||||
|
@ -22,3 +23,9 @@ pub fn millis() -> u64 {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.as_millis() as u64
|
.as_millis() as u64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
#[cfg(not(feature = "simulator"))]
|
||||||
|
pub fn millis() -> u64 {
|
||||||
|
1692450980000
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue