Prof Greg Egan / Mbed 2 deprecated UAVXArm-GKE

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers outputs_conventional.h Source File

outputs_conventional.h

00001 // ===============================================================================================
00002 // =                              UAVXArm Quadrocopter Controller                                =
00003 // =                           Copyright (c) 2008 by Prof. Greg Egan                             =
00004 // =                 Original V3.15 Copyright (c) 2007 Ing. Wolfgang Mahringer                   =
00005 // =                           http://code.google.com/p/uavp-mods/                               =
00006 // ===============================================================================================
00007 
00008 //    This is part of UAVXArm.
00009 
00010 //    UAVXArm is free software: you can redistribute it and/or modify it under the terms of the GNU
00011 //    General Public License as published by the Free Software Foundation, either version 3 of the
00012 //    License, or (at your option) any later version.
00013 
00014 //    UAVXArm is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without
00015 //    even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016 //    See the GNU General Public License for more details.
00017 
00018 //    You should have received a copy of the GNU General Public License along with this program.
00019 //    If not, see http://www.gnu.org/licenses/
00020 
00021 
00022 void OutSignals(void) {
00023     static int8 m;
00024     static uint8 r;
00025 
00026     for ( m = 0; m < (uint8)6; m++ )
00027         PWM[m] = Limit(PWM[m], ESCMin, ESCMax);
00028 
00029 #if !( defined SIMULATE | defined TESTING )
00030 
00031     if ( !F.MotorsArmed )
00032         StopMotors();
00033 
00034 #ifdef ELEVON
00035     Out0.pulsewidth_us(1000 + (int16)( PWM[ThrottleC] * PWMScale ) );
00036     Out1.pulsewidth_us(1000 + (int16)( PWM[RightElevonC] * PWMScale ) );
00037     Out2.pulsewidth_us(1000 + (int16)( PWM[LeftElevonC] * PWMScale ) );
00038     Out3.pulsewidth_us(1000 + (int16)( PWM[RudderC] * PWMScale ) );
00039 #else
00040     Out0.pulsewidth_us(1000 + (int16)( PWM[ThrottleC] * PWMScale ) );
00041     Out1.pulsewidth_us(1000 + (int16)( PWM[AileronC] * PWMScale ) );
00042     Out2.pulsewidth_us(1000 + (int16)( PWM[ElevatorC] * PWMScale ) );
00043     Out3.pulsewidth_us(1000 + (int16)( PWM[RudderC] * PWMScale ) );
00044 #endif
00045 
00046 } // OutSignals
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054