mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
now fixedwing should work on lisa
This commit is contained in:
committed by
Felix Ruess
parent
4e383daddb
commit
60f4cc243d
@@ -281,7 +281,8 @@ test_adc.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVI
|
||||
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.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HAND
|
||||
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
|
||||
@@ -24,9 +24,9 @@ endif
|
||||
#
|
||||
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)
|
||||
|
||||
@@ -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 @@ ifeq ($(ARCH), lpc21)
|
||||
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,13 +131,15 @@ ns_srcs += $(SRC_ARCH)/uart_hw.c
|
||||
# ANALOG
|
||||
#
|
||||
|
||||
#ifeq ($(ARCH), lpc21)
|
||||
ns_CFLAGS += -DADC
|
||||
#ifeq ($(ARCH), lpc21)
|
||||
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
|
||||
|
||||
######################################################################
|
||||
##
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user