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
- Committer:
- ikrase
- Date:
- 2015-07-03
- Revision:
- 7:f9e1e813fa24
- Parent:
- 6:bad5554bb890
- Child:
- 8:c09ae4fef420
File content as of revision 7:f9e1e813fa24:
#ifndef POLYSERVO_H
#define POLYSERVO_H
#include "mbed.h"
#include "FPointer.h"
#include <vector>
//#include "SpecifiedTimeout.h"
#define SERVO_DISABLED -1 // This is going to take raw servo microsecond entries.
#define PPM_PERIOD 20000 // In microseconds
void servo_set(int id);
class Polyservo {
public:
std::vector<DigitalOut *> servos;
//DigitalOut * servos;
bool global_enable;
std::vector<int> positions;
int numservos;
Polyservo(DigitalOut servo_pins[], int num_pins);
void set_position(int s, int pos);
private:
Ticker period_tick;
std::vector<Timeout *> servo_timers;
//Timeout * servo_times;
//void servo_set(int id);
void servos_reset(void);
template <typename Func, Func func>
struct ResetWrapper {
ResetWrapper(int id): id_(id) { }
void f() {func(id_);}
int id_;
};
};
#endif