1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use Mcu;
use load;
use std::env;

/// Gets information about the current microcontroller, if it is set.
pub fn mcu() -> Option<Mcu> {
    mcu_name().map(|mcu_name| {
        load::microcontroller(&mcu_name)
    })
}

/// Gets the name of the current microcontroller, if it is set.
pub fn mcu_name() -> Option<String> {
    env::var("CARGO_CFG_TARGET_CPU").ok().map(|c| c.to_owned())
}