1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP-291 CC Servo configuration: Gets S5 and S6 working

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2566 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-01-24 07:51:38 +00:00 committed by peabody124
parent 108ea8c959
commit 99f2f3c68b
4 changed files with 12 additions and 78 deletions

View File

@ -67,9 +67,8 @@ void PIOS_Board_Init(void) {
PIOS_COM_Init();
/* Remap AFIO pin */
GPIO_PinRemapConfig(GPIO_PartialRemap_TIM3, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
GPIO_PinRemapConfig( GPIO_Remap_SWJ_NoJTRST, ENABLE);
GPIO_PinRemapConfig( GPIO_PartialRemap_TIM3, ENABLE);
PIOS_Servo_Init();
PIOS_ADC_Init();
@ -262,9 +261,9 @@ void PIOS_ADC_handler() {
* Telemetry USART
*/
void PIOS_USART_telem_irq_handler(void);
void USART2_IRQHandler() __attribute__ ((alias ("PIOS_USART_telem_irq_handler")));
void USART1_IRQHandler() __attribute__ ((alias ("PIOS_USART_telem_irq_handler")));
const struct pios_usart_cfg pios_usart_telem_cfg = {
.regs = USART2,
.regs = USART1,
.init = {
#if defined (PIOS_COM_TELEM_BAUDRATE)
.USART_BaudRate = PIOS_COM_TELEM_BAUDRATE,
@ -280,7 +279,7 @@ const struct pios_usart_cfg pios_usart_telem_cfg = {
.irq = {
.handler = PIOS_USART_telem_irq_handler,
.init = {
.NVIC_IRQChannel = USART2_IRQn,
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
@ -289,7 +288,7 @@ const struct pios_usart_cfg pios_usart_telem_cfg = {
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_3,
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
@ -297,7 +296,7 @@ const struct pios_usart_cfg pios_usart_telem_cfg = {
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_2,
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
@ -311,7 +310,6 @@ void PIOS_USART_gps_irq_handler(void);
void USART3_IRQHandler() __attribute__ ((alias ("PIOS_USART_gps_irq_handler")));
const struct pios_usart_cfg pios_usart_gps_cfg = {
.regs = USART3,
.remap = GPIO_PartialRemap_USART3,
.init = {
#if defined (PIOS_COM_GPS_BAUDRATE)
.USART_BaudRate = PIOS_COM_GPS_BAUDRATE,
@ -334,7 +332,7 @@ const struct pios_usart_cfg pios_usart_gps_cfg = {
},
},
.rx = {
.gpio = GPIOC,
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_2MHz,
@ -342,7 +340,7 @@ const struct pios_usart_cfg pios_usart_gps_cfg = {
},
},
.tx = {
.gpio = GPIOC,
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
@ -351,56 +349,6 @@ const struct pios_usart_cfg pios_usart_gps_cfg = {
},
};
#ifdef PIOS_COM_AUX
/*
* AUX USART
*/
void PIOS_USART_aux_irq_handler(void);
void USART1_IRQHandler() __attribute__ ((alias ("PIOS_USART_aux_irq_handler")));
const struct pios_usart_cfg pios_usart_aux_cfg = {
.regs = USART1,
.init = {
#if defined (PIOS_COM_AUX_BAUDRATE)
.USART_BaudRate = PIOS_COM_AUX_BAUDRATE,
#else
.USART_BaudRate = 57600,
#endif
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl = USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.handler = PIOS_USART_aux_irq_handler,
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.remap = GPIO_Remap_USART1,
.rx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_IPU,
},
},
.tx = {
.gpio = GPIOB,
.init = {
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF_PP,
},
},
};
#endif
#ifdef PIOS_COM_SPEKTRUM
/*
* SPEKTRUM USART
@ -461,12 +409,6 @@ struct pios_usart_dev pios_usart_devs[] = {
{
.cfg = &pios_usart_gps_cfg,
},
#ifdef PIOS_COM_AUX
#define PIOS_USART_AUX 2
{
.cfg = &pios_usart_aux_cfg,
},
#endif
#ifdef PIOS_COM_SPEKTRUM
#define PIOS_USART_AUX 2
{
@ -487,13 +429,6 @@ void PIOS_USART_gps_irq_handler(void)
PIOS_USART_IRQ_Handler(PIOS_USART_GPS);
}
#ifdef PIOS_COM_AUX
void PIOS_USART_aux_irq_handler(void)
{
PIOS_USART_IRQ_Handler(PIOS_USART_AUX);
}
#endif
#ifdef PIOS_COM_SPEKTRUM
void PIOS_USART_spektrum_irq_handler(void)
{

View File

@ -148,8 +148,7 @@ TIM4 | RC In 1 | Servo 3 | Servo 2 | Servo 1
#define PIOS_USART_RX_BUFFER_SIZE 256
#define PIOS_USART_TX_BUFFER_SIZE 256
#define PIOS_USART_BAUDRATE 57600
#define PIOS_COM_AUX 0
#define PIOS_COM_DEBUG PIOS_COM_AUX
#define PIOS_COM_DEBUG PIOS_COM_GPS
#define PIOS_COM_TELEM_RF 0
#define PIOS_COM_GPS 1

View File

@ -34,7 +34,6 @@
#include <pios.h>
#include <pios_stm32.h>
// GPIO_TypeDef *gpio;
struct pios_servo_channel {
TIM_TypeDef * timer;
GPIO_TypeDef * port;

View File

@ -7483,7 +7483,6 @@
65E8F03811EFF25C00BBF654 /* inc */ = {
isa = PBXGroup;
children = (
6526645A122DF972006F9A3C /* pios_i2c_priv.h */,
6528CCE212E40F6700CF5144 /* pios_adxl345.h */,
6526645B122DF972006F9A3C /* pios_wdg.h */,
651CF9EF120B700D00EEFD70 /* pios_usb_hid_desc.h */,
@ -7502,12 +7501,14 @@
65E8F04111EFF25C00BBF654 /* pios_gpio.h */,
65E8F04211EFF25C00BBF654 /* pios_hmc5843.h */,
65E8F04311EFF25C00BBF654 /* pios_i2c.h */,
6526645A122DF972006F9A3C /* pios_i2c_priv.h */,
65E8F04411EFF25C00BBF654 /* pios_irq.h */,
65E8F04511EFF25C00BBF654 /* pios_led.h */,
65E8F04611EFF25C00BBF654 /* pios_opahrs.h */,
65E8F04711EFF25C00BBF654 /* pios_opahrs_proto.h */,
65E8F04811EFF25C00BBF654 /* pios_ppm.h */,
65E8F04911EFF25C00BBF654 /* pios_pwm.h */,
657FF86A12EA8BFB00801617 /* pios_pwm_priv.h */,
65E8F04A11EFF25C00BBF654 /* pios_sdcard.h */,
65E8F04B11EFF25C00BBF654 /* pios_servo.h */,
65FBE14412E7C98100176B5A /* pios_servo_priv.h */,