This commit is contained in:
Pascal Engélibert 2023-10-07 13:33:14 +02:00
commit 865599e059
64 changed files with 6448 additions and 1221 deletions

5
common/src/cm.rs Normal file
View file

@ -0,0 +1,5 @@
/// CPU to Modem
pub enum CMMessage {
Ping(u32),
Pong(u32),
}

15
common/src/lib.rs Normal file
View file

@ -0,0 +1,15 @@
pub mod cm;
pub mod mc;
pub const VERSION: u32 = 1;
enum State {
/// Not ready, not even pinged
Idle,
/// Ping failed
Fail,
/// Waiting for pong
Pinging,
/// Ready to work
Ready,
}

26
common/src/mc.rs Normal file
View file

@ -0,0 +1,26 @@
use crate::{cm::CMMessage, State};
/// Modem to CPU
pub enum MCMessage {
Ping(u32),
Pong(u32),
}
/// Modem-side connection driver
pub struct MCConnection<SPI> {
spi: SPI,
state: State,
}
impl<SPI> MCConnection<SPI> where SPI: embedded_hal::spi::SpiDevice {
pub fn new(spi: SPI) -> Self {
Self {
spi,
state: State::Idle,
}
}
fn handle_message(message: CMMessage) {
}
}