paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [6238] moving radio control to subsystems


From: Felix Ruess
Subject: [paparazzi-commits] [6238] moving radio control to subsystems
Date: Mon, 25 Oct 2010 21:57:07 +0000

Revision: 6238
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6238
Author:   flixr
Date:     2010-10-25 21:57:06 +0000 (Mon, 25 Oct 2010)
Log Message:
-----------
moving radio control to subsystems

Modified Paths:
--------------
    paparazzi3/trunk/conf/autopilot/booz2_test_progs.makefile
    paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile
    paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile
    paparazzi3/trunk/conf/autopilot/lisa_test_progs.makefile
    paparazzi3/trunk/conf/autopilot/sitl_jsbsim.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_dummy.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_datalink.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_ppm.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_joby.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
    
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_spektrum.makefile
    paparazzi3/trunk/sw/airborne/arch/lpc21/sys_time_hw.c
    paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_ppm.h
    paparazzi3/trunk/sw/airborne/booz/test/booz2_test_rc.c
    paparazzi3/trunk/sw/airborne/csc/csc_ap_main.c
    paparazzi3/trunk/sw/airborne/csc/csc_autopilot.c
    paparazzi3/trunk/sw/airborne/csc/ppm_bridge_main.c
    paparazzi3/trunk/sw/airborne/fbw_downlink.h
    paparazzi3/trunk/sw/airborne/firmwares/fixedwing/autopilot.h
    paparazzi3/trunk/sw/airborne/inter_mcu.h
    paparazzi3/trunk/sw/airborne/main_fbw.c
    paparazzi3/trunk/sw/simulator/old_booz/booz_rc_sim.h

Added Paths:
-----------
    paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/
    paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/
    paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.c
    paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.h
    paparazzi3/trunk/sw/airborne/arch/sim/subsystems/
    paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/
    paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c
    paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h
    paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/rc_datalink.c
    paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/
    paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/
    paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c
    paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.h
    paparazzi3/trunk/sw/airborne/subsystems/radio_control/
    paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.c
    paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.h
    paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.c
    paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.h
    paparazzi3/trunk/sw/airborne/subsystems/radio_control.c
    paparazzi3/trunk/sw/airborne/subsystems/radio_control.h

Removed Paths:
-------------
    paparazzi3/trunk/sw/airborne/arch/lpc21/radio_control/
    paparazzi3/trunk/sw/airborne/arch/sim/radio_control/
    paparazzi3/trunk/sw/airborne/arch/stm32/radio_control/
    paparazzi3/trunk/sw/airborne/radio_control/
    paparazzi3/trunk/sw/airborne/radio_control.c
    paparazzi3/trunk/sw/airborne/radio_control.h

Modified: paparazzi3/trunk/conf/autopilot/booz2_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/booz2_test_progs.makefile   2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/conf/autopilot/booz2_test_progs.makefile   2010-10-25 
21:57:06 UTC (rev 6238)
@@ -331,8 +331,8 @@
 test_rc_spektrum.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"booz_radio_control_spektrum_dx7se.h\"
 test_rc_spektrum.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B115200
 test_rc_spektrum.CFLAGS += -DRADIO_CONTROL_LINK=Uart0
-test_rc_spektrum.srcs += $(SRC_BOOZ)/booz_radio_control.c \
-                                                
$(SRC_BOOZ)/booz_radio_control_spektrum.c \
+test_rc_spektrum.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
+                                                
$(SRC_SUBSYSTEMS)/radio_control_spektrum.c \
                                                 $(SRC_ARCH)/uart_hw.c
 
 #
@@ -361,7 +361,7 @@
 test_rc_ppm.CFLAGS += -DUSE_RADIO_CONTROL -DRADIO_CONTROL_LED=1
 test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"booz_radio_control_ppm.h\"
 test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
-test_rc_ppm.srcs += $(SRC_BOOZ)/booz_radio_control.c \
+test_rc_ppm.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
                                        
$(SRC_BOOZ)/$(IMPL)/booz_radio_control_ppm.c \
                                        
$(SRC_BOOZ)/$(IMPL)/$(ARCH)/booz_radio_control_ppm_arch.c \
 

Modified: paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile    2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/conf/autopilot/booz_test_progs.makefile    2010-10-25 
21:57:06 UTC (rev 6238)
@@ -149,12 +149,12 @@
 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 -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
+test_rc_ppm.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/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.srcs   += subsystmes/radio_control.c \
+                                         subsystems/radio_control/ppm.c \
+                                         
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
 
 
 

Modified: paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile  2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/conf/autopilot/lisa_l_test_progs.makefile  2010-10-25 
21:57:06 UTC (rev 6238)
@@ -204,7 +204,7 @@
 test_rc_spektrum.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\"
 test_rc_spektrum.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
 test_rc_spektrum.CFLAGS += 
-DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER -DUSE_TIM6_IRQ
-test_rc_spektrum.srcs   += $(SRC_BOOZ)/booz_radio_control.c                    
             \
+test_rc_spektrum.srcs   += $(SRC_SUBSYSTEMS)/radio_control.c                   
              \
                           
