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
|
r.prescaler
|
||||||
.write(|w| w.prescaler().bits(config.prescaler as u8));
|
.write(|w| w.prescaler().bits(config.prescaler as u8));
|
||||||
r.countertop
|
r.countertop
|
||||||
.write(|w| unsafe { w.countertop().bits(config.top) });
|
.write(|w| unsafe { w.countertop().bits(config.max_duty) });
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
@ -260,7 +260,7 @@ pub struct SequenceConfig {
|
|||||||
/// Selects up mode or up-and-down mode for the counter
|
/// Selects up mode or up-and-down mode for the counter
|
||||||
pub counter_mode: CounterMode,
|
pub counter_mode: CounterMode,
|
||||||
/// Top value to be compared against buffer values
|
/// Top value to be compared against buffer values
|
||||||
pub top: u16,
|
pub max_duty: u16,
|
||||||
/// Configuration for PWM_CLK
|
/// Configuration for PWM_CLK
|
||||||
pub prescaler: Prescaler,
|
pub prescaler: Prescaler,
|
||||||
/// How a sequence is read from RAM and is spread to the compare register
|
/// 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 {
|
fn default() -> SequenceConfig {
|
||||||
SequenceConfig {
|
SequenceConfig {
|
||||||
counter_mode: CounterMode::Up,
|
counter_mode: CounterMode::Up,
|
||||||
top: 1000,
|
max_duty: 1000,
|
||||||
prescaler: Prescaler::Div16,
|
prescaler: Prescaler::Div16,
|
||||||
sequence_load: SequenceLoad::Common,
|
sequence_load: SequenceLoad::Common,
|
||||||
refresh: 0,
|
refresh: 0,
|
||||||
|
@ -91,7 +91,7 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
|||||||
let mut config = SequenceConfig::default();
|
let mut config = SequenceConfig::default();
|
||||||
config.prescaler = Prescaler::Div1;
|
config.prescaler = Prescaler::Div1;
|
||||||
// 1 period is 32767 * 1/16mhz = 0.002047938 = 2.047938ms
|
// 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
|
// 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
|
// happen exactly at 2.047938ms so we need a delay after each value of >~1ms
|
||||||
// which for us is ~1-2 periods
|
// which for us is ~1-2 periods
|
||||||
|
Loading…
Reference in New Issue
Block a user