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
00029 namespace apo
00030 {
00031
00032 class Loop
00033 {
00034 public:
00035 Loop() : _fptr(), _data(), _period(), _subLoops(), _timeStamp(), _load(), _dt() {};
00036 Loop(float frequency, void (*fptr)(void *) = NULL, void * data = NULL);
00037 void update();
00038 Vector<Loop *> & subLoops() {
00039 return _subLoops;
00040 }
00041 uint32_t frequency() {
00042 return 1.0e6/_period;
00043 }
00044 void frequency(float frequency) {
00045 _period = 1e6/frequency;
00046 }
00047 uint32_t timeStamp() {
00048 return _timeStamp;
00049 }
00050 float dt() {
00051 return _dt;
00052 }
00053 uint8_t load() {
00054 return _load;
00055 }
00056 private:
00057 void (*_fptr)(void *);
00058 void * _data;
00059 uint32_t _period;
00060 Vector<Loop *> _subLoops;
00061 uint32_t _timeStamp;
00062 uint8_t _load;
00063 float _dt;
00064 };
00065
00066 }
00067
00068 #endif
00069
00070