ESP
This commit is contained in:
parent
a4884bd189
commit
865599e059
64 changed files with 6448 additions and 1221 deletions
5
common/src/cm.rs
Normal file
5
common/src/cm.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/// CPU to Modem
|
||||
pub enum CMMessage {
|
||||
Ping(u32),
|
||||
Pong(u32),
|
||||
}
|
||||
15
common/src/lib.rs
Normal file
15
common/src/lib.rs
Normal 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
26
common/src/mc.rs
Normal 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) {
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue