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.
PolyServo.h@7:f9e1e813fa24, 2015-07-03 (annotated)
- Committer:
- ikrase
- Date:
- Fri Jul 03 08:17:30 2015 +0000
- Revision:
- 7:f9e1e813fa24
- Parent:
- 6:bad5554bb890
- Child:
- 8:c09ae4fef420
Closer to getting this working.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ikrase | 0:6105cf98b610 | 1 | #ifndef POLYSERVO_H |
| ikrase | 0:6105cf98b610 | 2 | #define POLYSERVO_H |
| ikrase | 0:6105cf98b610 | 3 | |
| ikrase | 0:6105cf98b610 | 4 | #include "mbed.h" |
| ikrase | 1:1135f0b1566e | 5 | #include "FPointer.h" |
| ikrase | 0:6105cf98b610 | 6 | #include <vector> |
| ikrase | 6:bad5554bb890 | 7 | //#include "SpecifiedTimeout.h" |
| ikrase | 0:6105cf98b610 | 8 | |
| ikrase | 0:6105cf98b610 | 9 | |
| ikrase | 0:6105cf98b610 | 10 | #define SERVO_DISABLED -1 // This is going to take raw servo microsecond entries. |
| ikrase | 2:f982504e6e84 | 11 | #define PPM_PERIOD 20000 // In microseconds |
| ikrase | 0:6105cf98b610 | 12 | |
| ikrase | 7:f9e1e813fa24 | 13 | void servo_set(int id); |
| ikrase | 7:f9e1e813fa24 | 14 | |
| ikrase | 7:f9e1e813fa24 | 15 | |
| ikrase | 7:f9e1e813fa24 | 16 | |
| ikrase | 0:6105cf98b610 | 17 | class Polyservo { |
| ikrase | 0:6105cf98b610 | 18 | public: |
| ikrase | 0:6105cf98b610 | 19 | |
| ikrase | 0:6105cf98b610 | 20 | std::vector<DigitalOut *> servos; |
| ikrase | 0:6105cf98b610 | 21 | //DigitalOut * servos; |
| ikrase | 0:6105cf98b610 | 22 | |
| ikrase | 0:6105cf98b610 | 23 | bool global_enable; |
| ikrase | 1:1135f0b1566e | 24 | std::vector<int> positions; |
| ikrase | 0:6105cf98b610 | 25 | int numservos; |
| ikrase | 0:6105cf98b610 | 26 | |
| ikrase | 0:6105cf98b610 | 27 | Polyservo(DigitalOut servo_pins[], int num_pins); |
| ikrase | 1:1135f0b1566e | 28 | void set_position(int s, int pos); |
| ikrase | 0:6105cf98b610 | 29 | |
| ikrase | 0:6105cf98b610 | 30 | |
| ikrase | 0:6105cf98b610 | 31 | |
| ikrase | 0:6105cf98b610 | 32 | |
| ikrase | 0:6105cf98b610 | 33 | |
| ikrase | 0:6105cf98b610 | 34 | private: |
| ikrase | 0:6105cf98b610 | 35 | |
| ikrase | 0:6105cf98b610 | 36 | Ticker period_tick; |
| ikrase | 1:1135f0b1566e | 37 | std::vector<Timeout *> servo_timers; |
| ikrase | 0:6105cf98b610 | 38 | //Timeout * servo_times; |
| ikrase | 0:6105cf98b610 | 39 | |
| ikrase | 7:f9e1e813fa24 | 40 | //void servo_set(int id); |
| ikrase | 1:1135f0b1566e | 41 | |
| ikrase | 1:1135f0b1566e | 42 | void servos_reset(void); |
| ikrase | 1:1135f0b1566e | 43 | |
| ikrase | 6:bad5554bb890 | 44 | template <typename Func, Func func> |
| ikrase | 6:bad5554bb890 | 45 | |
| ikrase | 6:bad5554bb890 | 46 | struct ResetWrapper { |
| ikrase | 6:bad5554bb890 | 47 | ResetWrapper(int id): id_(id) { } |
| ikrase | 7:f9e1e813fa24 | 48 | void f() {func(id_);} |
| ikrase | 6:bad5554bb890 | 49 | int id_; |
| ikrase | 6:bad5554bb890 | 50 | }; |
| ikrase | 6:bad5554bb890 | 51 | |
| ikrase | 6:bad5554bb890 | 52 | |
| ikrase | 6:bad5554bb890 | 53 | |
| ikrase | 6:bad5554bb890 | 54 | |
| ikrase | 6:bad5554bb890 | 55 | |
| ikrase | 0:6105cf98b610 | 56 | |
| ikrase | 0:6105cf98b610 | 57 | |
| ikrase | 0:6105cf98b610 | 58 | |
| ikrase | 0:6105cf98b610 | 59 | |
| ikrase | 0:6105cf98b610 | 60 | |
| ikrase | 0:6105cf98b610 | 61 | |
| ikrase | 0:6105cf98b610 | 62 | |
| ikrase | 0:6105cf98b610 | 63 | }; |
| ikrase | 0:6105cf98b610 | 64 | |
| ikrase | 0:6105cf98b610 | 65 | |
| ikrase | 0:6105cf98b610 | 66 | |
| ikrase | 0:6105cf98b610 | 67 | #endif |