Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNS - ADC Report Resolution #82

Merged
merged 6 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/io/hyped_adc/hyped_adc_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ fn impl_hyped_adc(ast: &syn::DeriveInput) -> TokenStream {
fn read_value(&mut self) -> u16 {
self.adc.blocking_read(&mut self.channel)
}

/// Return value of ADC resolution (4095)
fn get_resolution(&self) -> u16 {
4095
}
}

impl #impl_generics #name #ty_generics {
Expand Down
6 changes: 6 additions & 0 deletions lib/io/hyped_adc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/// ADC trait used to abstract the ADC peripheral
pub trait HypedAdc {
fn read_value(&mut self) -> u16;
fn get_resolution(&self) -> u16;
}

pub mod mock_adc {
Expand All @@ -22,6 +23,11 @@ pub mod mock_adc {
self.current_value = next_value;
self.current_value
}

/// Return value of resolution (4095)
fn get_resolution(&self) -> u16 {
4095
}
}

impl MockAdc {
Expand Down