Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef AP_Loop_H
00020 #define AP_Loop_H
00021
00022 #include "AP_Vector.h"
00023
00025
00026
00027
00028 namespace apo
00029 {
00030
00031 class Loop
00032 {
00033 public:
00034 Loop() : _fptr(), _data(), _period(), _subLoops(), _timeStamp(), _load(), _dt() {};
00035 Loop(float frequency, void (*fptr)(void *) = NULL, void * data = NULL);
00036 void update();
00037 Vector<Loop *> & subLoops() {
00038 return _subLoops;
00039 }
00040 uint32_t frequency() {
00041 return 1.0e6/_period;
00042 }
00043 void frequency(float frequency) {
00044 _period = 1e6/frequency;
00045 }
00046 uint32_t timeStamp() {
00047 return _timeStamp;
00048 }
00049 float dt() {
00050 return _dt;
00051 }
00052 uint8_t load() {
00053 return _load;
00054 }
00055 private:
00056 void (*_fptr)(void *);
00057 void * _data;
00058 uint32_t _period;
00059 Vector<Loop *> _subLoops;
00060 uint32_t _timeStamp;
00061 uint8_t _load;
00062 float _dt;
00063 };
00064
00065 }
00066
00067 #endif
00068
00069