nrf: sequencepwm rename top to max_duty for consistancy
This commit is contained in:
parent
ea1c62ff61
commit
937f49dead
@ -139,7 +139,7 @@ impl<'d, T: Instance> SequencePwm<'d, T> {
|
||||
r.prescaler
|
||||
.write(|w| w.prescaler().bits(config.prescaler as u8));
|
||||
r.countertop
|
||||
.write(|w| unsafe { w.countertop().bits(config.top) });
|
||||
.write(|w| unsafe { w.countertop().bits(config.max_duty) });
|
||||
|
||||
Ok(Self {
|
||||
phantom: PhantomData,
|
||||
@ -260,7 +260,7 @@ pub struct SequenceConfig {
|
||||
/// Selects up mode or up-and-down mode for the counter
|
||||
pub counter_mode: CounterMode,
|
||||
/// Top value to be compared against buffer values
|
||||
pub top: u16,
|
||||
pub max_duty: u16,
|
||||
/// Configuration for PWM_CLK
|
||||
pub prescaler: Prescaler,
|
||||
/// How a sequence is read from RAM and is spread to the compare register
|
||||
@ -275,7 +275,7 @@ impl Default for SequenceConfig {
|
||||
fn default() -> SequenceConfig {
|
||||
SequenceConfig {
|
||||
counter_mode: CounterMode::Up,
|
||||
top: 1000,
|
||||
max_duty: 1000,
|
||||
prescaler: Prescaler::Div16,
|
||||
sequence_load: SequenceLoad::Common,
|
||||
refresh: 0,
|
||||
|
@ -91,7 +91,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
let mut config = SequenceConfig::default();
|
||||
config.prescaler = Prescaler::Div1;
|
||||
// 1 period is 32767 * 1/16mhz = 0.002047938 = 2.047938ms
|
||||
config.top = 32767;
|
||||
config.max_duty = 32767;
|
||||
// pwm example is delaying >~3ms before updating duty cycle, our refreshes
|
||||
// happen exactly at 2.047938ms so we need a delay after each value of >~1ms
|
||||
// which for us is ~1-2 periods
|
||||
|
Loading…
Reference in New Issue
Block a user