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.
Revision 1:1135f0b1566e, committed 2015-06-27
- Comitter:
- ikrase
- Date:
- Sat Jun 27 06:03:19 2015 +0000
- Parent:
- 0:6105cf98b610
- Child:
- 2:f982504e6e84
- Commit message:
- Continued development of polyservo;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FPointer.lib Sat Jun 27 06:03:19 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/AjK/code/FPointer/#56e309e76c19
--- a/PolyServo.cpp Fri Jun 26 08:23:05 2015 +0000
+++ b/PolyServo.cpp Sat Jun 27 06:03:19 2015 +0000
@@ -1,22 +1,25 @@
#include "PolyServo.h"
#include "mbed.h"
+#include "FPointer.h"
#include <vector>
Polyservo::Polyservo(DigitalOut servo_pins[], int num_pins): numservos(num_pins) {
- servos.reserve(numservos); servo_times.reserve(numservos);
+ servos.reserve(numservos); servo_timers.reserve(numservos); positions.reserve(numservos);
//numservos = num_pins;
for(int i = 0; i < numservos; i++){
Timeout* t = new Timeout();
servos.push_back(&servo_pins[i]);
- servo_times.push_back(t);
+ servo_timers.push_back(t);
+ positions.push_back(SERVO_DISABLED);
+ servos[i]->write(0);
}
servos[2]->is_connected();
- servo_times[2]->detach();
+ servo_timers[2]->detach();
}
\ No newline at end of file
--- a/PolyServo.h Fri Jun 26 08:23:05 2015 +0000
+++ b/PolyServo.h Sat Jun 27 06:03:19 2015 +0000
@@ -2,6 +2,7 @@
#define POLYSERVO_H
#include "mbed.h"
+#include "FPointer.h"
#include <vector>
@@ -15,11 +16,11 @@
//DigitalOut * servos;
bool global_enable;
- int position[];
+ std::vector<int> positions;
int numservos;
Polyservo(DigitalOut servo_pins[], int num_pins);
- void set_position(int pos);
+ void set_position(int s, int pos);
@@ -28,9 +29,13 @@
private:
Ticker period_tick;
- std::vector<Timeout *> servo_times;
+ std::vector<Timeout *> servo_timers;
//Timeout * servo_times;
+ uint32_t servo_set(uint32_t);
+
+ void servos_reset(void);
+