Skip to content

periodUs incorrect due to int maths #58

@kevinjwalters

Description

@kevinjwalters

In

periodUs = period_ticks / (clock_frequency/1000000);
there's some maths with period_ticks and another integer constant value, for period_ticks of 20 this will result in (float) periodUs being set to 1.0 rather than 1.25

    periodUs = period_ticks / (clock_frequency/1000000);

I suspect that should be something like

    periodUs = (float)period_ticks / (clock_frequency/1000000);

to force FP maths?

The actual PWM hardware timers are set using period_ticks so they are okay AFAICS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions