Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 4:32fa20b74c9c, committed 2015-06-27
- Comitter:
- ikrase
- Date:
- Sat Jun 27 07:54:12 2015 +0000
- Parent:
- 3:1d16a22386a8
- Child:
- 5:92fc8f455565
- Commit message:
- Work on specifiedtimeout
Changed in this revision
| PolyServo.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SpecifiedTimeout.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/PolyServo.cpp Sat Jun 27 06:37:14 2015 +0000
+++ b/PolyServo.cpp Sat Jun 27 07:54:12 2015 +0000
@@ -3,7 +3,7 @@
#include "mbed.h"
#include "FPointer.h"
#include <vector>
-#include "SpecifiedTimeout.h"
+//#include "SpecifiedTimeout.h"
Polyservo::Polyservo(DigitalOut servo_pins[], int num_pins): numservos(num_pins) {
@@ -28,7 +28,7 @@
for(int i=0; i< numservos; i++) {
if (global_enable && positions[i] != SERVO_DISABLED){
servos[i]->write(1);
- servo_timers[i]->attach_us(this,&Polyservo::servo_set,positions[i]);
+ //servo_timers[i]->attach_us(this,&Polyservo::servo_set,positions[i]);
} else {
servos[i]->write(0);
}
--- a/SpecifiedTimeout.h Sat Jun 27 06:37:14 2015 +0000
+++ b/SpecifiedTimeout.h Sat Jun 27 07:54:12 2015 +0000
@@ -0,0 +1,35 @@
+#ifndef SPECTIMEOUT_H
+#define SPECTIMEOUT_H
+
+#include "mbed.h"
+#include "FPointer.h"
+//namespace mbed{
+
+class SpecifiedTimeout : public Timeout {
+
+public:
+ uint32_t val;
+ void attach_us(uint32_t (*fptr)(uint32_t) , timestamp_t t, uint32_t val);
+ template<class T>
+ void attach_us(T* tptr, uint32_t(T::*mptr)(uint32_t) , timestamp_t t, uint32_t val);
+protected:
+ virtual void handler();
+ FPointer _function;
+
+private:
+
+
+
+
+
+
+
+};
+//namespace mbed{
+ void SpecifiedTimeout::handler() {
+ _function.call(val);
+}
+
+//}
+
+#endif
\ No newline at end of file