-
Notifications
You must be signed in to change notification settings - Fork 6
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
Pwm upgrades #13
Pwm upgrades #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation and updates on the new functions should be on the same commits where there functions were added.
Ok, squashed the commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not ignore code in the doc files.
4360639
to
e01a6d8
Compare
found the '''not_run" resource for rust doc. Changed last commit. |
src/lib.rs
Outdated
@@ -21,6 +22,9 @@ pub use ads1x1x::ChannelSelection as adc_Channel; | |||
|
|||
use std::fmt::Debug; | |||
|
|||
//Navigator Defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Navigator Defaults | |
/// Navigator Defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to create a header to organize defaults,
constants, adresses and other values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm suggesting to make generate the documentation for it, implied by ///
src/lib.rs
Outdated
pub fn set_pwm_freq_hz(&mut self, mut freq: f32) { | ||
if freq < 24.0 { | ||
warn!("Invalid value. Value must be greater than 24.0."); | ||
freq = 24.0; | ||
} | ||
|
||
if freq > 1526.0 { | ||
warn!("Invalid value. Value must be less than 1526.0."); | ||
freq = 1526.0; | ||
} | ||
|
||
let prescale_clamped_value = | ||
(NAVIGATOR_PWM_XTAL_CLOCK_FREQ / (4_096.0 * freq)).round() as u8 - 1; | ||
|
||
self.set_pwm_freq_prescale(prescale_clamped_value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn set_pwm_freq_hz(&mut self, mut freq: f32) { | |
if freq < 24.0 { | |
warn!("Invalid value. Value must be greater than 24.0."); | |
freq = 24.0; | |
} | |
if freq > 1526.0 { | |
warn!("Invalid value. Value must be less than 1526.0."); | |
freq = 1526.0; | |
} | |
let prescale_clamped_value = | |
(NAVIGATOR_PWM_XTAL_CLOCK_FREQ / (4_096.0 * freq)).round() as u8 - 1; | |
self.set_pwm_freq_prescale(prescale_clamped_value); | |
} | |
pub fn set_pwm_freq_hz(&mut self, mut freq: f32) { | |
let min_freq = 24.0; | |
let max_freq = 1526.0; | |
if freq < min_freq { | |
warn!("Invalid value. Value must be greater than {min_freq}."); | |
freq = min_freq; | |
} | |
if freq > max_freq { | |
warn!("Invalid value. Value must be less than {max_freq}."); | |
freq = max_freq; | |
} | |
let prescale_clamped_value = | |
(NAVIGATOR_PWM_XTAL_CLOCK_FREQ / (4_096.0 * freq)).round() as u8 - 1; | |
self.set_pwm_freq_prescale(prescale_clamped_value); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be greater/less than or equal to
, not just greater/less than
.
Add Logger and Log crates,
RUST_LOG=debug ./raspberry-pi
Create a field deticated to navigator's defaults (PWM crystal)
Add new functions and documentation to pwm module:
On some descriptions, the links points to manufacturer's data-sheet and page for further info.