libhal-google / libhal

A collection of interfaces and abstractions for embedded peripherals and devices using modern C++
Apache License 2.0
86 stars 17 forks source link

:zap: Improve `pwm` interface performance & docs #662

Closed MaliaLabor closed 1 year ago

MaliaLabor commented 1 year ago

Added clamp function to pwm::frequency to clamp values between 1 Hz and 1 GHz. This allows callers and implementors to eliminate checks and clamping code by keeping them in a central place, which helps reduce code bloat.