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@2:f982504e6e84, 2015-06-27 (annotated)
- Committer:
- ikrase
- Date:
- Sat Jun 27 06:08:17 2015 +0000
- Revision:
- 2:f982504e6e84
- Parent:
- 1:1135f0b1566e
- Child:
- 3:1d16a22386a8
Added reset section;
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 | 0:6105cf98b610 | 7 | |
| ikrase | 0:6105cf98b610 | 8 | |
| ikrase | 0:6105cf98b610 | 9 | #define SERVO_DISABLED -1 // This is going to take raw servo microsecond entries. |
| ikrase | 2:f982504e6e84 | 10 | #define PPM_PERIOD 20000 // In microseconds |
| ikrase | 0:6105cf98b610 | 11 | |
| ikrase | 0:6105cf98b610 | 12 | class Polyservo { |
| ikrase | 0:6105cf98b610 | 13 | public: |
| ikrase | 0:6105cf98b610 | 14 | |
| ikrase | 0:6105cf98b610 | 15 | std::vector<DigitalOut *> servos; |
| ikrase | 0:6105cf98b610 | 16 | //DigitalOut * servos; |
| ikrase | 0:6105cf98b610 | 17 | |
| ikrase | 0:6105cf98b610 | 18 | bool global_enable; |
| ikrase | 1:1135f0b1566e | 19 | std::vector<int> positions; |
| ikrase | 0:6105cf98b610 | 20 | int numservos; |
| ikrase | 0:6105cf98b610 | 21 | |
| ikrase | 0:6105cf98b610 | 22 | Polyservo(DigitalOut servo_pins[], int num_pins); |
| ikrase | 1:1135f0b1566e | 23 | void set_position(int s, int pos); |
| ikrase | 0:6105cf98b610 | 24 | |
| ikrase | 0:6105cf98b610 | 25 | |
| ikrase | 0:6105cf98b610 | 26 | |
| ikrase | 0:6105cf98b610 | 27 | |
| ikrase | 0:6105cf98b610 | 28 | |
| ikrase | 0:6105cf98b610 | 29 | private: |
| ikrase | 0:6105cf98b610 | 30 | |
| ikrase | 0:6105cf98b610 | 31 | Ticker period_tick; |
| ikrase | 1:1135f0b1566e | 32 | std::vector<Timeout *> servo_timers; |
| ikrase | 0:6105cf98b610 | 33 | //Timeout * servo_times; |
| ikrase | 0:6105cf98b610 | 34 | |
| ikrase | 1:1135f0b1566e | 35 | uint32_t servo_set(uint32_t); |
| ikrase | 1:1135f0b1566e | 36 | |
| ikrase | 1:1135f0b1566e | 37 | void servos_reset(void); |
| ikrase | 1:1135f0b1566e | 38 | |
| ikrase | 0:6105cf98b610 | 39 | |
| ikrase | 0:6105cf98b610 | 40 | |
| ikrase | 0:6105cf98b610 | 41 | |
| ikrase | 0:6105cf98b610 | 42 | |
| ikrase | 0:6105cf98b610 | 43 | |
| ikrase | 0:6105cf98b610 | 44 | |
| ikrase | 0:6105cf98b610 | 45 | |
| ikrase | 0:6105cf98b610 | 46 | }; |
| ikrase | 0:6105cf98b610 | 47 | |
| ikrase | 0:6105cf98b610 | 48 | |
| ikrase | 0:6105cf98b610 | 49 | |
| ikrase | 0:6105cf98b610 | 50 | #endif |