Added custom irradiance quantity

This commit is contained in:
Zachary Sunforge
2024-07-09 10:48:13 -07:00
parent 96ae59087e
commit 8a23429e5f
4 changed files with 20 additions and 2 deletions

2
src/circuit/mod.rs Normal file
View File

@ -0,0 +1,2 @@
#[cfg(feature = "resistive-divider")]
pub mod resistive_divider;

View File

@ -5,7 +5,7 @@ pub mod control;
pub mod error;
pub mod adc;
#[cfg(feature = "resistive-divider")]
pub mod resistive_divider;
pub mod uom;
pub mod circuit;
pub use error::CriticalError;

16
src/uom.rs Normal file
View 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
}
}