paparazzi-commits
[Top][All Lists]
Advanced

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

[paparazzi-commits] [6404] now fixedwing should work on lisa


From: antoine drouin
Subject: [paparazzi-commits] [6404] now fixedwing should work on lisa
Date: Wed, 17 Nov 2010 12:15:10 +0000

Revision: 6404
          http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6404
Author:   poine
Date:     2010-11-17 12:15:09 +0000 (Wed, 17 Nov 2010)
Log Message:
-----------
now fixedwing should work on lisa

Modified Paths:
--------------
    paparazzi-software/trunk/conf/autopilot/lisa_l_test_progs.makefile
    
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/attitude_infrared.makefile
    
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/autopilot.makefile

Added Paths:
-----------
    paparazzi-software/trunk/sw/airborne/lisa/tunnel_hw.c

Modified: paparazzi-software/trunk/conf/autopilot/lisa_l_test_progs.makefile
===================================================================
--- paparazzi-software/trunk/conf/autopilot/lisa_l_test_progs.makefile  
2010-11-17 10:33:37 UTC (rev 6403)
+++ paparazzi-software/trunk/conf/autopilot/lisa_l_test_progs.makefile  
2010-11-17 12:15:09 UTC (rev 6404)
@@ -281,7 +281,8 @@
 test_adc.srcs   += downlink.c pprz_transport.c
 
 test_adc.srcs   += $(SRC_ARCH)/adc_hw.c
-test_adc.CFLAGS += -DUSE_AD1 -DUSE_AD1_1 -DUSE_AD1_2 -DUSE_AD1_3 -DUSE_AD1_4
+test_adc.CFLAGS += -DUSE_AD1 -DUSE_AD1_1
+# -DUSE_AD1_2 -DUSE_AD1_3 -DUSE_AD1_4
 test_adc.CFLAGS += -DUSE_ADC1_2_IRQ_HANDLER
 
 #
@@ -664,3 +665,20 @@
 test_manual.srcs   += $(SRC_SUBSYSTEMS)/radio_control.c                        
         \
                   subsystems/radio_control/spektrum.c          \
                   $(SRC_ARCH)/subsystems/radio_control/spektrum_arch.c
+
+
+
+#
+# tunnel
+#
+tunnel.ARCHDIR = $(ARCH)
+tunnel.CFLAGS += -I$(SRC_LISA) -I$(ARCH) -DPERIPHERALS_AUTO_INIT
+tunnel.CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
+tunnel.srcs   += $(SRC_LISA)/tunnel_hw.c          \
+                 $(SRC_ARCH)/stm32_exceptions.c   \
+                 $(SRC_ARCH)/stm32_vector_table.c
+tunnel.CFLAGS += -DUSE_LED
+tunnel.srcs   += $(SRC_ARCH)/led_hw.c
+tunnel.CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=$(SYS_TIME_LED)
+tunnel.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
+tunnel.srcs   += sys_time.c $(SRC_ARCH)/sys_time_hw.c
\ No newline at end of file

Modified: 
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/attitude_infrared.makefile
===================================================================
--- 
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/attitude_infrared.makefile
     2010-11-17 10:33:37 UTC (rev 6403)
+++ 
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/attitude_infrared.makefile
     2010-11-17 12:15:09 UTC (rev 6404)
@@ -24,9 +24,9 @@
 #
 ifeq ($(ARCH), stm32)
 ap.CFLAGS += -DUSE_AD1
-ap.CFLAGS += -DADC_CHANNEL_IR1=$(ADC_IR1) -DUSE_AD1_$(ADC_IR1)
-ap.CFLAGS += -DADC_CHANNEL_IR2=$(ADC_IR2) -DUSE_AD1_$(ADC_IR2)
-ap.CFLAGS += -DADC_CHANNEL_IR_TOP=$(ADC_IR_TOP) -DUSE_AD1_$(ADC_IR_TOP)
+ap.CFLAGS += -DADC_CHANNEL_IR1=$(ADC_IR1_CHAN) -DUSE_AD1_$(ADC_IR1)
+ap.CFLAGS += -DADC_CHANNEL_IR2=$(ADC_IR2_CHAN) -DUSE_AD1_$(ADC_IR2)
+ap.CFLAGS += -DADC_CHANNEL_IR_TOP=$(ADC_IR_TOP_CHAN) -DUSE_AD1_$(ADC_IR_TOP)
 endif
 
 ap.CFLAGS += -DADC_CHANNEL_IR_NB_SAMPLES=$(ADC_IR_NB_SAMPLES)

Modified: 
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/autopilot.makefile
===================================================================
--- 
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/autopilot.makefile 
    2010-11-17 10:33:37 UTC (rev 6403)
+++ 
paparazzi-software/trunk/conf/autopilot/subsystems/fixedwing/autopilot.makefile 
    2010-11-17 12:15:09 UTC (rev 6404)
@@ -27,6 +27,10 @@
 ## COMMON FIXEDWING ALL TARGETS (SIM + AP + FBW ...)
 ##
 
+# temporary hack
+ifeq ($(ARCH), stm32)
+$(TARGET).CFLAGS += -DSTM32
+endif
 #
 # Board config + Include paths
 #
@@ -83,7 +87,7 @@
 else ifeq ($(ARCH), stm32)
   ns_srcs              += $(SRC_ARCH)/stm32_exceptions.c
   ns_srcs              += $(SRC_ARCH)/stm32_vector_table.c
-  ns_CFLAGS            += -DPERIPHERALS_AUTO_INIT
+#  ns_CFLAGS           += -DPERIPHERALS_AUTO_INIT
 endif
 
 ifeq ($(ARCH), stm32)
@@ -127,14 +131,16 @@
 # ANALOG
 #
 
+  ns_CFLAGS            += -DADC
 #ifeq ($(ARCH), lpc21)
-  ns_CFLAGS            += -DADC
   ns_srcs              += $(SRC_ARCH)/adc_hw.c
 #else ifeq ($(ARCH), stm32)
 #  ns_srcs             += lisa/lisa_analog_plug.c
 #endif
+ifeq ($(ARCH), stm32)
+  ns_CFLAGS            += -DUSE_ADC1_2_IRQ_HANDLER
+endif
 
-
 ######################################################################
 ##
 ## FLY BY WIRE THREAD SPECIFIC

Added: paparazzi-software/trunk/sw/airborne/lisa/tunnel_hw.c
===================================================================
--- paparazzi-software/trunk/sw/airborne/lisa/tunnel_hw.c                       
        (rev 0)
+++ paparazzi-software/trunk/sw/airborne/lisa/tunnel_hw.c       2010-11-17 
12:15:09 UTC (rev 6404)
@@ -0,0 +1,129 @@
+/*
+ * $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 <stm32/flash.h>
+#include <stm32/misc.h>
+#include <stm32/gpio.h>
+#include <stm32/rcc.h>
+
+#include BOARD_CONFIG
+#include "init_hw.h"
+#include "sys_time.h"
+#include "led.h"
+
+#define A_PERIPH   RCC_APB2Periph_GPIOA
+#define A_RX_PIN   GPIO_Pin_10
+#define A_RX_PORT  GPIOA
+#define A_TX_PIN   GPIO_Pin_9
+#define A_TX_PORT  GPIOA
+
+#define B_PERIPH   RCC_APB2Periph_GPIOA
+#define B_RX_PIN   GPIO_Pin_3
+#define B_RX_PORT  GPIOA
+#define B_TX_PIN   GPIO_Pin_2
+#define B_TX_PORT  GPIOA
+
+static inline void main_periodic( void );
+static inline void main_event( void );
+
+void Delay(__IO uint32_t nCount) {
+  for(; nCount != 0; nCount--);
+}
+
+int main(void) {
+
+  hw_init();
+  sys_time_init();
+
+
+  /* init RCC */
+  RCC_APB2PeriphClockCmd(A_PERIPH , ENABLE);
+  //  RCC_APB2PeriphClockCmd(B_PERIPH , ENABLE);
+  //  GPIO_DeInit(A_RX_PORT);
+  /* Init GPIO for rx pins */
+  GPIO_InitTypeDef GPIO_InitStructure;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
+  //  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+  GPIO_InitStructure.GPIO_Pin = A_RX_PIN;
+  GPIO_Init(A_RX_PORT, &GPIO_InitStructure);
+  GPIO_InitStructure.GPIO_Pin = B_RX_PIN;
+  GPIO_Init(B_RX_PORT, &GPIO_InitStructure);
+  /* Init GPIO for tx pins */
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
+  GPIO_InitStructure.GPIO_Pin = A_TX_PIN;
+  GPIO_Init(A_TX_PORT, &GPIO_InitStructure);
+  GPIO_InitStructure.GPIO_Pin = B_TX_PIN;
+  GPIO_Init(B_TX_PORT, &GPIO_InitStructure);
+
+  A_TX_PORT->BRR  = A_TX_PIN;
+
+  /* */
+  while (1) {
+    if (sys_time_periodic())
+      main_periodic();
+    main_event();
+ };
+  return 0;
+}
+
+
+
+static inline void main_periodic( void ) {
+  LED_PERIODIC();
+}
+
+static inline void main_event( void ) {
+  //  Delay(2000);
+  static uint8_t foo = 0;
+  foo++;
+
+#if 0
+  if (!(foo%2))
+    GPIO_WriteBit(B_TX_PORT,  B_TX_PIN, Bit_SET);
+  else
+    GPIO_WriteBit(B_TX_PORT,  B_TX_PIN, Bit_RESET);
+#endif
+
+#if 0
+  if (!(foo%2))
+    A_TX_PORT->BRR  = A_TX_PIN;
+  else
+    A_TX_PORT->BSRR  = A_TX_PIN;
+#endif
+
+#if 1
+  GPIO_WriteBit(A_TX_PORT, A_TX_PIN, GPIO_ReadInputDataBit(B_RX_PORT, 
B_RX_PIN) );
+#endif
+  if (GPIO_ReadInputDataBit(A_RX_PORT, A_RX_PIN)) {
+    GPIO_WriteBit(B_TX_PORT, B_TX_PIN,  Bit_SET);
+    LED_ON(2);
+  }
+  else {
+    GPIO_WriteBit(B_TX_PORT, B_TX_PIN,  Bit_RESET);
+    LED_OFF(2);
+  }
+  
+  
+}




reply via email to

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