1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

CC-21 Make it possible to enable Spektrum on CC, although it eats up S6 in

order to free a timer.  Mode PIOS_DELAY (not working cleanly) to TIM3 because
Spektrum resets TIM2 count.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2758 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-02-08 16:34:45 +00:00 committed by peabody124
parent d2e5c7c301
commit a3ba9c3781
2 changed files with 18 additions and 22 deletions

View File

@ -358,8 +358,8 @@ const struct pios_usart_cfg pios_usart_gps_cfg = {
#include <pios_spektrum_priv.h>
void PIOS_USART_spektrum_irq_handler(void);
void USART3_IRQHandler() __attribute__ ((alias ("PIOS_USART_spektrum_irq_handler")));
void TIM6_IRQHandler();
void TIM6_IRQHandler() __attribute__ ((alias ("PIOS_TIM6_irq_handler")));
void TIM2_IRQHandler();
void TIM2_IRQHandler() __attribute__ ((alias ("PIOS_TIM2_irq_handler")));
const struct pios_spektrum_cfg pios_spektrum_cfg = {
.pios_usart_spektrum_cfg = {
.regs = USART3,
@ -414,20 +414,20 @@ const struct pios_spektrum_cfg pios_spektrum_cfg = {
},
.remap = 0,
.irq = {
.handler = TIM6_IRQHandler,
.handler = TIM2_IRQHandler,
.init = {
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.timer = TIM6,
.timer = TIM2,
.port = GPIOB,
.ccr = TIM_IT_Update,
.pin = GPIO_Pin_11,
};
void PIOS_TIM6_irq_handler()
void PIOS_TIM2_irq_handler()
{
PIOS_SPEKTRUM_irq_handler();
}
@ -491,23 +491,17 @@ struct pios_com_dev pios_com_devs[] = {
.id = PIOS_USART_TELEM,
.driver = &pios_usart_com_driver,
},
#ifdef PIOS_COM_GPS
{
.id = PIOS_USART_GPS,
.driver = &pios_usart_com_driver,
},
#endif
#if defined(PIOS_INCLUDE_USB_HID)
{
.id = 0,
.driver = &pios_usb_com_driver,
},
#endif
#ifdef PIOS_COM_AUX
{
.id = PIOS_USART_AUX,
.driver = &pios_usart_com_driver,
},
#ifdef PIOS_COM_GPS
{
.id = PIOS_USART_GPS,
.driver = &pios_usart_com_driver,
},
#endif
#ifdef PIOS_COM_SPEKTRUM
{
@ -555,12 +549,14 @@ const struct pios_servo_channel pios_servo_channels[] = {
.channel = TIM_Channel_1,
.pin = GPIO_Pin_4,
},
#ifndef PIOS_INCLUDE_SPEKTRUM
{
.timer = TIM2,
.port = GPIOA,
.channel = TIM_Channel_3,
.pin = GPIO_Pin_2,
},
},
#endif
};
const struct pios_servo_cfg pios_servo_cfg = {

View File

@ -111,8 +111,8 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
//-------------------------
// Delay Timer
//-------------------------
#define PIOS_DELAY_TIMER TIM2
#define PIOS_DELAY_TIMER_RCC_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE)
#define PIOS_DELAY_TIMER TIM3
#define PIOS_DELAY_TIMER_RCC_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE)
//-------------------------
// System Settings
@ -157,13 +157,13 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
#define PIOS_COM_TELEM_RF 0
#ifdef PIOS_INCLUDE_GPS
#define PIOS_COM_GPS 1
#define PIOS_COM_GPS 2
#endif
#define PIOS_COM_TELEM_USB 2
#define PIOS_COM_TELEM_USB 1
#ifdef PIOS_INCLUDE_SPEKTRUM
#define PIOS_COM_SPEKTRUM_BAUDRATE 115200
#define PIOS_COM_SPEKTRUM 1
#define PIOS_COM_SPEKTRUM 2
#endif
//-------------------------