modm API documentation
modm::GenericPrescaler< T > Class Template Reference

#include <modm/math/algorithm/prescaler.hpp>

Classes

struct  Result
 

Static Public Member Functions

static constexpr Result from_range (T input_frequency, T desired_frequency, std::ranges::forward_range auto &&prescalers)
 
static constexpr Result from_list (T input_frequency, T desired_frequency, std::initializer_list< uint32_t > prescalers)
 
template<typename Function >
static constexpr Result from_function (T input_frequency, T desired_frequency, uint32_t begin, uint32_t end, Function prescaler_modifier)
 
static constexpr Result from_linear (T input_frequency, T desired_frequency, uint32_t begin, uint32_t end)
 
static constexpr Result from_power (T input_frequency, T desired_frequency, uint32_t begin, uint32_t end)
 

Detailed Description

template<typename T>
class modm::GenericPrescaler< T >

Computes the best fitting prescaler from a list or range.

Note
For ranges the end is inclusive: [begin, end]!

Member Function Documentation

template<typename T >
template<typename Function >
static constexpr Result modm::GenericPrescaler< T >::from_function ( input_frequency,
desired_frequency,
uint32_t  begin,
uint32_t  end,
Function  prescaler_modifier 
)
inlinestaticconstexpr

From any linear range via modifier function.

Note
the range end is inclusive: [begin, end].
Precondition
begin must be smaller or equal than end!
template<typename T >
static constexpr Result modm::GenericPrescaler< T >::from_linear ( input_frequency,
desired_frequency,
uint32_t  begin,
uint32_t  end 
)
inlinestaticconstexpr

From any linear range.

Note
the range end is inclusive: [begin, end].
Precondition
begin must be smaller or equal than end!
template<typename T >
static constexpr Result modm::GenericPrescaler< T >::from_list ( input_frequency,
desired_frequency,
std::initializer_list< uint32_t >  prescalers 
)
inlinestaticconstexpr

From a initializer list.

Precondition
The list must be sorted from low to high numbers!
template<typename T >
static constexpr Result modm::GenericPrescaler< T >::from_power ( input_frequency,
desired_frequency,
uint32_t  begin,
uint32_t  end 
)
inlinestaticconstexpr

From any 2-logarithmic range.

Note
the range end is inclusive: [begin, end].
Precondition
begin and end must be powers of two!
begin must be smaller or equal than end!
template<typename T >
static constexpr Result modm::GenericPrescaler< T >::from_range ( input_frequency,
desired_frequency,
std::ranges::forward_range auto &&  prescalers 
)
inlinestaticconstexpr

From any forward range.

Precondition
The container must be sorted from low to high numbers!

The documentation for this class was generated from the following file: