paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [5677] adding a not yet working ppm decoder for lisa


From: antoine drouin
Subject: [paparazzi-commits] [5677] adding a not yet working ppm decoder for lisa
Date: Wed, 25 Aug 2010 17:44:55 +0000

Revision: 5677
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=5677
Author:   poine
Date:     2010-08-25 17:44:54 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
adding a not yet working ppm decoder for lisa

Modified Paths:
--------------
    paparazzi3/trunk/conf/airframes/Poine/booz2_a1.xml
    paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml
    paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile
    paparazzi3/trunk/conf/autopilot/fixedwing.xml
    paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
    paparazzi3/trunk/conf/messages.xml
    
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c
    
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h
    paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_ppm.h
    paparazzi3/trunk/sw/airborne/booz/test/booz2_test_radio_control.c
    paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h

Modified: paparazzi3/trunk/conf/airframes/Poine/booz2_a1.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/Poine/booz2_a1.xml  2010-08-25 14:25:15 UTC 
(rev 5676)
+++ paparazzi3/trunk/conf/airframes/Poine/booz2_a1.xml  2010-08-25 17:44:54 UTC 
(rev 5677)
@@ -196,13 +196,10 @@
  </section>
 
 
-
   <firmware name="rotorcraft">
-    <target name="ap" board="booz_1.0">
-      <param  name="FLASH_MODE" value="IAP"/>   <!-- default for the board but 
putting it here as example--> 
-    </target>
+    <target name="ap" board="booz_1.0"/>
     <target name="sim" board="pc">
-      <subsystem name="simulator"     type="nps"/>
+      <subsystem name="fdm"         type="nps"/>
     </target>
     <subsystem name="radio_control" type="ppm"/>
     <subsystem name="actuators"     type="mkk"/>
@@ -213,9 +210,10 @@
   </firmware>
 
   <firmware name="booz_test_progs">
-    <target name="test_telemetry" board="booz_1.0"/>
-    <target name="test_baro"      board="booz_1.0"/>
-    <target name="test_spektrum"  board="booz_1.0"/>
+    <target name="test_telemetry"   board="booz_1.0"/>
+    <target name="test_baro"        board="booz_1.0"/>
+    <target name="test_rc_spektrum" board="booz_1.0"/>
+    <target name="test_rc_ppm"      board="booz_1.0"/>
   </firmware>
 
 

Modified: paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml
===================================================================
--- paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml  2010-08-25 14:25:15 UTC 
(rev 5676)
+++ paparazzi3/trunk/conf/airframes/Poine/booz2_a7.xml  2010-08-25 17:44:54 UTC 
(rev 5677)
@@ -175,11 +175,11 @@
    <define name="SENSORS_PARAMS" 
value="&quot;nps_sensors_params_booz2_a1.h&quot;"/>
  </section>
 
-<!-- -->
+<!--
  <modules main_freq="512">
    <load name="vehicle_interface_overo_link.xml"/>
  </modules>
-<!-- -->
+-->
  
   <firmware name="rotorcraft">
     <target name="ap" board="lisa_l_1.0">
@@ -191,7 +191,7 @@
       <subsystem name="actuators"     type="asctec"/>
     </target>
     <target name="sim" board="pc">
-      <subsystem name="simulator"     type="nps"/>
+      <subsystem name="fdm"           type="nps"/>
       <subsystem name="radio_control" type="ppm"/>
       <subsystem name="actuators"     type="mkk"/>
     </target>
@@ -202,9 +202,10 @@
   </firmware>
 
   <firmware name="lisa_l_test_progs">
-    <target name="test_telemetry" board="lisa_l_1.0"/>
-    <target name="test_baro"      board="lisa_l_1.0"/>
-    <target name="test_spektrum"  board="lisa_l_1.0"/>
+    <target name="test_telemetry"   board="lisa_l_1.0"/>
+    <target name="test_baro"        board="lisa_l_1.0"/>
+    <target name="test_rc_spektrum" board="lisa_l_1.0"/>
+    <target name="test_rc_ppm"      board="lisa_l_1.0"/>
   </firmware>
 
   <firmware name="lisa_passthrough">

Modified: paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile    2010-08-25 
14:25:15 UTC (rev 5676)
+++ paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile    2010-08-25 
17:44:54 UTC (rev 5677)
@@ -121,7 +121,7 @@
 
 
 #
-# test_spektrum :
+# test_rc_spektrum :
 #
 # TODO
 # 
@@ -131,3 +131,36 @@
 
 
 
+#
+# test rc ppm
+#
+# configuration
+#   SYS_TIME_LED
+#   MODEM_PORT
+#   MODEM_BAUD
+#   RADIO_CONTROL_LED
+#
+test_rc_ppm.ARCHDIR   = $(ARCHI)
+test_rc_ppm.ARCH      = arm7tdmi
+test_rc_ppm.TARGET    = test_rc_ppm
+test_rc_ppm.TARGETDIR = test_rc_ppm
+
+test_rc_ppm.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+test_rc_ppm.CFLAGS += -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -I$(SRC_BOARD)
+test_rc_ppm.CFLAGS += -DPERIPHERALS_AUTO_INIT
+test_rc_ppm.srcs   += $(SRC_BOOZ)/test/booz2_test_radio_control.c
+test_rc_ppm.CFLAGS += -DUSE_LED
+test_rc_ppm.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))'
+test_rc_ppm.CFLAGS += -DTIME_LED=$(SYS_TIME_LED)
+test_rc_ppm.srcs   += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
+
+test_rc_ppm.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD)
+test_rc_ppm.srcs   += $(SRC_ARCH)/uart_hw.c
+test_rc_ppm.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport 
-DDOWNLINK_DEVICE=$(MODEM_PORT) 
+test_rc_ppm.srcs   += downlink.c pprz_transport.c
+test_rc_ppm.CFLAGS += -DUSE_RADIO_CONTROL 
-DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
+test_rc_ppm.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_ppm.h\"
+test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
+test_rc_ppm.srcs   += $(SRC_BOOZ)/booz_radio_control.c \
+                      $(SRC_BOOZ)/radio_control/booz_radio_control_ppm.c \
+                      
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_ppm_arch.c
\ No newline at end of file

Modified: paparazzi3/trunk/conf/autopilot/fixedwing.xml
===================================================================
--- paparazzi3/trunk/conf/autopilot/fixedwing.xml       2010-08-25 14:25:15 UTC 
(rev 5676)
+++ paparazzi3/trunk/conf/autopilot/fixedwing.xml       2010-08-25 17:44:54 UTC 
(rev 5677)
@@ -3,7 +3,7 @@
 
 
  <target name="ap" description="The autopilot">
-   <param name="FLASH_MODE" values="|IAP|JTAG|ISP|"/>
+   <param name="FLASH_MODE" values="IAP|JTAG|ISP"/>
    <define name="AGR_CLIMB" />
    <define name="TRAFFIC_INFO"/>
    <define name="LOITER_TRIM"/>

Modified: paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile  2010-08-25 
14:25:15 UTC (rev 5676)
+++ paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile  2010-08-25 
17:44:54 UTC (rev 5677)
@@ -117,40 +117,81 @@
 
 
 #
-# test_spektrum : sends RADIO_CONTROL messages on telemetry
+# test_rc_spektrum : sends RADIO_CONTROL messages on telemetry
 #
 # configuration
-#   MODEM_PORT :
-#   MODEM_BAUD :
-#   RADIO_CONROL_LINK :
+#   SYS_TIME_LED
+#   MODEM_PORT
+#   MODEM_BAUD
+#   RADIO_CONTROL_LED
+#   RADIO_CONROL_LINK
 #
+test_rc_spektrum.ARCHDIR   = $(ARCHI)
+test_rc_spektrum.TARGET    = test_rc_spektrum
+test_rc_spektrum.TARGETDIR = test_rc_spektrum
+
+test_rc_spektrum.CFLAGS += -I$(SRC_ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) 
-DPERIPHERALS_AUTO_INIT
+test_rc_spektrum.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) 
+test_rc_spektrum.srcs   += $(SRC_BOOZ_TEST)/booz2_test_radio_control.c \
+                           $(SRC_ARCH)/stm32_exceptions.c              \
+                           $(SRC_ARCH)/stm32_vector_table.c
+
+test_rc_spektrum.CFLAGS += -DUSE_LED
+test_rc_spektrum.srcs   += $(SRC_ARCH)/led_hw.c
+test_rc_spektrum.CFLAGS += -DUSE_SYS_TIME
+test_rc_spektrum.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))'
+test_rc_spektrum.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
+test_rc_spektrum.srcs   += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+test_rc_spektrum.CFLAGS += -DUSE_$(MODEM_PORT) 
-D$(MODEM_PORT)_BAUD=$(MODEM_BAUD)
+test_rc_spektrum.srcs   += $(SRC_ARCH)/uart_hw.c
+test_rc_spektrum.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport 
-DDOWNLINK_DEVICE=$(MODEM_PORT)
+test_rc_spektrum.srcs   += downlink.c pprz_transport.c
+test_rc_spektrum.CFLAGS += -DUSE_RADIO_CONTROL
+test_rc_spektrum.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
+test_rc_spektrum.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\"
+test_rc_spektrum.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"radio_control/booz_radio_control_spektrum_dx7se.h\"
+test_rc_spektrum.CFLAGS += -DRADIO_CONTROL_LINK=$(RADIO_CONTROL_LINK)
+test_rc_spektrum.CFLAGS += -DUSE_$(RADIO_CONTROL_LINK) 
-D$(RADIO_CONTROL_LINK)_BAUD=B115200
+test_rc_spektrum.srcs   += $(SRC_BOOZ)/booz_radio_control.c                    
             \
+                           
$(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c          \
+                          
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
+
+
 #
-test_spektrum.ARCHDIR = $(ARCHI)
-test_spektrum.TARGET = test_spektrum
-test_spektrum.TARGETDIR = test_spektrum
-test_spektrum.CFLAGS += -I$(SRC_ARCH) -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) 
-DPERIPHERALS_AUTO_INIT
-test_spektrum.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG) 
-test_spektrum.srcs   += $(SRC_BOOZ_TEST)/booz2_test_radio_control.c \
-                        $(SRC_ARCH)/stm32_exceptions.c              \
-                        $(SRC_ARCH)/stm32_vector_table.c
+# test_rc_ppm
+#
+# configuration
+#   SYS_TIME_LED
+#   MODEM_PORT
+#   MODEM_BAUD
+#   RADIO_CONTROL_LED
+#
+test_rc_ppm.ARCHDIR   = $(ARCHI)
+test_rc_ppm.TARGET    = test_rc_ppm
+test_rc_ppm.TARGETDIR = test_rc_ppm
 
-test_spektrum.CFLAGS += -DUSE_LED
-test_spektrum.srcs   += $(SRC_ARCH)/led_hw.c
-test_spektrum.CFLAGS += -DUSE_SYS_TIME
-test_spektrum.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))'
-test_spektrum.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
-test_spektrum.srcs   += sys_time.c $(SRC_ARCH)/sys_time_hw.c
-test_spektrum.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD)
-test_spektrum.srcs   += $(SRC_ARCH)/uart_hw.c
-test_spektrum.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport 
-DDOWNLINK_DEVICE=$(MODEM_PORT)
-test_spektrum.srcs   += downlink.c pprz_transport.c
-test_spektrum.CFLAGS += -DUSE_RADIO_CONTROL
-test_spektrum.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
-test_spektrum.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\"
-test_spektrum.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"radio_control/booz_radio_control_spektrum_dx7se.h\"
-test_spektrum.CFLAGS += -DRADIO_CONTROL_LINK=$(RADIO_CONTROL_LINK)
-test_spektrum.CFLAGS += -DUSE_$(RADIO_CONTROL_LINK) 
-D$(RADIO_CONTROL_LINK)_BAUD=B115200
-test_spektrum.srcs   += $(SRC_BOOZ)/booz_radio_control.c                       
          \
-                        
$(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c          \
-                       
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
+test_rc_ppm.CFLAGS += -I$(SRC_BOOZ) -I$(SRC_BOOZ_ARCH) -I$(SRC_BOARD)
+test_rc_ppm.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+test_rc_ppm.CFLAGS += -DPERIPHERALS_AUTO_INIT
+test_rc_ppm.srcs   += $(SRC_BOOZ)/test/booz2_test_radio_control.c \
+                      $(SRC_ARCH)/stm32_exceptions.c              \
+                      $(SRC_ARCH)/stm32_vector_table.c
 
+test_rc_ppm.CFLAGS += -DUSE_LED
+test_rc_ppm.srcs   += $(SRC_ARCH)/led_hw.c
+test_rc_ppm.CFLAGS += -DUSE_SYS_TIME
+test_rc_ppm.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./512.))'
+test_rc_ppm.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
+test_rc_ppm.srcs   += sys_time.c $(SRC_ARCH)/sys_time_hw.c
+test_rc_ppm.CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD)
+test_rc_ppm.srcs   += $(SRC_ARCH)/uart_hw.c
+test_rc_ppm.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport 
-DDOWNLINK_DEVICE=$(MODEM_PORT) 
+test_rc_ppm.srcs   += downlink.c pprz_transport.c
+test_rc_ppm.CFLAGS += -DUSE_RADIO_CONTROL
+test_rc_ppm.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
+test_rc_ppm.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_ppm.h\"
+test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
+test_rc_ppm.srcs   += $(SRC_BOOZ)/booz_radio_control.c \
+                      $(SRC_BOOZ)/radio_control/booz_radio_control_ppm.c \
+                      
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_ppm_arch.c
+test_rc_ppm.CFLAGS += -DUSE_TIM2_IRQ

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
    2010-08-25 14:25:15 UTC (rev 5676)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
    2010-08-25 17:44:54 UTC (rev 5677)
@@ -1,7 +1,7 @@
 #
 # Autopilot
 #
-ap.CFLAGS += -DUSE_RADIO_CONTROL -DRADIO_CONTROL_LED=1
+ap.CFLAGS += -DUSE_RADIO_CONTROL -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
 ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_ppm.h\"
 ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
 ap.srcs += $(SRC_BOOZ)/booz_radio_control.c                    \

Modified: paparazzi3/trunk/conf/messages.xml
===================================================================
--- paparazzi3/trunk/conf/messages.xml  2010-08-25 14:25:15 UTC (rev 5676)
+++ paparazzi3/trunk/conf/messages.xml  2010-08-25 17:44:54 UTC (rev 5677)
@@ -344,7 +344,7 @@
   </message>
 
   <message name="CHRONO" id="48">
-    <field name="tag" type="uint8"/>
+    <field name="tag"  type="uint8"/>
     <field name="time" type="uint32" unit="us"/>
   </message>
 

Modified: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c
    2010-08-25 14:25:15 UTC (rev 5676)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c
    2010-08-25 17:44:54 UTC (rev 5677)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *  
- * Copyright (C) 2010 Antoine Drouin <address@hidden>
+ * Copyright (C) 2010 The Paparazzi Team
  *
  * This file is part of paparazzi.
  *
@@ -23,6 +23,111 @@
 
 #include "booz_radio_control.h"
 
-void booz_radio_control_ppm_hw_init ( void ) {
+#include <stm32/rcc.h>
+#include <stm32/gpio.h>
+#include <stm32/tim.h>
+#include <stm32/misc.h>
 
+#include "sys_time.h"
+
+#include "my_debug_servo.h"
+
+
+/*
+ *
+ * This a radio control ppm driver for stm32
+ * signal on PA1 TIM2/CH2 (uart1 trig on lisa/L)
+ *
+ */
+uint8_t  booz_radio_control_ppm_cur_pulse;
+uint32_t booz_radio_control_ppm_last_pulse_time;
+
+uint32_t debug_len;
+
+void tim2_irq_handler(void);
+
+void booz_radio_control_ppm_arch_init ( void ) {
+
+  /* TIM2 channel 2 pin (PA.01) configuration */
+  GPIO_InitTypeDef GPIO_InitStructure;
+  GPIO_InitStructure.GPIO_Pin =  GPIO_Pin_1;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+  GPIO_Init(GPIOA, &GPIO_InitStructure);
+
+  /* TIM2 clock enable */
+  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
+
+  /* GPIOA clock enable */
+  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
+
+ /* TIM2 configuration: Input Capture mode ---------------------
+     The external signal is connected to TIM2 CH2 pin (PA.01)  
+     The Rising edge is used as active edge,
+  ------------------------------------------------------------ */
+  TIM_ICInitTypeDef  TIM_ICInitStructure;
+  TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;
+  TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;
+  TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
+  TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
+  TIM_ICInitStructure.TIM_ICFilter = 0x0;
+  TIM_ICInit(TIM2, &TIM_ICInitStructure);
+
+
+  /* Enable the TIM2 global Interrupt */
+  NVIC_InitTypeDef NVIC_InitStructure;
+  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
+  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
+  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
+  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
+  NVIC_Init(&NVIC_InitStructure);
+ 
+  /* TIM2 enable counter */
+  TIM_Cmd(TIM2, ENABLE);
+
+  /* Enable the CC2 Interrupt Request */
+  TIM_ITConfig(TIM2, TIM_IT_CC2, ENABLE);
+
+  booz_radio_control_ppm_last_pulse_time = 0;
+  booz_radio_control_ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL;
+
+  DEBUG_SERVO2_INIT();
+
 }
+
+
+void tim2_irq_handler(void) {
+
+  DEBUG_S4_ON();
+
+  if(TIM_GetITStatus(TIM2, TIM_IT_CC2) == SET) {
+    TIM_ClearITPendingBit(TIM2, TIM_IT_CC2);
+    
+    uint32_t now = TIM_GetCapture2(TIM2);
+    uint32_t length = now - booz_radio_control_ppm_last_pulse_time;
+    debug_len = length;
+    booz_radio_control_ppm_last_pulse_time = now;                      
+                                                                       
+    if (booz_radio_control_ppm_cur_pulse == RADIO_CONTROL_NB_CHANNEL) {        
+      if (length > SYS_TICS_OF_USEC(PPM_SYNC_MIN_LEN) &&               
+         length < SYS_TICS_OF_USEC(PPM_SYNC_MAX_LEN)) {                
+       booz_radio_control_ppm_cur_pulse = 0;                           
+      }                                                                        
+    }                                                                  
+    else {                                                             
+      if (length > SYS_TICS_OF_USEC(PPM_DATA_MIN_LEN) &&               
+         length < SYS_TICS_OF_USEC(PPM_DATA_MAX_LEN)) {                
+       booz_radio_control_ppm_pulses[booz_radio_control_ppm_cur_pulse] = 
length;
+       booz_radio_control_ppm_cur_pulse++;                             
+       if (booz_radio_control_ppm_cur_pulse == RADIO_CONTROL_NB_CHANNEL) { 
+         booz_radio_control_ppm_frame_available = TRUE;                
+       }                                                               
+      }                                                                        
+      else                                                             
+       booz_radio_control_ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL;    
+    }                                                                  
+  }
+
+  DEBUG_S4_OFF();
+
+}

Modified: 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h
===================================================================
--- 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h
    2010-08-25 14:25:15 UTC (rev 5676)
+++ 
paparazzi3/trunk/sw/airborne/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.h
    2010-08-25 17:44:54 UTC (rev 5677)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  *  
- * Copyright (C) 2010 Antoine Drouin <address@hidden>
+ * Copyright (C) 2010 The Paparazzi Team
  *
  * This file is part of paparazzi.
  *
@@ -26,4 +26,3 @@
  *
  */
 
-extern void booz_radio_control_ppm_hw_init ( void );

Modified: 
paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_ppm.h
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_ppm.h    
2010-08-25 14:25:15 UTC (rev 5676)
+++ paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_ppm.h    
2010-08-25 17:44:54 UTC (rev 5677)
@@ -56,7 +56,7 @@
         radio_control.status = RADIO_CONTROL_OK;                       \
         NormalizePpm();                                                        
\
         _received_frame_handler();                                     \
-      } \
+      }                                                                        
\
       booz_radio_control_ppm_frame_available = FALSE;                  \
     }                                                                  \
   }

Modified: paparazzi3/trunk/sw/airborne/booz/test/booz2_test_radio_control.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/test/booz2_test_radio_control.c   
2010-08-25 14:25:15 UTC (rev 5676)
+++ paparazzi3/trunk/sw/airborne/booz/test/booz2_test_radio_control.c   
2010-08-25 17:44:54 UTC (rev 5677)
@@ -54,6 +54,8 @@
   int_enable();
 }
 
+extern uint32_t debug_len;
+
 static inline void main_periodic_task( void ) {
   
   RunOnceEvery(51, {/*LED_TOGGLE(2);*/ DOWNLINK_SEND_TIME(DefaultChannel, 
&cpu_time_sec);});  
@@ -69,6 +71,10 @@
                                                      
&radio_control.values[RADIO_CONTROL_MODE],     \
                                                      &foo,                     
                     \
                                                      &radio_control.status);});
+  uint8_t bar;
+  RunOnceEvery(10, {  DOWNLINK_SEND_CHRONO(DefaultChannel, &bar, &debug_len)});
+
+
   LED_PERIODIC();
 }
 

Modified: paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h
===================================================================
--- paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h    2010-08-25 14:25:15 UTC 
(rev 5676)
+++ paparazzi3/trunk/sw/airborne/stm32/sys_time_hw.h    2010-08-25 17:44:54 UTC 
(rev 5677)
@@ -1,7 +1,7 @@
 /*
  * Paparazzi $Id$
  *
- * Copyright (C) 2009 Antoine Drouin <address@hidden>
+ * Copyright (C) 2009-2010 The Paparazzi Team
  *
  * This file is part of paparazzi.
  *




reply via email to

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