annotate include/intervals.h @ 151:e9c9404e3d1f ClockSync

Pff partially working. No PID. When setting the audio clock on the bbb to 44098 the master and slave clock keep diverging instead of converging ...
author Giulio Moro <giuliomoro@yahoo.it>
date Tue, 22 Sep 2015 04:10:07 +0100
parents 24af9a14b203
children
rev   line source
giuliomoro@42 1 /*
giuliomoro@42 2 * intervals.h
giuliomoro@42 3 *
giuliomoro@42 4 * Created on: 18 May 2015
giuliomoro@42 5 * Author: unmanaged
giuliomoro@42 6 */
giuliomoro@42 7
giuliomoro@42 8 #ifndef INTERVALS_H_
giuliomoro@42 9 #define INTERVALS_H_
giuliomoro@42 10
giuliomoro@42 11 #define TEN_POW_9 1000000000
giuliomoro@42 12
giuliomoro@42 13 #include <unistd.h>
giuliomoro@42 14 #include <stdio.h>
giuliomoro@42 15 #include <stdlib.h>
giuliomoro@42 16
giuliomoro@42 17 #include <native/timer.h>
giuliomoro@42 18 #include <rtdk.h>
giuliomoro@42 19
giuliomoro@42 20 class Interval
giuliomoro@42 21 {
giuliomoro@42 22 private:
giuliomoro@42 23 int intervalsPointer;
giuliomoro@42 24 long sum;
giuliomoro@42 25 RTIME startTime;
giuliomoro@42 26 RTIME *intervals;
giuliomoro@42 27 float maxTimeus;
giuliomoro@42 28 float timeus;
giuliomoro@42 29 float samplingRate; //used for getPrint()
giuliomoro@42 30 int numFrames;
giuliomoro@42 31 bool enabled; //whether it actually reads the clock or not
giuliomoro@42 32 int numAverages;
giuliomoro@42 33 char *name;
giuliomoro@42 34 void init(int aNumAverages, int aNumFrames, float aSamplingRate, const char *aName);
giuliomoro@42 35 public:
giuliomoro@42 36 Interval();
giuliomoro@42 37 Interval(int aNumAverages);
giuliomoro@42 38 Interval(int aNumAverages, int aNumFrames, float aSamplingRate, const char *aName);
giuliomoro@42 39 ~Interval();
giuliomoro@42 40 void setNumFrames(int aNumFrames);
giuliomoro@42 41 int start();
giuliomoro@42 42 int resetMax();
giuliomoro@42 43 int split();
giuliomoro@42 44 void setEnabled(bool aActive);
giuliomoro@42 45 float getTimeus();
giuliomoro@42 46 float getMaxTimeus();
giuliomoro@42 47 void print();
giuliomoro@42 48 };
giuliomoro@42 49
giuliomoro@42 50 #endif /* INTERVALS_H_ */