forked from drogue-iot/drogue-device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod.rs
26 lines (21 loc) · 725 Bytes
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//! Board Support Packages (BSP).
pub mod boards;
/// A board capable of creating itself using peripherals.
pub trait Board: Sized {
type Peripherals;
type Config;
fn new(peripherals: Self::Peripherals, config: Option<Self::Config>) -> Self;
}
#[macro_export]
macro_rules! bind_bsp {
($bsp:ty, $app_bsp:ident) => {
struct $app_bsp($bsp);
impl $crate::bsp::Board for BSP {
type Peripherals = <$bsp as $crate::bsp::Board>::Peripherals;
type Config = <$bsp as $crate::bsp::Board>::Config;
fn new(peripherals: Self::Peripherals, config: Option<Self::Config>) -> Self {
BSP(<$bsp>::new(peripherals, config))
}
}
};
}