|
Chrispy
High-performance multichannel ADC sampling and audio recording.
|
Configuration for a hardware timer. More...
#include <Timer.h>
Public Member Functions | |
| TimerConfig (clk_t src_clock, clk_t desired_clock, Skew preference) | |
| Constructor for a timer config which initializes required variables for a configuration but does not perform any computation. | |
| TimerRc | compute (size_t nprescalers, pre_t *prescalers, clk_t max_compare, double max_error) |
Compute the first timer configuration satisfying the error constraint, or find the best possible timer configuration if given a max_error of 0. | |
| void | pprint () |
| Pretty print the timer configuration. | |
Data Fields | |
| pre_t | prescaler |
| Prescaler value to use with timer. | |
| clk_t | compare |
| Comparison value to trigger timer at. | |
| clk_t | src |
| Input clock frequency (Hz). | |
| clk_t | desired |
| Target clock frequency (Hz) given input. | |
| Skew | skew |
| Preference for whether a lower/high clock rate. | |
| clk_t | actual |
| Actual clock rate achieved. | |
| double | error |
| Percentage error from desired clock rate. | |
Configuration for a hardware timer.
Constructor for a timer config which initializes required variables for a configuration but does not perform any computation.
| src_clock | Input clock frequency (Hz). |
| desired_clock | Desired clock frequency (Hz). |
| preference | Preference for whether to err low or high when calculating parameters to get desired clock frequency. |
| enum TimerRc TimerConfig::compute | ( | size_t | nprescalers, |
| pre_t * | prescalers, | ||
| clk_t | max_compare, | ||
| double | max_error | ||
| ) |
Compute the first timer configuration satisfying the error constraint, or find the best possible timer configuration if given a max_error of 0.
| nprescalers | Size of prescaler array values, |
| prescalers | Array of potential prescaler values. |
| max_compare | Upper bound for timer compare value. Typically UINT8_MAX for 8-bit timers and UINT16_MAX for 16-bit timers. |
| max_error | Upper error bound for computation. Causes the first configuration satisfying the bound to be used. When set to 0.0, this will examine every potential option and end with the best one. |
Okay or the error which occured. | void TimerConfig::pprint | ( | ) |
Pretty print the timer configuration.
For debugging purposes only.
| clk_t TimerConfig::actual |
Actual clock rate achieved.
| clk_t TimerConfig::compare |
Comparison value to trigger timer at.
| clk_t TimerConfig::desired |
Target clock frequency (Hz) given input.
| double TimerConfig::error |
Percentage error from desired clock rate.
| pre_t TimerConfig::prescaler |
Prescaler value to use with timer.
| Skew TimerConfig::skew |
Preference for whether a lower/high clock rate.
| clk_t TimerConfig::src |
Input clock frequency (Hz).