SatCat5
satcat5::ptp::RateConversion Class Reference

Detailed Description

Convert normalized frequency offset to ticks-per-clock.

Input: 65536 LSB = 1 PPB = 1 nanosecond per second Output: 2^scale LSB = 1 nanosecond per reference clock All floating-point calculations can be run at build-time.

Definition at line 545 of file ptp_filters.h.

#include <ptp_filters.h>

Public Member Functions

constexpr RateConversion (double ref_clk_hz, unsigned scale_ns)
 Specify the nominal clock frequency and the scale (see above). More...
 
bool ok () const
 Is the scale coefficient large enough to mitigate rounding error?
 
s64 convert (s64 offset) const
 Forward conversion (normalized rate ==> ticks-per-clock)
 
s64 invert (s64 rate) const
 Inverse conversion (ticks-per-clock ==> normalized rate)
 

Static Protected Member Functions

static constexpr double fw_gain (unsigned scale_ns)
 

Protected Attributes

s64 m_scale
 

Static Protected Attributes

static constexpr unsigned SHIFT = 48
 

Constructor & Destructor Documentation

◆ RateConversion()

constexpr satcat5::ptp::RateConversion::RateConversion ( double  ref_clk_hz,
unsigned  scale_ns 
)
inlineconstexpr

Specify the nominal clock frequency and the scale (see above).

Negative "ref_clk_hz" inverts the usual fast/slow sign convention.

Definition at line 549 of file ptp_filters.h.


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