Added custom irradiance quantity
This commit is contained in:
2
src/circuit/mod.rs
Normal file
2
src/circuit/mod.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#[cfg(feature = "resistive-divider")]
|
||||||
|
pub mod resistive_divider;
|
@ -5,7 +5,7 @@ pub mod control;
|
|||||||
pub mod error;
|
pub mod error;
|
||||||
|
|
||||||
pub mod adc;
|
pub mod adc;
|
||||||
#[cfg(feature = "resistive-divider")]
|
pub mod uom;
|
||||||
pub mod resistive_divider;
|
pub mod circuit;
|
||||||
|
|
||||||
pub use error::CriticalError;
|
pub use error::CriticalError;
|
||||||
|
16
src/uom.rs
Normal file
16
src/uom.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
//TODO: Everything in here is implemented standalone and not integrated with uom library because it is spawned from macro
|
||||||
|
// soup + has shit documentation and I cannot figure out how to add a custom unit to SI. This should be integrated with
|
||||||
|
// UoM
|
||||||
|
|
||||||
|
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug, Default)]
|
||||||
|
pub struct Irradiance(f32);
|
||||||
|
|
||||||
|
pub fn watts_per_sq_meter(value: f32) -> Irradiance {
|
||||||
|
Irradiance(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Irradiance {
|
||||||
|
fn to_watts_per_sq_meter(self) -> f32 {
|
||||||
|
self.0
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user