1use super::{
2 flash,
3 serial::{Read, TimeoutRead, Write},
4 time,
5};
6
7pub type NullAddress = usize;
8
9pub struct NullSerial;
10
11#[derive(Copy, Clone, Debug)]
12pub struct NullError;
13
14impl Read for NullSerial {
15 type Error = NullError;
16 fn read(&mut self) -> nb::Result<u8, Self::Error> { unimplemented!() }
17}
18
19impl Write for NullSerial {
20 type Error = NullError;
21
22 fn write_str(&mut self, _: &str) -> Result<(), Self::Error> { unimplemented!() }
23}
24
25impl TimeoutRead for NullSerial {
26 type Error = NullError;
27 fn read<T: Copy + Into<super::time::Milliseconds>>(&mut self, _: T) -> Result<u8, Self::Error> {
28 unimplemented!()
29 }
30}
31
32pub struct NullFlash;
33
34impl flash::ReadWrite for NullFlash {
35 type Error = NullError;
36 type Address = NullAddress;
37
38 fn label() -> &'static str {
39 unimplemented!();
40 }
41 fn read(&mut self, _: Self::Address, _: &mut [u8]) -> nb::Result<(), Self::Error> {
42 unimplemented!()
43 }
44 fn write(&mut self, _: Self::Address, _: &[u8]) -> nb::Result<(), Self::Error> {
45 unimplemented!()
46 }
47 fn range(&self) -> (Self::Address, Self::Address) { unimplemented!() }
48 fn erase(&mut self) -> nb::Result<(), Self::Error> { unimplemented!() }
49 fn write_from_blocks<I: Iterator<Item = [u8; N]>, const N: usize>(
50 &mut self,
51 _: Self::Address,
52 _: I,
53 ) -> Result<(), Self::Error> {
54 unimplemented!()
55 }
56}
57
58pub struct NullSystick;
59
60#[derive(Copy, Clone, Debug)]
61pub struct NullInstant;
62
63impl core::ops::Sub for NullInstant {
64 type Output = time::Milliseconds;
65 fn sub(self, _: Self) -> Self::Output { time::Milliseconds(0) }
66}
67
68impl<T: Into<time::Milliseconds>> core::ops::Add<T> for NullInstant {
70 type Output = Self;
71 fn add(self, _: T) -> Self { Self {} }
72}
73
74impl time::Now for NullSystick {
75 type I = NullInstant;
76 fn now() -> Self::I { unimplemented!() }
77}