Skip to content
Open
Changes from all 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
12 changes: 6 additions & 6 deletions src/servo/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ let ledc = Ledc::new(peripherals.LEDC);
let mut hstimer0 = ledc.timer::<HighSpeed>(timer::Number::Timer0);
hstimer0
.configure(timer::config::Config {
duty: timer::config::Duty::Duty5Bit,
duty: timer::config::Duty::Duty12Bit,
clock_source: timer::HSClockSource::APBClk,
frequency: Rate::from_khz(24),
frequency: Rate::from_hz(50),
})
.unwrap();

let mut channel0 = ledc.channel(channel::Number::Channel0, &mut servo);
channel0
.configure(channel::config::Config {
timer: &hstimer0,
duty_pct: 10,
duty_pct: 100,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why edit this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by setting it to 100, we are saying that we want to control all 100% of the duty cycle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by setting it to 100, we are saying that we want to control all 100% of the duty cycle.

It seems to me that this only sets the initial value of the duty cycle.

The issue has already been fixed here: #17

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. 👍

pin_config: channel::config::PinConfig::PushPull,
})
.unwrap();
Expand Down Expand Up @@ -129,17 +129,17 @@ fn main() -> ! {
let mut hstimer0 = ledc.timer::<HighSpeed>(timer::Number::Timer0);
hstimer0
.configure(timer::config::Config {
duty: timer::config::Duty::Duty5Bit,
duty: timer::config::Duty::Duty12Bit,
clock_source: timer::HSClockSource::APBClk,
frequency: Rate::from_khz(24),
frequency: Rate::from_hz(50),
})
.unwrap();

let mut channel0 = ledc.channel(channel::Number::Channel0, &mut servo);
channel0
.configure(channel::config::Config {
timer: &hstimer0,
duty_pct: 10,
duty_pct: 100,
pin_config: channel::config::PinConfig::PushPull,
})
.unwrap();
Expand Down