mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-10 15:09:25 +08:00
Fixed-Wing Code on STM32 Step 1/10
This commit is contained in:
@@ -173,14 +173,28 @@
|
||||
|
||||
# Config for AP
|
||||
|
||||
# Board Specifics
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/lisa_l.makefile
|
||||
|
||||
# Fixed Wing Specifics
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/fixedwing_common.makefile
|
||||
include $(CFG_FIXEDWING)/fixedwing_autopilot.makefile
|
||||
|
||||
# Temporary problem solving
|
||||
ap.CFLAGS += -DSTM32
|
||||
|
||||
GPS_UART_NR = 1
|
||||
GPS_BAUD = 38400
|
||||
include $(CFG_FIXEDWING)/subsystems/fixedwing_gps_ublox.makefile
|
||||
|
||||
MODEM_UART_NR = 2
|
||||
MODEM_BAUD = 57600
|
||||
include $(CFG_FIXEDWING)/subsystems/fixedwing_telemetry_transparent.makefile
|
||||
|
||||
# Config for SITL simulation
|
||||
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
|
||||
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -DTRAFFIC_INFO
|
||||
sim.srcs += nav_survey_rectangle.c traffic_info.c nav_line.c
|
||||
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -DTRAFFIC_INFO
|
||||
sim.srcs += nav_survey_rectangle.c traffic_info.c nav_line.c
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
</section>
|
||||
<makefile>
|
||||
|
||||
BOARD_CFG=\"tiny_2_1_1.h\"
|
||||
FLASH_MODE=IAP
|
||||
BOARD_CFG = \"tiny_2_1_1.h\"
|
||||
FLASH_MODE = IAP
|
||||
|
||||
# Board Specifics
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
|
||||
@@ -185,25 +185,25 @@ include $(CFG_FIXEDWING)/subsystems/fixedwing_attitude_infrared.makefile
|
||||
# IO Options
|
||||
include $(CFG_FIXEDWING)/subsystems/fixedwing_radio_control_ppm.makefile
|
||||
|
||||
GPS_UART=Uart0
|
||||
GPS_BAUD=38400
|
||||
GPS_UART_NR = 0
|
||||
GPS_BAUD = 38400
|
||||
include $(CFG_FIXEDWING)/subsystems/fixedwing_gps_ublox.makefile
|
||||
|
||||
MODEM_UART=Uart1
|
||||
MODEM_BAUD=9600
|
||||
MODEM_UART_NR = 1
|
||||
MODEM_BAUD = 9600
|
||||
include $(CFG_FIXEDWING)/subsystems/fixedwing_telemetry_transparent.makefile
|
||||
|
||||
|
||||
# Special options
|
||||
ap.CFLAGS += -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
|
||||
ap.CFLAGS += -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
|
||||
|
||||
|
||||
######################################
|
||||
# Todo
|
||||
|
||||
ap.CFLAGS += -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
|
||||
ap.CFLAGS += -DGYRO -DADXRS150
|
||||
ap.srcs += gyro.c
|
||||
ap.CFLAGS += -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
|
||||
ap.CFLAGS += -DGYRO -DADXRS150
|
||||
ap.srcs += $(SRC_FIXEDWING)/gyro.c
|
||||
|
||||
|
||||
######################################
|
||||
|
||||
@@ -60,11 +60,13 @@ endif
|
||||
#
|
||||
ap.CFLAGS += -DUSE_SYS_TIME
|
||||
ap.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c
|
||||
#ap.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1./512.)'
|
||||
ap.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./60.))'
|
||||
ifeq ($(ARCHI), stm32)
|
||||
ap.CFLAGS += -DSYS_TIME_LED=1
|
||||
ap.CFLAGS += -DSYS_TIME_LED=1 -DPERIPHERALS_AUTO_INIT
|
||||
endif
|
||||
|
||||
|
||||
#
|
||||
# FlyByWire Main
|
||||
#
|
||||
@@ -80,8 +82,9 @@ ap.srcs += $(SRC_FIXEDWING)/estimator.c
|
||||
ap.CFLAGS += -DNAV
|
||||
ap.srcs += $(SRC_FIXEDWING)/nav.c $(SRC_FIXEDWING)/fw_h_ctl.c $(SRC_FIXEDWING)/fw_v_ctl.c
|
||||
ap.srcs += $(SRC_FIXEDWING)/nav_survey_rectangle.c $(SRC_FIXEDWING)/nav_line.c
|
||||
|
||||
#
|
||||
# InterMCU Commands
|
||||
# InterMCU & Commands
|
||||
#
|
||||
|
||||
ap.CFLAGS += -DINTER_MCU
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
|
||||
|
||||
|
||||
ifeq ($(GPS_UART), Uart0)
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B$(GPS_BAUD)
|
||||
else
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B$(GPS_BAUD)
|
||||
endif
|
||||
ap.CFLAGS += -DGPS -DUBX
|
||||
ap.CFLAGS += -DGPS_LINK=Uart$(GPS_UART_NR)
|
||||
ap.CFLAGS += -DUSE_UART$(GPS_UART_NR)
|
||||
ap.CFLAGS += -DUART$(GPS_UART_NR)_BAUD=B$(GPS_BAUD)
|
||||
|
||||
|
||||
ap.CFLAGS += -DGPS -DUBX -DGPS_LINK=$(GPS_UART)
|
||||
ap.srcs += $(SRC_FIXEDWING)/gps_ubx.c $(SRC_FIXEDWING)/gps.c $(SRC_FIXEDWING)/latlong.c
|
||||
ap.srcs += $(SRC_FIXEDWING)/gps_ubx.c $(SRC_FIXEDWING)/gps.c $(SRC_FIXEDWING)/latlong.c
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
|
||||
|
||||
ifeq ($(MODEM_UART), Uart0)
|
||||
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B$(MODEM_BAUD)
|
||||
else
|
||||
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B$(MODEM_BAUD)
|
||||
endif
|
||||
|
||||
ap.CFLAGS += -DUSE_UART$(MODEM_UART_NR)
|
||||
ap.CFLAGS += -DUART$(MODEM_UART_NR)_BAUD=B$(MODEM_BAUD)
|
||||
|
||||
MODEM_UART = Uart$(MODEM_UART_NR)
|
||||
|
||||
ap.CFLAGS += -DDOWNLINK -DDOWNLINK_FBW_DEVICE=$(MODEM_UART) -DDOWNLINK_AP_DEVICE=$(MODEM_UART) -DPPRZ_UART=$(MODEM_UART)
|
||||
ap.CFLAGS += -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE settings SYSTEM "settings.dtd">
|
||||
|
||||
<!-- A conf to use for standard operation (no tuning) -->
|
||||
|
||||
<settings>
|
||||
<dl_settings>
|
||||
<dl_settings NAME="flight params">
|
||||
<dl_setting MAX="1000" MIN="0" STEP="10" VAR="flight_altitude" shortname="altitude"/>
|
||||
<dl_setting MAX="360" MIN="0" STEP="1" VAR="nav_course"/>
|
||||
<dl_setting MAX="10" MIN="-10" STEP="5" VAR="nav_shift" module="nav" handler="IncreaseShift" shortname="inc. shift"/>
|
||||
<dl_setting MAX="0" MIN="0" STEP="1" VAR="estimator_flight_time" shortname="flight time" module="autopilot" handler="ResetFlightTimeAndLaunch"/>
|
||||
<dl_setting MAX="200" MIN="-200" STEP="10" VAR="nav_radius" module="nav" handler="SetNavRadius">
|
||||
<strip_button icon="circle-right.png" name="Circle right" value="1"/>
|
||||
<strip_button icon="circle-left.png" name="Circle left" value="-1"/>
|
||||
<key_press key="greater" value="1"/>
|
||||
<key_press key="less" value="-1"/>
|
||||
</dl_setting>
|
||||
</dl_settings>
|
||||
|
||||
<dl_settings NAME="mode">
|
||||
<dl_setting MAX="2" MIN="0" STEP="1" VAR="pprz_mode" module="estimator" values="MANUAL|AUTO1|AUTO2|HOME|NOGPS|FAILSAFE">
|
||||
</dl_setting>
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="launch">
|
||||
</dl_setting>
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle">
|
||||
</dl_setting>
|
||||
<dl_setting MAX="2" MIN="0" STEP="1" VAR="telemetry_mode_Ap_DefaultChannel" shortname="tele_AP" module="downlink"/>
|
||||
<dl_setting MAX="2" MIN="0" STEP="1" VAR="gps_reset" module="gps_ubx" handler="Reset" shortname="GPS reset"/>
|
||||
</dl_settings>
|
||||
|
||||
</dl_settings>
|
||||
</settings>
|
||||
@@ -32,7 +32,8 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "std.h"
|
||||
#ifndef READYBOARD_NO_BARO
|
||||
//#ifndef READYBOARD_NO_BARO
|
||||
#ifdef BARO_MS5534A
|
||||
#include "baro_MS5534A.h"
|
||||
#endif
|
||||
|
||||
|
||||
+12
-1
@@ -41,10 +41,18 @@
|
||||
#define Ap(f)
|
||||
#endif
|
||||
|
||||
#ifdef STM32
|
||||
#include "init_hw.h"
|
||||
#endif
|
||||
|
||||
int main( void ) {
|
||||
#ifdef STM32
|
||||
hw_init();
|
||||
sys_time_init();
|
||||
#endif
|
||||
Fbw(init);
|
||||
Ap(init);
|
||||
InitSysTimePeriodic()
|
||||
InitSysTimePeriodic();
|
||||
while (1) {
|
||||
if (sys_time_periodic()) {
|
||||
Fbw(periodic_task);
|
||||
@@ -52,6 +60,9 @@ int main( void ) {
|
||||
}
|
||||
Fbw(event_task);
|
||||
Ap(event_task);
|
||||
#ifdef STM32
|
||||
LED_PERIODIC();
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+10
-1
@@ -54,7 +54,11 @@
|
||||
#include "flight_plan.h"
|
||||
#include "datalink.h"
|
||||
#include "xbee.h"
|
||||
#ifdef STM32
|
||||
#include <stm32/gpio.h>
|
||||
#else
|
||||
#include "gpio.h"
|
||||
#endif
|
||||
#include "light.h"
|
||||
|
||||
#if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
|
||||
@@ -490,7 +494,8 @@ void periodic_task_ap( void ) {
|
||||
tcas_periodic_task_1Hz();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef USE_LIGHT
|
||||
@@ -508,6 +513,8 @@ void periodic_task_ap( void ) {
|
||||
estimator_flight_time = 1;
|
||||
launch = TRUE; /* Not set in non auto launch */
|
||||
DOWNLINK_SEND_TAKEOFF(DefaultChannel, &cpu_time_sec);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef DIGITAL_CAM
|
||||
@@ -812,7 +819,9 @@ void init_ap( void ) {
|
||||
int_enable();
|
||||
|
||||
/** wait 0.5s (historical :-) */
|
||||
#ifndef STM32
|
||||
sys_time_usleep(500000);
|
||||
#endif
|
||||
|
||||
#if defined GPS_CONFIGURE
|
||||
gps_configure_uart();
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* $Id: adc_hw.h 2638 2008-08-18 01:30:27Z poine $
|
||||
*
|
||||
* Copyright (C) 2008 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 ADC_HW_H
|
||||
#define ADC_HW_H
|
||||
|
||||
#define AdcBank0(x) (x)
|
||||
#define AdcBank1(x) (x+NB_ADC)
|
||||
|
||||
#endif /* ADC_HW_H */
|
||||
@@ -0,0 +1,4 @@
|
||||
#ifndef GPS_HW_H
|
||||
#define GPS_HW_H
|
||||
|
||||
#endif /* GPS_HW_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/* $Id: link_mcu_hw.h 2064 2007-11-23 12:35:50Z hecto $
|
||||
*
|
||||
* Copyright (C) 2003-2005 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/** \brief handling of arm7 inter mcu link
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LINK_MCU_HW_H
|
||||
#define LINK_MCU_HW_H
|
||||
|
||||
#define CRC_INIT 0x0
|
||||
#define CrcLow(x) ((x)&0xff)
|
||||
#define CrcHigh(x) ((x)>>8)
|
||||
|
||||
static inline uint16_t CrcUpdate(uint16_t crc, uint8_t data) {
|
||||
uint8_t a = ((uint8_t)CrcHigh(crc)) + data;
|
||||
uint8_t b = ((uint8_t)CrcLow(crc)) + a;
|
||||
crc = b | a << 8;
|
||||
return crc;
|
||||
}
|
||||
|
||||
#endif /* LINK_MCU_HW_H */
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "led.h"
|
||||
#endif
|
||||
|
||||
#define InitSysTimePeriodic()
|
||||
|
||||
extern void sys_time_init( void );
|
||||
extern void sys_tick_irq_handler(void);
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <stm32/gpio.h>
|
||||
#include "std.h"
|
||||
|
||||
|
||||
|
||||
#ifdef USE_UART1
|
||||
|
||||
volatile uint16_t uart1_rx_insert_idx, uart1_rx_extract_idx;
|
||||
@@ -397,3 +395,18 @@ void usart3_irq_handler(void) {
|
||||
|
||||
|
||||
#endif /* USE_UART3 */
|
||||
|
||||
void uart_init( void )
|
||||
{
|
||||
#ifdef USE_UART1
|
||||
uart1_init();
|
||||
#endif
|
||||
#ifdef USE_UART2
|
||||
uart2_init();
|
||||
#endif
|
||||
#ifdef USE_UART3
|
||||
uart3_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "std.h"
|
||||
|
||||
#define B9600 9600
|
||||
#define B38400 38400
|
||||
#define B57600 57600
|
||||
#define B115200 115200
|
||||
@@ -107,4 +108,7 @@ extern void usart3_irq_handler(void);
|
||||
|
||||
#endif /* USE_UART3 */
|
||||
|
||||
|
||||
void uart_init( void );
|
||||
|
||||
#endif /* UART_HW_H */
|
||||
|
||||
Reference in New Issue
Block a user