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@8:c09ae4fef420, 2015-07-04 (annotated)
- Committer:
- ikrase
- Date:
- Sat Jul 04 03:32:02 2015 +0000
- Revision:
- 8:c09ae4fef420
- Parent:
- 7:f9e1e813fa24
- Child:
- 9:a40eac6bdfae
Said "screw it" and just hardcoded 12 functions by hand.
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 | 8:c09ae4fef420 | 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 | 8:c09ae4fef420 | 12 | #define NUM_SERVOS 12 |
| ikrase | 0:6105cf98b610 | 13 | |
| ikrase | 7:f9e1e813fa24 | 14 | void servo_set(int id); |
| ikrase | 7:f9e1e813fa24 | 15 | |
| ikrase | 7:f9e1e813fa24 | 16 | |
| ikrase | 7:f9e1e813fa24 | 17 | |
| ikrase | 0:6105cf98b610 | 18 | class Polyservo { |
| ikrase | 0:6105cf98b610 | 19 | public: |
| ikrase | 0:6105cf98b610 | 20 | |
| ikrase | 0:6105cf98b610 | 21 | std::vector<DigitalOut *> servos; |
| ikrase | 0:6105cf98b610 | 22 | //DigitalOut * servos; |
| ikrase | 0:6105cf98b610 | 23 | |
| ikrase | 8:c09ae4fef420 | 24 | //bool global_enable; |
| ikrase | 8:c09ae4fef420 | 25 | int positions[NUM_SERVOS]; |
| ikrase | 0:6105cf98b610 | 26 | int numservos; |
| ikrase | 8:c09ae4fef420 | 27 | void disable(); |
| ikrase | 8:c09ae4fef420 | 28 | void enable(); |
| ikrase | 0:6105cf98b610 | 29 | |
| ikrase | 8:c09ae4fef420 | 30 | Polyservo(DigitalOut servo_pins[]); |
| ikrase | 1:1135f0b1566e | 31 | void set_position(int s, int pos); |
| ikrase | 0:6105cf98b610 | 32 | |
| ikrase | 0:6105cf98b610 | 33 | |
| ikrase | 0:6105cf98b610 | 34 | |
| ikrase | 0:6105cf98b610 | 35 | |
| ikrase | 0:6105cf98b610 | 36 | |
| ikrase | 0:6105cf98b610 | 37 | private: |
| ikrase | 0:6105cf98b610 | 38 | |
| ikrase | 0:6105cf98b610 | 39 | Ticker period_tick; |
| ikrase | 1:1135f0b1566e | 40 | std::vector<Timeout *> servo_timers; |
| ikrase | 0:6105cf98b610 | 41 | //Timeout * servo_times; |
| ikrase | 0:6105cf98b610 | 42 | |
| ikrase | 7:f9e1e813fa24 | 43 | //void servo_set(int id); |
| ikrase | 1:1135f0b1566e | 44 | |
| ikrase | 1:1135f0b1566e | 45 | void servos_reset(void); |
| ikrase | 1:1135f0b1566e | 46 | |
| ikrase | 8:c09ae4fef420 | 47 | bool global_enable; |
| ikrase | 8:c09ae4fef420 | 48 | |
| ikrase | 8:c09ae4fef420 | 49 | void servo0_set(void); |
| ikrase | 8:c09ae4fef420 | 50 | void servo1_set(void); |
| ikrase | 8:c09ae4fef420 | 51 | void servo2_set(void); |
| ikrase | 8:c09ae4fef420 | 52 | void servo3_set(void); |
| ikrase | 8:c09ae4fef420 | 53 | void servo4_set(void); |
| ikrase | 8:c09ae4fef420 | 54 | void servo5_set(void); |
| ikrase | 8:c09ae4fef420 | 55 | void servo6_set(void); |
| ikrase | 8:c09ae4fef420 | 56 | void servo7_set(void); |
| ikrase | 8:c09ae4fef420 | 57 | void servo8_set(void); |
| ikrase | 8:c09ae4fef420 | 58 | void servo9_set(void); |
| ikrase | 8:c09ae4fef420 | 59 | void servo10_set(void); |
| ikrase | 8:c09ae4fef420 | 60 | void servo11_set(void); |
| ikrase | 8:c09ae4fef420 | 61 | //void servo12_set(void); |
| ikrase | 6:bad5554bb890 | 62 | |
| ikrase | 8:c09ae4fef420 | 63 | void (*servo_sets[NUM_SERVOS])(void); |
| ikrase | 8:c09ae4fef420 | 64 | |
| ikrase | 6:bad5554bb890 | 65 | |
| ikrase | 6:bad5554bb890 | 66 | |
| ikrase | 6:bad5554bb890 | 67 | |
| ikrase | 6:bad5554bb890 | 68 | |
| ikrase | 6:bad5554bb890 | 69 | |
| ikrase | 0:6105cf98b610 | 70 | |
| ikrase | 0:6105cf98b610 | 71 | |
| ikrase | 0:6105cf98b610 | 72 | |
| ikrase | 0:6105cf98b610 | 73 | |
| ikrase | 0:6105cf98b610 | 74 | |
| ikrase | 0:6105cf98b610 | 75 | |
| ikrase | 0:6105cf98b610 | 76 | |
| ikrase | 0:6105cf98b610 | 77 | }; |
| ikrase | 0:6105cf98b610 | 78 | |
| ikrase | 0:6105cf98b610 | 79 | |
| ikrase | 0:6105cf98b610 | 80 | |
| ikrase | 0:6105cf98b610 | 81 | #endif |