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@9:a40eac6bdfae, 2015-07-04 (annotated)
- Committer:
- ikrase
- Date:
- Sat Jul 04 07:11:33 2015 +0000
- Revision:
- 9:a40eac6bdfae
- Parent:
- 8:c09ae4fef420
Compiles now, still need to check.
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 | 9:a40eac6bdfae | 14 | //void servo_set(int id); |
| 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 | 8:c09ae4fef420 | 23 | //bool global_enable; |
| ikrase | 8:c09ae4fef420 | 24 | int positions[NUM_SERVOS]; |
| ikrase | 0:6105cf98b610 | 25 | int numservos; |
| ikrase | 8:c09ae4fef420 | 26 | void disable(); |
| ikrase | 8:c09ae4fef420 | 27 | void enable(); |
| ikrase | 0:6105cf98b610 | 28 | |
| ikrase | 8:c09ae4fef420 | 29 | Polyservo(DigitalOut servo_pins[]); |
| ikrase | 1:1135f0b1566e | 30 | void set_position(int s, int pos); |
| ikrase | 0:6105cf98b610 | 31 | |
| ikrase | 9:a40eac6bdfae | 32 | typedef void (Polyservo::*PolyservoMbr)(void); |
| ikrase | 9:a40eac6bdfae | 33 | |
| ikrase | 9:a40eac6bdfae | 34 | |
| ikrase | 0:6105cf98b610 | 35 | |
| ikrase | 0:6105cf98b610 | 36 | |
| ikrase | 0:6105cf98b610 | 37 | |
| ikrase | 0:6105cf98b610 | 38 | |
| ikrase | 0:6105cf98b610 | 39 | private: |
| ikrase | 0:6105cf98b610 | 40 | |
| ikrase | 0:6105cf98b610 | 41 | Ticker period_tick; |
| ikrase | 1:1135f0b1566e | 42 | std::vector<Timeout *> servo_timers; |
| ikrase | 0:6105cf98b610 | 43 | //Timeout * servo_times; |
| ikrase | 0:6105cf98b610 | 44 | |
| ikrase | 7:f9e1e813fa24 | 45 | //void servo_set(int id); |
| ikrase | 1:1135f0b1566e | 46 | |
| ikrase | 1:1135f0b1566e | 47 | void servos_reset(void); |
| ikrase | 1:1135f0b1566e | 48 | |
| ikrase | 8:c09ae4fef420 | 49 | bool global_enable; |
| ikrase | 8:c09ae4fef420 | 50 | |
| ikrase | 8:c09ae4fef420 | 51 | void servo0_set(void); |
| ikrase | 8:c09ae4fef420 | 52 | void servo1_set(void); |
| ikrase | 8:c09ae4fef420 | 53 | void servo2_set(void); |
| ikrase | 8:c09ae4fef420 | 54 | void servo3_set(void); |
| ikrase | 8:c09ae4fef420 | 55 | void servo4_set(void); |
| ikrase | 8:c09ae4fef420 | 56 | void servo5_set(void); |
| ikrase | 8:c09ae4fef420 | 57 | void servo6_set(void); |
| ikrase | 8:c09ae4fef420 | 58 | void servo7_set(void); |
| ikrase | 8:c09ae4fef420 | 59 | void servo8_set(void); |
| ikrase | 8:c09ae4fef420 | 60 | void servo9_set(void); |
| ikrase | 8:c09ae4fef420 | 61 | void servo10_set(void); |
| ikrase | 8:c09ae4fef420 | 62 | void servo11_set(void); |
| ikrase | 8:c09ae4fef420 | 63 | //void servo12_set(void); |
| ikrase | 6:bad5554bb890 | 64 | |
| ikrase | 9:a40eac6bdfae | 65 | |
| ikrase | 9:a40eac6bdfae | 66 | |
| ikrase | 9:a40eac6bdfae | 67 | //void (Polyservo::*)(void) myPtr; |
| ikrase | 9:a40eac6bdfae | 68 | PolyservoMbr servo_sets[12]; |
| ikrase | 9:a40eac6bdfae | 69 | |
| ikrase | 8:c09ae4fef420 | 70 | |
| ikrase | 6:bad5554bb890 | 71 | |
| ikrase | 6:bad5554bb890 | 72 | |
| ikrase | 6:bad5554bb890 | 73 | |
| ikrase | 6:bad5554bb890 | 74 | |
| ikrase | 6:bad5554bb890 | 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 | |
| ikrase | 0:6105cf98b610 | 82 | |
| ikrase | 0:6105cf98b610 | 83 | }; |
| ikrase | 0:6105cf98b610 | 84 | |
| ikrase | 0:6105cf98b610 | 85 | |
| ikrase | 0:6105cf98b610 | 86 | |
| ikrase | 9:a40eac6bdfae | 87 | |
| ikrase | 0:6105cf98b610 | 88 | #endif |