$(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c          \
                           
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
 
@@ -239,11 +239,11 @@
 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_H=\"subsystems/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.srcs   += $(SRC_SUBSYSTEMS)/radio_control.c \
+                                         $(SRC_SUBSYSTEMS)/radio_control/ppm.c 
\
+                                         
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
 test_rc_ppm.CFLAGS += -DUSE_TIM2_IRQ
 
 #
@@ -658,6 +658,6 @@
 test_manual.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\"
 test_manual.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
 test_manual.CFLAGS += 
-DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER -DUSE_TIM6_IRQ
-test_manual.srcs   += $(SRC_BOOZ)/booz_radio_control.c                         
        \
+test_manual.srcs   += $(SRC_SUBSYSTEMS)/radio_control.c                        
         \
                      $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c   
       \
                      
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c

Modified: paparazzi3/trunk/conf/autopilot/lisa_test_progs.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/lisa_test_progs.makefile    2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/conf/autopilot/lisa_test_progs.makefile    2010-10-25 
21:57:06 UTC (rev 6238)
@@ -361,7 +361,7 @@
 test_rc_24.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"radio_control/booz_radio_control_spektrum_dx7se.h\"
 test_rc_24.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B115200
 test_rc_24.CFLAGS += -DRADIO_CONTROL_LINK=Uart3
-test_rc_24.srcs += $(SRC_BOOZ)/booz_radio_control.c \
+test_rc_24.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
                    $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c
 #                  $(SRC_ARCH)/uart_hw.c
 
@@ -1106,7 +1106,7 @@
 ptw.CFLAGS += -DUSE_RADIO_CONTROL
 ptw.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_spektrum.h\"
 ptw.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_MODEL_H=\"radio_control/booz_radio_control_spektrum_dx7se.h\"
-ptw.srcs += $(SRC_BOOZ)/booz_radio_control.c \
+ptw.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
            $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c
 ptw.CFLAGS += -DRADIO_CONTROL_LED=6
 ptw.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B115200

Modified: paparazzi3/trunk/conf/autopilot/sitl_jsbsim.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/sitl_jsbsim.makefile        2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/conf/autopilot/sitl_jsbsim.makefile        2010-10-25 
21:57:06 UTC (rev 6238)
@@ -32,5 +32,5 @@
 # jsbsim.srcs += $(SIMDIR)/sim_ac_fw.c
 # jsbsim.srcs += $(SIMDIR)/sim_ac_booz.c
 
-#jsbsim.CFLAGS += -DRADIO_CONTROL 
-DRADIO_CONTROL_TYPE_H=\"radio_control/ppm.h\" -DRADIO_CONTROL_TYPE_PPM
+#jsbsim.CFLAGS += -DRADIO_CONTROL 
-DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\" 
-DRADIO_CONTROL_TYPE_PPM
 #jsbsim.srcs   += radio_control.c radio_control/ppm.c 
$(SRC_ARCH)/radio_control/ppm_arch.c

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_dummy.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_dummy.makefile   
    2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/booz2_radio_control_dummy.makefile   
    2010-10-25 21:57:06 UTC (rev 6238)
@@ -1,3 +1,3 @@
-RDYB_SRCS += $(SRC_BOOZ)/booz_radio_control.c 
$(SRC_BOOZ)/radio_control/booz_radio_control_dummy.c
+RDYB_SRCS += $(SRC_SUBSYSTEMS)/radio_control.c 
$(SRC_BOOZ)/radio_control/booz_radio_control_dummy.c
 RDYB_CFLAGS += -DUSE_RADIO_CONTROL
 RDYB_CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_dummy.h\"

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_datalink.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_datalink.makefile
        2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_datalink.makefile
        2010-10-25 21:57:06 UTC (rev 6238)
@@ -12,8 +12,8 @@
   $(TARGET).CFLAGS     += -DRADIO_CONTROL
        $(TARGET).CFLAGS        += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/rc_datalink.h\"
        $(TARGET).CFLAGS        += -DRADIO_CONTROL_TYPE_DATALINK
-  $(TARGET).srcs               += $(SRC_FIXEDWING)/radio_control.c
-  $(TARGET).srcs               += $(SRC_FIXEDWING)/radio_control/rc_datalink.c
-       # arch only with sim target for compatibility (empty functions)
+  $(TARGET).srcs               += $(SRC_SUBSYSTEMS)/radio_control.c
+  $(TARGET).srcs               += $(SRC_SUBSYSTEMS)/radio_control/rc_datalink.c
+# arch only with sim target for compatibility (empty functions)
        sim.srcs                                        += 
$(SRC_ARCH)/radio_control/rc_datalink.c
 endif

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_ppm.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_ppm.makefile 
    2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/fixedwing/radio_control_ppm.makefile 
    2010-10-25 21:57:06 UTC (rev 6238)
@@ -10,15 +10,12 @@
 
 
 ifeq ($(ARCH),stm32)
-  ap.CFLAGS  += -I$(SRC_FIXEDWING)/booz/
-  ap.CFLAGS  += -I$(SRC_FIXEDWING)/booz/arch/stm32/
-
-  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 -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
+  ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
   ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
-  ap.srcs += $(SRC_FIXEDWING)/booz/booz_radio_control.c                    \
-             $(SRC_FIXEDWING)/booz/radio_control/booz_radio_control_ppm.c  \
-             
$(SRC_FIXEDWING)/booz/arch/stm32/radio_control/booz_radio_control_ppm_arch.c
+  ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
+             $(SRC_SUBSYSTEMS)/radio_control/ppm.c \
+             $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
   ap.CFLAGS += -DUSE_TIM2_IRQ
 
   NORADIO = True
@@ -26,11 +23,11 @@
 
 ifeq ($(NORADIO), False)
   $(TARGET).CFLAGS     += -DRADIO_CONTROL
-       $(TARGET).CFLAGS        += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/ppm.h\"
-       $(TARGET).CFLAGS        += -DRADIO_CONTROL_TYPE_PPM
-  $(TARGET).srcs               += $(SRC_FIXEDWING)/radio_control.c
-  $(TARGET).srcs               += $(SRC_FIXEDWING)/radio_control/ppm.c
+  $(TARGET).CFLAGS     += 
-DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
+  $(TARGET).CFLAGS     += -DRADIO_CONTROL_TYPE_PPM
+  $(TARGET).srcs       += $(SRC_SUBSYSTEMS)/radio_control.c
+  $(TARGET).srcs       += $(SRC_SUBSYSTEMS)/radio_control/ppm.c
   ifneq ($(ARCH),jsbsim)
-    $(TARGET).srcs     += $(SRC_ARCH)/radio_control/ppm_arch.c
+    $(TARGET).srcs     += $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
   endif
 endif

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_joby.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_joby.makefile
     2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_joby.makefile
     2010-10-25 21:57:06 UTC (rev 6238)
@@ -4,7 +4,7 @@
 stm_passthrough.CFLAGS += -DUSE_RADIO_CONTROL
 stm_passthrough.CFLAGS += 
-DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_joby.h\"
 stm_passthrough.CFLAGS += 
-DRADIO_CONTROL_JOBY_MODEL_H=\"radio_control/booz_radio_control_joby_9ch.h\"
-stm_passthrough.srcs += $(SRC_BOOZ)/booz_radio_control.c \
+stm_passthrough.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
            $(SRC_BOOZ)/radio_control/booz_radio_control_joby.c
 stm_passthrough.CFLAGS += -DRADIO_CONTROL_LED=6
 stm_passthrough.CFLAGS += -DUSE_UART3 -DUART3_BAUD=B115200

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
 2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/lisa_passthrough/radio_control_spektrum.makefile
 2010-10-25 21:57:06 UTC (rev 6238)
@@ -13,7 +13,7 @@
 stm_passthrough.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
 stm_passthrough.CFLAGS += -DRADIO_CONTROL_LINK=$(RADIO_CONTROL_LINK)
 stm_passthrough.CFLAGS += -DUSE_$(RADIO_CONTROL_LINK) 
-D$(RADIO_CONTROL_LINK)_BAUD=B115200
-stm_passthrough.srcs += $(SRC_BOOZ)/booz_radio_control.c                       
 \
+stm_passthrough.srcs += $(SRC_SUBSYSTEMS)/radio_control.c                      
  \
                         
$(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c \
                         
$(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
 

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
    2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
    2010-10-25 21:57:06 UTC (rev 6238)
@@ -1,23 +1,23 @@
 #
 # Autopilot
 #
-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 -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
+ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
 ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
-ap.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
+ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c                    \
+           $(SRC_SUBSYSTEMS)/radio_control/ppm.c  \
+           $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
 ap.CFLAGS += -DUSE_TIM2_IRQ
 
 #
 # Simulator
 #
-sim.CFLAGS += -DUSE_RADIO_CONTROL -DRADIO_CONTROL_LED=1
-sim.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"radio_control/booz_radio_control_ppm.h\"
+sim.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=1
+sim.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
 sim.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
-sim.srcs += $(SRC_BOOZ)/booz_radio_control.c \
-            $(SRC_BOOZ)/radio_control/booz_radio_control_ppm.c \
-            $(SRC_BOOZ_SIM)/radio_control/booz_radio_control_ppm_arch.c
+sim.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
+            $(SRC_BOOZ)/subsystems/radio_control/ppm.c \
+            $(SRC_BOOZ_SIM)/subsystems/radio_control/ppm_arch.c
 
 #
 # test_rc_ppm

Modified: 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_spektrum.makefile
===================================================================
--- 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_spektrum.makefile
       2010-10-25 18:50:05 UTC (rev 6237)
+++ 
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_spektrum.makefile
       2010-10-25 21:57:06 UTC (rev 6238)
@@ -16,7 +16,7 @@
 ap.CFLAGS += 
-DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
 ap.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER 
-DUSE_TIM6_IRQ
 
-ap.srcs += $(SRC_BOOZ)/booz_radio_control.c \
+ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
            $(SRC_BOOZ)/radio_control/booz_radio_control_spektrum.c \
           $(SRC_BOOZ_ARCH)/radio_control/booz_radio_control_spektrum_arch.c
 

Copied: 
paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.c 
(from rev 6237, 
paparazzi3/trunk/sw/airborne/arch/lpc21/radio_control/ppm_arch.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.c 
                        (rev 0)
+++ paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.c 
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,46 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 <subsystems/radio_control.h>
+#include <subsystems/radio_control/ppm.h>
+
+uint8_t  ppm_cur_pulse;
+uint32_t ppm_last_pulse_time;
+bool_t   ppm_data_valid;
+
+void ppm_arch_init ( void ) {
+  /* select pin for capture */
+  PPM_PINSEL |= PPM_PINSEL_VAL << PPM_PINSEL_BIT;
+  /* enable capture 0.2 on falling or rising edge + trigger interrupt */
+#if defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_POSITIVE
+  T0CCR = PPM_CCR_CRR | PPM_CCR_CRI;
+#elif defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_NEGATIVE
+  T0CCR = PPM_CCR_CRF | PPM_CCR_CRI;
+#else
+#error "ppm_arch.h: Unknown PM_PULSE_TYPE"
+#endif
+  ppm_last_pulse_time = 0;
+  ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL;
+  ppm_data_valid = FALSE;
+  ppm_frame_available = FALSE;
+}

Copied: 
paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.h 
(from rev 6237, 
paparazzi3/trunk/sw/airborne/arch/lpc21/radio_control/ppm_arch.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.h 
                        (rev 0)
+++ paparazzi3/trunk/sw/airborne/arch/lpc21/subsystems/radio_control/ppm_arch.h 
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,50 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 PPM_ARCH_H
+#define PPM_ARCH_H
+
+
+#include "LPC21xx.h"
+#include BOARD_CONFIG
+
+/**
+ * On tiny (and booz) the ppm counter is running at the same speed as
+ * the systic counter. There is no reason for this to be true.
+ * Let's add a pair of macros to make it possible for them to be different.
+ *
+ */
+#define RC_PPM_TICS_OF_USEC        SYS_TICS_OF_USEC
+#define RC_PPM_SIGNED_TICS_OF_USEC SIGNED_SYS_TICS_OF_USEC
+
+#define PPM_NB_CHANNEL RADIO_CONTROL_NB_CHANNEL
+
+#define PPM_IT PPM_CRI
+
+#define PPM_ISR() {       \
+  uint32_t now = PPM_CR;  \
+  DecodePpmFrame(now);    \
+}
+
+
+#endif /* PPM_ARCH_H */

Modified: paparazzi3/trunk/sw/airborne/arch/lpc21/sys_time_hw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/lpc21/sys_time_hw.c       2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/sw/airborne/arch/lpc21/sys_time_hw.c       2010-10-25 
21:57:06 UTC (rev 6238)
@@ -14,13 +14,13 @@
 #endif /* ACTUATORS */
 
 #if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_PPM
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 #else
 #define PPM_IT 0x00
 #endif
 
 #if defined USE_RADIO_CONTROL && defined RADIO_CONTROL_TYPE_PPM
-#include "radio_control/booz_radio_control_ppm.h"
+#include <subsystems/radio_control/ppm.h>
 #else
 #define RADIO_CONTROL_PPM_IT 0x00
 #endif

Copied: 
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c (from 
rev 6237, paparazzi3/trunk/sw/airborne/arch/sim/radio_control/ppm_arch.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c   
                        (rev 0)
+++ paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c   
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,64 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 "sys_time.h"
+#include <subsystems/radio_control.h>
+#include <subsystems/radio_control/ppm.h>
+
+#include <inttypes.h>
+#include <caml/mlvalues.h>
+
+uint8_t  ppm_cur_pulse;
+uint32_t ppm_last_pulse_time;
+bool_t   ppm_data_valid;
+
+void ppm_arch_init ( void ) {
+  ppm_last_pulse_time = 0;
+  ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL;
+  ppm_data_valid = FALSE;
+  ppm_frame_available = FALSE;
+}
+
+#ifdef RADIO_CONTROL
+
+value update_rc_channel(value c, value v) {
+  ppm_pulses[Int_val(c)] = Double_val(v);
+  return Val_unit;
+}
+
+value send_ppm(value unit) {
+  ppm_frame_available = TRUE;
+  return unit;
+}
+
+#else // RADIO_CONTROL
+
+value update_rc_channel(value c __attribute__ ((unused)), value v 
__attribute__ ((unused))) {
+  return Val_unit;
+}
+
+value send_ppm(value unit) {
+  return unit;
+}
+
+#endif // RADIO_CONTROL

Copied: 
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h (from 
rev 6237, paparazzi3/trunk/sw/airborne/arch/sim/radio_control/ppm_arch.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h   
                        (rev 0)
+++ paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h   
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 PPM_ARCH_H
+#define PPM_ARCH_H
+
+
+/**
+ * On tiny (and booz) the ppm counter is running at the same speed as
+ * the systic counter. There is no reason for this to be true.
+ * Let's add a pair of macros to make it possible for them to be different.
+ *
+ */
+#define RC_PPM_TICS_OF_USEC(_x) (_x)
+#define RC_PPM_SIGNED_TICS_OF_USEC(_x) (_x)
+
+#define PPM_NB_CHANNEL RADIO_CONTROL_NB_CHANNEL
+
+#endif /* PPM_ARCH_H */

Copied: 
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/rc_datalink.c 
(from rev 6237, 
paparazzi3/trunk/sw/airborne/arch/sim/radio_control/rc_datalink.c)
===================================================================
--- 
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/rc_datalink.c    
                            (rev 0)
+++ 
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/rc_datalink.c    
    2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 <subsystems/radio_control.h>
+
+#include <inttypes.h>
+#include <caml/mlvalues.h>
+
+value update_rc_channel(value c __attribute__ ((unused)), value v 
__attribute__ ((unused))) {
+  return Val_unit;
+}
+
+value send_ppm(value unit) {
+  return unit;
+}

Copied: 
paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c 
(from rev 6237, 
paparazzi3/trunk/sw/airborne/arch/stm32/radio_control/ppm_arch.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c 
                        (rev 0)
+++ paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c 
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,117 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 <subsystems/radio_control.h>
+#include <subsystems/radio_control/ppm.h>
+
+#include <stm32/rcc.h>
+#include <stm32/gpio.h>
+#include <stm32/tim.h>
+#include <stm32/misc.h>
+
+#include "sys_time.h"
+
+/*
+ *
+ * This a radio control ppm driver for stm32
+ * signal on PA1 TIM2/CH2 (uart1 trig on lisa/L)
+ *
+ */
+uint8_t  ppm_cur_pulse;
+uint32_t ppm_last_pulse_time;
+bool_t   ppm_data_valid;
+static uint32_t timer_rollover_cnt;
+
+void tim2_irq_handler(void);
+
+void 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);
+
+  /* Time Base configuration */
+  TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
+  TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
+  TIM_TimeBaseStructure.TIM_Period        = 0xFFFF;
+  TIM_TimeBaseStructure.TIM_Prescaler     = 0x8;
+  TIM_TimeBaseStructure.TIM_ClockDivision = 0x0;
+  TIM_TimeBaseStructure.TIM_CounterMode   = TIM_CounterMode_Up;
+  TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
+
+ /* 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 = 0x00;
+  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|TIM_IT_Update, ENABLE);
+
+  ppm_last_pulse_time = 0;
+  ppm_cur_pulse = RADIO_CONTROL_NB_CHANNEL;
+  timer_rollover_cnt = 0;
+
+}
+
+
+void tim2_irq_handler(void) {
+
+  if(TIM_GetITStatus(TIM2, TIM_IT_CC2) == SET) {
+    TIM_ClearITPendingBit(TIM2, TIM_IT_CC2);
+
+    uint32_t now = TIM_GetCapture2(TIM2) + timer_rollover_cnt;
+    DecodePpmFrame(now);
+  }
+  else if(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET) {
+    timer_rollover_cnt+=(1<<16);
+    TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
+  }
+
+}

Copied: 
paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.h 
(from rev 6237, 
paparazzi3/trunk/sw/airborne/arch/stm32/radio_control/ppm_arch.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.h 
                        (rev 0)
+++ paparazzi3/trunk/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.h 
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,36 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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.
+ */
+
+/** \file booz_radio_control_ppm_hw.h
+ *  \brief STM32 ppm decoder
+ *
+ */
+
+/**
+ * On tiny (and booz) the ppm counter is running at the same speed as
+ * the systic counter. There is no reason for this to be true.
+ * Let's add a pair of macros to make it possible for them to be different.
+ *
+ */
+#define RC_PPM_TICS_OF_USEC(_v)        SYS_TICS_OF_USEC((_v)/9)
+#define RC_PPM_SIGNED_TICS_OF_USEC(_v) SIGNED_SYS_TICS_OF_USEC((_v)/9)

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-10-25 18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/sw/airborne/booz/radio_control/booz_radio_control_ppm.h    
2010-10-25 21:57:06 UTC (rev 6238)
@@ -27,7 +27,7 @@
 /**
  * Architecture dependant code
  */
-#include "radio_control/booz_radio_control_ppm_arch.h"
+#include "subsystems/radio_control/ppm_arch.h"
 /* must be implemented by arch dependant code */
 extern void booz_radio_control_ppm_arch_init ( void );
 

Modified: paparazzi3/trunk/sw/airborne/booz/test/booz2_test_rc.c
===================================================================
--- paparazzi3/trunk/sw/airborne/booz/test/booz2_test_rc.c      2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/sw/airborne/booz/test/booz2_test_rc.c      2010-10-25 
21:57:06 UTC (rev 6238)
@@ -33,7 +33,7 @@
 
 #include "interrupt_hw.h"
 
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 
 static inline void main_init( void );
 static inline void main_periodic_task( void );

Modified: paparazzi3/trunk/sw/airborne/csc/csc_ap_main.c
===================================================================
--- paparazzi3/trunk/sw/airborne/csc/csc_ap_main.c      2010-10-25 18:50:05 UTC 
(rev 6237)
+++ paparazzi3/trunk/sw/airborne/csc/csc_ap_main.c      2010-10-25 21:57:06 UTC 
(rev 6238)
@@ -37,7 +37,7 @@
 #include "periodic.h"
 #include "airframe.h"
 #include "commands.h"
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 #include "booz/booz2_gps.h"
 
 //#include "ap_downlink.h"

Modified: paparazzi3/trunk/sw/airborne/csc/csc_autopilot.c
===================================================================
--- paparazzi3/trunk/sw/airborne/csc/csc_autopilot.c    2010-10-25 18:50:05 UTC 
(rev 6237)
+++ paparazzi3/trunk/sw/airborne/csc/csc_autopilot.c    2010-10-25 21:57:06 UTC 
(rev 6238)
@@ -33,7 +33,7 @@
 #include "led.h"
 #include <math/pprz_algebra_float.h>
 #include "string.h"
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 #include "pwm_input.h"
 #include "LPC21xx.h"
 #include "print.h"

Modified: paparazzi3/trunk/sw/airborne/csc/ppm_bridge_main.c
===================================================================
--- paparazzi3/trunk/sw/airborne/csc/ppm_bridge_main.c  2010-10-25 18:50:05 UTC 
(rev 6237)
+++ paparazzi3/trunk/sw/airborne/csc/ppm_bridge_main.c  2010-10-25 21:57:06 UTC 
(rev 6238)
@@ -37,7 +37,7 @@
 #include "periodic.h"
 #include "airframe.h"
 #include "commands.h"
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 
 #include "csc_telemetry.h"
 #include "led.h"

Modified: paparazzi3/trunk/sw/airborne/fbw_downlink.h
===================================================================
--- paparazzi3/trunk/sw/airborne/fbw_downlink.h 2010-10-25 18:50:05 UTC (rev 
6237)
+++ paparazzi3/trunk/sw/airborne/fbw_downlink.h 2010-10-25 21:57:06 UTC (rev 
6238)
@@ -44,7 +44,7 @@
 
 #include "uart.h"
 #include "main_fbw.h"
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 #include "inter_mcu.h"
 
 #define DOWNLINK_DEVICE DOWNLINK_FBW_DEVICE

Modified: paparazzi3/trunk/sw/airborne/firmwares/fixedwing/autopilot.h
===================================================================
--- paparazzi3/trunk/sw/airborne/firmwares/fixedwing/autopilot.h        
2010-10-25 18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/sw/airborne/firmwares/fixedwing/autopilot.h        
2010-10-25 21:57:06 UTC (rev 6238)
@@ -93,7 +93,7 @@
 //void telecommand_task(void);
 
 #ifdef RADIO_CONTROL
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 static inline void autopilot_process_radio_control ( void ) {
   pprz_mode = PPRZ_MODE_OF_PULSE(radio_control.values[RADIO_MODE], 0);
 }

Modified: paparazzi3/trunk/sw/airborne/inter_mcu.h
===================================================================
--- paparazzi3/trunk/sw/airborne/inter_mcu.h    2010-10-25 18:50:05 UTC (rev 
6237)
+++ paparazzi3/trunk/sw/airborne/inter_mcu.h    2010-10-25 21:57:06 UTC (rev 
6238)
@@ -41,7 +41,7 @@
 
 #include "paparazzi.h"
 #include "airframe.h"
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 #include "main_fbw.h"
 
 /** Data structure shared by fbw and ap processes */

Modified: paparazzi3/trunk/sw/airborne/main_fbw.c
===================================================================
--- paparazzi3/trunk/sw/airborne/main_fbw.c     2010-10-25 18:50:05 UTC (rev 
6237)
+++ paparazzi3/trunk/sw/airborne/main_fbw.c     2010-10-25 21:57:06 UTC (rev 
6238)
@@ -48,7 +48,7 @@
 #include "sys_time.h"
 #include "commands.h"
 #include <firmwares/fixedwing/actuators.h>
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 #include "fbw_downlink.h"
 #include "autopilot.h"
 #include "paparazzi.h"

Deleted: paparazzi3/trunk/sw/airborne/radio_control.c
===================================================================
--- paparazzi3/trunk/sw/airborne/radio_control.c        2010-10-25 18:50:05 UTC 
(rev 6237)
+++ paparazzi3/trunk/sw/airborne/radio_control.c        2010-10-25 21:57:06 UTC 
(rev 6238)
@@ -1,27 +0,0 @@
-/*
- * Paparazzi $Id$
- *
- * Copyright (C) 2006 Pascal Brisset, Antoine Drouin
- *
- * 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 "radio_control.h"
-
-struct RadioControl radio_control;

Deleted: paparazzi3/trunk/sw/airborne/radio_control.h
===================================================================
--- paparazzi3/trunk/sw/airborne/radio_control.h        2010-10-25 18:50:05 UTC 
(rev 6237)
+++ paparazzi3/trunk/sw/airborne/radio_control.h        2010-10-25 21:57:06 UTC 
(rev 6238)
@@ -1,114 +0,0 @@
-/*
- * Paparazzi $Id$
- *
- * Copyright (C) 2006 Pascal Brisset, Antoine Drouin
- *
- * 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 RADIO_CONTROL_H
-#define RADIO_CONTROL_H
-
-#if defined RADIO_CONTROL
-
-#include "led.h"
-#include "airframe.h"
-#include "paparazzi.h"
-
-/* underlying hardware */
-#include RADIO_CONTROL_TYPE_H
-/* must be defined by underlying hardware */
-extern void radio_control_impl_init(void);
-/* RADIO_CONTROL_NB_CHANNEL has to be defined by the implementation */
-
-/* timeouts - for now assumes 60Hz periodic */
-#define RC_AVG_PERIOD 8  /* TODO remove if IIR filter is used */
-#define RC_LOST_TIME 30  /* 500ms with a 60Hz timer */
-#define RC_REALLY_LOST_TIME 60 /* ~1s */
-/* Number of valid frames before going back to RC OK */
-#define RC_OK_CPT 15
-
-#define RC_OK          0
-#define RC_LOST        1
-#define RC_REALLY_LOST 2
-
-struct RadioControl {
-  uint8_t status;
-  uint8_t time_since_last_frame;
-  uint8_t radio_ok_cpt;
-  uint8_t frame_rate;
-  uint8_t frame_cpt;
-  pprz_t  values[RADIO_CONTROL_NB_CHANNEL];
-};
-
-extern struct RadioControl radio_control;
-
-
-/************* INIT ******************************************************/
-static inline void radio_control_init ( void ) {
-  uint8_t i;
-  for (i=0; i<RADIO_CONTROL_NB_CHANNEL; i++)
-    radio_control.values[i] = 0;
-  radio_control.status = RC_REALLY_LOST;
-  radio_control.time_since_last_frame = RC_REALLY_LOST_TIME;
-  radio_control.radio_ok_cpt = 0;
-  radio_control.frame_rate = 0;
-  radio_control.frame_cpt = 0;
-  radio_control_impl_init();
-}
-
-/************* PERIODIC ******************************************************/
-static inline void radio_control_periodic_task ( void ) {
-  static uint8_t _1Hz;
-  _1Hz++;
-
-  if (_1Hz >= 60) {
-    _1Hz = 0;
-    radio_control.frame_rate = radio_control.frame_cpt;
-    radio_control.frame_cpt = 0;
-  }
-
-  if (radio_control.time_since_last_frame >= RC_REALLY_LOST_TIME) {
-    radio_control.status = RC_REALLY_LOST;
-  } else {
-    if (radio_control.time_since_last_frame >= RC_LOST_TIME) {
-      radio_control.status = RC_LOST;
-      radio_control.radio_ok_cpt = RC_OK_CPT;
-    }
-    radio_control.time_since_last_frame++;
-  }
-
-#if defined RADIO_CONTROL_LED
-  if (radio_control.status == RC_OK) {
-    LED_ON(RADIO_CONTROL_LED);
-  }
-  else {
-    LED_OFF(RADIO_CONTROL_LED);
-  }
-#endif
-
-}
-
-/********** EVENT ************************************************************/
-// Implemented in radio_control/*.h
-
-
-#endif /* RADIO_CONTROL */
-
-#endif /* RADIO_CONTROL_H */

Copied: paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.c (from rev 
6237, paparazzi3/trunk/sw/airborne/radio_control/ppm.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.c                 
        (rev 0)
+++ paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.c 2010-10-25 
21:57:06 UTC (rev 6238)
@@ -0,0 +1,33 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 <subsystems/radio_control.h>
+#include <subsystems/radio_control/ppm.h>
+
+uint16_t ppm_pulses[ PPM_NB_CHANNEL ];
+volatile bool_t ppm_frame_available;
+
+void radio_control_impl_init(void) {
+  ppm_frame_available = FALSE;
+  ppm_arch_init();
+}

Copied: paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.h (from rev 
6237, paparazzi3/trunk/sw/airborne/radio_control/ppm.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.h                 
        (rev 0)
+++ paparazzi3/trunk/sw/airborne/subsystems/radio_control/ppm.h 2010-10-25 
21:57:06 UTC (rev 6238)
@@ -0,0 +1,122 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 RC_PPM_H
+#define RC_PPM_H
+
+#include "std.h"
+
+/**
+ * Architecture dependant code
+ */
+#include "subsystems/radio_control/ppm_arch.h"
+/* must be implemented by arch dependant code */
+extern void ppm_arch_init(void);
+
+/**
+ * Generated code holding the description of a given
+ * transmitter
+ */
+#include "radio.h"
+
+/**
+ * Define number of channels
+ * Using generated code radio.h
+ */
+#define RADIO_CONTROL_NB_CHANNEL RADIO_CTL_NB
+
+/**
+ *  ppm pulse type : futaba is falling edge clocked whereas JR is rising edge
+ */
+#define PPM_PULSE_TYPE_POSITIVE 0
+#define PPM_PULSE_TYPE_NEGATIVE 1
+
+extern uint16_t ppm_pulses[ RADIO_CONTROL_NB_CHANNEL ];
+extern volatile bool_t ppm_frame_available;
+
+/**
+ * Event macro with handler callback
+ * PPM frame are normalize using the IIR filter
+ */
+#define RadioControlEvent(_received_frame_handler) {  \
+  if (ppm_frame_available) {                          \
+    radio_control.frame_cpt++;                        \
+    radio_control.time_since_last_frame = 0;          \
+    if (radio_control.radio_ok_cpt > 0) {             \
+      radio_control.radio_ok_cpt--;                   \
+    } else {                                          \
+      radio_control.status = RC_OK;                   \
+      NormalizePpmIIR(ppm_pulses,radio_control);      \
+      _received_frame_handler();                      \
+    }                                                 \
+    ppm_frame_available = FALSE;                      \
+  }                                                   \
+}
+
+/**
+ * State machine for decoding ppm frames
+ */
+extern uint8_t  ppm_cur_pulse;
+extern uint32_t ppm_last_pulse_time;
+extern bool_t   ppm_data_valid;
+
+/**
+ * A valid ppm frame:
+ * - synchro blank
+ * - correct number of channels
+ * - synchro blank
+ */
+#define DecodePpmFrame(_ppm_time) {                         \
+  uint32_t length = _ppm_time - ppm_last_pulse_time;        \
+  ppm_last_pulse_time = _ppm_time;                          \
+                                                            \
+  if (ppm_cur_pulse == PPM_NB_CHANNEL) {                    \
+    if (length > RC_PPM_TICS_OF_USEC(PPM_SYNC_MIN_LEN) &&   \
+        length < RC_PPM_TICS_OF_USEC(PPM_SYNC_MAX_LEN)) {   \
+      if (ppm_data_valid) {                                 \
+        ppm_frame_available = TRUE;                         \
+        ppm_data_valid = FALSE;                             \
+      }                                                     \
+      ppm_cur_pulse = 0;                                    \
+    }                                                       \
+    else {                                                  \
+      ppm_data_valid = FALSE;                               \
+    }                                                       \
+  }                                                         \
+  else {                                                    \
+    if (length > RC_PPM_TICS_OF_USEC(PPM_DATA_MIN_LEN) &&   \
+        length < RC_PPM_TICS_OF_USEC(PPM_DATA_MAX_LEN)) {   \
+      ppm_pulses[ppm_cur_pulse] = length;                   \
+      ppm_cur_pulse++;                                      \
+      if (ppm_cur_pulse == PPM_NB_CHANNEL) {                \
+        ppm_data_valid = TRUE;                              \
+      }                                                     \
+    }                                                       \
+    else {                                                  \
+      ppm_cur_pulse = PPM_NB_CHANNEL;                       \
+      ppm_data_valid = FALSE;                               \
+    }                                                       \
+  }                                                         \
+}
+
+#endif /* RC_PPM_H */

Copied: paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.c 
(from rev 6237, paparazzi3/trunk/sw/airborne/radio_control/rc_datalink.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.c         
                (rev 0)
+++ paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.c 
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,49 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 "radio_control/rc_datalink.h"
+#include <subsystems/radio_control.h>
+
+int8_t rc_dl_values[ RC_DL_NB_CHANNEL ];
+volatile bool_t rc_dl_frame_available;
+
+
+void radio_control_impl_init(void) {
+  rc_dl_frame_available = FALSE;
+}
+
+
+void parse_rc_datalink( uint8_t throttle_mode,
+                        int8_t roll,
+                        int8_t pitch)
+{
+  uint8_t throttle = throttle_mode & 0xFC;
+  uint8_t mode = throttle_mode & 0x03;
+
+  rc_dl_values[RADIO_ROLL] = roll;
+  rc_dl_values[RADIO_PITCH] = pitch;
+  rc_dl_values[RADIO_THROTTLE] = (int8_t)throttle;
+  rc_dl_values[RADIO_MODE] = (int8_t)mode;
+
+  rc_dl_frame_available = TRUE;
+}

Copied: paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.h 
(from rev 6237, paparazzi3/trunk/sw/airborne/radio_control/rc_datalink.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.h         
                (rev 0)
+++ paparazzi3/trunk/sw/airborne/subsystems/radio_control/rc_datalink.h 
2010-10-25 21:57:06 UTC (rev 6238)
@@ -0,0 +1,84 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 The Paparazzi Team
+ *
+ * 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 RC_DATALINK_H
+#define RC_DATALINK_H
+
+#include "std.h"
+
+#define RC_DL_NB_CHANNEL 5
+#define RADIO_CONTROL_NB_CHANNEL RC_DL_NB_CHANNEL
+
+/**
+ * Redefining RADIO_*
+ * Do not use with radio.h (ppm rc)
+ */
+#define RADIO_ROLL      0
+#define RADIO_PITCH     1
+#define RADIO_YAW       2
+#define RADIO_THROTTLE  3
+#define RADIO_MODE      4
+
+extern int8_t rc_dl_values[ RC_DL_NB_CHANNEL ];
+extern volatile bool_t rc_dl_frame_available;
+
+/**
+ * Decode datalink message to get rc values
+ */
+extern void parse_rc_datalink(
+    uint8_t throttle_mode,
+    int8_t roll,
+    int8_t pitch);
+
+/**
+ * Macro that normalize rc_dl_values to radio values
+ */
+#define NormalizeRcDl(_in, _out) {  \
+  _out[RADIO_ROLL] = (MAX_PPRZ/128) * _in[RADIO_ROLL];            \
+  Bound(_out[RADIO_ROLL], MIN_PPRZ, MAX_PPRZ);                    \
+  _out[RADIO_PITCH] = (MAX_PPRZ/128) * _in[RADIO_PITCH];          \
+  Bound(_out[RADIO_PITCH], MIN_PPRZ, MAX_PPRZ);                   \
+  _out[RADIO_YAW] = 0;                                            \
+  Bound(_out[RADIO_YAW], MIN_PPRZ, MAX_PPRZ);                     \
+  _out[RADIO_THROTTLE] = ((MAX_PPRZ/64) * _in[RADIO_THROTTLE]);   \
+  Bound(_out[RADIO_THROTTLE], 0, MAX_PPRZ);                       \
+  _out[RADIO_MODE] = MAX_PPRZ * (_in[RADIO_MODE] - 1);            \
+  Bound(_out[RADIO_MODE], MIN_PPRZ, MAX_PPRZ);                    \
+}
+
+/**
+ * Event macro with handler callback
+ */
+#define RadioControlEvent(_received_frame_handler) {  \
+  if (rc_dl_frame_available) {                        \
+    radio_control.frame_cpt++;                        \
+    radio_control.time_since_last_frame = 0;          \
+    radio_control.radio_ok_cpt = 0;                   \
+    radio_control.status = RC_OK;                     \
+    NormalizeRcDl(rc_dl_values,radio_control.values); \
+    _received_frame_handler();                        \
+    rc_dl_frame_available = FALSE;                    \
+  }                                                   \
+}
+
+#endif /* RC_DATALINK_H */

Copied: paparazzi3/trunk/sw/airborne/subsystems/radio_control.c (from rev 6237, 
paparazzi3/trunk/sw/airborne/radio_control.c)
===================================================================
--- paparazzi3/trunk/sw/airborne/subsystems/radio_control.c                     
        (rev 0)
+++ paparazzi3/trunk/sw/airborne/subsystems/radio_control.c     2010-10-25 
21:57:06 UTC (rev 6238)
@@ -0,0 +1,27 @@
+/*
+ * Paparazzi $Id$
+ *
+ * Copyright (C) 2006 Pascal Brisset, Antoine Drouin
+ *
+ * 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 <subsystems/radio_control.h>
+
+struct RadioControl radio_control;

Copied: paparazzi3/trunk/sw/airborne/subsystems/radio_control.h (from rev 6237, 
paparazzi3/trunk/sw/airborne/radio_control.h)
===================================================================
--- paparazzi3/trunk/sw/airborne/subsystems/radio_control.h                     
        (rev 0)
+++ paparazzi3/trunk/sw/airborne/subsystems/radio_control.h     2010-10-25 
21:57:06 UTC (rev 6238)
@@ -0,0 +1,114 @@
+/*
+ * Paparazzi $Id$
+ *
+ * Copyright (C) 2006 Pascal Brisset, Antoine Drouin
+ *
+ * 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 RADIO_CONTROL_H
+#define RADIO_CONTROL_H
+
+#if defined RADIO_CONTROL
+
+#include "led.h"
+#include "airframe.h"
+#include "paparazzi.h"
+
+/* underlying hardware */
+#include RADIO_CONTROL_TYPE_H
+/* must be defined by underlying hardware */
+extern void radio_control_impl_init(void);
+/* RADIO_CONTROL_NB_CHANNEL has to be defined by the implementation */
+
+/* timeouts - for now assumes 60Hz periodic */
+#define RC_AVG_PERIOD 8  /* TODO remove if IIR filter is used */
+#define RC_LOST_TIME 30  /* 500ms with a 60Hz timer */
+#define RC_REALLY_LOST_TIME 60 /* ~1s */
+/* Number of valid frames before going back to RC OK */
+#define RC_OK_CPT 15
+
+#define RC_OK          0
+#define RC_LOST        1
+#define RC_REALLY_LOST 2
+
+struct RadioControl {
+  uint8_t status;
+  uint8_t time_since_last_frame;
+  uint8_t radio_ok_cpt;
+  uint8_t frame_rate;
+  uint8_t frame_cpt;
+  pprz_t  values[RADIO_CONTROL_NB_CHANNEL];
+};
+
+extern struct RadioControl radio_control;
+
+
+/************* INIT ******************************************************/
+static inline void radio_control_init ( void ) {
+  uint8_t i;
+  for (i=0; i<RADIO_CONTROL_NB_CHANNEL; i++)
+    radio_control.values[i] = 0;
+  radio_control.status = RC_REALLY_LOST;
+  radio_control.time_since_last_frame = RC_REALLY_LOST_TIME;
+  radio_control.radio_ok_cpt = 0;
+  radio_control.frame_rate = 0;
+  radio_control.frame_cpt = 0;
+  radio_control_impl_init();
+}
+
+/************* PERIODIC ******************************************************/
+static inline void radio_control_periodic_task ( void ) {
+  static uint8_t _1Hz;
+  _1Hz++;
+
+  if (_1Hz >= 60) {
+    _1Hz = 0;
+    radio_control.frame_rate = radio_control.frame_cpt;
+    radio_control.frame_cpt = 0;
+  }
+
+  if (radio_control.time_since_last_frame >= RC_REALLY_LOST_TIME) {
+    radio_control.status = RC_REALLY_LOST;
+  } else {
+    if (radio_control.time_since_last_frame >= RC_LOST_TIME) {
+      radio_control.status = RC_LOST;
+      radio_control.radio_ok_cpt = RC_OK_CPT;
+    }
+    radio_control.time_since_last_frame++;
+  }
+
+#if defined RADIO_CONTROL_LED
+  if (radio_control.status == RC_OK) {
+    LED_ON(RADIO_CONTROL_LED);
+  }
+  else {
+    LED_OFF(RADIO_CONTROL_LED);
+  }
+#endif
+
+}
+
+/********** EVENT ************************************************************/
+// Implemented in radio_control/*.h
+
+
+#endif /* RADIO_CONTROL */
+
+#endif /* RADIO_CONTROL_H */

Modified: paparazzi3/trunk/sw/simulator/old_booz/booz_rc_sim.h
===================================================================
--- paparazzi3/trunk/sw/simulator/old_booz/booz_rc_sim.h        2010-10-25 
18:50:05 UTC (rev 6237)
+++ paparazzi3/trunk/sw/simulator/old_booz/booz_rc_sim.h        2010-10-25 
21:57:06 UTC (rev 6238)
@@ -1,7 +1,7 @@
 #ifndef BOOZ_RC_SIM_H
 #define BOOZ_RC_SIM_H
 
-#include "radio_control.h"
+#include <subsystems/radio_control.h>
 
 #define MODE_SWITCH_MANUAL 1900
 #define MODE_SWITCH_AUTO1  1500




reply via email to

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