paparazzi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paparazzi-commits] [4697]


From: antoine drouin
Subject: [paparazzi-commits] [4697]
Date: Mon, 15 Mar 2010 15:48:12 +0000

Revision: 4697
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4697
Author:   poine
Date:     2010-03-15 15:48:12 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------


Modified Paths:
--------------
    paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.c
    paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.h

Added Paths:
-----------
    paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_pwm.h
    paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/
    
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.c
    
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.h

Added: paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_pwm.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_pwm.h            
                (rev 0)
+++ paparazzi3/trunk/sw/airborne/booz/actuators/booz_actuators_pwm.h    
2010-03-15 15:48:12 UTC (rev 4697)
@@ -0,0 +1,34 @@
+/*
+ * $Id$
+ *  
+ * Copyright (C) 2010 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA. 
+ */
+
+#ifndef BOOZ_ACTUATORS_PWM_H
+#define BOOZ_ACTUATORS_PWM_H
+
+#include "std.h"
+
+#define BOOZ_ACTUATORS_PWM_NB 4
+extern int32_t booz_actuators_pwm_values[BOOZ_ACTUATORS_PWM_NB];
+
+#include "actuators/booz_actuators_pwm_hw.h"
+
+#endif /* BOOZ_ACTUATORS_PWM_H */

Added: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.c
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.c  
                            (rev 0)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.c  
    2010-03-15 15:48:12 UTC (rev 4697)
@@ -0,0 +1,99 @@
+/*
+ * $Id$
+ *  
+ * Copyright (C) 2010 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA. 
+ */
+
+#include "actuators/booz_actuators_pwm.h"
+
+#include <stm32/gpio.h>
+#include <stm32/rcc.h>
+#include <stm32/flash.h>
+#include <stm32/misc.h>
+#include <stm32/tim.h>
+
+void booz_actuators_pwm_hw_init(void) {
+
+  /* System clock */
+  /* PCLK1 = HCLK/4 */
+  RCC_PCLK1Config(RCC_HCLK_Div4);
+  /* TIM3 clock enable */
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
+  /* GPIOB and GPIOC clock enable */
+  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | 
RCC_APB2Periph_GPIOC | 
+                        RCC_APB2Periph_AFIO, ENABLE);
+  /* GPIO */
+  /* PC6=servo1 PC7=servo2 PB0=servo3 */
+  GPIO_InitTypeDef GPIO_InitStructure;
+  GPIO_InitStructure.GPIO_Pin   = GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | 
GPIO_Pin_9;
+  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_AF_PP;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+  GPIO_Init(GPIOC, &GPIO_InitStructure);
+  GPIO_PinRemapConfig(GPIO_FullRemap_TIM3, ENABLE);    
+
+  /* TIM */
+  TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
+  TIM_OCInitTypeDef  TIM_OCInitStructure;
+  /* Time base configuration */
+  TIM_TimeBaseStructure.TIM_Period = 56249;
+  TIM_TimeBaseStructure.TIM_Prescaler = 15;
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0;
+  TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
+
+  TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
+ 
+  uint16_t CCR1_Val = 2250;
+  uint16_t CCR2_Val = 2250;
+  uint16_t CCR3_Val = 2250;
+  /* PWM1 Mode configuration: Channel1 */
+  TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
+  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
+  TIM_OCInitStructure.TIM_Pulse = CCR1_Val;
+  TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
+
+  TIM_OC1Init(TIM3, &TIM_OCInitStructure);
+
+  TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);
+
+  /* PWM1 Mode configuration: Channel2 */
+  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
+  TIM_OCInitStructure.TIM_Pulse = CCR2_Val;
+
+  TIM_OC2Init(TIM3, &TIM_OCInitStructure);
+
+  TIM_OC2PreloadConfig(TIM3, TIM_OCPreload_Enable);
+
+  /* PWM1 Mode configuration: Channel3 */
+  TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
+  TIM_OCInitStructure.TIM_Pulse = CCR3_Val;
+
+  TIM_OC3Init(TIM3, &TIM_OCInitStructure);
+
+  TIM_OC3PreloadConfig(TIM3, TIM_OCPreload_Enable);
+
+  /* TIM3 enable counter */
+  TIM_Cmd(TIM3, ENABLE);
+
+}
+
+void booz_actuators_pwm_commit(void) {
+  TIM_SetCompare1 (TIM3, booz_actuators_pwm_values[0]);
+  
+}

Added: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.h
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.h  
                            (rev 0)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/actuators/booz_actuators_pwm_hw.h  
    2010-03-15 15:48:12 UTC (rev 4697)
@@ -0,0 +1,34 @@
+/*
+ * $Id$
+ *  
+ * Copyright (C) 2010 Antoine Drouin <address@hidden>
+ *
+ * This file is part of paparazzi.
+ *
+ * paparazzi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * paparazzi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with paparazzi; see the file COPYING.  If not, write to
+ * the Free Software Foundation, 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA. 
+ */
+
+/*
+ * STM32 PWM servos handling
+ */
+
+#ifndef BOOZ_ACTUATORS_PWM_HW_H
+#define BOOZ_ACTUATORS_PWM_HW_H
+
+extern void booz_actuators_pwm_hw_init(void);
+extern void booz_actuators_pwm_commit(void);
+
+#endif /* BOOZ_ACTUATORS_PWM_HW_H */

Modified: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.c    
2010-03-15 15:46:59 UTC (rev 4696)
+++ paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.c    
2010-03-15 15:48:12 UTC (rev 4697)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *  
- * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ * Copyright (C) 2010 Antoine Drouin <address@hidden>
  *
  * This file is part of paparazzi.
  *

Modified: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.h    
2010-03-15 15:46:59 UTC (rev 4696)
+++ paparazzi3/trunk/sw/airborne/booz/arch/stm32/booz_radio_control_ppm_hw.h    
2010-03-15 15:48:12 UTC (rev 4697)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *  
- * Copyright (C) 2008-2009 Antoine Drouin <address@hidden>
+ * Copyright (C) 2010 Antoine Drouin <address@hidden>
  *
  * This file is part of paparazzi.
  *





reply via email to

[Prev in Thread] Current Thread [Next in Thread]