2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
Diff: Updater.h
- Revision:
- 14:1dd83e626153
- Parent:
- 13:5566df1250f1
- Child:
- 15:35c40765f7c3
--- a/Updater.h Wed Dec 12 17:38:02 2018 +0000 +++ b/Updater.h Wed Dec 12 18:21:57 2018 +0000 @@ -6,15 +6,36 @@ class Updater: private mbed::NonCopyable<Updater> { public: + /** Start the updater running - cannot be exited! + * @param interval_ms is the interval in ms between calls to update() + * @note Makes use of RTOS EventQueue and Event. + */ void start(int interval_ms); + + /// Return singleton instance static Updater *instance(); + + /** Get gyro values + * @return g array of x, y, and z gyro values + * @return dt time since data last updated + */ void gyro(int g[3], float& dt); - + + /** Get encoder count + * @return encoder count since last call + */ + int encoder(); + private: - Updater() {} // parameterize - Timer *t; - void update(); - int _gyro[3]; + /// Basic constructor (singleton) + Updater() {} + + /// Update all sensors + void update(); + + Timer *t; // timer used to measure dt + int _gyro[3]; // gyro raw + int _ecount; // encoder count float _dt; int thisTime; int lastTime;