wesh gros, ajout des ref dans brushlessservo

Dependencies:   MPU6050 mbed

Fork of Gimbal_ENSEA by Thomas Giraud-Sauveur

Files at this revision

API Documentation at this revision

Comitter:
sype
Date:
Fri Jun 03 14:17:35 2016 +0000
Parent:
1:f5b18e784a39
Commit message:
Ajout ref brushlessservo

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mycontroller.cpp Show annotated file Show diff for this revision Revisions of this file
mycontroller.h Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Jun 03 13:51:54 2016 +0000
+++ b/main.cpp	Fri Jun 03 14:17:35 2016 +0000
@@ -6,7 +6,19 @@
 Serial pc(USBTX, USBRX); 
 Ticker filter; 
 Ticker toggler1; 
-MPU6050 mpu6050;  
+MPU6050 mpu6050;
+
+PwmOut pwmA1(PA_1);
+PwmOut pwmA2(PA_2);
+PwmOut pwmA3(PA_3);
+
+PwmOut pwmB1(PA_4);
+PwmOut pwmB2(PA_5);
+PwmOut pwmB3(PA_6);
+
+brushlessservo moteur(pwmA1,pwmA2,pwmA3);
+brushlessservo moteurB(pwmB1,pwmB2,pwmB3);
+
 /*
 PwmOut pwm1A(PA_10);
 PwmOut pwm1B(PA_6);
@@ -22,7 +34,6 @@
 void toggle_led2();
 
 int main() {
-    brushlessservo moteur;
     mpu6050.init(); 
     filter.attach(&compFilter, 0.005);
     wait(1);
--- a/mycontroller.cpp	Fri Jun 03 13:51:54 2016 +0000
+++ b/mycontroller.cpp	Fri Jun 03 14:17:35 2016 +0000
@@ -11,7 +11,7 @@
 
 
 
-brushlessservo::brushlessservo(/*PwmOut phaseA,PwmOut phaseB,PwmOut &phaseC,DigitalOut &EENNAABLE1,DigitalOut &EENNAABLE2*/)
+brushlessservo::brushlessservo(PwmOut &p_pwm1,PwmOut &p_pwm2,PwmOut &p_pwm3) : pwm1(p_pwm1), pwm2(p_pwm2), pwm3(p_pwm3)
 {
 /*    
     pwm[1]=phaseA;
--- a/mycontroller.h	Fri Jun 03 13:51:54 2016 +0000
+++ b/mycontroller.h	Fri Jun 03 14:17:35 2016 +0000
@@ -6,12 +6,13 @@
 class brushlessservo
 {
     public:
-        brushlessservo();
+        brushlessservo(PwmOut &p_pwm1,PwmOut &p_pwm2,PwmOut &p_pwm3);
         void gotothetha(int theta);
         void updatepwm();
         void test();
         
     private:
+        PwmOut &pwm1, &pwm2, &pwm3;
         int32_t realtheta;
         int32_t targettheta;
         int32_t phase[3];