Copyright | (c) Marc Fontaine 2017 |
---|---|

License | BSD3 |

Maintainer | Marc.Fontaine@gmx.de |

Stability | experimental |

Portability | GHC-only |

Safe Haskell | Safe |

Language | Haskell2010 |

This module contains utility functions for fractional PLL divers. Most arduino Si5351 packages use dividers with a fixed large denominator, which seens to be against the spirit of the Si5351 design. I use continued fractions to compute the best fractional approximation. (This may be an overkill but why not.)

- dividerToPVal :: Rational -> (Word32, Word32, Word32)
- dividerToABC :: Rational -> (Integer, Integer, Integer)
- approximations :: Rational -> [Rational]
- toContinuedFraction :: Rational -> (Integer, [Integer])
- fromContinuedFraction :: (Integer, [Integer]) -> Rational

# Documentation

dividerToPVal :: Rational -> (Word32, Word32, Word32) Source #

Compute the pvalues for a rational divider. Any denominator is pemissible here. The function uses the best approximation.

dividerToABC :: Rational -> (Integer, Integer, Integer) Source #

Approximate the a,b,c values of a divider.

approximations :: Rational -> [Rational] Source #

Compute a list of approximations of a rational number.