update credits
[librepilot.git] / flight / pios / posix / pios_servo.c
blobae00eaa04e6ccaaa5478ff4ebce6123d9fd75286
1 /**
2 ******************************************************************************
3 * @addtogroup PIOS PIOS Core hardware abstraction layer
4 * @{
5 * @addtogroup PIOS_SERVO RC Servo Functions
6 * @brief Code to do set RC servo output
7 * @{
9 * @file pios_servo.c
10 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
11 * @brief RC Servo routines (STM32 dependent)
12 * @see The GNU Public License (GPL) Version 3
14 *****************************************************************************/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 3 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * for more details.
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 /* Project Includes */
32 #include "pios.h"
34 #if defined(PIOS_INCLUDE_SERVO)
36 /* Private Function Prototypes */
38 /* Local Variables */
39 static volatile uint16_t ServoPosition[PIOS_SERVO_NUM_TIMERS];
41 /**
42 * Initialise Servos
44 void PIOS_Servo_Init(void)
46 /**
47 * Set the servo update rate (Max 500Hz)
48 * \param[in] array of rates in Hz
49 * \param[in] array of timer clocks in Hz
50 * \param[in] maximum number of banks
52 void PIOS_Servo_SetHz(const uint16_t *speeds, const uint32_t *clock, uint8_t banks)
55 /**
56 * Set servo position
57 * \param[in] Servo Servo number (0-7)
58 * \param[in] Position Servo position in milliseconds
60 void PIOS_Servo_Set(uint8_t Servo, uint16_t Position)
62 #ifndef PIOS_ENABLE_DEBUG_PINS
63 /* Make sure servo exists */
64 if (Servo < PIOS_SERVO_NUM_OUTPUTS) {
65 /* Update the position */
66 ServoPosition[Servo] = Position;
68 #endif // PIOS_ENABLE_DEBUG_PINS
71 #endif /* if defined(PIOS_INCLUDE_SERVO) */